cli/smartcontract: move common endpoint parameter definition

Put more emphasys on that it should be trusted and use localhost example
(because you usually do trust it).
This commit is contained in:
Roman Khimov 2019-11-29 18:16:46 +03:00
parent d8ef9ba0ec
commit fd93986503

View file

@ -31,6 +31,11 @@ var (
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")
errFileExist = errors.New("A file with given smart-contract name already exists") errFileExist = errors.New("A file with given smart-contract name already exists")
endpointFlag = cli.StringFlag{
Name: "endpoint, e",
Usage: "trusted RPC endpoint address (like 'http://localhost:20331')",
}
) )
const ( const (
@ -83,10 +88,7 @@ func NewCommands() []cli.Command {
Name: "config, c", Name: "config, c",
Usage: "configuration input file (*.yml)", Usage: "configuration input file (*.yml)",
}, },
cli.StringFlag{ endpointFlag,
Name: "endpoint, e",
Usage: "RPC endpoint address (like 'http://seed4.ngd.network:20332')",
},
cli.StringFlag{ cli.StringFlag{
Name: "wif, w", Name: "wif, w",
Usage: "key to sign deployed transaction (in wif format)", Usage: "key to sign deployed transaction (in wif format)",
@ -114,10 +116,7 @@ func NewCommands() []cli.Command {
`, `,
Action: testInvoke, Action: testInvoke,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ endpointFlag,
Name: "endpoint, e",
Usage: "RPC endpoint address (like 'http://seed4.ngd.network:20332')",
},
}, },
}, },
{ {
@ -188,10 +187,7 @@ func NewCommands() []cli.Command {
`, `,
Action: testInvokeFunction, Action: testInvokeFunction,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ endpointFlag,
Name: "endpoint, e",
Usage: "RPC endpoint address (like 'http://seed4.ngd.network:20332')",
},
}, },
}, },
{ {
@ -199,10 +195,7 @@ func NewCommands() []cli.Command {
Usage: "Invoke compiled AVM code on the blockchain (test mode, not creating a transaction for it)", Usage: "Invoke compiled AVM code on the blockchain (test mode, not creating a transaction for it)",
Action: testInvokeScript, Action: testInvokeScript,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ endpointFlag,
Name: "endpoint, e",
Usage: "RPC endpoint address (like 'http://seed4.ngd.network:20332')",
},
cli.StringFlag{ cli.StringFlag{
Name: "in, i", Name: "in, i",
Usage: "Input location of the avm file that needs to be invoked", Usage: "Input location of the avm file that needs to be invoked",