1 Star 0 Fork 0

艾鸥科技 / go-aiou

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
send.go 874 Bytes
一键复制 编辑 原始数据 按行查看 历史
张卓 提交于 2020-05-10 14:55 . init
package iwallet
import (
"github.com/spf13/cobra"
"gitee.com/aiou-official/go-aiou/rpc/pb"
"gitee.com/aiou-official/go-aiou/sdk"
)
// sendCmd represents the send command that send a contract with given actions.
var sendCmd = &cobra.Command{
Use: "send txFile",
Short: "Send transaction onto blockchain by given json file",
Long: `Send transaction onto blockchain by given json file`,
Example: ` iwallet send tx.json --account test0`,
Args: func(cmd *cobra.Command, args []string) error {
if err := checkArgsNumber(cmd, args, "txFile"); err != nil {
return err
}
return checkAccount(cmd)
},
RunE: func(cmd *cobra.Command, args []string) error {
tx := &rpcpb.TransactionRequest{}
err := sdk.LoadProtoStructFromJSONFile(args[0], tx)
if err != nil {
return err
}
return sendTx(tx)
},
}
func init() {
rootCmd.AddCommand(sendCmd)
}
1
https://gitee.com/aiou-official/go-aiou.git
git@gitee.com:aiou-official/go-aiou.git
aiou-official
go-aiou
go-aiou
376a44096468

搜索帮助