Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "send", Short: "Send a transaction", Example: `flow transactions send --code=tx.cdc --args="[{\"type\": \"String\", \"value\": \"Hello, Cadence\"}]"`, Run: func(cmd *cobra.Command, args []string) { projectConf := cli.LoadConfig() signerAccount := projectConf.Accounts[conf.Signer] if signerAccount == nil && conf.Signer == "service" { signerAccount = projectConf.Accounts["emulator-account"] } validateKeyPreReq(signerAccount) var ( code []byte err error ) if conf.Code != "" { code, err = ioutil.ReadFile(conf.Code) if err != nil { cli.Exitf(1, "Failed to read transaction script from %s", conf.Code) } } tx := flow. NewTransaction(). SetScript(code). AddAuthorizer(signerAccount.Address) if conf.Args != "" { transactionArguments, err := cli.ParseArguments(conf.Args) if err != nil { cli.Exitf(1, "Invalid arguments passed: %s", conf.Args) } for _, arg := range transactionArguments { err := tx.AddArgument(arg) if err != nil { cli.Exitf(1, "Failed to add %s argument to a transaction ", conf.Code) } } } cli.SendTransaction(projectConf.HostWithOverride(conf.Host), signerAccount, tx, conf.Results) }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Args string `default:"" flag:"args" info:"arguments in JSON-Cadence format"`
Code string `flag:"code,c" info:"path to Cadence file"`
Host string `flag:"host" info:"Flow Access API host address"`
Signer string `default:"service" flag:"signer,s"`
Results bool `default:"false" flag:"results" info:"Display the results of the transaction"`
}
Click to show internal directories.
Click to hide internal directories.