Documentation
¶
Index ¶
- func BroadcastTx(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error
- func CalculateGas(clientCtx gogogrpc.ClientConn, txf Factory, msgs ...sdk.Msg) (*tx.SimulateResponse, uint64, error)
- func GenerateOrBroadcastTxCLI(clientCtx client.Context, flagSet *pflag.FlagSet, msgs ...sdk.Msg) error
- func GenerateOrBroadcastTxWithFactory(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error
- func Sign(ctx client.Context, txf Factory, name string, txBuilder client.TxBuilder, ...) error
- func SignWithPrivKey(ctx context.Context, signMode signing.SignMode, ...) (signing.SignatureV2, error)
- type AuxTxBuilder
- func (b *AuxTxBuilder) GetAuxSignerData() (tx.AuxSignerData, error)
- func (b *AuxTxBuilder) GetSignBytes() ([]byte, error)
- func (b *AuxTxBuilder) SetAccountNumber(accNum uint64)
- func (b *AuxTxBuilder) SetAddress(addr string)
- func (b *AuxTxBuilder) SetChainID(chainID string)
- func (b *AuxTxBuilder) SetExtensionOptions(extOpts ...*codectypes.Any)
- func (b *AuxTxBuilder) SetMemo(memo string)
- func (b *AuxTxBuilder) SetMsgs(msgs ...sdk.Msg) error
- func (b *AuxTxBuilder) SetNonCriticalExtensionOptions(extOpts ...*codectypes.Any)
- func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error
- func (b *AuxTxBuilder) SetSequence(accSeq uint64)
- func (b *AuxTxBuilder) SetSignMode(mode signing.SignMode) error
- func (b *AuxTxBuilder) SetSignature(sig []byte)
- func (b *AuxTxBuilder) SetTimeoutHeight(height uint64)
- func (b *AuxTxBuilder) SetTimeoutTimestamp(timestamp time.Time)
- type Factory
- func (f Factory) AccountNumber() uint64
- func (f Factory) AccountRetriever() client.AccountRetriever
- func (f Factory) BuildSimTx(msgs ...sdk.Msg) ([]byte, error)
- func (f Factory) BuildUnsignedTx(msgs ...sdk.Msg) (client.TxBuilder, error)
- func (f Factory) ChainID() string
- func (f Factory) Fees() sdk.Coins
- func (f Factory) FromName() string
- func (f Factory) Gas() uint64
- func (f Factory) GasAdjustment() float64
- func (f Factory) GasPrices() sdk.DecCoins
- func (f Factory) Keybase() keyring.Keyring
- func (f Factory) Memo() string
- func (f Factory) Prepare(clientCtx client.Context) (Factory, error)
- func (f Factory) PreprocessTx(keyname string, builder client.TxBuilder) error
- func (f Factory) PrintUnsignedTx(clientCtx client.Context, msgs ...sdk.Msg) error
- func (f Factory) Sequence() uint64
- func (f Factory) SignMode() signing.SignMode
- func (f Factory) SimulateAndExecute() bool
- func (f Factory) TimeoutHeight() uint64
- func (f Factory) TimeoutTimestamp() time.Time
- func (f Factory) Unordered() bool
- func (f Factory) WithAccountNumber(accnum uint64) Factory
- func (f Factory) WithAccountRetriever(ar client.AccountRetriever) Factory
- func (f Factory) WithChainID(chainID string) Factory
- func (f Factory) WithExtensionOptions(extOpts ...*codectypes.Any) Factory
- func (f Factory) WithFeeGranter(fg sdk.AccAddress) Factory
- func (f Factory) WithFeePayer(fp sdk.AccAddress) Factory
- func (f Factory) WithFees(fees string) Factory
- func (f Factory) WithFromName(fromName string) Factory
- func (f Factory) WithGas(gas uint64) Factory
- func (f Factory) WithGasAdjustment(gasAdj float64) Factory
- func (f Factory) WithGasPrices(gasPrices string) Factory
- func (f Factory) WithKeybase(keybase keyring.Keyring) Factory
- func (f Factory) WithMemo(memo string) Factory
- func (f Factory) WithPreprocessTxHook(preprocessFn client.PreprocessTxFn) Factory
- func (f Factory) WithSequence(sequence uint64) Factory
- func (f Factory) WithSignMode(mode signing.SignMode) Factory
- func (f Factory) WithSimulateAndExecute(sim bool) Factory
- func (f Factory) WithTimeoutHeight(height uint64) Factory
- func (f Factory) WithTimeoutTimestamp(timestamp time.Time) Factory
- func (f Factory) WithTxConfig(g client.TxConfig) Factory
- func (f Factory) WithUnordered(v bool) Factory
- type GasEstimateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastTx ¶ added in v1.2.6
BroadcastTx attempts to generate, sign and broadcast a transaction with the given set of messages. It will also simulate gas requirements if necessary. It will return an error upon failure.
func CalculateGas ¶ added in v1.2.6
func CalculateGas( clientCtx gogogrpc.ClientConn, txf Factory, msgs ...sdk.Msg, ) (*tx.SimulateResponse, uint64, error)
CalculateGas simulates the execution of a transaction and returns the simulation response obtained by the query and the adjusted gas amount.
func GenerateOrBroadcastTxCLI ¶ added in v1.2.6
func GenerateOrBroadcastTxCLI(clientCtx client.Context, flagSet *pflag.FlagSet, msgs ...sdk.Msg) error
GenerateOrBroadcastTxCLI will either generate and print an unsigned transaction or sign it and broadcast it returning an error upon failure.
func GenerateOrBroadcastTxWithFactory ¶ added in v1.2.6
GenerateOrBroadcastTxWithFactory will either generate and print an unsigned transaction or sign it and broadcast it returning an error upon failure.
func Sign ¶ added in v1.2.6
func Sign(ctx client.Context, txf Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error
Sign signs a given tx with a named key. The bytes signed over are canonical. The resulting signature will be added to the transaction builder overwriting the previous ones if overwrite=true (otherwise, the signature will be appended). Signing a transaction with multiple signers in the DIRECT mode is not supported and will return an error. An error is returned upon failure.
func SignWithPrivKey ¶ added in v1.2.6
func SignWithPrivKey( ctx context.Context, signMode signing.SignMode, signerData authsigning.SignerData, txBuilder client.TxBuilder, priv cryptotypes.PrivKey, txConfig client.TxConfig, accSeq uint64, ) (signing.SignatureV2, error)
SignWithPrivKey signs a given tx with the given private key, and returns the corresponding SignatureV2 if the signing is successful.
Types ¶
type AuxTxBuilder ¶ added in v1.2.6
type AuxTxBuilder struct {
// contains filtered or unexported fields
}
AuxTxBuilder is a client-side builder for creating an AuxSignerData.
func NewAuxTxBuilder ¶ added in v1.2.6
func NewAuxTxBuilder() AuxTxBuilder
NewAuxTxBuilder creates a new client-side builder for constructing an AuxSignerData.
func (*AuxTxBuilder) GetAuxSignerData ¶ added in v1.2.6
func (b *AuxTxBuilder) GetAuxSignerData() (tx.AuxSignerData, error)
GetAuxSignerData returns the builder's AuxSignerData.
func (*AuxTxBuilder) GetSignBytes ¶ added in v1.2.6
func (b *AuxTxBuilder) GetSignBytes() ([]byte, error)
GetSignBytes returns the builder's sign bytes.
func (*AuxTxBuilder) SetAccountNumber ¶ added in v1.2.6
func (b *AuxTxBuilder) SetAccountNumber(accNum uint64)
SetAccountNumber sets the aux signer's account number in the AuxSignerData.
func (*AuxTxBuilder) SetAddress ¶ added in v1.2.6
func (b *AuxTxBuilder) SetAddress(addr string)
SetAddress sets the aux signer's bech32 address.
func (*AuxTxBuilder) SetChainID ¶ added in v1.2.6
func (b *AuxTxBuilder) SetChainID(chainID string)
SetChainID sets the chain id in the AuxSignerData.
func (*AuxTxBuilder) SetExtensionOptions ¶ added in v1.2.6
func (b *AuxTxBuilder) SetExtensionOptions(extOpts ...*codectypes.Any)
SetExtensionOptions sets the aux signer's extension options.
func (*AuxTxBuilder) SetMemo ¶ added in v1.2.6
func (b *AuxTxBuilder) SetMemo(memo string)
SetMemo sets a memo in the tx.
func (*AuxTxBuilder) SetMsgs ¶ added in v1.2.6
func (b *AuxTxBuilder) SetMsgs(msgs ...sdk.Msg) error
SetMsgs sets an array of Msgs in the tx.
func (*AuxTxBuilder) SetNonCriticalExtensionOptions ¶ added in v1.2.6
func (b *AuxTxBuilder) SetNonCriticalExtensionOptions(extOpts ...*codectypes.Any)
SetNonCriticalExtensionOptions sets the aux signer's non-critical extension options.
func (*AuxTxBuilder) SetPubKey ¶ added in v1.2.6
func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error
SetPubKey sets the aux signer's pubkey in the AuxSignerData.
func (*AuxTxBuilder) SetSequence ¶ added in v1.2.6
func (b *AuxTxBuilder) SetSequence(accSeq uint64)
SetSequence sets the aux signer's sequence in the AuxSignerData.
func (*AuxTxBuilder) SetSignMode ¶ added in v1.2.6
func (b *AuxTxBuilder) SetSignMode(mode signing.SignMode) error
SetSignMode sets the aux signer's sign mode. Allowed sign modes are DIRECT_AUX and LEGACY_AMINO_JSON.
func (*AuxTxBuilder) SetSignature ¶ added in v1.2.6
func (b *AuxTxBuilder) SetSignature(sig []byte)
SetSignature sets the aux signer's signature in the AuxSignerData.
func (*AuxTxBuilder) SetTimeoutHeight ¶ added in v1.2.6
func (b *AuxTxBuilder) SetTimeoutHeight(height uint64)
SetTimeoutHeight sets a timeout height in the tx.
func (*AuxTxBuilder) SetTimeoutTimestamp ¶ added in v1.2.6
func (b *AuxTxBuilder) SetTimeoutTimestamp(timestamp time.Time)
SetTimeoutTimestamp sets a timeout timestamp in the tx.
type Factory ¶ added in v1.2.6
type Factory struct {
// contains filtered or unexported fields
}
Factory defines a client transaction factory that facilitates generating and signing an application-specific transaction.
func NewFactoryCLI ¶ added in v1.2.6
NewFactoryCLI creates a new Factory.
func (Factory) AccountNumber ¶ added in v1.2.6
func (Factory) AccountRetriever ¶ added in v1.2.6
func (f Factory) AccountRetriever() client.AccountRetriever
func (Factory) BuildSimTx ¶ added in v1.2.6
BuildSimTx creates an unsigned tx with an empty single signature and returns the encoded transaction or an error if the unsigned transaction cannot be built.
func (Factory) BuildUnsignedTx ¶ added in v1.2.6
BuildUnsignedTx builds a transaction to be signed given a set of messages. Once created, the fee, memo, and messages are set.
func (Factory) GasAdjustment ¶ added in v1.2.6
func (Factory) Prepare ¶ added in v1.2.6
Prepare ensures the account defined by ctx.GetFromAddress() exists and if the account number and/or the account sequence number are zero (not set), they will be queried for and set on the provided Factory. A new Factory with the updated fields will be returned. Note: When in offline mode, the Prepare does nothing and returns the original factory.
func (Factory) PreprocessTx ¶ added in v1.2.6
PreprocessTx calls the preprocessing hook with the factory parameters and returns the result.
func (Factory) PrintUnsignedTx ¶ added in v1.2.6
PrintUnsignedTx will generate an unsigned transaction and print it to the writer specified by ctx.Output. If simulation was requested, the gas will be simulated and also printed to the same writer before the transaction is printed.
func (Factory) SimulateAndExecute ¶ added in v1.2.6
SimulateAndExecute returns the option to simulate and then execute the transaction using the gas from the simulation results
func (Factory) TimeoutHeight ¶ added in v1.2.6
func (Factory) TimeoutTimestamp ¶ added in v1.2.6
func (Factory) WithAccountNumber ¶ added in v1.2.6
WithAccountNumber returns a copy of the Factory with an updated account number.
func (Factory) WithAccountRetriever ¶ added in v1.2.6
func (f Factory) WithAccountRetriever(ar client.AccountRetriever) Factory
WithAccountRetriever returns a copy of the Factory with an updated AccountRetriever.
func (Factory) WithChainID ¶ added in v1.2.6
WithChainID returns a copy of the Factory with an updated chainID.
func (Factory) WithExtensionOptions ¶ added in v1.2.6
func (f Factory) WithExtensionOptions(extOpts ...*codectypes.Any) Factory
WithExtensionOptions returns a Factory with given extension options added to the existing options, Example to add dynamic fee extension options:
extOpt := ethermint.ExtensionOptionDynamicFeeTx{ MaxPriorityPrice: math.NewInt(1000000), } extBytes, _ := extOpt.Marshal() extOpts := []*types.Any{ { TypeUrl: "/ethermint.types.v1.ExtensionOptionDynamicFeeTx", Value: extBytes, }, }
txf.WithExtensionOptions(extOpts...)
func (Factory) WithFeeGranter ¶ added in v1.2.6
func (f Factory) WithFeeGranter(fg sdk.AccAddress) Factory
WithFeeGranter returns a copy of the Factory with an updated fee granter.
func (Factory) WithFeePayer ¶ added in v1.2.6
func (f Factory) WithFeePayer(fp sdk.AccAddress) Factory
WithFeePayer returns a copy of the Factory with an updated fee granter.
func (Factory) WithFees ¶ added in v1.2.6
WithFees returns a copy of the Factory with an updated fee.
func (Factory) WithFromName ¶ added in v1.2.6
WithFromName returns a copy of the Factory with updated fromName fromName will be use for building a simulation tx.
func (Factory) WithGas ¶ added in v1.2.6
WithGas returns a copy of the Factory with an updated gas value.
func (Factory) WithGasAdjustment ¶ added in v1.2.6
WithGasAdjustment returns a copy of the Factory with an updated gas adjustment.
func (Factory) WithGasPrices ¶ added in v1.2.6
WithGasPrices returns a copy of the Factory with updated gas prices.
func (Factory) WithKeybase ¶ added in v1.2.6
WithKeybase returns a copy of the Factory with updated Keybase.
func (Factory) WithMemo ¶ added in v1.2.6
WithMemo returns a copy of the Factory with an updated memo.
func (Factory) WithPreprocessTxHook ¶ added in v1.2.6
func (f Factory) WithPreprocessTxHook(preprocessFn client.PreprocessTxFn) Factory
WithPreprocessTxHook returns a copy of the Factory with an updated preprocess tx function, allows for preprocessing of transaction data using the TxBuilder.
func (Factory) WithSequence ¶ added in v1.2.6
WithSequence returns a copy of the Factory with an updated sequence number.
func (Factory) WithSignMode ¶ added in v1.2.6
WithSignMode returns a copy of the Factory with an updated sign mode value.
func (Factory) WithSimulateAndExecute ¶ added in v1.2.6
WithSimulateAndExecute returns a copy of the Factory with an updated gas simulation value.
func (Factory) WithTimeoutHeight ¶ added in v1.2.6
WithTimeoutHeight returns a copy of the Factory with an updated timeout height.
func (Factory) WithTimeoutTimestamp ¶ added in v1.2.6
WithTimeoutTimestamp returns a copy of the Factory with an updated timeout timestamp.
func (Factory) WithTxConfig ¶ added in v1.2.6
WithTxConfig returns a copy of the Factory with an updated TxConfig.
func (Factory) WithUnordered ¶ added in v1.2.6
WithUnordered returns a copy of the Factory with an updated unordered field.
type GasEstimateResponse ¶ added in v1.2.6
type GasEstimateResponse struct {
GasEstimate uint64 `json:"gas_estimate" yaml:"gas_estimate"`
}
GasEstimateResponse defines a response definition for tx gas estimation.
func (GasEstimateResponse) String ¶ added in v1.2.6
func (gr GasEstimateResponse) String() string