package wallet import ( "encoding/hex" "errors" "fmt" "math/big" "strings" "github.com/nspcc-dev/neo-go/cli/cmdargs" "github.com/nspcc-dev/neo-go/cli/flags" "github.com/nspcc-dev/neo-go/cli/options" "github.com/nspcc-dev/neo-go/cli/txctx" "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neo-go/pkg/neorpc/result" "github.com/nspcc-dev/neo-go/pkg/rpcclient" "github.com/nspcc-dev/neo-go/pkg/rpcclient/actor" "github.com/nspcc-dev/neo-go/pkg/rpcclient/gas" "github.com/nspcc-dev/neo-go/pkg/rpcclient/neo" "github.com/nspcc-dev/neo-go/pkg/rpcclient/nep11" "github.com/nspcc-dev/neo-go/pkg/rpcclient/nep17" "github.com/nspcc-dev/neo-go/pkg/rpcclient/neptoken" "github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/wallet" "github.com/urfave/cli" ) var ( tokenFlag = cli.StringFlag{ Name: "token", Usage: "Token to use (hash or name (for NEO/GAS or imported tokens))", } baseBalanceFlags = []cli.Flag{ walletPathFlag, walletConfigFlag, tokenFlag, flags.AddressFlag{ Name: "address, a", Usage: "Address to use", }, } importFlags = append([]cli.Flag{ walletPathFlag, walletConfigFlag, flags.AddressFlag{ Name: "token", Usage: "Token contract address or hash in LE", }, }, options.RPC...) baseTransferFlags = []cli.Flag{ walletPathFlag, walletConfigFlag, txctx.OutFlag, fromAddrFlag, toAddrFlag, tokenFlag, txctx.GasFlag, txctx.SysGasFlag, txctx.ForceFlag, cli.StringFlag{ Name: "amount", Usage: "Amount of asset to send", }, } multiTransferFlags = append([]cli.Flag{ walletPathFlag, walletConfigFlag, txctx.OutFlag, fromAddrFlag, txctx.GasFlag, txctx.SysGasFlag, txctx.ForceFlag, }, options.RPC...) ) func newNEP17Commands() []cli.Command { balanceFlags := make([]cli.Flag, len(baseBalanceFlags)) copy(balanceFlags, baseBalanceFlags) balanceFlags = append(balanceFlags, options.RPC...) transferFlags := make([]cli.Flag, len(baseTransferFlags)) copy(transferFlags, baseTransferFlags) transferFlags = append(transferFlags, options.RPC...) return []cli.Command{ { Name: "balance", Usage: "get address balance", UsageText: "balance -w wallet [--wallet-config path] --rpc-endpoint [--timeout