public async Task <MintNftOfTypeServiceResponse> Handle(MintNftOfTypeServiceRequest aMintNftOfTypeServiceRequest, CancellationToken aCancellationToken) { Function <MintNftOfTypeFunctionInput> aMintNftOfTypeFunction = NftCreatorInstance.Instance.GetFunction <MintNftOfTypeFunctionInput>(); Nethereum.Contracts.ContractHandlers.IContractTransactionHandler <MintNftOfTypeFunctionInput> mintingHandler = NethWeb3.Instance.Eth.GetContractTransactionHandler <MintNftOfTypeFunctionInput>(); // serialization needed var aMintNftOfTypeFunctionMessage = new MintNftOfTypeFunctionInput { NftId = aMintNftOfTypeServiceRequest.MintNftId, ImmutableDataString = aMintNftOfTypeServiceRequest.ImmutableDataString, MutableDataString = aMintNftOfTypeServiceRequest.MutableDataString == null ? "" : aMintNftOfTypeServiceRequest.MutableDataString }; Nethereum.Hex.HexTypes.HexBigInteger gasEstimate = await mintingHandler.EstimateGasAsync(NftCreatorAddresses.NewNftCreatorRopstenAddress, aMintNftOfTypeFunctionMessage); aMintNftOfTypeFunctionMessage.Gas = gasEstimate.Value; Nethereum.RPC.Eth.DTOs.TransactionReceipt mintingTransactionReceipt = await mintingHandler.SendRequestAndWaitForReceiptAsync(NftCreatorAddresses.NewNftCreatorRopstenAddress, aMintNftOfTypeFunctionMessage); System.Collections.Generic.List <EventLog <MintNftOutputEventDto> > MintNftOutput = mintingTransactionReceipt.DecodeAllEvents <MintNftOutputEventDto>(); int id = (int)MintNftOutput[0].Event.Id; return(new MintNftOfTypeServiceResponse { TransactionHash = mintingTransactionReceipt.TransactionHash, TokenId = id, GasUsed = new HexBigInteger(mintingTransactionReceipt.GasUsed.Value) }); }
static async Task CallSmartContractMethod() { var _contractAddress = "0x556aE816E31AdaCf5F64bE5C36c7565bD84B1237"; Account _account = new Account("f4787bddd02d87d671697809885a3b36f902f4545a77556840b6b52a7dac8c5a", 5777); // Account account = new Account(privatekey, Nethereum.Signer.Chain.MainNet); var web3 = new Web3(_account, "http://127.0.0.1:7545"); web3.TransactionManager.UseLegacyAsDefault = true; Contract voteContract = web3.Eth.GetContract(_abi, _contractAddress); var candidate1 = await voteContract.GetFunction("candidate1").CallAsync <BigInteger>(); Console.WriteLine("candidate1 has " + candidate1 + " vote"); var candidate2 = await voteContract.GetFunction("candidate2").CallAsync <BigInteger>(); Console.WriteLine("candidate2 has " + candidate2 + " vote"); var gas = new Nethereum.Hex.HexTypes.HexBigInteger(400000); var value = new Nethereum.Hex.HexTypes.HexBigInteger(0); var castVoteResult = await voteContract.GetFunction("castVote").SendTransactionAsync(_account.Address, gas, value, 1); candidate1 = await voteContract.GetFunction("candidate1").CallAsync <BigInteger>(); Console.WriteLine("candidate1 has " + candidate1 + " vote"); candidate2 = await voteContract.GetFunction("candidate2").CallAsync <BigInteger>(); Console.WriteLine("candidate2 has " + candidate2 + " vote"); }
// Use this for initialization async void Start() { this.PrivateKey = "ab5aef177d8e317bea7d76cbf5ac083e8be617891ff2089c4573cf63a15b9465"; this.Url = "http://localhost:8545"; string contractAddress = "0x0b0a24c1a001ad78dc43cccea4f3cf6c83c5676f"; // var account = new ManagedAccount(senderAddress, password); this.web3 = new Web3(Url); this.address = EthECKey.GetPublicAddress(this.PrivateKey); //could do checksum this.contract = web3.Eth.GetContract(TestWeb3.ABI, contractAddress); // call sample int ping = await contract.GetFunction("getPing").CallAsync <int>().ConfigureAwait(true); Debug.Log("ping: " + ping); Nethereum.Hex.HexTypes.HexBigInteger balance = await web3.Eth.GetBalance.SendRequestAsync(address); Debug.Log("Balance: " + balance.Value.ToString()); await MineAndGetReceiptAsync(); }
public async Task<List<Deposit>> StartupDeposits(string blockNumber) { List<Deposit> deposits = null; try { var startupLog = new List<Nethereum.Contracts.EventLog<Bizanc.io.Matching.Infra.Connector.LogDepositEvent>>(); var parameter = BlockParameter.CreateEarliest(); if (!string.IsNullOrEmpty(blockNumber)) { Log.Information("Reading Eth Events from block " + blockNumber); currentBlockDeposits = new HexBigInteger(blockNumber); parameter = new BlockParameter(currentBlockDeposits); } var lastBlock = new HexBigInteger((await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync()).Value - 5); depositFilter = logDepositEvent.CreateFilterInput(parameter, new BlockParameter(lastBlock)); deposits = await GetDeposits(depositFilter); currentBlockDeposits = lastBlock; } catch (Exception e) { Log.Error("Ethereum Connector Startp Failed: " + e.ToString()); } return deposits; }
public async Task MineAndGetReceiptAsync(ulong ping) { var setPingFunction = contract.GetFunction("setPint"); Nethereum.Contracts.Event pongEvent = contract.GetEvent("Pong"); Nethereum.Hex.HexTypes.HexBigInteger estimatedGas = await setPingFunction.EstimateGasAsync(ping); Nethereum.RPC.Eth.DTOs.TransactionReceipt receipt = await setPingFunction.SendTransactionAndWaitForReceiptAsync(userAddress, estimatedGas, null, null, ping); Debug.Log("receipt: " + receipt.TransactionHash + ", blockNum: " + receipt.BlockNumber.Value); var filterInput = pongEvent.CreateFilterInput(new BlockParameter(0), BlockParameter.CreateLatest()); var logs = await pongEvent.GetAllChanges <PongEvent>(filterInput); foreach (Nethereum.Contracts.EventLog <PongEvent> log in logs) { Debug.Log("================================"); Debug.Log("address: " + log.Log.Address); Debug.Log("TransactionHash: " + log.Log.TransactionHash); Debug.Log("blockNum: " + log.Log.BlockNumber); Debug.Log("data: " + log.Log.Data); Debug.Log("Pong: " + log.Event.Pong); } }
public virtual bool Validate(T instance) { bool bValid = true; var contract = GetContract(); var callRuleTreeEvent = contract.GetEvent(CONST_EVENT_CALL_RULE_TREE); var callRuleSetEvent = contract.GetEvent(CONST_EVENT_CALL_RULE_SET); var callRuleEvent = contract.GetEvent(CONST_EVENT_CALL_RULE); var filterCRTAll = callRuleTreeEvent.CreateFilterAsync().Result; var filterCRSAll = callRuleSetEvent.CreateFilterAsync().Result; var filterCRAll = callRuleEvent.CreateFilterAsync().Result; var gas = new Nethereum.Hex.HexTypes.HexBigInteger(1000000); var executeWithReportFunction = contract.GetFunction(CONST_CONTRACT_FUNCTION_EXEC_RPT); var ruleTreeReport = executeWithReportFunction.CallDeserializingToObjectAsync <WonkaRuleTreeReport>(BlockchainEngine.SenderAddress).Result; HandleEvents(callRuleTreeEvent, callRuleSetEvent, callRuleEvent, filterCRTAll, filterCRSAll, filterCRAll); if (ruleTreeReport.NumberOfRuleFailures <= 0) { bValid = true; } else { throw new WonkaValidatorException(ruleTreeReport); } return(bValid); }
public async Task <List <Deposit> > GetEthDeposit() { var deposits = new List <Deposit>(); depositFilter = logDepositEvent.CreateFilterInput(); depositFilter.FromBlock = new BlockParameter(currentBlock); var lastBlock = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync(); depositFilter.ToBlock = new BlockParameter(new HexBigInteger(lastBlock.Value - 5)); var log = await logDepositEvent.GetAllChanges <LogDepositEvent>(depositFilter); if (log.Count > 0) { foreach (var d in log) { currentBlock = d.Log.BlockNumber; //Read Ethereum events data. var deposit = new Deposit(); deposit.TargetWallet = d.Event.Destination; deposit.Asset = d.Event.Symbol; deposit.Quantity = Web3Geth.Convert.FromWei(d.Event.Value); deposit.TxHash = d.Log.TransactionHash; deposits.Add(deposit); } } return(deposits); }
public async Task <string> GetBalance(string address) { Nethereum.Hex.HexTypes.HexBigInteger balance = await web3.Eth.GetBalance.SendRequestAsync(address); Debug.Log("address: " + address + ", Balance: " + balance.Value.ToString()); return(balance.Value.ToString()); }
private IEnumerator GetBlockWithTransactionsByNumberUnityRequest(BigInteger number) { var request = new EthGetBlockWithTransactionsByNumberUnityRequest(Wallet._url); var _number = new Nethereum.Hex.HexTypes.HexBigInteger(number); yield return(request.SendRequest(_number)); var transactions = request.Result.Transactions; }
private IEnumerator GetBlockWithTransactionsHashesByNumberUnityRequest(BigInteger number) { var hashesRequest = new EthGetBlockWithTransactionsHashesByNumberUnityRequest(Wallet._url); var _number = new Nethereum.Hex.HexTypes.HexBigInteger(number); yield return(hashesRequest.SendRequest(_number)); //var Result = hashesRequest.Result; //string[] Result_hashes = Result.TransactionHashes; }
public async Task<List<WithdrawInfo>> GetWithdaws() { withdrawFilter.FromBlock = new BlockParameter(currentBlockWithdraws); var lastBlock = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync(); withdrawFilter.ToBlock = new BlockParameter(lastBlock); var result = await GetWithdraws(withdrawFilter); currentBlockWithdraws = lastBlock; return result; }
public async Task<List<Deposit>> GetDeposits() { depositFilter.FromBlock = new BlockParameter(currentBlockDeposits); var lastBlock = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync(); lastBlock = new HexBigInteger(lastBlock.Value - 5); depositFilter.ToBlock = new BlockParameter(lastBlock); var result = await GetDeposits(depositFilter); currentBlockDeposits = lastBlock; return result; }
static async Task DeploySmartContract() { Account _account = new Account("fbde582d0deb10b30d0c1be8752650a9f4fc12c705610cb754b7ae3b0a2d4aa7", 5777); // Account account = new Account(privatekey, Nethereum.Signer.Chain.MainNet); var web3 = new Web3(_account, "http://127.0.0.1:7545"); web3.TransactionManager.UseLegacyAsDefault = true; var gasPrice = new Nethereum.Hex.HexTypes.HexBigInteger(8000000); var txHash = await web3.Eth.DeployContract.SendRequestAsync(_abi, _bytecode, _account.Address, gasPrice); Console.WriteLine("TxHash : " + txHash); }
public virtual bool Orchestrate(ICommand instance, bool pbSimulationMode) { bool bValid = true; var contract = GetContract(moInitData.BlockchainEngine); var callRuleTreeEvent = contract.GetEvent(CONST_EVENT_CALL_RULE_TREE); var callRuleSetEvent = contract.GetEvent(CONST_EVENT_CALL_RULE_SET); var callRuleEvent = contract.GetEvent(CONST_EVENT_CALL_RULE); var filterCRTAll = callRuleTreeEvent.CreateFilterAsync().Result; var filterCRSAll = callRuleSetEvent.CreateFilterAsync().Result; var filterCRAll = callRuleEvent.CreateFilterAsync().Result; var gas = new Nethereum.Hex.HexTypes.HexBigInteger(2000000); var executeWithReportFunction = contract.GetFunction(CONST_CONTRACT_FUNCTION_EXEC_RPT); var executeGetLastReportFunction = contract.GetFunction(CONST_CONTRACT_FUNCTION_GET_LAST_RPT); WonkaRuleTreeReport ruleTreeReport = new WonkaRuleTreeReport(); if (pbSimulationMode) { // Now, we get a full report on the execution of the rules engine, including the possibility of any failures ruleTreeReport = executeWithReportFunction.CallDeserializingToObjectAsync <WonkaRuleTreeReport>(moInitData.BlockchainEngine.SenderAddress, gas, null, moInitData.BlockchainEngine.SenderAddress).Result; } else { // Next, we execute the rules engine within a transaction, so that the any persistence will actually change the state of the blockchain var receiptAddAttribute = executeWithReportFunction.SendTransactionAsync(moInitData.BlockchainEngineOwner, gas, null, moInitData.BlockchainEngine.SenderAddress).Result; // Now, we get a full report on the execution of the rules engine, including the possibility of any failures ruleTreeReport = executeGetLastReportFunction.CallDeserializingToObjectAsync <WonkaRuleTreeReport>().Result; } // Finally, we handle any events that have been issued during the execution of the rules engine // HandleEvents(callRuleTreeEvent, callRuleSetEvent, callRuleEvent, filterCRTAll, filterCRSAll, filterCRAll); if (ruleTreeReport.NumberOfRuleFailures <= 0) { bValid = true; } else { throw new WonkaOrchestratorException(ruleTreeReport); } return(bValid); }
public async Task <string> GetTransactionForSigning(EthTransaction ethTransaction, bool useTxPool = false) { string from = ethTransaction.FromAddress; var gas = new Nethereum.Hex.HexTypes.HexBigInteger(ethTransaction.GasAmount); var gasPrice = new Nethereum.Hex.HexTypes.HexBigInteger(ethTransaction.GasPrice); var nonce = await _nonceCalculator.GetNonceAsync(from, useTxPool); var to = ethTransaction.ToAddress; var value = new Nethereum.Hex.HexTypes.HexBigInteger(ethTransaction.Value); var tr = new Nethereum.Signer.Transaction(to, value, nonce, gasPrice, gas); var hex = tr.GetRLPEncoded().ToHex(); return(hex); }
private static IEnumerator GetBlockWithTransactionsByNumberUnityRequest(BigInteger number, Action callBack) { var request = new EthGetBlockWithTransactionsByNumberUnityRequest(Wallet._url); var _number = new Nethereum.Hex.HexTypes.HexBigInteger(number); yield return(request.SendRequest(_number)); if (request.Result != null) { Nethereum.RPC.Eth.DTOs.Transaction[] transactions = request.Result.Transactions; lock (TransactionsList){ TransactionsList.Add(transactions); } } blockIndex += 1; //startBlockNumber += 1; callBack(); }
public TransactionInput CreatePingTransactionInput( // For this transaction to the contract we are going to use // the address which is excecuting the transaction (addressFrom), // the private key of that address (privateKey), // the ping value we are going to send to this contract (pingValue), // the maximum amount of gas to consume, // the price you are willing to pay per each unit of gas consumed, (higher the price, faster the tx will be included) // and the valueAmount in ETH to send to this contract. // IMPORTANT: the PingContract doesn't accept eth transfers so this must be 0 or it will throw an error. string addressFrom, string privateKey, BigInteger pingValue, HexBigInteger gas = null, HexBigInteger gasPrice = null, HexBigInteger valueAmount = null) { var function = GetPingFunction(); return(function.CreateTransactionInput(addressFrom, gas, gasPrice, valueAmount, pingValue)); }
public async Task MineAndGetReceiptAsync() { var setPingFunction = contract.GetFunction("setPint"); Nethereum.Contracts.Event pongEvent = contract.GetEvent("Pong"); // var filterAll = await pongEvent.CreateFilterAsync (); // Debug.Log ("filterAll: " + filterAll); // var filter7 = await pongEvent.CreateFilterAsync(7); Nethereum.Hex.HexTypes.HexBigInteger estimatedGas = await setPingFunction.EstimateGasAsync(111); // var transactionHash = await setPingFunction.SendTransactionAsync(address, estimatedGas, null, 8); // Debug.Log ("transactionHash: " + transactionHash); Nethereum.RPC.Eth.DTOs.TransactionReceipt receipt = await setPingFunction.SendTransactionAndWaitForReceiptAsync(address, estimatedGas, null, null, 111); Debug.Log("receipt: " + receipt.TransactionHash + ", blockNum: " + receipt.BlockNumber.Value); // object[] array = new[] { "9" }; var filterInput = pongEvent.CreateFilterInput(new BlockParameter(0), BlockParameter.CreateLatest()); var logs = await pongEvent.GetAllChanges <PongEvent>(filterInput); foreach (Nethereum.Contracts.EventLog <PongEvent> log in logs) { Debug.Log("================================"); Debug.Log("address: " + log.Log.Address); Debug.Log("TransactionHash: " + log.Log.TransactionHash); Debug.Log("blockNum: " + log.Log.BlockNumber); Debug.Log("data: " + log.Log.Data); Debug.Log("Pong: " + log.Event.Pong); } // var log = await pongEvent.GetFilterChanges<PongEvent>(filterAll); // var log7 = await pongEvent.GetFilterChanges<PongEvent>(filter7); Debug.Log("logs: " + logs.Count); // Debug.Log("log: " + log.Count); }
public async Task <List <Deposit> > Startup() { try { //var blockPeriod = 5 * 60 * 20 * 30; // Amount of blocks to scan for events var deposits = new List <Deposit>(); try { currentBlock = new HexBigInteger((await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync()).Value - 5); startupFilter = logDepositEvent.CreateFilterInput(new BlockParameter(new HexBigInteger(currentBlock.Value - currentBlock.Value + 1)), new BlockParameter(currentBlock)); startupLog = await logDepositEvent.GetAllChanges <LogDepositEvent>(startupFilter); } catch (Exception e) { Console.WriteLine(e.ToString()); } foreach (var d in startupLog) { var deposit = new Deposit(); deposit.TargetWallet = d.Event.Destination; deposit.Asset = d.Event.Symbol; deposit.Quantity = Web3Geth.Convert.FromWei(d.Event.Value); deposit.TxHash = d.Log.TransactionHash; currentBlock = d.Log.BlockNumber; deposits.Add(deposit); } return(deposits); } catch (Exception e) { Console.WriteLine("Ethereum Connector Startp Failed: " + e.ToString()); } return(await Task.FromResult((List <Deposit>) null)); }
protected virtual void SerializeRecordToBlockchain(T poCommand) { Hashtable DataValues = new Hashtable(); GetPropertiesViaReflection(poCommand, DataValues); var contract = GetContract(); var setValueOnRecordFunction = contract.GetFunction(CONST_CONTRACT_FUNCTION_SET_VALUE); // Out of gas exception // var gas = setValueOnRecordFunction.EstimateGasAsync(sSenderAddress, "SomeAttr", "SomeValue").Result; var gas = new Nethereum.Hex.HexTypes.HexBigInteger(1000000); foreach (String sTempAttrName in DataValues.Keys) { string sSenderAddr = BlockchainEngine.SenderAddress; string sAttrValue = (string)DataValues[sTempAttrName]; var receiptSetValueOnRecord = setValueOnRecordFunction.SendTransactionAsync(sSenderAddr, gas, null, sSenderAddr, sTempAttrName, sAttrValue).Result; } }
public virtual void SerializeRecordToBlockchain(ICommand poCommand) { Hashtable DataValues = new Hashtable(); GetPropertiesViaReflection(poCommand, DataValues); Dictionary <string, Contract> Sources = new Dictionary <string, Contract>(); foreach (string sAttrName in moRulesEngine.SourceMap.Keys) { var contract = this.GetContract(moRulesEngine.SourceMap[sAttrName]); Sources[moRulesEngine.SourceMap[sAttrName].SourceId] = contract; } // Out of gas exception // var gas = setValueOnRecordFunction.EstimateGasAsync(sSenderAddress, "SomeAttr", "SomeValue").Result; var gas = new Nethereum.Hex.HexTypes.HexBigInteger(1000000); foreach (String sTempAttrName in DataValues.Keys) { WonkaBreSource TempSource = moRulesEngine.SourceMap[sTempAttrName]; string sSenderAddr = TempSource.SenderAddress; string sAttrValue = (string)DataValues[sTempAttrName]; var contract = Sources[TempSource.SourceId]; var setValueOnRecordFunction = contract.GetFunction(TempSource.SetterMethodName); if (!String.IsNullOrEmpty(sAttrValue)) { var receiptSetValueOnRecord = setValueOnRecordFunction.SendTransactionAsync(sSenderAddr, gas, null, sTempAttrName, sAttrValue).Result; } } }
public virtual void DeserializeRecordFromBlockchain(ICommand poCommand) { Hashtable DataValues = new Hashtable(); Dictionary <string, Contract> Sources = new Dictionary <string, Contract>(); foreach (string sAttrName in moInitData.BlockchainDataSources.Keys) { var contract = this.GetContract(moInitData.BlockchainDataSources[sAttrName]); Sources[moInitData.BlockchainDataSources[sAttrName].SourceId] = contract; } // Out of gas exception // var gas = setValueOnRecordFunction.EstimateGasAsync(sSenderAddress, "SomeAttr", "SomeValue").Result; var gas = new Nethereum.Hex.HexTypes.HexBigInteger(1000000); foreach (String sTempAttrName in moInitData.BlockchainDataSources.Keys) { WonkaBizSource TempSource = moInitData.BlockchainDataSources[sTempAttrName]; string sSenderAddr = TempSource.SenderAddress; var contract = Sources[TempSource.SourceId]; var getValueOnRecordFunction = contract.GetFunction(TempSource.MethodName); string sAttrValue = getValueOnRecordFunction.CallAsync <string>(sTempAttrName).Result; if (!String.IsNullOrEmpty(sAttrValue)) { DataValues[sTempAttrName] = sAttrValue; } } AssignPropertiesViaReflection(poCommand, DataValues); }
public IEnumerator SendRequest(Nethereum.Hex.HexTypes.HexBigInteger filterId) { var request = _ethUninstallFilter.BuildRequest(filterId); yield return(SendRequest(request)); }
public static ulong ToUlong(this HexBigInteger val) { return((ulong)val.Value); }
private async Task unlockAccount(Web3 web3, string publicKey, string password) { Nethereum.Hex.HexTypes.HexBigInteger accountUnlockTime = new Nethereum.Hex.HexTypes.HexBigInteger(120); var account = await web3.Personal.UnlockAccount.SendRequestAsync(publicKey, password, accountUnlockTime); }
public IEnumerator SendRequest(Nethereum.Hex.HexTypes.HexBigInteger filterId) { var request = _ethGetFilterLogsForEthNewFilter.BuildRequest(filterId); yield return(SendRequest(request)); }
void UpdateUIPanel() { while (ShallRun) { ulong newBlockNumber = GetCurrentBlockNumber(); UpdateBalances(); if (StartBlockNumber == 0) { StartBlockNumber = newBlockNumber; LastBlockNumberProcessed = newBlockNumber; } //Web3.Eth.Blocks.GetBlockNumber(); if (newBlockNumber > LastBlockNumber) { var blockNumber = new Nethereum.Hex.HexTypes.HexBigInteger(new BigInteger(newBlockNumber)); var blockTask = Web3.Eth.Blocks.GetBlockWithTransactionsByNumber.SendRequestAsync(blockNumber); blockTask.Wait(); var block = blockTask.Result; BlockDetails blockDetails = new BlockDetails(); blockDetails.BlockInfo = block; StringBuilder txInfos = new StringBuilder(); txInfos.AppendLine(newBlockNumber.ToString()); txInfos.AppendLine(block.BlockHash); List <Task <TransactionReceipt> > transactionReceiptTasks = new List <Task <TransactionReceipt> >(); foreach (var tx in block.Transactions) { //TODO: maybe just pick up transaction that point to one of our contracts ? see mapping ContractMappingAddressToName txInfos.AppendLine(" - " + tx.TransactionHash); //tx.TransactionHash; //tx. //tx. Task <TransactionReceipt> receiptTask = Web3.Eth.TransactionManager.TransactionReceiptService.PollForReceiptAsync(tx.TransactionHash); //receiptTask.Start(); transactionReceiptTasks.Add(receiptTask); } TimeSpan timeout = TimeSpan.FromSeconds(10); foreach (var task in transactionReceiptTasks) { task.Wait(timeout); TransactionDetails details = new TransactionDetails(); if (task.IsCompleted) { details.TransactionReceipt = task.Result; if (!string.IsNullOrEmpty(details.TransactionReceipt.ContractAddress) && ContractMappingAddressToName.ContainsKey(details.TransactionReceipt.ContractAddress)) { details.ContractName = ContractMappingAddressToName[details.TransactionReceipt.ContractAddress]; } AddEventsFromReceipt(details.TransactionReceipt, details.FishEvents, details.AllEvents); AddEventsFromReceipt(details.TransactionReceipt, details.LandEvents, details.AllEvents); AddEventsFromReceipt(details.TransactionReceipt, details.LandOwner, details.AllEvents); AddEventsFromReceipt(details.TransactionReceipt, details.DoggerWasBuild, details.AllEvents); // AddEventsFromReceipt(details.TransactionReceipt, details.TimberMintEvents, details.AllEvents); // AddEventsFromReceipt(details.TransactionReceipt, details.CopperMintEvents , details.AllEvents); LatestTransactionInformations.TryAdd(details.TransactionReceipt.TransactionHash, details); blockDetails.TransactionDetails.Add(details); } else { if (task.IsCanceled) { Debug.LogWarning("Receiving Transaction details was cancelled"); } if (task.IsFaulted) { Debug.LogWarning("Receiving Transaction details Rand into an Error."); } } //var fishEvents = details.TransactionReceipt.DecodeAllEvents<Galleass3D.Contracts.Bay.ContractDefinition.FishEventDTO>(); //details. //task.Result } LatestBlockInformation = txInfos.ToString(); if (!LatestBlockDetails.TryAdd(newBlockNumber, blockDetails)) { Debug.LogError("Could not add Block #" + newBlockNumber); } LastBlockNumber = newBlockNumber; //block.Result.Transactions } System.Threading.Thread.Sleep(BlockTimeMs); } }
public IEnumerator SendRequest(Nethereum.Hex.HexTypes.HexBigInteger blockNumber, Nethereum.Hex.HexTypes.HexBigInteger transactionIndex) { var request = _ethGetTransactionByBlockNumberAndIndex.BuildRequest(blockNumber, transactionIndex); yield return(SendRequest(request)); }
public IEnumerator SendRequest(System.String blockHash, Nethereum.Hex.HexTypes.HexBigInteger transactionIndex) { var request = _ethGetTransactionByBlockHashAndIndex.BuildRequest(blockHash, transactionIndex); yield return(SendRequest(request)); }
public IEnumerator SendRequest(Nethereum.Hex.HexTypes.HexBigInteger filterId) { var request = _ethGetFilterChangesForBlockOrTransaction.BuildRequest(filterId); yield return(SendRequest(request)); }