package wallet import ( "encoding/hex" "errors" "fmt" "math/big" "strings" "time" "github.com/nspcc-dev/neo-go/cli/cmdargs" "github.com/nspcc-dev/neo-go/cli/flags" "github.com/nspcc-dev/neo-go/cli/input" "github.com/nspcc-dev/neo-go/cli/options" "github.com/nspcc-dev/neo-go/cli/paramcontext" "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))", } gasFlag = flags.Fixed8Flag{ Name: "gas, g", Usage: "network fee to add to the transaction (prioritizing it)", } sysGasFlag = flags.Fixed8Flag{ Name: "sysgas, e", Usage: "system fee to add to transaction (compensating for execution)", } 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, outFlag, fromAddrFlag, toAddrFlag, tokenFlag, gasFlag, sysGasFlag, forceFlag, cli.StringFlag{ Name: "amount", Usage: "Amount of asset to send", }, } multiTransferFlags = append([]cli.Flag{ walletPathFlag, walletConfigFlag, outFlag, fromAddrFlag, gasFlag, sysGasFlag, 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