Exemplo n.º 1
0
        public override void PreCommand(ICommandContext commandContext)
        {
            base.PreCommand(commandContext);

            buildTransaction = MicrothreadLocalDatabases.CreateTransaction(commandContext.GetOutputObjectsGroups());
            MicrothreadLocalDatabases.MountDatabase(buildTransaction);
        }
Exemplo n.º 2
0
        public async Task <Transaction> SendCoin(Recipient recipient)
        {
            var amount = (await GetBalance()).balance / 100;

            BuildTransaction buildTransaction = new BuildTransaction {
                WalletName         = walletName,
                AccountName        = accountName,
                CoinType           = 105,
                Password           = password,
                DestinationAddress = recipient.address,
                Amount             = amount.ToString(),
                FeeType            = "low",
                AllowUnconfirmed   = true
            };
            var transaction = await stratApi.BuildTransaction(buildTransaction);

            SendTransaction sendTransaction = new SendTransaction {
                Hex = transaction.Hex
            };

            var resp = await stratApi.SendTransaction(sendTransaction);

            return(new Transaction {
                confirmation = transaction.TransactionId
            });
        }
Exemplo n.º 3
0
        public override void PreCommand(ICommandContext commandContext)
        {
            base.PreCommand(commandContext);

            buildTransaction = MicrothreadLocalDatabases.CreateTransaction(commandContext.GetOutputObjectsGroups());
            MicrothreadLocalDatabases.MountDatabase(buildTransaction);
        }
Exemplo n.º 4
0
        public async Task <Recipient> SendCoin(Recipient recipient)
        {
            if (newRecipient(recipient))
            {
                try
                {
                    BuildTransaction buildTransaction = new BuildTransaction
                    {
                        WalletName         = walletName,
                        AccountName        = accountName,
                        CoinType           = 105,
                        Password           = password,
                        DestinationAddress = recipient.address,
                        Amount             = 100m,
                        FeeType            = "low",
                        AllowUnconfirmed   = true
                    };
                    var transaction = await stratApi.BuildTransaction(buildTransaction);

                    SendTransaction sendTransaction = new SendTransaction
                    {
                        Hex = transaction.Hex
                    };

                    var resp = await stratApi.SendTransaction(sendTransaction);


                    recipient.is_sent = true;
                    UpdateRecipient(recipient);

                    Throttling.AddressesSeen.Enqueue(recipient.address);
                    Throttling.IPAddressesSeen.Enqueue(recipient.ip_address);

                    return(recipient);
                }
                catch (Refit.ApiException exc)
                {
                    Console.WriteLine(exc.ToString());
                    Console.WriteLine(exc.Content);
                    recipient.is_error = true;
                    UpdateRecipient(recipient);
                    throw new FaucetException(ERROR_WALLET);
                }
            }
            else
            {
                throw new FaucetException(ERROR_DUPE);
            }
        }
Exemplo n.º 5
0
        public async Task <Transaction> SendCoin(string address)
        {
            BuildTransaction buildTransaction = new BuildTransaction
            {
                WalletName         = walletName,
                AccountName        = accountName,
                CoinType           = 105,
                Password           = password,
                DestinationAddress = address,
                Amount             = 100m,
                FeeType            = "low",
                AllowUnconfirmed   = true
            };

            var transaction = await stratApi.BuildTransaction(buildTransaction);

            var resp = await stratApi.SendTransaction(new SendTransaction { Hex = transaction.Hex });

            return(new Transaction
            {
                TransactionId = transaction.TransactionId
            });
        }