rest

package
v1.131.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BroadcastTxRequest added in v1.82.0

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 added in v1.82.0

func ConvertAndEncodeStdTx(txConfig client.TxConfig, stdTx StdTx) ([]byte, error)

ConvertAndEncodeStdTx encodes the stdTx as a transaction in the format specified by txConfig

func CopyTx added in v1.82.0

func CopyTx(tx signing.Tx, builder client.TxBuilder, ignoreSignatureError bool) error

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

func RegisterRoutes(cliCtx client.Context, r *mux.Router, storeName string)

RegisterRoutes - Central function to define routes that get registered by the main application

func StdSignatureToSignatureV2 added in v1.82.0

func StdSignatureToSignatureV2(cdc *codec.LegacyAmino, sig StdSignature) (signing.SignatureV2, error)

StdSignatureToSignatureV2 converts a StdSignature to a SignatureV2

Types

type BroadcastReq added in v1.82.0

type BroadcastReq struct {
	Tx   StdTx  `json:"tx" yaml:"tx"`
	Mode string `json:"mode" yaml:"mode"`
}

BroadcastReq defines a tx broadcasting request.

func (BroadcastReq) UnpackInterfaces added in v1.82.0

func (m BroadcastReq) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements the UnpackInterfacesMessage interface.

type StdFee added in v1.82.0

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 minimum to be accepted into the mempool.

func NewStdFee deprecated added in v1.82.0

func NewStdFee(gas uint64, amount sdk.Coins) StdFee

Deprecated: NewStdFee returns a new instance of StdFee

func (StdFee) Bytes added in v1.82.0

func (fee StdFee) Bytes() []byte

Bytes returns the encoded bytes of a StdFee.

func (StdFee) GasPrices added in v1.82.0

func (fee StdFee) GasPrices() sdk.DecCoins

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).

func (StdFee) GetAmount added in v1.82.0

func (fee StdFee) GetAmount() sdk.Coins

GetAmount returns the fee's amount.

func (StdFee) GetGas added in v1.82.0

func (fee StdFee) GetGas() uint64

GetGas returns the fee's (wanted) gas.

type StdSignature added in v1.82.0

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 added in v1.82.0

func NewStdSignature(pk cryptotypes.PubKey, sig []byte) StdSignature

func (StdSignature) GetPubKey added in v1.82.0

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 added in v1.82.0

func (ss StdSignature) GetSignature() []byte

GetSignature returns the raw signature bytes.

func (StdSignature) MarshalYAML added in v1.82.0

func (ss StdSignature) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of the signature.

func (StdSignature) UnpackInterfaces added in v1.82.0

func (ss StdSignature) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

type StdTx added in v1.82.0

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 NewStdTx added in v1.82.0

func NewStdTx(msgs []sdk.Msg, fee StdFee, sigs []StdSignature, memo string) StdTx

Deprecated

func (*StdTx) AsAny deprecated added in v1.82.0

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 added in v1.82.0

func (tx StdTx) FeeGranter() sdk.AccAddress

FeeGranter always returns nil for StdTx

func (StdTx) FeePayer added in v1.82.0

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) GetFee added in v1.82.0

func (tx StdTx) GetFee() sdk.Coins

GetFee returns the FeeAmount in StdFee

func (StdTx) GetGas added in v1.82.0

func (tx StdTx) GetGas() uint64

GetGas returns the Gas in StdFee

func (StdTx) GetMemo added in v1.82.0

func (tx StdTx) GetMemo() string

GetMemo returns the memo

func (StdTx) GetMsgs added in v1.82.0

func (tx StdTx) GetMsgs() []sdk.Msg

GetMsgs returns the all the transaction's messages.

func (StdTx) GetPubKeys added in v1.82.0

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 added in v1.82.0

func (tx StdTx) GetSignatures() [][]byte

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 added in v1.82.0

func (tx StdTx) GetSignaturesV2() ([]signing.SignatureV2, error)

GetSignaturesV2 implements SigVerifiableTx.GetSignaturesV2

func (StdTx) GetSigners added in v1.82.0

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 added in v1.82.0

func (tx StdTx) GetTimeoutHeight() uint64

GetTimeoutHeight returns the transaction's timeout height (if set).

func (StdTx) UnpackInterfaces added in v1.82.0

func (tx StdTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

func (StdTx) ValidateBasic added in v1.82.0

func (tx StdTx) ValidateBasic() error

ValidateBasic does a simple and lightweight validation check that doesn't require access to any other information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL