new interface for querying tnx details via tags flag
Closed this issue · 9 comments
It is an enhancement for current querying process for the detailed Tnx, this feature is initiated from Frontend user with receipt.
Currently, this part is resolved from block data via Qmoon. We think there is some trade-off here.
New interface should be designed here to query Tnx with tags from cosmos networks.
To be concluded in the dev-cosmosv35.0 branch at first, it will be merged into master if testing is all ready!
This feature should be included in both right master branch as well as the latest cosmosv0.35.0 before it is finalized with detailed upgrade arrangement.
So the development on it could be on parallel process.
Step into the integration of the query txs
as below interpretation:
[vagrant@vagrant-192-168-168-184 ~]$ ./gaiacli query txs -h
Search for transactions that match the exact given tags where results are paginated.
Example:
$ gaiacli query txs --tags '<tag1>:<value1>&<tag2>:<value2>' --page 1 --limit 30
Usage:
gaiacli query txs [flags]
Flags:
-h, --help help for txs
--limit uint32 Query number of transactions results per page returned (default 30)
-n, --node string Node to connect to (default "tcp://localhost:26657")
--page uint32 Query a specific page of paginated results (default 1)
--tags string tag:value list of tags that must match
--trust-node Trust connected full node (don't verify proofs for responses)
Global Flags:
--chain-id string Chain ID of tendermint node
-e, --encoding string Binary encoding (hex|b64|btc) (default "hex")
--home string directory for config and data (default "/home/vagrant/.gaiacli")
-o, --output string Output format (text|json) (default "text")
--trace print out full stack trace on errors
Thanks for Kuan`s support on the 'tags' listing.
Input example from SDK test case:
func TestQueryTxsWithTags(t *testing.T) {
usr, _ := user.Current()
rootDir := usr.HomeDir
node := "tcp://47.105.52.237:36657"
chainId := "cosmoshub-2"
addr := "cosmos1ktecz4dr56j9tsfh7nwg8s9suvhfu70qpzrfcr"
page := 1
limit := 30
out := QueryTxsWithTags(rootDir, node, chainId, addr, page, limit)
t.Log(out)
}
with the result output as below:
[
{
"height": "198147",
"txhash": "EB418AB7406E6D4C18F740B429471A52A3D4F1818CE45E3F2EFAD15DF572918C",
"raw_log": "[{\"msg_index\":\"0\",\"success\":true,\"log\":\"\"}]",
"logs": [
{
"msg_index": "0",
"success": true,
"log": ""
}
],
"gas_wanted": "200000",
"gas_used": "83188",
"tags": [
{
"key": "action",
"value": "delegate"
},
{
"key": "delegator",
"value": "cosmos1ktecz4dr56j9tsfh7nwg8s9suvhfu70qpzrfcr"
},
{
"key": "destination-validator",
"value": "cosmosvaloper1ff0dw8kawsnxkrgj7p65kvw7jxxakyf8n583gx"
}
],
"tx": {
"type": "auth/StdTx",
"value": {
"msg": [
{
"type": "cosmos-sdk/MsgDelegate",
"value": {
"delegator_address": "cosmos1ktecz4dr56j9tsfh7nwg8s9suvhfu70qpzrfcr",
"validator_address": "cosmosvaloper1ff0dw8kawsnxkrgj7p65kvw7jxxakyf8n583gx",
"amount": {
"denom": "uatom",
"amount": "4999300"
}
}
}
],
"fee": {
"amount": [
{
"denom": "uatom",
"amount": "700"
}
],
"gas": "200000"
},
"signatures": [
{
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "Av1RR+7+fni/phJEblAsmEDLPWHiAhjfLparIFW24j+z"
},
"signature": "DkDKfuxTJbY0RUVSsrqrD3bZIbdFNjsLRm609lfcheM1pb25o7clK31g3YjhVnr06DcV/OnX3HKKUhJzoHVXIQ=="
}
],
"memo": ""
}
},
"timestamp": "2019-05-08T10:05:07Z"
},
{
"height": "194995",
"txhash": "41B6A57012C1743DAE54B05A5CBB9A2BB43678DB66C986BA5E34C8B2A1CEA025",
"raw_log": "[{\"msg_index\":\"0\",\"success\":true,\"log\":\"\"}]",
"logs": [
{
"msg_index": "0",
"success": true,
"log": ""
}
],
"gas_wanted": "100000",
"gas_used": "29538",
"tags": [
{
"key": "action",
"value": "send"
},
{
"key": "sender",
"value": "cosmos1nynns8ex9fq6sjjfj8k79ymkdz4sqth06xexae"
},
{
"key": "recipient",
"value": "cosmos1ktecz4dr56j9tsfh7nwg8s9suvhfu70qpzrfcr"
}
],
"tx": {
"type": "auth/StdTx",
"value": {
"msg": [
{
"type": "cosmos-sdk/MsgSend",
"value": {
"from_address": "cosmos1nynns8ex9fq6sjjfj8k79ymkdz4sqth06xexae",
"to_address": "cosmos1ktecz4dr56j9tsfh7nwg8s9suvhfu70qpzrfcr",
"amount": [
{
"denom": "uatom",
"amount": "5000000"
}
]
}
}
],
"fee": {
"amount": [
{
"denom": "uatom",
"amount": "1"
}
],
"gas": "100000"
},
"signatures": [
{
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "A4Zl/vjM3DezZ+kOzomchon6QiX8OPLuP2CmN/ndlsR6"
},
"signature": "9ddSLnj8WPOGKzfMzOWIHJAZgwnDR9daqTIx6mvFgQdD1AqiDRwm5oSBrMDPwK50AmKcCTNVkFtYd21kK324xA=="
}
],
"memo": ""
}
},
"timestamp": "2019-05-08T04:05:13Z"
}
]
Hi, the result is currently in disorder, can you arrange them in reverse chronological order?
Low priority
closed with low priority.
PS: this code is included in master
branch, however not in the branch dev_cosmosv37
and later branch rebased on it.