internal BlockchainOperation( BlockchainOperationId id, IWeb3 web3, ConfirmationLevel minimalConfirmationLevel = default) { _minimalConfirmationLevel = minimalConfirmationLevel; _web3 = web3; Id = id; }
protected async Task <BlockchainOperation> SendTransactionAsync <TParameters>( Address from, TransactionDefinition <TParameters> transactionDefinition, ConfirmationLevel minimalConfirmationLevel) where TParameters : TransactionDefinition <TParameters>, new() { var transactionInput = await Web3.Eth .GetContractTransactionHandler <TParameters>() .CreateTransactionInputEstimatingGasAsync ( ContractAddress, (TParameters)transactionDefinition ); transactionInput.From = from; transactionInput.GasPrice = new HexBigInteger(await EstimateGasPriceStrategy.ExecuteAsync()); string transactionHash; if (Web3.TransactionManager.Account != null) { var signedTransaction = await Web3.TransactionManager .SignTransactionAsync(transactionInput); transactionHash = await Web3.Eth.Transactions .SendRawTransaction .SendRequestAsync(signedTransaction); } else { transactionHash = await Web3.Eth.Transactions .SendTransaction .SendRequestAsync(transactionInput); } var blockchainOperationId = BlockchainOperationId.Parse(transactionHash); return(new BlockchainOperation(blockchainOperationId, Web3, minimalConfirmationLevel)); }
public IBlockchainOperation GetOperation( BlockchainOperationId operationId, ConfirmationLevel minimalConfirmationLevel = default) { return(new BlockchainOperation(operationId, _web3, minimalConfirmationLevel)); }