types

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "auth"

	// StoreKey is the store key string for auth
	StoreKey = ModuleName

	// RouterKey is the message route for auth
	RouterKey = ModuleName

	// QuerierRoute is the querier route for auth
	QuerierRoute = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName

	// FeeStoreKey is a string representation of the store key for fees
	FeeStoreKey = "fee"

	// FeeCollectorName the root string for the fee collector account address
	FeeCollectorName = "fee_collector"

	// FeeToken fee token name
	FeeToken = "matic"
)
View Source
const (
	DefaultMaxMemoCharacters      uint64 = 256
	DefaultTxSigLimit             uint64 = 7
	DefaultTxSizeCostPerByte      uint64 = 10
	DefaultSigVerifyCostED25519   uint64 = 590
	DefaultSigVerifyCostSecp256k1 uint64 = 1000

	DefaultMaxTxGas uint64 = 1000000
	DefaultTxFees   string = "1000000000000000"
)

Default parameter values

View Source
const (
	QueryParams  = "params"
	QueryAccount = "account"
)

query endpoints supported by the auth Querier

View Source
const (
	// PulpHashLength pulp hash length
	PulpHashLength int = 4
)

Variables

View Source
var (
	// AddressStoreKeyPrefix prefix for account-by-address store
	AddressStoreKeyPrefix = []byte{0x01}

	// ProposerKeyPrefix prefix for proposer
	ProposerKeyPrefix = []byte("proposer")

	// GlobalAccountNumberKey param key for global account number
	GlobalAccountNumberKey = []byte("globalAccountNumber")
)
View Source
var (
	KeyMaxMemoCharacters      = []byte("MaxMemoCharacters")
	KeyTxSigLimit             = []byte("TxSigLimit")
	KeyTxSizeCostPerByte      = []byte("TxSizeCostPerByte")
	KeySigVerifyCostED25519   = []byte("SigVerifyCostED25519")
	KeySigVerifyCostSecp256k1 = []byte("SigVerifyCostSecp256k1")

	KeyMaxTxGas = []byte("MaxTxGas")
	KeyTxFees   = []byte("TxFees")
)

Parameter keys

View Source
var ModuleCdc *codec.Codec

ModuleCdc module wide codec

Functions

func AddressStoreKey

func AddressStoreKey(addr types.HeimdallAddress) []byte

AddressStoreKey turn an address to key used to get it from the account store

func DefaultTxDecoder

func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder

DefaultTxDecoder logic for standard transaction decoding

func DefaultTxEncoder

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

DefaultTxEncoder logic for standard transaction encoding

func GetPulpHash

func GetPulpHash(msg sdk.Msg) []byte

GetPulpHash returns string hash

func NewTestTx

func NewTestTx(ctx sdk.Context, msg sdk.Msg, priv crypto.PrivKey, accNum uint64, seq uint64) sdk.Tx

NewTestTx creates new test tx

func NewTestTxWithMemo

func NewTestTxWithMemo(ctx sdk.Context, msg sdk.Msg, priv crypto.PrivKey, accNum uint64, seq uint64, memo string) sdk.Tx

NewTestTxWithMemo create new test tx

func NewTestTxWithSignBytes

func NewTestTxWithSignBytes(msg sdk.Msg, priv crypto.PrivKey, accNum uint64, seq uint64, signBytes []byte, memo string) sdk.Tx

NewTestTxWithSignBytes creates tx with sign bytes

func ParamKeyTable

func ParamKeyTable() subspace.KeyTable

ParamKeyTable for auth module

func ProposerKey

func ProposerKey() []byte

ProposerKey returns proposer key

func RecoverPubkey

func RecoverPubkey(msg []byte, sig []byte) ([]byte, error)

RecoverPubkey builds a StdSignature for given a StdSignMsg.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the codec

func SetGenesisStateToAppState

func SetGenesisStateToAppState(appState map[string]json.RawMessage, accounts GenesisAccounts) (map[string]json.RawMessage, error)

SetGenesisStateToAppState sets state into app state

func StdSignBytes

func StdSignBytes(chainID string, accnum uint64, sequence uint64, msg sdk.Msg, memo string) []byte

StdSignBytes returns the bytes to sign for a transaction.

