Documentation ¶
Index ¶
- Constants
- Variables
- func GetSigner() crypto.PubKey
- func LoadJSON(template interface{}) (bool, error)
- func OutputTx(res *ctypes.ResultBroadcastTxCommit) error
- func Sign(tx interface{}) (packet []byte, err error)
- func SignAndPostTx(tx Validatable) (*ctypes.ResultBroadcastTxCommit, error)
- type DemoTx
- type Validatable
Constants ¶
View Source
const ( UserFlag = "user" AgeFlag = "age" )
View Source
const ( NameFlag = "name" InputFlag = "input" )
Variables ¶
View Source
var DemoCmd = &cobra.Command{ Use: "demo", Short: "Demo tx creation", RunE: commands.RequireInit(runDemo), }
View Source
var RootCmd = &cobra.Command{
Use: "tx",
Short: "Create and post transactions to the node",
}
RootCmd represents the base command when called without any subcommands
Functions ¶
func GetSigner ¶ added in v0.10.1
GetSigner returns the pub key that will sign the tx returns empty key if no name provided
func LoadJSON ¶ added in v0.10.1
LoadJSON will read a json file from disk if --input is passed in template is a pointer to a struct that can hold the expected data (&MyTx{})
If not data is provided, returns (false, nil) If data is provided and passes, returns (true, nil) If data is provided but not parsable, returns (true, err)
func OutputTx ¶ added in v0.10.1
func OutputTx(res *ctypes.ResultBroadcastTxCommit) error
OutputTx prints the tx result to stdout TODO: something other than raw json?
func SignAndPostTx ¶ added in v0.10.1
func SignAndPostTx(tx Validatable) (*ctypes.ResultBroadcastTxCommit, error)
SignAndPostTx does all work once we construct a proper struct it validates the data, signs if needed, transforms to bytes, and posts to the node.
Types ¶
type DemoTx ¶ added in v0.10.1
func (DemoTx) ValidateBasic ¶ added in v0.10.1
type Validatable ¶ added in v0.10.1
type Validatable interface {
ValidateBasic() error
}
Click to show internal directories.
Click to hide internal directories.