Standardization of block retrieval
Currently we have 6 different functions to retrieve information from blocks:
- block_api.get_block
- block_api.get_block_range
- condenser_api.get_block
- condenser_api.get_ops_in_block
- account_history_api.get_ops_in_block
- account_history_api.enum_virtual_ops
With few exceptions, they each have a different parameters' format and provide different results (structure, format, ...).
[1,2,3] do not return vops
[4,5] return ops and/or vops but not block data
[6] returns vops but not ops nor block data
[1,2] return tx ids as a global array
[3] returns tx ids as a global array and inside transactions objects (the later is easier to manage)
[6] returns tx ids in each operation object
[4] returns result as an array
[5] returns result is an object containing an array
[6] is the only one to effectively return operation_id
Properties like block_num, timestamp are sometimes duplicated in each transaction/operation which increases the volume of data returned and transferred.
Some APIs return operation type with the _operation
suffix, some do not.
... and so on
Couldn't we optimize all this by providing one API call and above all standardizing how data are returned?
get_block_range
looks like the favorite candidate to me.
It is quite new, less used up to now, and therefore less prone to break things if we change it.
My wish is it could return vops and has transactions_ids
in each transaction object instead of being grouped in an array at the end.