|
| 1 | +// Copyright (c) 2020 IoTeX Foundation |
| 2 | +// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no |
| 3 | +// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent |
| 4 | +// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache |
| 5 | +// License 2.0 that can be found in the LICENSE file. |
| 6 | + |
| 7 | +package contract |
| 8 | + |
| 9 | +import ( |
| 10 | + "github.com/spf13/cobra" |
| 11 | + |
| 12 | + "github.com/iotexproject/iotex-core/ioctl/config" |
| 13 | + "github.com/iotexproject/iotex-core/ioctl/output" |
| 14 | + "github.com/iotexproject/iotex-core/ioctl/util" |
| 15 | +) |
| 16 | + |
| 17 | +// Multi-language support |
| 18 | +var ( |
| 19 | + invokeFunctionCmdUses = map[config.Language]string{ |
| 20 | + config.English: "function (CONTRACT_ADDRESS|ALIAS) FUNCTION_NAME [ABI_PATH INVOKE_INPUT]", |
| 21 | + config.Chinese: "function (合约地址|别名) 函数名 [ABI文件路径 调用初始化输入]", |
| 22 | + } |
| 23 | + invokeFunctionCmdShorts = map[config.Language]string{ |
| 24 | + config.English: "invoke smart contract on IoTex blockchain with function name", |
| 25 | + config.Chinese: "invoke 通过 函数名方式 调用IoTex区块链上的智能合约", |
| 26 | + } |
| 27 | +) |
| 28 | + |
| 29 | +// contractInvokeFunctionCmd represents the contract invoke function command |
| 30 | +var contractInvokeFunctionCmd = &cobra.Command{ |
| 31 | + Use: config.TranslateInLang(invokeFunctionCmdUses, config.UILanguage), |
| 32 | + Short: config.TranslateInLang(invokeFunctionCmdShorts, config.UILanguage), |
| 33 | + Args: util.CheckArgs(1, 3), |
| 34 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 35 | + cmd.SilenceUsage = true |
| 36 | + err := contractInvokeFunction(args) |
| 37 | + return output.PrintError(err) |
| 38 | + }, |
| 39 | +} |
| 40 | + |
| 41 | +func contractInvokeFunction(args []string) error { |
| 42 | + return nil |
| 43 | +} |
0 commit comments