public override async Task <JObject> ExecuteAsync(IClient client) { var senderAddress = "0x12890d2cce102216644c59daE5baed380d84830c"; var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7"; var abi = @"[{""constant"":false,""inputs"":[{""name"":""val"",""type"":""int256""}],""name"":""multiply"",""outputs"":[{""name"":""d"",""type"":""int256""}],""type"":""function""},{""inputs"":[{""name"":""multiplier"",""type"":""int256""}],""type"":""constructor""}]"; var byteCode = "0x60606040526040516020806052833950608060405251600081905550602b8060276000396000f3606060405260e060020a60003504631df4f1448114601a575b005b600054600435026060908152602090f3"; var multiplier = 7; var web3 = new Web3.Web3(new Account(privateKey), client); var receipt = await web3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(abi, byteCode, senderAddress, new HexBigInteger(900000), null, multiplier); var contract = web3.Eth.GetContract(abi, receipt.ContractAddress); var function = contract.GetFunction("multiply"); var transactionInput = function.CreateTransactionInput(senderAddress, null, null, 7); var signer = new LegacyTransactionSigner(); var nonce = await web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(senderAddress); var signedTransaction = signer.SignTransaction(privateKey, transactionInput.To, 0, nonce.Value, LegacyTransaction.DEFAULT_GAS_PRICE, 900000, transactionInput.Data); var traceTransaction = new TraceRawTransaction(client); return(await traceTransaction.SendRequestAsync(signedTransaction.EnsureHexPrefix(), new[] { TraceType.vmTrace }, BlockParameter.CreateLatest())); }
public ExternalAccountSignerTransactionManager(IClient rpcClient, ExternalAccount account, BigInteger?chainId = null) { ChainId = chainId; Account = account ?? throw new ArgumentNullException(nameof(account)); Client = rpcClient; _transactionSigner = new LegacyTransactionSigner(); }
public TransactionSignedUnityRequest(string url, string privateKey, BigInteger?chainId = null, Dictionary <string, string> requestHeaders = null) { _chainId = chainId; _url = url; _account = EthECKey.GetPublicAddress(privateKey); _privateKey = privateKey; _transactionSigner = new LegacyTransactionSigner(); _ethSendTransactionRequest = new EthSendRawTransactionUnityRequest(_url); _ethSendTransactionRequest.RequestHeaders = requestHeaders; _transactionCountRequest = new EthGetTransactionCountUnityRequest(_url); _transactionCountRequest.RequestHeaders = requestHeaders; _ethEstimateGasUnityRequest = new EthEstimateGasUnityRequest(_url); _ethEstimateGasUnityRequest.RequestHeaders = requestHeaders; _ethGasPriceUnityRequest = new EthGasPriceUnityRequest(_url); _ethGasPriceUnityRequest.RequestHeaders = requestHeaders; Fee1559SuggestionStrategy = new SimpleFeeSuggestionUnityRequestStrategy(url, requestHeaders); }
public AccountOfflineTransactionSigner() { _legacyTransactionSigner = new LegacyTransactionSigner(); }
public AccountOfflineTransactionSigner(LegacyTransactionSigner legacyTransactionSigner) { _legacyTransactionSigner = legacyTransactionSigner; }