private async Task <HexBigInteger> EstimateGasLimit(string data, string to) { EthTransactionsService txService = new EthTransactionsService(_web3.Client); HexBigInteger gasEstimate = await txService.EstimateGas.SendRequestAsync(String.IsNullOrEmpty(to) ?new CallInput { Data = data } : new CallInput { Data = data, To = to }); //Use this to compensate for some transactions using slightly more gas than estimated BigInteger gasLimit = gasEstimate.Value * EstimateMultiplier; return(new HexBigInteger(gasLimit)); }
private static async Task<TransactionReceipt> GetTransactionReceiptAsync(EthTransactionsService transactionService, string transactionHash) { TransactionReceipt receipt = null; //wait for the contract to be mined to the address while (receipt == null) { await Task.Delay(1000); receipt = await transactionService.GetTransactionReceipt.SendRequestAsync(transactionHash); } return receipt; }