コード例 #1
0
        public async void ShouldBeAbleToCalculateHistoryAndSend1000sOfTransactions()
        {
            if (_ethereumClientIntegrationFixture.EthereumClient == EthereumClient.Geth)
            {
                var receiveAddress = "0x13f022d72158410433cbd66f5dd8bf6d2d129924";

                var web3 = _ethereumClientIntegrationFixture.GetWeb3();
#if NETCOREAPP3_1_OR_GREATER || NET50
                EthECKey.SignRecoverable = true;
#endif
                var feeStrategy = new TimePreferenceFeeSuggestionStrategy(web3.Client);
                for (var x = 0; x < 10; x++)
                {
                    Thread.Sleep(500);
                    var fee = await feeStrategy.SuggestFeesAsync();

                    for (int i = 0; i < 50; i++)
                    {
                        var encoded = await web3.TransactionManager.SendTransactionAsync(
                            new TransactionInput()
                        {
                            Type                 = new HexBigInteger(2),
                            From                 = web3.TransactionManager.Account.Address,
                            MaxFeePerGas         = new HexBigInteger(fee[0].MaxFeePerGas.Value),
                            MaxPriorityFeePerGas = new HexBigInteger(fee[0].MaxPriorityFeePerGas.Value),
                            To    = receiveAddress,
                            Value = new HexBigInteger(10)
                        });
                    }
                }
            }
        }
コード例 #2
0
ファイル: EIP1559Tests.cs プロジェクト: huyen-pk/Nethereum
            //[Fact]
            public async void ShouldCheckFeeHistory()
            {
                //besu
                // var web3 = new Nethereum.Web3.Web3("http://18.116.30.130:8545/");
                //calavera
                var web3 = new Nethereum.Web3.Web3("http://18.224.51.102:8545/");
                //var web3 = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Goerli);
                var version = await new Web3ClientVersion(web3.Client).SendRequestAsync().ConfigureAwait(false);

                var x    = new TimePreferenceFeeSuggestionStrategy(web3.Client);
                var fees = await x.SuggestFeesAsync();

                //var block =
                //    await web3.Eth.FeeHistory.SendRequestAsync(7, new BlockParameter(10), new []{10,20, 30}
                //         );
                var count = fees.Length;
            }