legacytx

package
v0.0.0-...-fbaf713 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultTxEncoder

func DefaultTxEncoder(cdc *codec.LegacyAmino) sdk.TxEncoder

DefaultTxEncoder logic for standard transaction encoding

func MultiSignatureDataToAminoMultisignature

func MultiSignatureDataToAminoMultisignature(cdc *codec.LegacyAmino, mSig *signingtypes.MultiSignatureData) (multisig.AminoMultisignature, error)

MultiSignatureDataToAminoMultisignature converts a MultiSignatureData to an AminoMultisignature. Only SIGN_MODE_LEGACY_AMINO_JSON is supported.

func NewStdTxSignModeHandler

func NewStdTxSignModeHandler() signing.SignModeHandler

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

func SignatureDataToAminoSignature

func SignatureDataToAminoSignature(cdc *codec.LegacyAmino, data signingtypes.SignatureData) ([]byte, error)

SignatureDataToAminoSignature converts a SignatureData to amino-encoded signature bytes. Only SIGN_MODE_LEGACY_AMINO_JSON is supported.

func StdSignBytes

func StdSignBytes(chainID string, accnum, sequence, timeout uint64, fee StdFee, msgs []sdk.Msg, memo string) []byte

StdSignBytes returns the bytes to sign for a transaction.

func StdSignatureToSignatureV2

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

StdSignatureToSignatureV2 converts a StdSignature to a SignatureV2

Types

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. [Deprecated]

func NewStdFee deprecated

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

Deprecated: NewStdFee returns a new instance of StdFee

func (StdFee) Bytes

func (fee StdFee) Bytes() []byte

Bytes returns the encoded bytes of a StdFee.

func (StdFee) GasPrices

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

func (fee StdFee) GetAmount() sdk.Coins

GetAmount returns the fee's amount.

func (StdFee) GetGas

func (fee StdFee) GetGas() uint64

GetGas returns the fee's (wanted) gas.

type StdSignDoc

type StdSignDoc struct {
	AccountNumber uint64            `json:"account_number" yaml:"account_number"`
	Sequence      uint64            `json:"sequence" yaml:"sequence"`
	TimeoutHeight uint64            `json:"timeout_height,omitempty" yaml:"timeout_height"`
	ChainID       string            `json:"chain_id" yaml:"chain_id"`
	Memo          string            `json:"memo" yaml:"memo"`
	Fee           json.RawMessage   `json:"fee" yaml:"fee"`
	Msgs          []json.RawMessage `json:"msgs" yaml:"msgs"`
}

StdSignDoc is replay-prevention structure. It includes the result of msg.GetSignBytes(), as well as the ChainID (prevent cross chain replay) and the Sequence numbers for each signature (prevent inchain replay and enforce tx ordering per account).

type StdSignMsg

type StdSignMsg struct {
	ChainID       string    `json:"chain_id" yaml:"chain_id"`
	AccountNumber uint64    `json:"account_number" yaml:"account_number"`
	Sequence      uint64    `json:"sequence" yaml:"sequence"`
	TimeoutHeight uint64    `json:"timeout_height" yaml:"timeout_height"`
	Fee           StdFee    `json:"fee" yaml:"fee"`
	Msgs          []sdk.Msg `json:"msgs" yaml:"msgs"`
	Memo          string    `json:"memo" yaml:"memo"`
}

StdSignMsg is a convenience structure for passing along a Msg with the other requirements for a StdSignDoc before it is signed. For use in the CLI.

func (StdSignMsg) Bytes

func (msg StdSignMsg) Bytes() []byte

get message bytes

func (StdSignMsg) UnpackInterfaces

func (msg StdSignMsg) UnpackInterfaces(unpacker types.AnyUnpacker) error

type StdSignature deprecated

type StdSignature struct {
	cryptotypes.PubKey `json:"pub_key" yaml:"pub_key"` // optional
	Signature          []byte                          `json:"signature" yaml:"signature"`
}

Deprecated: StdSignature represents a sig

func NewStdSignature

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

Deprecated

func SignatureV2ToStdSignature

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

