Pre-requisite Readings
Abstract
This document specifies thex/auth/tx
package of the Cosmos SDK.
This package represents the Cosmos SDK implementation of the client.TxConfig
, client.TxBuilder
, client.TxEncoder
and client.TxDecoder
interfaces.
Contents
Transactions
TxConfig
client.TxConfig
defines an interface a client can utilize to generate an application-defined concrete transaction type. The interface defines a set of methods for creating a client.TxBuilder
.
client/tx_config.go
client.TxConfig
is instantiated by NewTxConfig
in x/auth/tx
module.
x/auth/tx/config.go
TxBuilder
client/tx_config.go
client.TxBuilder
interface is as well implemented by x/auth/tx
. A client.TxBuilder
can be accessed with TxConfig.NewTxBuilder()
.
TxEncoder
/ TxDecoder
More information about TxEncoder
and TxDecoder
can be found here.
Client
CLI
Query
Thex/auth/tx
module provides a CLI command to query any transaction, given its hash, transaction sequence or signature.
Without any argument, the command will query the transaction using the transaction hash.
--type=acc_seq
flag:
--type=signature
flag:
--type=events
flag:
x/auth/block
module provides a CLI command to query any block, given its hash, height, or events.
When querying a block by its hash, use the --type=hash
flag:
--type=height
flag:
--query
flag:
Transactions
Thex/auth/tx
module provides a convinient CLI command for decoding and encoding transactions.
encode
The encode
command encodes a transaction created with the --generate-only
flag or signed with the sign command. The transaction is seralized it to Protobuf and returned as base64.
encode
command can be found running simd tx encode --help
.
decode
The decode
commands decodes a transaction encoded with the encode
command.
decode
command can be found running simd tx decode --help
.
gRPC
A user can query thex/auth/tx
module using gRPC endpoints.
TxDecode
The TxDecode
endpoint allows to decode a transaction.
TxEncode
The TxEncode
endpoint allows to encode a transaction.
TxDecodeAmino
The TxDecode
endpoint allows to decode an amino transaction.
TxEncodeAmino
The TxEncodeAmino
endpoint allows to encode an amino transaction.