Skip to content

Latest commit

 

History

History
76 lines (47 loc) · 2.59 KB

query-transactions.md

File metadata and controls

76 lines (47 loc) · 2.59 KB

Query Transactions

Matching a Set of Events

Querying transaction commands use the following format:

secretcli query tx \
    --type=[hash|acc_seq|signature] \
    [hash|acc_seq|signature] \
    [flags]

Use the transaction search command to query for transactions matching a specific set of events, which are added on every transaction.

Each event contains a key-value pair in the form of {eventType}.{eventAttribute}={value}.

Events can be combined to query for more specific results using the & symbol.

You can query transactions by events as follows:

secretcli q txs --query "message.sender='secret1...'"

And for using multiple events:

secretcli q txs --query "message.sender='secret1...' AND message.action='/secret.compute.v1beta1.MsgInstantiateContract' "

The pagination is supported as well via page and limit:

secretcli q txs --query "message.sender='secret1...'" --page=1 --limit=20

Note: The action tag always equals the message type returned by the Type() function of the relevant message.

Events List

You can find a list of available events on each of the SDK modules:

Matching a Transaction Hash

You can query a single transaction by its hash using the following command:

secretcli q tx [hash]

Flags

There are four flags associated with querying Secret Network transactions using the secretcli.

Height

The --height [int] flag uses a specific height to query the state of the Secret Network (there will be an error if the node is pruning state).

Node

The --node [string] flag uses <host>:<port> to connect with the Tendermint RPC for a specific chain (default is "tcp://localhost:26657").

Type

The --type [string] flag is for querying a tx, and can be the 'hash' (default), 'acc_seq', or 'signature'.

Help

The --help flag will generate an output giving further details on flags to use with the tx class of secretcli commands, and information about global flags to use with the secretcli.