public BalanceService(IWeb3 web3) { _web3 = web3; }
public ErcInterfaceService(IBaseSettings settings, IWeb3 web3) { _web3 = web3; _settings = settings; }
public void TestInit() { TestConfig.ReconfigureServices(); _detector = TestConfig.ServiceProvider.GetService <IErc20Detector>(); _web3 = TestConfig.ServiceProvider.GetService <IWeb3>(); }
public BlockVmPostProcessor(IWeb3 web3, IBlockHandler blockHandler, ITransactionProcessor transactionProcessor) : base(web3, blockHandler, transactionProcessor) { }
public GetLatestHexUniswapData(IHttpClientFactory httpClientFactory, IWeb3 web3) { _client = httpClientFactory.CreateClient(); _contractHandler = web3.Eth.GetContractHandler(HexUniswapV2Address); _cacheExpirationSecs = 15; }
public BlockchainAccessorService(IWeb3 web3, CoreConfiguration configuration) { _web3 = web3 ?? throw new ArgumentNullException(nameof(web3)); _config = configuration ?? throw new ArgumentNullException(nameof(configuration)); }
public RawTransactionSubmitter(IWeb3 web3, ISignatureChecker signatureChecker) { _signatureChecker = signatureChecker; _web3 = web3; }
public NetInfoService(IWeb3 web3) { _web3 = web3; _memoryCache = new InMemoryCacheClient(); }
public VASPIndexClient( Address address, IWeb3 web3) : base(address, web3) { }
public BlockchainListenerService(CoreConfiguration config, IBlockchainAccessor blockchainAccessor, IWeb3 web3) { _config = config ?? throw new ArgumentNullException(nameof(config)); _blockchainAccessor = blockchainAccessor ?? throw new ArgumentNullException(nameof(blockchainAccessor)); _web3 = web3 ?? throw new ArgumentNullException(nameof(web3)); }
private async Task SendRawTransaction(TimestampDao timestamp, IWeb3 web3, string secretKey, double estimateGasPrice, EthSettings ethSettings) { if (!Enum.TryParse(ethSettings.Network, true, out Chain networkChain)) { networkChain = Chain.MainNet; _logger.Warning($"Unable to parse '{ethSettings.Network}' to type '{typeof(Chain)}', so setting default to '{networkChain}'."); } bool proofVerified = _ethHelper.VerifyStamp(timestamp); if (!proofVerified) { var message = $"Unable to verify the signature '{timestamp.Signature}'."; _logger.Warning(message); throw new TimestampException(message); } string proofStr = JsonConvert.SerializeObject( new { file = timestamp.FileName, hash = timestamp.FileHash, publicKey = timestamp.PublicKey, signature = timestamp.Signature }); var txData = HexStringUTF8ConvertorExtensions.ToHexUTF8(proofStr); var fromAddress = web3.TransactionManager.Account.Address; var futureNonce = await web3.TransactionManager.Account.NonceService.GetNextNonceAsync(); _logger.Information($"Signed transaction on chain: {networkChain}, To: {ethSettings.ToAddress}, Nonce: {futureNonce}, GasPrice: {estimateGasPrice}, From Address :{fromAddress}"); var offlineTransactionSigner = new TransactionSigner(); var encoded = offlineTransactionSigner.SignTransaction( secretKey, networkChain, ethSettings.ToAddress, Web3.Convert.ToWei(0, UnitConversion.EthUnit.Gwei), futureNonce, Web3.Convert.ToWei(estimateGasPrice, UnitConversion.EthUnit.Gwei), new BigInteger(100000), txData); var verified = offlineTransactionSigner.VerifyTransaction(encoded); if (!verified) { var message = $"Unable to verify the transaction for data '{txData}'."; _logger.Error(message); throw new TimestampException(message); } try { var txId = await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" + encoded); timestamp.Address = fromAddress; timestamp.Nonce = (long)futureNonce.Value; timestamp.TransactionId = txId; timestamp.Network = networkChain.ToString(); timestamp.BlockNumber = -1; if (string.IsNullOrWhiteSpace(txId)) { timestamp.Status = TimestampState.Failed; var message = $"Transaction failed for an user '{timestamp.UserId}' with file name '{timestamp.FileName}'."; _logger.Error(message); } } catch (RpcResponseException ex) { await web3.TransactionManager.Account.NonceService.ResetNonce(); if (ex.Message.Contains("nonce too low", StringComparison.InvariantCultureIgnoreCase)) { throw new RpcClientNonceException(ex.Message); } else if (ex.Message.Contains("transaction underpriced", StringComparison.InvariantCultureIgnoreCase)) { throw new RpcClientUnderpricedException(ex.Message); } throw; } }
public static void RemoveGetVmStackInterceptor(this IWeb3 web3) => _getTransactionVmStackInterceptors.TryRemove(web3, out _);
// a hook for unit test interception // GetTransactionVmStack is currently Web3Geth specific // this allows a unit test to simulate Web3Geth public static void RegisterGetVmStackInterceptor(this IWeb3 web3, Func <string, JObject> interceptionFunc) => _getTransactionVmStackInterceptors.AddOrUpdate(web3, interceptionFunc, (w3, i) => interceptionFunc);
public VASPDirectoryClient( Address address, IWeb3 web3) : base(address, web3) { }
public EthereumService(IWeb3 web3) { _web3 = web3; }
public static IBlockProcessor Create(IWeb3 web3, HandlerContainer handlers, FilterContainer filters = null, bool postVm = false, bool processTransactionsInParallel = true) { return(Create(web3, new VmStackErrorCheckerWrapper(), handlers, filters, postVm, processTransactionsInParallel)); }
public RpcController(IEthereumIndexerService ethereumIndexerService, IWeb3 web3) { _web3 = web3; _ethereumIndexerService = ethereumIndexerService; }
public EventFunctionProcessor( IWeb3 web3) { _web3 = web3; _eventToHandlerMapping = new Dictionary <Type, List <ITransactionHandler> >(); }
public OwnerBlockchainService(IWeb3 web3, IBaseSettings baseSettings) { _baseSettings = baseSettings; _web3 = web3; }
public MinetokenService(IWeb3 web3) { _balanceHandler = web3.Eth.GetContractQueryHandler <BalanceOfFunction>(); }
public void TestInit() { TestConfig.ReconfigureServices(); _debug = TestConfig.ServiceProvider.GetService <IDebug>(); _web3 = TestConfig.ServiceProvider.GetService <IWeb3>(); }
public BlockController(IWeb3 web3, ILog log) { _web3 = web3; _log = log; }
public EthereumRpc(IWeb3 web3) { this._web3 = web3; }
public WhisperRpc(IWeb3 web3, IMessageFormatter messageFormatter) { this._web3 = web3; this._messageFormatter = messageFormatter; }
public static Task MineBlockAsync( this IWeb3 web3) { return(web3.Client.SendRequestAsync("evm_mine")); }
public SmartContractBase(IWeb3 web3, string jsonAbi, string address) { Web3 = web3; Contract = web3.Eth.GetContract(jsonAbi, address); }
public VASPContractClient( Address address, IWeb3 web3) : base(address, web3) { }
public DefaultEstimateGasPriceStrategy( IWeb3 web3) { _web3 = web3; }