Exemple #1
0
class ChainSyncGetTransactionsTestCase(ChainSyncBaseTestCase):
    def setUp(self):
        adapter = SteemAdapter(endpoints='https://steemd.pevo.science',
                               retry=False)
        self.chainsync = ChainSync(adapter=adapter, retry=False)

    def test_get_transactions(self):
        txs = [
            'a3815d4a17f1331481ec6bf89ba0844ce16175bc',
            'c68435a34a7afc701771eb090f96526ed4c2a37b',
        ]
        result = self.chainsync.get_transactions(txs)
        for tx in result:
            self.assertTrue(tx['transaction_id'] in txs)

    def test_get_transactions_exception_no_transaction_id(self):
        with self.assertRaises(TypeError) as context:
            self.chainsync.get_transactions()

    def test_get_transactions_exception_invalid_transaction_id(self):
        with self.assertRaises(Exception) as context:
            txs = [
                'a3815d4a17f1331481ec6bf89ba0844ce16175bc',
                '0000000000000000000000000000000000000000',
            ]
            result = self.chainsync.get_transactions(txs)
            for tx in result:
                self.assertTrue(tx['transaction_id'] in txs)
Exemple #2
0
print('\nGetting block 1')
block = chainsync.get_block(1)
print_event('block', block)

print('\nGetting transaction c68435a34a7afc701771eb090f96526ed4c2a37b')
tx = chainsync.get_transaction('c68435a34a7afc701771eb090f96526ed4c2a37b')
print_event('tx', tx)

print('\nGetting multiple transactions')
transactions = [
    '62f68c45f67ecbe4ac6eb8348bce44e73e46611c',
    '2f58f00e70b8d0f88e90350043e17ed6ea2eb223',
    'c68435a34a7afc701771eb090f96526ed4c2a37b',
]
for tx in chainsync.get_transactions(transactions):
    print_event('tx', tx)

print('\nGetting ops in transaction c68435a34a7afc701771eb090f96526ed4c2a37b')
for op in chainsync.get_ops_in_transaction('c68435a34a7afc701771eb090f96526ed4c2a37b'):
    print_event('op', op)

print('\nGetting ops in multiple transactions')
transactions = [
    '62f68c45f67ecbe4ac6eb8348bce44e73e46611c',
    '2f58f00e70b8d0f88e90350043e17ed6ea2eb223',
    'c68435a34a7afc701771eb090f96526ed4c2a37b',
]
for op in chainsync.get_ops_in_transactions(transactions):
    print_event('op', op)