Example #1
0
        public static void Balance(Address address, NexusAPI api, Logger logger, string[] args)
        {
            if (args.Length == 1)
            {
                address = Address.FromText(args[0]);
            }

            var account = (AccountResult)api.GetAccount(address.Text);

            logger.Message($"Balance for {account.name} ({address.Text})");
            if (account.balances.Any())
            {
                foreach (var entry in account.balances)
                {
                    var amount = BigInteger.Parse(entry.amount);
                    logger.Success($"{entry.chain} => {UnitConversion.ToDecimal(amount, (int)entry.decimals)} {entry.symbol}");
                }
            }
            else
            {
                logger.Warning("Empty wallet.");
            }
        }