Documentation ¶
Index ¶
- Constants
- Variables
- func DoTx(tx sdk.Tx) (err error)
- func GetSigner() crypto.PubKey
- func GetSignerAct() (res sdk.Actor)
- func OutputTx(res *ctypes.ResultBroadcastTxCommit) error
- func PostTx(tx sdk.Tx) (*ctypes.ResultBroadcastTxCommit, error)
- func PrepareOrPostTx(tx sdk.Tx) (*ctypes.ResultBroadcastTxCommit, error)
- func PrepareTx(tx sdk.Tx) (bool, error)
- func SignTx(tx sdk.Tx) error
- type Validatable
- type Wrapper
- type Wrappers
Constants ¶
const ( FlagName = "name" FlagNoSign = "no-sign" FlagIn = "in" FlagPrepare = "prepare" )
nolint
Variables ¶
var RootCmd = &cobra.Command{
Use: "tx",
Short: "Post tx from json input",
RunE: doRawTx,
}
RootCmd represents the base command when called without any subcommands
Functions ¶
func DoTx ¶
DoTx is a helper function for the lazy :)
It uses only public functions and goes through the standard sequence of wrapping the tx with middleware layers, signing it, either preparing it, or posting it and displaying the result.
If you want a non-standard flow, just call the various functions directly. eg. if you already set the middleware layers in your code, or want to output in another format.
func GetSigner ¶
GetSigner returns the pub key that will sign the tx returns empty key if no name provided
func GetSignerAct ¶
GetSignerAct returns the address of the signer of the tx (as we still only support single sig)
func OutputTx ¶
func OutputTx(res *ctypes.ResultBroadcastTxCommit) error
OutputTx validates if success and prints the tx result to stdout
func PostTx ¶
func PostTx(tx sdk.Tx) (*ctypes.ResultBroadcastTxCommit, error)
PostTx does all work once we construct a proper struct it validates the data, signs if needed, transforms to bytes, and posts to the node.
func PrepareOrPostTx ¶
func PrepareOrPostTx(tx sdk.Tx) (*ctypes.ResultBroadcastTxCommit, error)
PrepareOrPostTx checks the flags to decide to prepare the tx for future multisig, or to post it to the node. Returns error on any failure. If no error and the result is nil, it means it already wrote to file, no post, no need to do more.
Types ¶
type Validatable ¶
type Validatable interface {
ValidateBasic() error
}
Validatable represents anything that can be Validated
type Wrapper ¶
Wrapper defines the information needed for each middleware package that wraps the data. They should read all configuration out of bounds via viper.
var ( // Middleware must be set in main.go to defined the wrappers we should apply Middleware Wrapper )