Beispiel #1
0
        public async Task <string> SendTransactionAsync <T>(T transaction) where T : TransactionInput
        {
            var ethSendTransaction = new EthSendRawTransaction(Client);

            var nonce = await GetNonceAsync(transaction);

            var value    = transaction.Value?.Value ?? 0;
            var gasPrice = await EstimateGasPrice();

            var gasValue = transaction.Gas?.Value ?? Transaction.DEFAULT_GAS_LIMIT;

            var tr       = new Transaction(transaction.To, value, nonce, gasPrice, gasValue, transaction.Data);
            var hex      = tr.GetRLPEncoded().ToHex();
            var response = await _signatureApi.SignTransaction(new SignRequest { From = transaction.From, Transaction = hex });

            return(await ethSendTransaction.SendRequestAsync(response.SignedTransaction.EnsureHexPrefix()).ConfigureAwait(false));
        }
 public async Task <string> SignTransaction(string transaction, SigHash hashType = SigHash.All)
 {
     return((await _signatureApi.SignTransaction(new TransactionSignRequest(transaction, (byte)hashType))).SignedTransaction);
 }
Beispiel #3
0
 public async Task <string> SignTransaction(string transaction, SigHash hashType = SigHash.All, string[] additionalSecrets = null, string[] prevTransactions = null)
 {
     return((await _signatureApi.SignTransaction(new TransactionSignRequest(transaction, (byte)hashType, additionalSecrets, prevTransactions))).SignedTransaction);
 }