func ValidateGenAccounts

func ValidateGenAccounts(accounts GenesisAccounts) error

ValidateGenAccounts validates an array of GenesisAccounts and checks for duplicates

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis performs basic validation of auth genesis data returning an error for any failed validation criteria.

Types

type Account

type Account = exported.Account

Account is an interface used to store coins at a given address within state. It presumes a notion of sequence numbers for replay protection, a notion of account numbers for replay protection for previously pruned accounts, and a pubkey for authentication purposes.

Many complex conditions can be used in the concrete struct which implements Account.

func ProtoBaseAccount

func ProtoBaseAccount() Account

ProtoBaseAccount - a prototype function for BaseAccount

type AccountProcessor

type AccountProcessor func(*GenesisAccount, *BaseAccount) exported.Account

AccountProcessor is an interface to process account as per module

type AccountRetriever

type AccountRetriever struct {
	// contains filtered or unexported fields
}

AccountRetriever defines the properties of a type that can be used to retrieve accounts.

func NewAccountRetriever

func NewAccountRetriever(querier NodeQuerier) AccountRetriever

NewAccountRetriever initialises a new AccountRetriever instance.

func (AccountRetriever) EnsureExists

func (ar AccountRetriever) EnsureExists(addr types.HeimdallAddress) error

EnsureExists returns an error if no account exists for the given address else nil.

func (AccountRetriever) GetAccount

func (ar AccountRetriever) GetAccount(addr types.HeimdallAddress) (Account, error)

GetAccount queries for an account given an address and a block height. An error is returned if the query or decoding fails.

func (AccountRetriever) GetAccountNumberSequence

func (ar AccountRetriever) GetAccountNumberSequence(addr types.HeimdallAddress) (uint64, uint64, error)

GetAccountNumberSequence returns sequence and account number for the given address. It returns an error if the account couldn't be retrieved from the state.

func (AccountRetriever) GetAccountWithHeight

func (ar AccountRetriever) GetAccountWithHeight(addr types.HeimdallAddress) (Account, int64, error)

GetAccountWithHeight queries for an account given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.

type BaseAccount

type BaseAccount struct {
	Address       types.HeimdallAddress `json:"address" yaml:"address"`
	Coins         sdk.Coins             `json:"coins" yaml:"coins"`
	PubKey        crypto.PubKey         `json:"public_key" yaml:"public_key"`
	AccountNumber uint64                `json:"account_number" yaml:"account_number"`
	Sequence      uint64                `json:"sequence" yaml:"sequence"`
}

BaseAccount - a base account structure. This can be extended by embedding within in your AppAccount. However one doesn't have to use BaseAccount as long as your struct implements Account.

func NewBaseAccount

func NewBaseAccount(
	address types.HeimdallAddress,
	coins sdk.Coins,
	pubKey crypto.PubKey,
	accountNumber uint64,
	sequence uint64,
) *BaseAccount

NewBaseAccount creates a new BaseAccount object

func NewBaseAccountWithAddress

func NewBaseAccountWithAddress(addr types.HeimdallAddress) BaseAccount

NewBaseAccountWithAddress - returns a new base account with a given address

func (*BaseAccount) GetAccountNumber

func (acc *BaseAccount) GetAccountNumber() uint64

GetAccountNumber - Implements Account

func (BaseAccount) GetAddress

func (acc BaseAccount) GetAddress() types.HeimdallAddress

GetAddress - Implements sdk.Account.

func (*BaseAccount) GetCoins

func (acc *BaseAccount) GetCoins() sdk.Coins

GetCoins - Implements sdk.Account.

func (BaseAccount) GetPubKey

func (acc BaseAccount) GetPubKey() crypto.PubKey

GetPubKey - Implements sdk.Account.

func (*BaseAccount) GetSequence

func (acc *BaseAccount) GetSequence() uint64

GetSequence - Implements sdk.Account.

func (BaseAccount) MarshalYAML

