class ChainSyncGetOpsInTransactionTestCase(ChainSyncBaseTestCase): def setUp(self): adapter = SteemAdapter(endpoints='https://steemd.pevo.science', retry=False) self.chainsync = ChainSync(adapter=adapter, retry=False) def test_get_ops_in_transaction(self): tx_id = 'c68435a34a7afc701771eb090f96526ed4c2a37b' result = self.chainsync.get_ops_in_transaction(tx_id) for op in result: self.assertEqual(op['block_num'], 20905025) def test_get_ops_in_transaction_exception_no_transaction_id(self): with self.assertRaises(TypeError) as context: self.chainsync.get_ops_in_transaction() def test_get_ops_in_transaction_exception_invalid_transaction_id(self): with self.assertRaises(Exception) as context: results = [ op in self.chainsync.get_ops_in_transaction( '0000000000000000000000000000000000000000') ]
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) print('\nGetting blocks 1, 10, 50, 250, 500') blocks = chainsync.get_blocks([1, 10, 50, 250, 500]) for block in blocks: print_event('block', block)