Documentation ¶
Index ¶
- Variables
- func DefaultJSONTxDecoder(cdc codec.Codec) sdk.TxDecoder
- func DefaultJSONTxEncoder(cdc codec.Codec) sdk.TxEncoder
- func DefaultTxDecoder(cdc codec.Codec) sdk.TxDecoder
- func DefaultTxEncoder() sdk.TxEncoder
- func DirectSignBytes(bodyBytes, authInfoBytes []byte, chainID string, accnum uint64) ([]byte, error)
- func ModeInfoAndSigToSignatureData(modeInfo *tx.ModeInfo, sig []byte) (signing.SignatureData, error)
- func NewDefaultSigningOptions() (*txsigning.Options, error)
- func NewSignModeLegacyAminoJSONHandler() signing.SignModeHandler
- func NewSigningHandlerMap(configOpts ConfigOptions) (*txsigning.HandlerMap, error)
- func NewTxConfig(protoCodec codec.Codec, enabledSignModes []signingtypes.SignMode, ...) client.TxConfig
- func NewTxConfigWithOptions(protoCodec codec.Codec, configOptions ConfigOptions) (client.TxConfig, error)
- func NewTxServer(clientCtx client.Context, simulate baseAppSimulateFn, ...) txtypes.ServiceServer
- func QueryTx(clientCtx client.Context, hashHexStr string) (*sdk.TxResponse, error)
- func QueryTxsByEvents(clientCtx client.Context, page, limit int, query, orderBy string) (*sdk.SearchTxsResult, error)
- func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.ServeMux)
- func RegisterTxService(qrt gogogrpc.Server, clientCtx client.Context, simulateFn baseAppSimulateFn, ...)
- func SignatureDataToModeInfoAndSig(data signing.SignatureData) (*tx.ModeInfo, []byte)
- func WrapTx(protoTx *tx.Tx) client.TxBuilder
- type ConfigOptions
- type ExtensionOptionsTxBuilder
Constants ¶
This section is empty.
Variables ¶
var DefaultSignModes = []signingtypes.SignMode{ signingtypes.SignMode_SIGN_MODE_DIRECT, signingtypes.SignMode_SIGN_MODE_DIRECT_AUX, signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, }
DefaultSignModes are the default sign modes enabled for protobuf transactions.
Functions ¶
func DefaultJSONTxDecoder ¶
DefaultJSONTxDecoder returns a default protobuf JSON TxDecoder using the provided Marshaler.
func DefaultJSONTxEncoder ¶
DefaultJSONTxEncoder returns a default protobuf JSON TxEncoder using the provided Marshaler.
func DefaultTxDecoder ¶
DefaultTxDecoder returns a default protobuf TxDecoder using the provided Marshaler.
func DefaultTxEncoder ¶
DefaultTxEncoder returns a default protobuf TxEncoder using the provided Marshaler
func DirectSignBytes ¶
func DirectSignBytes(bodyBytes, authInfoBytes []byte, chainID string, accnum uint64) ([]byte, error)
DirectSignBytes returns the SIGN_MODE_DIRECT sign bytes for the provided TxBody bytes, AuthInfo bytes, chain ID, account number and sequence.
func ModeInfoAndSigToSignatureData ¶
func ModeInfoAndSigToSignatureData(modeInfo *tx.ModeInfo, sig []byte) (signing.SignatureData, error)
ModeInfoAndSigToSignatureData converts a ModeInfo and raw bytes signature to a SignatureData or returns an error
func NewDefaultSigningOptions ¶ added in v0.50.1
NewDefaultSigningOptions returns the sdk default signing options used by x/tx. This includes account and validator address prefix enabled codecs.
func NewSignModeLegacyAminoJSONHandler ¶ added in v0.50.1
func NewSignModeLegacyAminoJSONHandler() signing.SignModeHandler
NewSignModeLegacyAminoJSONHandler returns a new signModeLegacyAminoJSONHandler. Note: The public constructor is only used for testing. Deprecated: Please use x/tx/signing/aminojson instead.
func NewSigningHandlerMap ¶ added in v0.50.1
func NewSigningHandlerMap(configOpts ConfigOptions) (*txsigning.HandlerMap, error)
NewSigningHandlerMap returns a new txsigning.HandlerMap using the provided ConfigOptions. It is recommended to use types.InterfaceRegistry in the field ConfigOptions.FileResolver as shown in NewTxConfigWithOptions but this fn does not enforce it.
func NewTxConfig ¶
func NewTxConfig(protoCodec codec.Codec, enabledSignModes []signingtypes.SignMode, customSignModes ...txsigning.SignModeHandler, ) client.TxConfig
NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and sign modes. The first enabled sign mode will become the default sign mode.
NOTE: Use NewTxConfigWithOptions to provide a custom signing handler in case the sign mode is not supported by default (eg: SignMode_SIGN_MODE_EIP_191), or to enable SIGN_MODE_TEXTUAL.
We prefer to use depinject to provide client.TxConfig, but we permit this constructor usage. Within the SDK, this constructor is primarily used in tests, but also sees usage in app chains like: https://github.com/evmos/evmos/blob/719363fbb92ff3ea9649694bd088e4c6fe9c195f/encoding/config.go#L37
func NewTxConfigWithOptions ¶ added in v0.50.1
func NewTxConfigWithOptions(protoCodec codec.Codec, configOptions ConfigOptions) (client.TxConfig, error)
NewTxConfigWithOptions returns a new protobuf TxConfig using the provided ProtoCodec, ConfigOptions and custom sign mode handlers. If ConfigOptions is an empty struct then default values will be used.
func NewTxServer ¶
func NewTxServer(clientCtx client.Context, simulate baseAppSimulateFn, interfaceRegistry codectypes.InterfaceRegistry) txtypes.ServiceServer
NewTxServer creates a new Tx service server.
func QueryTx ¶ added in v0.43.0
QueryTx queries for a single transaction by a hash string in hex format. An error is returned if the transaction does not exist or cannot be queried.
func QueryTxsByEvents ¶ added in v0.43.0
func QueryTxsByEvents(clientCtx client.Context, page, limit int, query, orderBy string) (*sdk.SearchTxsResult, error)
QueryTxsByEvents retrieves a list of paginated transactions from CometBFT's TxSearch RPC method given a set of pagination criteria and an events query. Note, the events query must be valid based on CometBFT's query semantics. An error is returned if the query or parsing fails or if the query is empty.
Note, if an empty orderBy is provided, the default behavior is ascending. If negative values are provided for page or limit, defaults will be used.
func RegisterGRPCGatewayRoutes ¶
func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.ServeMux)
RegisterGRPCGatewayRoutes mounts the tx service's GRPC-gateway routes on the given Mux.
func RegisterTxService ¶
func RegisterTxService( qrt gogogrpc.Server, clientCtx client.Context, simulateFn baseAppSimulateFn, interfaceRegistry codectypes.InterfaceRegistry, )
RegisterTxService registers the tx service on the gRPC router.
func SignatureDataToModeInfoAndSig ¶
func SignatureDataToModeInfoAndSig(data signing.SignatureData) (*tx.ModeInfo, []byte)
SignatureDataToModeInfoAndSig converts a SignatureData to a ModeInfo and raw bytes signature
Types ¶
type ConfigOptions ¶ added in v0.50.1
type ConfigOptions struct { // If SigningHandler is specified it will be used instead constructing one. // This option supersedes all below options, whose sole purpose are to configure the creation of // txsigning.HandlerMap. SigningHandler *txsigning.HandlerMap // EnabledSignModes is the list of sign modes that will be enabled in the txsigning.HandlerMap. EnabledSignModes []signingtypes.SignMode // If SigningContext is specified it will be used when constructing sign mode handlers. If nil, one will be created // with the options specified in SigningOptions. SigningContext *txsigning.Context // SigningOptions are the options that will be used when constructing a txsigning.Context and sign mode handlers. // If nil defaults will be used. SigningOptions *txsigning.Options // TextualCoinMetadataQueryFn is the function that will be used to query coin metadata when constructing // textual sign mode handler. This is required if SIGN_MODE_TEXTUAL is enabled. TextualCoinMetadataQueryFn textual.CoinMetadataQueryFn // CustomSignModes are the custom sign modes that will be added to the txsigning.HandlerMap. CustomSignModes []txsigning.SignModeHandler // ProtoDecoder is the decoder that will be used to decode protobuf transactions. ProtoDecoder sdk.TxDecoder // ProtoEncoder is the encoder that will be used to encode protobuf transactions. ProtoEncoder sdk.TxEncoder // JSONDecoder is the decoder that will be used to decode json transactions. JSONDecoder sdk.TxDecoder // JSONEncoder is the encoder that will be used to encode json transactions. JSONEncoder sdk.TxEncoder }
ConfigOptions define the configuration of a TxConfig when calling NewTxConfigWithOptions. An empty struct is a valid configuration and will result in a TxConfig with default values.
type ExtensionOptionsTxBuilder ¶
type ExtensionOptionsTxBuilder interface { client.TxBuilder SetExtensionOptions(...*codectypes.Any) SetNonCriticalExtensionOptions(...*codectypes.Any) }
ExtensionOptionsTxBuilder defines a TxBuilder that can also set extensions.