Пример #1
0
        public async Task <ActionResult> Index(FaucetViewModel model)
        {
            var mvcCaptcha = new MvcCaptcha(nameof(FaucetViewModel));

            if (!mvcCaptcha.Validate(model.CaptchaCode))
            {
                ModelState.AddModelError(nameof(model.CaptchaCode), "Invalid captcha");

                return(View(model));
            }

            if (!model.To.IsValidEthereumAddressHexFormat())
            {
                ModelState.AddModelError(nameof(model.To), "Invalid address");

                return(View(model));
            }

            var rskService = new RskService();

            var transaction = await rskService.SendTransaction(model.To, 0.001m);

            model.TransactionHash = transaction;

            return(View(model));
        }
Пример #2
0
        public void WhenDispenseThenSendTx()
        {
            var rskService = new RskService();

            var transaction = rskService.SendTransaction("0xcb11cec9e4f3f6a9eaa880e2a030e571b744cfa1", 0.0001m).Result;

            Console.WriteLine(transaction);
        }
Пример #3
0
        /// <summary>
        /// Load some RBTC
        /// </summary>
        /// <param name="nodeUrl">Node Url</param>
        /// <param name="privateKey">Private Key</param>
        /// <param name="address">Address</param>
        /// <param name="amount">Amount</param>
        /// <param name="gas">Gas</param>
        private static void LoadSomeRBTC(string nodeUrl,
                                         string privateKey, string address,
                                         decimal amount,
                                         decimal gas)
        {
            IRskService rskService = new RskService(nodeUrl, privateKey);

            rskService.SendTransaction(address, amount, gas);
        }
Пример #4
0
        public void RskService_SendTransaction_Complete_Successfully()
        {
            // Arrange
            string  testNodeUrl            = ConfigurationManager.AppSettings["RskTestnetNodeUrl"];
            string  privateKey             = ConfigurationManager.AppSettings["PrivateKey"];
            string  fromTransferPrivateKey = ConfigurationManager.AppSettings["FromTransferPrivateKey"];
            Account account = new Account(privateKey);

            IRskService rskService = new RskService(testNodeUrl,
                                                    fromTransferPrivateKey);

            // Act
            string transactionHex = rskService.SendTransaction(account.Address, 0.001m, 0.06m);

            // Assert
            Assert.IsTrue(transactionHex.Length > 0);
        }