SignatureV2ToStdSignature converts a SignatureV2 to a StdSignature [Deprecated]

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

func NewStdTx

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

Deprecated

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

func (tx StdTx) GetFee() sdk.Coins

GetFee returns the FeeAmount in StdFee

func (StdTx) GetGas

func (tx StdTx) GetGas() uint64

GetGas returns the Gas in StdFee

func (StdTx) GetMemo

func (tx StdTx) GetMemo() string

GetMemo returns the memo

func (StdTx) GetMsgs

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

GetMsgs returns the all the transaction's messages.

func (StdTx) GetPubKeys

func (tx StdTx) GetPubKeys() []cryptotypes.PubKey

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

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

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

func (tx StdTx) GetTimeoutHeight() uint64

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

func (StdTx) UnpackInterfaces

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

func (StdTx) ValidateBasic

func (tx StdTx) ValidateBasic() error

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

type StdTxBuilder

type StdTxBuilder struct {
	StdTx
	// contains filtered or unexported fields
}

StdTxBuilder wraps StdTx to implement to the context.TxBuilder interface. Note that this type just exists for backwards compatibility with amino StdTx and will not work for protobuf transactions.

func (*StdTxBuilder) GetTx

func (s *StdTxBuilder) GetTx() authsigning.Tx

GetTx implements TxBuilder.GetTx

func (*StdTxBuilder) SetFeeAmount

func (s *StdTxBuilder) SetFeeAmount(amount sdk.Coins)

func (*StdTxBuilder) SetGasLimit

func (s *StdTxBuilder) SetGasLimit(limit uint64)

func (*StdTxBuilder) SetMemo

func (s *StdTxBuilder) SetMemo(memo string)

SetMemo implements TxBuilder.SetMemo

func (*StdTxBuilder) SetMsgs

func (s *StdTxBuilder) SetMsgs(msgs ...sdk.Msg) error

SetMsgs implements TxBuilder.SetMsgs

func (*StdTxBuilder) SetSignatures

func (s *StdTxBuilder) SetSignatures(signatures ...signing.SignatureV2) error

SetSignatures implements TxBuilder.SetSignatures.

func (*StdTxBuilder) SetTimeoutHeight

func (s *StdTxBuilder) SetTimeoutHeight(height uint64)

SetTimeoutHeight sets the transaction's height timeout.

type StdTxConfig

type StdTxConfig struct {
	Cdc *codec.LegacyAmino
}

StdTxConfig is a context.TxConfig for StdTx

func (StdTxConfig) MarshalSignatureJSON

func (s StdTxConfig) MarshalSignatureJSON(sigs []signing.SignatureV2) ([]byte, error)

func (StdTxConfig) NewTxBuilder

func (s StdTxConfig) NewTxBuilder() client.TxBuilder

NewTxBuilder implements TxConfig.NewTxBuilder

func (StdTxConfig) SignModeHandler

func (s StdTxConfig) SignModeHandler() authsigning.SignModeHandler

func (StdTxConfig) TxDecoder

func (s StdTxConfig) TxDecoder() sdk.TxDecoder

func (StdTxConfig) TxEncoder

func (s StdTxConfig) TxEncoder() sdk.TxEncoder

MarshalTx implements TxConfig.MarshalTx

func (StdTxConfig) TxJSONDecoder

func (s StdTxConfig) TxJSONDecoder() sdk.TxDecoder

func (StdTxConfig) TxJSONEncoder

func (s StdTxConfig) TxJSONEncoder() sdk.TxEncoder

func (StdTxConfig) UnmarshalSignatureJSON

func (s StdTxConfig) UnmarshalSignatureJSON(bz []byte) ([]signing.SignatureV2, error)

func (StdTxConfig) WrapTxBuilder

func (s StdTxConfig) WrapTxBuilder(newTx sdk.Tx) (client.TxBuilder, error)

WrapTxBuilder returns a StdTxBuilder from provided transaction

type Unmarshaler

type Unmarshaler func(bytes []byte, ptr interface{}) error

Unmarshaler is a generic type for Unmarshal functions

Jump to

Keyboard shortcuts

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