github.com/iotexproject/iotex-core@v1.14.1-rc1/ioctl/cmd/action/actioninvoke.go (about)

     1  // Copyright (c) 2022 IoTeX Foundation
     2  // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
     3  // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
     4  // This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
     5  
     6  package action
     7  
     8  import (
     9  	"github.com/spf13/cobra"
    10  
    11  	"github.com/iotexproject/iotex-core/ioctl/config"
    12  	"github.com/iotexproject/iotex-core/ioctl/output"
    13  )
    14  
    15  // Multi-language support
    16  var (
    17  	_invokeCmdShorts = map[config.Language]string{
    18  		config.English: "Invoke smart contract on IoTeX blockchain\nWarning: 'ioctl action invoke' has been deprecated, use 'ioctl contract invoke' instead",
    19  		config.Chinese: "在IoTeX区块链上调用智能合约\nWarning: 'ioctl action invoke' 已被废弃, 使用 'ioctl contract invoke' 代替",
    20  	}
    21  	_invokeCmdUses = map[config.Language]string{
    22  		config.English: "invoke (ALIAS|CONTRACT_ADDRESS) [AMOUNT_IOTX] -b BYTE_CODE [-s SIGNER] [-n NONCE] [-l GAS_LIMIT] [-p GAS_PRICE] [-P PASSWORD] [-y]",
    23  		config.Chinese: "invoke (别名|联系人地址) [IOTX数量] -b 类型码 [-s 签署人] [-n NONCE] [-l GAS限制] [-p GAS" +
    24  			"价格] [-P 密码] [-y]",
    25  	}
    26  )
    27  
    28  // _actionInvokeCmd represents the action invoke command
    29  // Deprecated: notify users to use the new ioctl contract command
    30  // TODO: this command will be deprecated soon
    31  var _actionInvokeCmd = &cobra.Command{
    32  	Use:                config.TranslateInLang(_invokeCmdUses, config.UILanguage),
    33  	Short:              config.TranslateInLang(_invokeCmdShorts, config.UILanguage),
    34  	Hidden:             true,
    35  	DisableFlagParsing: true,
    36  	RunE: func(cmd *cobra.Command, args []string) error {
    37  		cmd.SilenceUsage = true
    38  		var err error
    39  		return output.NewError(output.RuntimeError, "'ioctl action invoke' has been deprecated, use 'ioctl contract invoke' instead", err)
    40  	},
    41  }