private static async Task <TransactionReceipt> SendEther(Account account, Records recipient, Web3 web3) { var transactionPolling = web3.TransactionManager.TransactionReceiptService; //var currentBalance = await web3.Eth.GetBalance.SendRequestAsync(account.Address); //assumed client is mining already //when sending a transaction using an Account, a raw transaction is signed and send using the private key return(await transactionPolling.SendRequestAndWaitForReceiptAsync(() => { var transactionInput = new TransactionInput { From = account.Address, //Gas = new HexBigInteger(25000), GasPrice = new HexBigInteger(10 ^ 10), To = recipient.Address, Value = new HexBigInteger(new BigInteger(recipient.Value)), Nonce = web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(account.Address).Result }; var txSigned = new Nethereum.Signer.TransactionSigner(); var signedTx = txSigned.SignTransaction(account.PrivateKey, transactionInput.To, transactionInput.Value, transactionInput.Nonce); var transaction = new Nethereum.RPC.Eth.Transactions.EthSendRawTransaction(web3.Client); return transaction.SendRequestAsync(signedTx); })); }
private static async Task <TransactionReceipt> SendEther(Account account, string recipient, Web3 web3, BigInteger transferwei) { var transactionPolling = web3.TransactionManager.TransactionReceiptService; HexBigInteger nonce = web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(account.Address).Result; return(await transactionPolling.SendRequestAndWaitForReceiptAsync(() => { var transactionInput = new TransactionInput { From = account.Address, //Gas = new HexBigInteger(25000), GasPrice = new HexBigInteger(10 ^ 10), To = recipient, Value = new HexBigInteger(transferwei), Nonce = nonce }; var txSigned = new Nethereum.Signer.TransactionSigner(); var signedTx = txSigned.SignTransaction(account.PrivateKey, transactionInput.To, transactionInput.Value, transactionInput.Nonce); var transaction = new Nethereum.RPC.Eth.Transactions.EthSendRawTransaction(web3.Client); return transaction.SendRequestAsync(signedTx); })); }
public EthSendRawTransactionUnityRequest(string url, JsonSerializerSettings jsonSerializerSettings = null) : base(url, jsonSerializerSettings) { _ethSendRawTransaction = new Nethereum.RPC.Eth.Transactions.EthSendRawTransaction(null); }
public EthSendRawTransactionUnityRequest(string network = "mainnet", AuthProvider authProvider = null, JsonSerializerSettings jsonSerializerSettings = null) : base(network, authProvider, jsonSerializerSettings) { _ethSendRawTransaction = new Nethereum.RPC.Eth.Transactions.EthSendRawTransaction(null); }