cli: move common NEP17 flags to package variables

These flags will be reused for NEP11 commands.
This commit is contained in:
Anna Shaleva 2021-04-27 17:28:28 +03:00
parent c3264c065d
commit 4b8d814ee8

View file

@ -28,27 +28,22 @@ var (
Name: "gas", Name: "gas",
Usage: "Amount of GAS to attach to a tx", Usage: "Amount of GAS to attach to a tx",
} }
) balanceFlags = append([]cli.Flag{
func newNEP17Commands() []cli.Command {
balanceFlags := []cli.Flag{
walletPathFlag, walletPathFlag,
tokenFlag, tokenFlag,
flags.AddressFlag{ flags.AddressFlag{
Name: "address, a", Name: "address, a",
Usage: "Address to use", Usage: "Address to use",
}, },
} }, options.RPC...)
balanceFlags = append(balanceFlags, options.RPC...) importFlags = append([]cli.Flag{
importFlags := []cli.Flag{
walletPathFlag, walletPathFlag,
flags.AddressFlag{ flags.AddressFlag{
Name: "token", Name: "token",
Usage: "Token contract address or hash in LE", Usage: "Token contract address or hash in LE",
}, },
} }, options.RPC...)
importFlags = append(importFlags, options.RPC...) transferFlags = append([]cli.Flag{
transferFlags := []cli.Flag{
walletPathFlag, walletPathFlag,
outFlag, outFlag,
fromAddrFlag, fromAddrFlag,
@ -59,15 +54,16 @@ func newNEP17Commands() []cli.Command {
Name: "amount", Name: "amount",
Usage: "Amount of asset to send", Usage: "Amount of asset to send",
}, },
} }, options.RPC...)
transferFlags = append(transferFlags, options.RPC...) multiTransferFlags = append([]cli.Flag{
multiTransferFlags := []cli.Flag{
walletPathFlag, walletPathFlag,
outFlag, outFlag,
fromAddrFlag, fromAddrFlag,
gasFlag, gasFlag,
} }, options.RPC...)
multiTransferFlags = append(multiTransferFlags, options.RPC...) )
func newNEP17Commands() []cli.Command {
return []cli.Command{ return []cli.Command{
{ {
Name: "balance", Name: "balance",