Example #1
0
        private bool OnClaimCommand(string[] args)
        {
            if (NoWallet())
            {
                return(true);
            }

            Coins coins = new Coins(Program.Wallet, system);

            switch (args[1].ToLower())
            {
            case "gas":
                if (args.Length > 2)
                {
                    switch (args[2].ToLower())
                    {
                    case "all":
                        ClaimTransaction[] txs = coins.ClaimAll();
                        if (txs.Length > 0)
                        {
                            foreach (ClaimTransaction tx in txs)
                            {
                                Console.WriteLine($"Tranaction Suceeded: {tx.Hash}");
                            }
                        }
                        return(true);

                    default:
                        return(base.OnCommand(args));
                    }
                }
                else
                {
                    ClaimTransaction tx = coins.Claim();
                    if (tx != null)
                    {
                        Console.WriteLine($"Tranaction Suceeded: {tx.Hash}");
                    }
                    return(true);
                }

            default:
                return(base.OnCommand(args));
            }
        }
Example #2
0
        private bool OnClaimCommand(string[] args)
        {
            if (args.Length < 2 || args.Length > 4 || !args[1].Equals("gas", StringComparison.OrdinalIgnoreCase))
            {
                return(base.OnCommand(args));
            }

            if (NoWallet())
            {
                return(true);
            }

            bool    all = args.Length > 2 && args[2].Equals("all", StringComparison.OrdinalIgnoreCase);
            bool    useChangeAddress = (all && args.Length == 4) || (!all && args.Length == 3);
            UInt160 changeAddress    = useChangeAddress ? args[args.Length - 1].ToScriptHash() : null;

            if (WalletLocked())
            {
                return(true);
            }
            Coins coins = new Coins(Program.Wallet, system);

            ClaimTransaction[] txs = all
                ? coins.ClaimAll(changeAddress)
                : new[] { coins.Claim(changeAddress) };
            if (txs is null)
            {
                return(true);
            }
            foreach (ClaimTransaction tx in txs)
            {
                if (tx != null)
                {
                    Console.WriteLine($"Tranaction Suceeded: {tx.Hash}");
                }
            }
            return(true);
        }
Example #3
0
        private bool OnClaimCommand(string[] args)
        {
            if (NoWallet())
            {
                return(true);
            }

            Coins coins = new Coins(Program.Wallet, LocalNode);

            switch (args[1].ToLower())
            {
            case "gas":
                ClaimTransaction tx = coins.Claim();
                if (tx != null)
                {
                    Console.WriteLine($"Tranaction Suceeded: {tx.Hash}");
                }
                return(true);

            default:
                return(base.OnCommand(args));
            }
        }