Documentation ¶
Index ¶
- func BroadcastTxRequest(clientCtx client.Context) http.HandlerFunc
- func ConvertAndEncodeStdTx(txConfig client.TxConfig, stdTx StdTx) ([]byte, error)
- func CopyTx(tx signing.Tx, builder client.TxBuilder, ignoreSignatureError bool) error
- func RegisterRoutes(cliCtx client.Context, r *mux.Router, storeName string)
- func StdSignatureToSignatureV2(cdc *codec.LegacyAmino, sig StdSignature) (signing.SignatureV2, error)
- type BroadcastReq
- type StdFee
- type StdSignature
- type StdTx
- func (tx *StdTx) AsAny() *codectypes.Anydeprecated
- func (tx StdTx) FeeGranter() sdk.AccAddress
- func (tx StdTx) FeePayer() sdk.AccAddress
- func (tx StdTx) GetFee() sdk.Coins
- func (tx StdTx) GetGas() uint64
- func (tx StdTx) GetMemo() string
- func (tx StdTx) GetMsgs() []sdk.Msg
- func (tx StdTx) GetPubKeys() ([]cryptotypes.PubKey, error)
- func (tx StdTx) GetSignatures() [][]byte
- func (tx StdTx) GetSignaturesV2() ([]signing.SignatureV2, error)
- func (tx StdTx) GetSigners() []sdk.AccAddress
- func (tx StdTx) GetTimeoutHeight() uint64
- func (tx StdTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
- func (tx StdTx) ValidateBasic() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastTxRequest ¶
func BroadcastTxRequest(clientCtx client.Context) http.HandlerFunc
BroadcastTxRequest implements a tx broadcasting handler that is responsible for broadcasting a valid and signed tx to a full node. The tx can be broadcasted via a sync|async|block mechanism.
func ConvertAndEncodeStdTx ¶
ConvertAndEncodeStdTx encodes the stdTx as a transaction in the format specified by txConfig
func CopyTx ¶
CopyTx copies a Tx to a new TxBuilder, allowing conversion between different transaction formats. If ignoreSignatureError is true, copying will continue tx even if the signature cannot be set in the target builder resulting in an unsigned tx.
func RegisterRoutes ¶
RegisterRoutes - Central function to define routes that get registered by the main application
func StdSignatureToSignatureV2 ¶
func StdSignatureToSignatureV2(cdc *codec.LegacyAmino, sig StdSignature) (signing.SignatureV2, error)
StdSignatureToSignatureV2 converts a StdSignature to a SignatureV2
Types ¶
type BroadcastReq ¶
BroadcastReq defines a tx broadcasting request.
func (BroadcastReq) UnpackInterfaces ¶
func (m BroadcastReq) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
UnpackInterfaces implements the UnpackInterfacesMessage interface.
type StdFee ¶
type StdFee struct { Amount sdk.Coins `json:"amount" yaml:"amount"` Gas uint64 `json:"gas" yaml:"gas"` }
StdFee includes the amount of coins paid in fees and the maximum gas to be used by the transaction. The ratio yields an effective "gasprice", which must be above some miminum to be accepted into the mempool.
func (StdFee) GasPrices ¶
GasPrices returns the gas prices for a StdFee.
NOTE: The gas prices returned are not the true gas prices that were originally part of the submitted transaction because the fee is computed as fee = ceil(gasWanted * gasPrices).
type StdSignature ¶
type StdSignature struct { cryptotypes.PubKey `json:"pub_key" yaml:"pub_key"` // optional Signature []byte `json:"signature" yaml:"signature"` Sequence uint64 `json:"sequence"` }
StdSignature represents a sig
func NewStdSignature ¶
func NewStdSignature(pk cryptotypes.PubKey, sig []byte) StdSignature
func (StdSignature) GetPubKey ¶
func (ss StdSignature) GetPubKey() cryptotypes.PubKey
GetPubKey returns the public key of a signature as a cryptotypes.PubKey using the Amino codec.
func (StdSignature) GetSignature ¶
func (ss StdSignature) GetSignature() []byte
GetSignature returns the raw signature bytes.
func (StdSignature) MarshalYAML ¶
func (ss StdSignature) MarshalYAML() (interface{}, error)
MarshalYAML returns the YAML representation of the signature.
func (StdSignature) UnpackInterfaces ¶
func (ss StdSignature) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
type StdTx ¶
type StdTx struct { Msgs []sdk.Msg `json:"msg" yaml:"msg"` Fee StdFee `json:"fee" yaml:"fee"` Signatures []StdSignature `json:"signatures" yaml:"signatures"` Memo string `json:"memo" yaml:"memo"` TimeoutHeight uint64 `json:"timeout_height" yaml:"timeout_height"` }
StdTx is the legacy transaction format for wrapping a Msg with Fee and Signatures. It only works with Amino, please prefer the new protobuf Tx in types/tx. NOTE: the first signature is the fee payer (Signatures must not be nil).
func (*StdTx) AsAny
deprecated
func (tx *StdTx) AsAny() *codectypes.Any
Deprecated: AsAny implements intoAny. It doesn't work for protobuf serialization, so it can't be saved into protobuf configured storage. We are using it only for API compatibility.
func (StdTx) FeeGranter ¶
func (tx StdTx) FeeGranter() sdk.AccAddress
FeeGranter always returns nil for StdTx
func (StdTx) FeePayer ¶
func (tx StdTx) FeePayer() sdk.AccAddress
FeePayer returns the address that is responsible for paying fee StdTx returns the first signer as the fee payer If no signers for tx, return empty address
func (StdTx) GetPubKeys ¶
func (tx StdTx) GetPubKeys() ([]cryptotypes.PubKey, error)
GetPubkeys returns the pubkeys of signers if the pubkey is included in the signature If pubkey is not included in the signature, then nil is in the slice instead
func (StdTx) GetSignatures ¶
GetSignatures returns the signature of signers who signed the Msg. CONTRACT: Length returned is same as length of pubkeys returned from MsgKeySigners, and the order matches. CONTRACT: If the signature is missing (ie the Msg is invalid), then the corresponding signature is .Empty().
func (StdTx) GetSignaturesV2 ¶
func (tx StdTx) GetSignaturesV2() ([]signing.SignatureV2, error)
GetSignaturesV2 implements SigVerifiableTx.GetSignaturesV2
func (StdTx) GetSigners ¶
func (tx StdTx) GetSigners() []sdk.AccAddress
GetSigners returns the addresses that must sign the transaction. Addresses are returned in a deterministic order. They are accumulated from the GetSigners method for each Msg in the order they appear in tx.GetMsgs(). Duplicate addresses will be omitted.
func (StdTx) GetTimeoutHeight ¶
GetTimeoutHeight returns the transaction's timeout height (if set).
func (StdTx) UnpackInterfaces ¶
func (tx StdTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
func (StdTx) ValidateBasic ¶
ValidateBasic does a simple and lightweight validation check that doesn't require access to any other information.