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_ops_in_transactions(self): blocks = [ 20905050, 20905025, ] txs = [ 'a3815d4a17f1331481ec6bf89ba0844ce16175bc', 'c68435a34a7afc701771eb090f96526ed4c2a37b', ] result = self.chainsync.get_ops_in_transactions(txs) for op in result: self.assertTrue(op['block_num'] in blocks) def test_get_ops_in_transactions_exception_no_transaction_id(self): with self.assertRaises(TypeError) as context: self.chainsync.get_transactions() def test_get_ops_in_transactions_exception_invalid_transaction_id(self): with self.assertRaises(Exception) as context: txs = [ 'a3815d4a17f1331481ec6bf89ba0844ce16175bc', '0000000000000000000000000000000000000000', # invalid tx ] results = [op in self.chainsync.get_ops_in_transactions(txs)]
'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) print('\nGetting blocks 1000-1005') blocks = chainsync.get_block_sequence(1000, 5) for block in blocks: print_event('block', block) print('\nGetting all ops in block 9284729...') for op in chainsync.get_ops_in_block(9284729): print_event('op', op)