From 3eefda7f1a596acdcb800c310a19047ef6bb2efe Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 23 Apr 2021 18:42:59 +0300 Subject: [PATCH] cli: add `nep11 balance` command --- cli/wallet/nep11.go | 110 ++++++++++++++++++++++++++++++++++++++++++++ cli/wallet/nep17.go | 7 ++- 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/cli/wallet/nep11.go b/cli/wallet/nep11.go index 7408d5837..30fd85a62 100644 --- a/cli/wallet/nep11.go +++ b/cli/wallet/nep11.go @@ -1,12 +1,37 @@ package wallet import ( + "errors" + "fmt" + "math/big" + + "github.com/nspcc-dev/neo-go/cli/flags" + "github.com/nspcc-dev/neo-go/cli/options" + "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/smartcontract/manifest" + "github.com/nspcc-dev/neo-go/pkg/wallet" "github.com/urfave/cli" ) func newNEP11Commands() []cli.Command { + tokenID := cli.StringFlag{ + Name: "id", + Usage: "Token ID", + } + + balanceFlags := make([]cli.Flag, len(baseBalanceFlags)) + copy(balanceFlags, baseBalanceFlags) + balanceFlags = append(balanceFlags, tokenID) + balanceFlags = append(balanceFlags, options.RPC...) return []cli.Command{ + { + Name: "balance", + Usage: "get address balance", + UsageText: "balance --wallet --rpc-endpoint [--timeout