/// <summary>
        /// Transferring funds to a newly created account
        /// </summary>
        /// <param name="from">Source Account</param>
        /// <param name="to">Destination Account</param>
        /// <returns></returns>
        private async Task <string> PerformInitials(Account from, Account to)
        {
            Web3 web3 = new Web3(from, this.serverUrl);

            ITransactionReceiptService transactionPolling = web3.TransactionManager.TransactionReceiptService;

            BigInteger currentBalance = await web3.Eth.GetBalance.SendRequestAsync(to.Address);

            TransactionReceipt hash = await transactionPolling.SendRequestAndWaitForReceiptAsync(() =>
                                                                                                 web3.TransactionManager.SendTransactionAsync(from.Address, to.Address, new HexBigInteger(howManyTransfer))
                                                                                                 );

            BigInteger status = BigInteger.Parse(hash.Status.ToString(), NumberStyles.AllowHexSpecifier);

            if (status != 1)
            {
                throw new Exception("error concerning transfer status");
            }

            BigInteger afterBalance = await web3.Eth.GetBalance.SendRequestAsync(to.Address);

            if (currentBalance != afterBalance)
            {
                return(hash.TransactionHash);
            }

            return(string.Empty);
        }
 public static async Task <string> DeployContractAndGetAddressAsync(ITransactionReceiptService transactionReceiptService, Web3.Web3 web3,
                                                                    string addressFrom, string previousPublishedVersion, HexBigInteger gas = null, HexBigInteger valueAmount = null, CancellationTokenSource cancellationTokenSource = null)
 {
     return(await transactionReceiptService.DeployContractAndGetAddressAsync(() =>
                                                                             DeployContractAsync(web3, addressFrom, previousPublishedVersion, gas, valueAmount),
                                                                             cancellationTokenSource));
 }
        public static async Task <UportRegistryService> DeployContractAndGetServiceAsync(
            ITransactionReceiptService transactionReceiptService, Web3.Web3 web3,
            string addressFrom, string previousPublishedVersion, HexBigInteger gas = null,
            HexBigInteger valueAmount = null, CancellationTokenSource cancellationTokenSource = null)
        {
            var contractAddress = await DeployContractAndGetAddressAsync(transactionReceiptService, web3, addressFrom,
                                                                         previousPublishedVersion, gas, valueAmount, cancellationTokenSource);

            return(new UportRegistryService(web3, contractAddress));
        }
 public Task <TransactionReceipt> SetAsyncAndGetReceipt(string addressFrom, string registrationIdentifier,
                                                        string subject, string value, ITransactionReceiptService transactionReceiptService,
                                                        HexBigInteger gas = null, HexBigInteger valueAmount = null,
                                                        CancellationTokenSource cancellationTokenSource = null)
 {
     return(transactionReceiptService.SendRequestAndWaitForReceiptAsync(
                () => SetAsync(addressFrom, registrationIdentifier, subject, value, gas, valueAmount),
                cancellationTokenSource));
 }
 public ContractDeployer(Web3 web3, ITransactionReceiptService receiptService, WalletInfo owner)
 {
     m_Web3           = web3 ?? throw new ArgumentNullException(nameof(web3));
     m_ReceiptService = receiptService ?? throw new ArgumentNullException(nameof(receiptService));
     Owner            = owner ?? throw new ArgumentNullException(nameof(owner));
 }