Esempio n. 1
0
        public IActionResult GetCoins(FaucetDto dto)
        {
            var addressService     = this.ServiceProvider.GetService <AddressService>();
            var httpRequestService = this.ServiceProvider.GetService <IHttpRequestService>();
            var nodeData           = this.nodeSettings.Value;
            var transactionManager = this.ServiceProvider.GetService <ITransactionManager>();

            var response = string.Empty;
            var success  = false;

            var transferAmount = 0.3m;

            var transaction = new TransactionDto()
            {
                TransferAmount  = transferAmount,
                ReceiverAccount = dto.ToAddress,
                PrivateKey      = FaucetPrivateKey,
                Account         = FaucetAddress
            };

            (response, success) = transactionManager.MakeTransaction(addressService, httpRequestService, nodeData, transaction);


            if (success)
            {
                dto.Amount = transferAmount;
                this.AddDtoToTempData(TempDataKeys.FaucetDto, dto);
            }


            return(this.RedirectToAction(nameof(this.GetCoins)));
        }
Esempio n. 2
0
        public IActionResult GetCoins()
        {
            var dto = this.GetDtoFromTempData <FaucetDto>(TempDataKeys.FaucetDto);

            if (dto == null)
            {
                dto = new FaucetDto();
            }

            return(View(dto));
        }