Closed suraneti closed 5 years ago
@suraneti of course pull request is welcome, feel free to do so. And Api for query transaction I'm thinking about it there're another repo here https://github.com/kulapio/libra-service, you can pr for that api as well.
But what I concern is there're limit in request/sec to testnet node that we're facing right now, so if we open more apis like query transaction may be it's too much request to our service.
Btw feel free to PR query transaction to repo above, even we don't use in Wallet poc but for other developers that forked libra-service can benefit of that.
@totiz ok thanks.
Hi @suraneti, I'm thinking about this again and I think we should provide this api anyway, for providing developer to query sent/received for specific address. I've some research that we can use query event.
Example for received:
query event e498567610d2611539817b19a610867489622a6dfbc97870ddbd2bc368d588d3 received 0 true 10
<account_address> <sent|received> <start_sequence_number> <ascending=true|false> <limit>
EventWithProof {
transaction_version: 72898,
event_index: 1,
event: ContractEvent { access_path: AccessPath { address: e498567610d2611539817b19a610867489622a6dfbc97870ddbd2bc368d588d3, type: Resource, hash: "217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97", suffix: "/received_events_count/" } , index: 0, event_data: AccountEvent { account: 664be5c4acdebe643a0b57ffc4f39e1d28f359433a2518ca99c8aedb0fe424cb, amount: 9000000 } },
proof: EventProof { ledger_info_to_transaction_info_proof: AccumulatorProof { siblings: [HashValue(d69e7b31baef68d284d4c9a856f94197bccdff799ac69ace8ff1786b2c52b323), HashValue(0ad78cb20124b14a74b450b26a5440cf654ee472fed59cc19aad45ae10a38222), HashValue(8fe86e73c158ac885eee1d20cebd0f463cfd8b1908aacf4864d4f1d1b3b8c8e8), HashValue(e59c193978ac2eb0dfcfa367feb821903a6a92553cb38731a1e76c74b1b1bcbd), HashValue(c84e97c3ca2093ce44955ea8bf5186fbc4fbc5141a4a4dbd752be7a7936284fa), HashValue(e01b8cf4a2735924eaf140bae251d29078bae5ae94a7c4e88807ae099c1d62ea), HashValue(4a902c492a7f995462e37116664b4e3f5647bef9eb194be32fdfcb912a99ecff), HashValue(d0c425c6559a65250679f054c8a1594e7c97e70b04ae48642ec44dcc74666b4b), HashValue(ea5909a2e94af0e460e00e6263f18dad79de3d0830224e287523ca1ce38304f1), HashValue(eacb77a404b2f4eb2d43c707c7763b8db5f762da444bc99d5b96ced68b91a084), HashValue(1eac72d97f11eebbd2a576f355492b50b0cde89c2801ad2144e16d22620aaf9a), HashValue(85e6d675b0089c514dfbdabe56dfd4b55e8ef5d5b1b7c08459a51b18bf1d6c85), HashValue(1beb29a120c9c899983785fb797d836f74fe995bb43447722f4229e7b5546e0d), HashValue(67c35705f6b95742d8a19c682d0848f6dbd7880a405af2a747c8629460090af1), HashValue(07bdbfe26e816b915f581a1ef60939d94dfda52cfbe0c70d1afe867644634566), HashValue(db82b1be5afcb0fb17a9c00298a399074ebc896c1e7f0af4e5a16d1c128c8f4c), HashValue(6cdce77f2313ec5f6388f2b6c5ebd5358f6dcac9e294ed5367af661e52254846), HashValue(f00675f0b8964c5a59cab996cc1db57734286cf45e2ec8be913a575c89b9aa3e)] }, transaction_info: TransactionInfo { signed_transaction_hash: HashValue(661e55fc52f0f79b7396d5ed77236a8088d902b5d7353be293a847f00e0d60f0), state_root_hash: HashValue(c4518dbb636bbcc9f41e34cc36dc7ef4a1826dce3d146585fa61fa028d31fdd9), event_root_hash: HashValue(927ed8006de38a9864a5c01cb589787422601d9e545f164cb69427552288dbb5), gas_used: 0 }, transaction_info_to_event_proof: AccumulatorProof { siblings: [HashValue(ca4357cb71e437da13b7f2283dc27b7cb908e6fb007b7c91cfe347b7f331993a)] } }
}
...
Example for sent:
query event e498567610d2611539817b19a610867489622a6dfbc97870ddbd2bc368d588d3 sent 0 false 10
EventWithProof {
transaction_version: 80205,
event_index: 0,
event: ContractEvent { access_path: AccessPath { address: e498567610d2611539817b19a610867489622a6dfbc97870ddbd2bc368d588d3, type: Resource, hash: "217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97", suffix: "/sent_events_count/" } , index: 0, event_data: AccountEvent { account: 664be5c4acdebe643a0b57ffc4f39e1d28f359433a2518ca99c8aedb0fe424cb, amount: 80000000 } },
proof: EventProof { ledger_info_to_transaction_info_proof: AccumulatorProof { siblings: [HashValue(2c7cbdf1a2c49215c337bb6a89c0edb438183821c5d42c715de8785445dc7857), HashValue(0ad78cb20124b14a74b450b26a5440cf654ee472fed59cc19aad45ae10a38222), HashValue(8fe86e73c158ac885eee1d20cebd0f463cfd8b1908aacf4864d4f1d1b3b8c8e8), HashValue(e59c193978ac2eb0dfcfa367feb821903a6a92553cb38731a1e76c74b1b1bcbd), HashValue(8ae3cf8997fe8dd3d624a96139702afd30d1fda1e43cdc4f69ff4a00440aafba), HashValue(c0996cdbdf185734946e2dc79ca138d4aa5fd53ac2a582cc3dafbf6483750f35), HashValue(6f9af08bd9a318b62f1928ec3176faa2a2d3fa9140f6c7bf8cf308c7bb9b5063), HashValue(992f497114724f5eaba844b859491051934c77aa55c1935b274f0143e96048f2), HashValue(59d44b4e1690f13043f19835dd93919a8e60f3ca61a7c83a82c3d27aaafdbac8), HashValue(eda62f98fbc0d18a26a64c12ec9b1d364368dc2a9f1da8aabceaac35cb68d905), HashValue(941ed4fe56ee75fe632d2ae875cad72cca96173a69a27746895b3b14d96b9fa1), HashValue(cb778fc446d0b9b9a83e8cac118e504b1369d4950836201a7db5d4305ad2a87c), HashValue(d4be59298ec3e301422770d7c7b0aea02e8a5fc59e94738b9130309162aa454a), HashValue(a5e5f0bd3b3d7353fa194db8373046e8b2b61a2d61f4c972c048266e6763d382), HashValue(4794be6d868a5d4659d5dbe287ab444e87f0315537cb0f8f9a36b3eed6e9eaa1), HashValue(700268408a24d4543491bb74cd2a1aa558ce1dd136431be469d3c995c741996c), HashValue(cb9df9643a10b58dedd34cbc3abe2dfcecb957b0e48a053445c4b31ddb8e6689), HashValue(1b5e87b1e3eeb902cb02dbb2ed38854f68bf545ef1998891b32807abaae7c6f1)] }, transaction_info: TransactionInfo { signed_transaction_hash: HashValue(154d1c2efef1ffc48ad3f4b52ec36878848dcd701640be6d65509274bb1416db), state_root_hash: HashValue(a5ec93f3820d99b7f5d9b43122b5291a0c4b06e65fa2df4df7f2b6134eae6b68), event_root_hash: HashValue(7c76fd0f981ded30771be0131346c5808989e78f0ed772dce1847befd6dcd62d), gas_used: 0 }, transaction_info_to_event_proof: AccumulatorProof { siblings: [HashValue(de5c48cbd414bdd2855d6738c3afbf8836e3f0f590edb665f934765c2c951a2e)] } }
}
...
I would be great if you guys can PR this Api, may be [POST] /transactionHistory, and merging two result from above events, if do so please PR to this repo https://github.com/kulapio/libra-service.
And for limitation of request/sec we have plan to scale up for multi-ip soon so everything should be fine.
@totiz That's great! 😄
Done merged
Motivation
Display transferred or received transaction information.
Pitch
Are you willing to provide api for query transaction of each wallet? Are you willing to open a pull request for frontend?