public async Task <string> SubmitSignedTransaction(string from, string signedTrHex) { await _transactionValidationService.ValidateInputForSignedAsync(from, signedTrHex); string transactionHex = await _rawTransactionSubmitter.SubmitSignedTransaction(from, signedTrHex); return(transactionHex); }
/// Example for debugging purpose: signedTransaction - 0xa9059cbb000000000000000000000000aa4981d084120aef4bbaeecb9abdbc7d180c7edb000000000000000000000000000000000000000000000000000000000000000a public async Task ValidateInputForSignedAsync(string fromAddress, string signedTransaction) { await _transactionValidationService.ValidateInputForSignedAsync(fromAddress, signedTransaction); Nethereum.Signer.Transaction transaction = new Nethereum.Signer.Transaction(signedTransaction.HexToByteArray()); string erc20Address = transaction.ReceiveAddress.ToHex().EnsureHexPrefix(); string erc20InvocationData = transaction.Data.ToHex().EnsureHexPrefix(); if (!await _transactionValidationService.IsTransactionErc20Transfer(signedTransaction)) { throw new ClientSideException(ExceptionType.WrongParams, "Transaction is not a erc20 transfer"); } string parametrsString = erc20InvocationData.Replace(Constants.Erc20TransferSignature, ""); var amount = parametrsString.Substring(64, 64); HexBigInteger tokenAmount = new HexBigInteger(amount); await ValidateTokenAddressBalanceAsync(fromAddress, erc20Address, tokenAmount); }