func (acc BaseAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of an account.

func (*BaseAccount) SetAccountNumber

func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error

SetAccountNumber - Implements Account

func (*BaseAccount) SetAddress

func (acc *BaseAccount) SetAddress(addr types.HeimdallAddress) error

SetAddress - Implements sdk.Account.

func (*BaseAccount) SetCoins

func (acc *BaseAccount) SetCoins(coins sdk.Coins) error

SetCoins - Implements sdk.Account.

func (*BaseAccount) SetPubKey

func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error

SetPubKey - Implements sdk.Account.

func (*BaseAccount) SetSequence

func (acc *BaseAccount) SetSequence(seq uint64) error

SetSequence - Implements sdk.Account.

func (*BaseAccount) SpendableCoins

func (acc *BaseAccount) SpendableCoins(_ time.Time) sdk.Coins

SpendableCoins returns the total set of spendable coins. For a base account, this is simply the base coins.

func (BaseAccount) String

func (acc BaseAccount) String() string

String implements fmt.Stringer

func (BaseAccount) Validate

func (acc BaseAccount) Validate() error

Validate checks for errors on the account fields

type GenesisAccount

type GenesisAccount struct {
	Address       hmTypes.HeimdallAddress `json:"address" yaml:"address"`
	Coins         sdk.Coins               `json:"coins" yaml:"coins"`
	Sequence      uint64                  `json:"sequence_number" yaml:"sequence_number"`
	AccountNumber uint64                  `json:"account_number" yaml:"account_number"`

	// module account fields
	ModuleName        string   `json:"module_name" yaml:"module_name"`               // name of the module account
	ModulePermissions []string `json:"module_permissions" yaml:"module_permissions"` // permissions of module account
}

GenesisAccount is a struct for account initialization used exclusively during genesis

func NewGenesisAccount

func NewGenesisAccount(acc *BaseAccount) GenesisAccount

NewGenesisAccount creates a GenesisAccount instance from a BaseAccount.

func NewGenesisAccountI

func NewGenesisAccountI(acc Account) (GenesisAccount, error)

NewGenesisAccountI creates a GenesisAccount instance from an Account interface.

func NewGenesisAccountRaw

func NewGenesisAccountRaw(
	address hmTypes.HeimdallAddress,
	coins sdk.Coins,
	module string,
	permissions ...string,
) GenesisAccount

NewGenesisAccountRaw creates a new GenesisAccount object

func (*GenesisAccount) ToAccount

func (ga *GenesisAccount) ToAccount() Account

ToAccount converts a GenesisAccount to an Account interface

func (GenesisAccount) Validate

func (ga GenesisAccount) Validate() error

Validate checks for errors on the vesting and module account parameters

type GenesisAccounts

type GenesisAccounts []GenesisAccount

GenesisAccounts list of genesis account

func SanitizeGenesisAccounts

func SanitizeGenesisAccounts(genAccs GenesisAccounts) GenesisAccounts

SanitizeGenesisAccounts sorts accounts and coin sets.

func (GenesisAccounts) Contains

func (gaccs GenesisAccounts) Contains(acc hmTypes.HeimdallAddress) bool

Contains checks if genesis accounts contain an address

type GenesisState

type GenesisState struct {
	Params   Params          `json:"params" yaml:"params"`
	Accounts GenesisAccounts `json:"accounts" yaml:"accounts"`
}

GenesisState - all auth state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - Return a default genesis state

func GetGenesisStateFromAppState

func GetGenesisStateFromAppState(appState map[string]json.RawMessage) GenesisState

GetGenesisStateFromAppState returns x/auth GenesisState given raw application genesis state.

func NewGenesisState

func NewGenesisState(params Params, accounts GenesisAccounts) GenesisState

NewGenesisState - Create a new genesis state

type LightBaseAccount

type LightBaseAccount struct {
	Address       types.HeimdallAddress `json:"address" yaml:"address"`
	AccountNumber uint64                `json:"account_number" yaml:"account_number"`
	Sequence      uint64                `json:"sequence" yaml:"sequence"`
}

LightBaseAccount - a base account structure.

type NodeQuerier

type NodeQuerier interface {
	// QueryWithData performs a query to a Tendermint node with the provided path
	// and a data payload. It returns the result and height of the query upon success
	// or an error if the query fails.
	QueryWithData(path string, data []byte) ([]byte, int64, error)
}

NodeQuerier is an interface that is satisfied by types that provide the QueryWithData method

type Params

type Params struct {
	MaxMemoCharacters      uint64 `json:"max_memo_characters" yaml:"max_memo_characters"`
	TxSigLimit             uint64 `json:"tx_sig_limit" yaml:"tx_sig_limit"`
	TxSizeCostPerByte      uint64 `json:"tx_size_cost_per_byte" yaml:"tx_size_cost_per_byte"`
	SigVerifyCostED25519   uint64 `json:"sig_verify_cost_ed25519" yaml:"sig_verify_cost_ed25519"`
	SigVerifyCostSecp256k1 uint64 `json:"sig_verify_cost_secp256k1" yaml:"sig_verify_cost_secp256k1"`

	MaxTxGas uint64 `json:"max_tx_gas" yaml:"max_tx_gas"`
	TxFees   string `json:"tx_fees" yaml:"tx_fees"`
}

Params defines the parameters for the auth module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func NewParams

func NewParams(
	maxMemoCharacters uint64,
	txSigLimit uint64,
	txSizeCostPerByte uint64,
	sigVerifyCostED25519 uint64,
	sigVerifyCostSecp256k1 uint64,

	maxTxGas uint64,
	txFees string,
) Params

NewParams creates a new Params object

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Params types are identical.

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() subspace.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of auth module's parameters. nolint

func (Params) String

func (p Params) String() string

String implements the stringer interface.

func (Params) Validate

func (p Params) Validate() error

Validate checks that the parameters have valid values.

type Pulp

type Pulp struct {
	// contains filtered or unexported fields
}

Pulp codec for RLP

func GetPulpInstance

func GetPulpInstance() *Pulp

GetPulpInstance gets new pulp codec

func NewPulp

func NewPulp() *Pulp

NewPulp creates new pulp codec

func (*Pulp) DecodeBytes

func (p *Pulp) DecodeBytes(data []byte) (interface{}, error)

DecodeBytes decodes bytes to msg

func (*Pulp) EncodeToBytes

func (p *Pulp) EncodeToBytes(tx StdTx) ([]byte, error)

EncodeToBytes encodes msg to bytes

func (*Pulp) GetMsgTxInstance

func (p *Pulp) GetMsgTxInstance(hash []byte) interface{}

GetMsgTxInstance get new instance associated with base tx

func (*Pulp) RegisterConcrete

func (p *Pulp) RegisterConcrete(msg sdk.Msg)

RegisterConcrete should be used to register concrete types that will appear in interface fields/elements to be encoded/decoded by pulp.

type QueryAccountParams

type QueryAccountParams struct {
	Address types.HeimdallAddress
}

QueryAccountParams defines the params for querying accounts.

func NewQueryAccountParams

func NewQueryAccountParams(addr types.HeimdallAddress) QueryAccountParams

NewQueryAccountParams creates a new instance of QueryAccountParams.

type StdFee

type StdFee struct {
	Amount sdk.Coins `json:"amount"`
	Gas    uint64    `json:"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 NewStdFee

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

NewStdFee returns a new instance of StdFee

func (StdFee) Bytes

func (fee StdFee) Bytes() []byte

Bytes for signing later

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

type StdSignDoc

type StdSignDoc struct {
	ChainID       string          `json:"chain_id" yaml:"chain_id"`
	AccountNumber uint64          `json:"account_number" yaml:"account_number"`
	Sequence      uint64          `json:"sequence" yaml:"sequence"`
	Msg           json.RawMessage `json:"msg" yaml:"msg"`
	Memo          string          `json:"memo" yaml:"memo"`
}

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"`
	Msg           sdk.Msg `json:"msg" yaml:"msg"`
	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

Bytes returns message bytes

type StdSignature

type StdSignature []byte

StdSignature represents a sig

func MakeSignature

func MakeSignature(privKey secp256k1.PrivKeySecp256k1, msg StdSignMsg) (sig StdSignature, err error)

MakeSignature builds a StdSignature for given a StdSignMsg.

func MakeSignatureWithKeybase

func MakeSignatureWithKeybase(
	keybase crkeys.Keybase,
	name string,
	passphrase string,
	msg StdSignMsg,
) (sig StdSignature, err error)

MakeSignatureWithKeybase builds a StdSignature given keybase, key name, passphrase, and a StdSignMsg.

func (StdSignature) Bytes

func (ss StdSignature) Bytes() []byte

Bytes returns the bytes

func (StdSignature) Empty

func (ss StdSignature) Empty() bool

Empty checks is sig is empty

func (StdSignature) Marshal

func (ss StdSignature) Marshal() ([]byte, error)

Marshal returns the raw address bytes. It is needed for protobuf compatibility.

func (StdSignature) MarshalJSON

func (ss StdSignature) MarshalJSON() ([]byte, error)

MarshalJSON marshals to JSON using Bech32.

func (StdSignature) MarshalYAML

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

MarshalYAML marshals to YAML using Bech32.

func (StdSignature) String

func (ss StdSignature) String() string

String implements the Stringer interface.

func (*StdSignature) Unmarshal

func (ss *StdSignature) Unmarshal(data []byte) error

Unmarshal sets the address to the given data. It is needed for protobuf compatibility.

func (*StdSignature) UnmarshalJSON

func (ss *StdSignature) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

type StdTx

type StdTx struct {
	Msg       sdk.Msg      `json:"msg" yaml:"msg"`
	Signature StdSignature `json:"signature" yaml:"signature"`
	Memo      string       `json:"memo" yaml:"memo"`
}

StdTx is a standard way to wrap a Msg with Fee and Signatures.

func NewStdTx

func NewStdTx(msg sdk.Msg, sig StdSignature, memo string) StdTx

NewStdTx is function to get new std tx object

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

func (tx StdTx) GetSignatures() []StdSignature

GetSignatures returns the signature of signers who signed the Msg.

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

func (tx StdTx) ValidateBasic() sdk.Error

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

type StdTxRaw

type StdTxRaw struct {
	Msg       rlp.RawValue
	Signature StdSignature
	Memo      string
}

StdTxRaw is a standard way to wrap a RLP Msg with Fee and Signatures.

type TxBuilder

type TxBuilder struct {
	// contains filtered or unexported fields
}

TxBuilder implements a transaction context created in SDK modules.

func NewTxBuilder

func NewTxBuilder(
	txEncoder sdk.TxEncoder,
	accNumber uint64,
	seq uint64,
	gas uint64,
	gasAdj float64,
	simulateAndExecute bool,
	chainID string,
	memo string,
	fees sdk.Coins,
	gasPrices sdk.DecCoins,
) TxBuilder

NewTxBuilder returns a new initialized TxBuilder.

func NewTxBuilderFromCLI

func NewTxBuilderFromCLI() TxBuilder

NewTxBuilderFromCLI returns a new initialized TxBuilder with parameters from the command line using Viper.

func (TxBuilder) AccountNumber

func (bldr TxBuilder) AccountNumber() uint64

AccountNumber returns the account number

func (TxBuilder) BuildAndSign

func (bldr TxBuilder) BuildAndSign(privKey secp256k1.PrivKeySecp256k1, msgs []sdk.Msg) ([]byte, error)

BuildAndSign builds a single message to be signed, and signs a transaction with the built message given a set of messages.

func (TxBuilder) BuildAndSignWithPassphrase

func (bldr TxBuilder) BuildAndSignWithPassphrase(name, passphrase string, msgs []sdk.Msg) ([]byte, error)

BuildAndSignWithPassphrase builds a single message to be signed, and signs a transaction with the built message given a name, passphrase, and a set of messages.

func (TxBuilder) BuildSignMsg

func (bldr TxBuilder) BuildSignMsg(msgs []sdk.Msg) (StdSignMsg, error)

BuildSignMsg builds a single message to be signed from a TxBuilder given a set of messages. It returns an error if a fee is supplied but cannot be parsed.

func (TxBuilder) BuildTxForSim

func (bldr TxBuilder) BuildTxForSim(msgs []sdk.Msg) ([]byte, error)

BuildTxForSim creates a StdSignMsg and encodes a transaction with the StdSignMsg with a single empty StdSignature for tx simulation.

func (TxBuilder) ChainID

func (bldr TxBuilder) ChainID() string

ChainID returns the chain id

func (TxBuilder) Fees

func (bldr TxBuilder) Fees() sdk.Coins

Fees returns the fees for the transaction

func (TxBuilder) Gas

func (bldr TxBuilder) Gas() uint64

Gas returns the gas for the transaction

func (TxBuilder) GasAdjustment

func (bldr TxBuilder) GasAdjustment() float64

GasAdjustment returns the gas adjustment

func (TxBuilder) GasPrices

func (bldr TxBuilder) GasPrices() sdk.DecCoins

GasPrices returns the gas prices set for the transaction, if any.

func (TxBuilder) GetStdTxBytes

func (bldr TxBuilder) GetStdTxBytes(stdTx StdTx) (result []byte, err error)

GetStdTxBytes get tx bytes

func (TxBuilder) Keybase

func (bldr TxBuilder) Keybase() crkeys.Keybase

Keybase returns the keybase

func (TxBuilder) Memo

func (bldr TxBuilder) Memo() string

Memo returns the memo message

func (TxBuilder) Sequence

func (bldr TxBuilder) Sequence() uint64

Sequence returns the transaction sequence

func (TxBuilder) Sign

func (bldr TxBuilder) Sign(privKey secp256k1.PrivKeySecp256k1, msg StdSignMsg) ([]byte, error)

Sign transaction with default node key

func (TxBuilder) SignStdTx

func (bldr TxBuilder) SignStdTx(privKey secp256k1.PrivKeySecp256k1, stdTx StdTx, appendSig bool) (signedStdTx StdTx, err error)

SignStdTx appends a signature to a StdTx and returns a copy of it. If append is false, it replaces the signatures already attached with the new signature.

func (TxBuilder) SignStdTxWithPassphrase

func (bldr TxBuilder) SignStdTxWithPassphrase(name, passphrase string, stdTx StdTx, appendSig bool) (signedStdTx StdTx, err error)

SignStdTxWithPassphrase appends a signature to a StdTx and returns a copy of it. If append is false, it replaces the signatures already attached with the new signature.

func (TxBuilder) SignWithPassphrase

func (bldr TxBuilder) SignWithPassphrase(name, passphrase string, msg StdSignMsg) ([]byte, error)

SignWithPassphrase signs a transaction given a name, passphrase, and a single message to signed. An error is returned if signing fails.

func (TxBuilder) SimulateAndExecute

func (bldr TxBuilder) SimulateAndExecute() bool

SimulateAndExecute returns the option to simulate and then execute the transaction using the gas from the simulation results

func (TxBuilder) TxEncoder

func (bldr TxBuilder) TxEncoder() sdk.TxEncoder

TxEncoder returns the transaction encoder

func (TxBuilder) WithAccountNumber

func (bldr TxBuilder) WithAccountNumber(accnum uint64) TxBuilder

WithAccountNumber returns a copy of the context with an account number.

func (TxBuilder) WithChainID

func (bldr TxBuilder) WithChainID(chainID string) TxBuilder

WithChainID returns a copy of the context with an updated chainID.

func (TxBuilder) WithFees

func (bldr TxBuilder) WithFees(fees string) TxBuilder

WithFees returns a copy of the context with an updated fee.

func (TxBuilder) WithGas

func (bldr TxBuilder) WithGas(gas uint64) TxBuilder

WithGas returns a copy of the context with an updated gas.

func (TxBuilder) WithGasPrices

func (bldr TxBuilder) WithGasPrices(gasPrices string) TxBuilder

WithGasPrices returns a copy of the context with updated gas prices.

func (TxBuilder) WithKeybase

func (bldr TxBuilder) WithKeybase(keybase crkeys.Keybase) TxBuilder

WithKeybase returns a copy of the context with updated keybase.

func (TxBuilder) WithMemo

func (bldr TxBuilder) WithMemo(memo string) TxBuilder

WithMemo returns a copy of the context with an updated memo.

func (TxBuilder) WithSequence

func (bldr TxBuilder) WithSequence(sequence uint64) TxBuilder

WithSequence returns a copy of the context with an updated sequence number.

func (TxBuilder) WithTxEncoder

func (bldr TxBuilder) WithTxEncoder(txEncoder sdk.TxEncoder) TxBuilder

WithTxEncoder returns a copy of the context with an updated codec.

Jump to

Keyboard shortcuts

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