utils

package
Version: v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateGas added in v0.25.0

func CalculateGas(queryFunc func(string, common.HexBytes) ([]byte, error),
	cdc *amino.Codec, txBytes []byte, adjustment float64) (estimate, adjusted uint64, err error)

CalculateGas simulates the execution of a transaction and returns both the estimate obtained by the query and the adjusted amount.

func CompleteAndBroadcastTxCLI added in v0.31.0

func CompleteAndBroadcastTxCLI(txBldr authtxb.TxBuilder, cliCtx context.CLIContext, msgs []sdk.Msg) error

CompleteAndBroadcastTxCLI implements a utility function that facilitates sending a series of messages in a signed transaction given a TxBuilder and a QueryContext. It ensures that the account exists, has a proper number and sequence set. In addition, it builds and signs a transaction with the supplied messages. Finally, it broadcasts the signed transaction to a node.

func EnrichWithGas added in v0.31.0

func EnrichWithGas(txBldr authtxb.TxBuilder, cliCtx context.CLIContext, msgs []sdk.Msg) (authtxb.TxBuilder, error)

EnrichWithGas calculates the gas estimate that would be consumed by the transaction and set the transaction's respective value accordingly.

func GenerateOrBroadcastMsgs added in v0.31.0

func GenerateOrBroadcastMsgs(cliCtx context.CLIContext, txBldr authtxb.TxBuilder, msgs []sdk.Msg, offline bool) error

GenerateOrBroadcastMsgs respects CLI flags and outputs a message

func GetTxEncoder added in v0.28.1

func GetTxEncoder(cdc *codec.Codec) (encoder sdk.TxEncoder)

GetTxEncoder return tx encoder from global sdk configuration if ones is defined. Otherwise returns encoder with default logic.

func PrepareTxBuilder added in v0.31.0

func PrepareTxBuilder(txBldr authtxb.TxBuilder, cliCtx context.CLIContext) (authtxb.TxBuilder, error)

PrepareTxBuilder populates a TxBuilder in preparation for the build of a Tx.

func PrintUnsignedStdTx added in v0.25.0

func PrintUnsignedStdTx(
	txBldr authtxb.TxBuilder, cliCtx context.CLIContext, msgs []sdk.Msg, offline bool,
) (err error)

PrintUnsignedStdTx builds an unsigned StdTx and prints it to os.Stdout. Don't perform online validation or lookups if offline is true.

func ReadStdTxFromFile added in v0.33.0

func ReadStdTxFromFile(cdc *amino.Codec, filename string) (stdTx auth.StdTx, err error)

Read and decode a StdTx from the given filename. Can pass "-" to read from stdin.

func SignStdTx added in v0.25.0

func SignStdTx(
	txBldr authtxb.TxBuilder, cliCtx context.CLIContext, name string,
	stdTx auth.StdTx, appendSig bool, offline bool,
) (auth.StdTx, error)

SignStdTx appends a signature to a StdTx and returns a copy of it. If appendSig is false, it replaces the signatures already attached with the new signature. Don't perform online validation or lookups if offline is true.

func SignStdTxWithSignerAddress added in v0.30.0

func SignStdTxWithSignerAddress(txBldr authtxb.TxBuilder, cliCtx context.CLIContext,
	addr sdk.AccAddress, name string, stdTx auth.StdTx,
	offline bool) (signedStdTx auth.StdTx, err error)

SignStdTxWithSignerAddress attaches a signature to a StdTx and returns a copy of a it. Don't perform online validation or lookups if offline is true, else populate account and sequence numbers from a foreign account.

Types

type GasEstimateResponse added in v0.31.0

type GasEstimateResponse struct {
	GasEstimate uint64 `json:"gas_estimate"`
}

GasEstimateResponse defines a response definition for tx gas estimation.

func (GasEstimateResponse) String added in v0.31.0

func (gr GasEstimateResponse) String() string

Source Files

Jump to

Keyboard shortcuts

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