mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-12 11:10:35 +00:00
Merge pull request #848 from nspcc-dev/cli-invoke-nomethod-check-2.x
cli: check for method presence for invokefunction commands
This commit is contained in:
commit
84edcf0b0e
1 changed files with 5 additions and 1 deletions
|
@ -34,6 +34,7 @@ var (
|
||||||
errNoEndpoint = errors.New("no RPC endpoint specified, use option '--endpoint' or '-e'")
|
errNoEndpoint = errors.New("no RPC endpoint specified, use option '--endpoint' or '-e'")
|
||||||
errNoInput = errors.New("no input file was found, specify an input file with the '--in or -i' flag")
|
errNoInput = errors.New("no input file was found, specify an input file with the '--in or -i' flag")
|
||||||
errNoConfFile = errors.New("no config file was found, specify a config file with the '--config' or '-c' flag")
|
errNoConfFile = errors.New("no config file was found, specify a config file with the '--config' or '-c' flag")
|
||||||
|
errNoMethod = errors.New("no method specified for function invocation command")
|
||||||
errNoWallet = errors.New("no wallet parameter found, specify it with the '--wallet or -w' flag")
|
errNoWallet = errors.New("no wallet parameter found, specify it with the '--wallet or -w' flag")
|
||||||
errNoScriptHash = errors.New("no smart contract hash was provided, specify one as the first argument")
|
errNoScriptHash = errors.New("no smart contract hash was provided, specify one as the first argument")
|
||||||
errNoSmartContractName = errors.New("no name was provided, specify the '--name or -n' flag")
|
errNoSmartContractName = errors.New("no name was provided, specify the '--name or -n' flag")
|
||||||
|
@ -403,7 +404,10 @@ func invokeInternal(ctx *cli.Context, withMethod bool, signAndPush bool) error {
|
||||||
return cli.NewExitError(errNoScriptHash, 1)
|
return cli.NewExitError(errNoScriptHash, 1)
|
||||||
}
|
}
|
||||||
script := args[0]
|
script := args[0]
|
||||||
if withMethod && len(args) > 1 {
|
if withMethod {
|
||||||
|
if len(args) <= 1 {
|
||||||
|
return cli.NewExitError(errNoMethod, 1)
|
||||||
|
}
|
||||||
operation = args[1]
|
operation = args[1]
|
||||||
paramsStart++
|
paramsStart++
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue