From fd93986503638200910b70f9dce4a690d6eb6ba5 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 29 Nov 2019 18:16:46 +0300 Subject: [PATCH] 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). --- cli/smartcontract/smart_contract.go | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/cli/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index 488a62a33..567576944 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -31,6 +31,11 @@ var ( 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") 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 ( @@ -83,10 +88,7 @@ func NewCommands() []cli.Command { Name: "config, c", Usage: "configuration input file (*.yml)", }, - cli.StringFlag{ - Name: "endpoint, e", - Usage: "RPC endpoint address (like 'http://seed4.ngd.network:20332')", - }, + endpointFlag, cli.StringFlag{ Name: "wif, w", Usage: "key to sign deployed transaction (in wif format)", @@ -114,10 +116,7 @@ func NewCommands() []cli.Command { `, Action: testInvoke, Flags: []cli.Flag{ - cli.StringFlag{ - Name: "endpoint, e", - Usage: "RPC endpoint address (like 'http://seed4.ngd.network:20332')", - }, + endpointFlag, }, }, { @@ -188,10 +187,7 @@ func NewCommands() []cli.Command { `, Action: testInvokeFunction, Flags: []cli.Flag{ - cli.StringFlag{ - Name: "endpoint, e", - Usage: "RPC endpoint address (like 'http://seed4.ngd.network:20332')", - }, + endpointFlag, }, }, { @@ -199,10 +195,7 @@ func NewCommands() []cli.Command { Usage: "Invoke compiled AVM code on the blockchain (test mode, not creating a transaction for it)", Action: testInvokeScript, Flags: []cli.Flag{ - cli.StringFlag{ - Name: "endpoint, e", - Usage: "RPC endpoint address (like 'http://seed4.ngd.network:20332')", - }, + endpointFlag, cli.StringFlag{ Name: "in, i", Usage: "Input location of the avm file that needs to be invoked",