コード例 #1
0
ファイル: MainForm.cs プロジェクト: wanpixiaozi/FCS
        public async void WatchEventRpc()
        {
            var client = new RpcClient(new Uri("https://mainnet.infura.io"));

            var ethGetBlockByHash = new EthGetBlockWithTransactionsByNumber(client);

            var bts = await ethGetBlockByHash.SendRequestAsync(new BlockParameter(7865954));

            if (null != bts)
            {
                var author = bts.Author;
            }

            var ethGetGasEstimate = new EthGasPrice(client);
            var gas = await ethGetGasEstimate.SendRequestAsync();

            Console.WriteLine(gas.Value);

            var apiService = new EthApiService(client);
            var bal        = await apiService.GetBalance.SendRequestAsync("0xDcCC7b8dDf511f7CE2Ecf8672F57a4E277d73198");

            Console.WriteLine(bal.Value);

            var gass = await apiService.GasPrice.SendRequestAsync();

            Console.WriteLine(gass.Value);
        }
コード例 #2
0
        public async Task <HexBigInteger> GetGasPriceAsync(TransactionInput transactionInput)
        {
            //if (transactionInput.GasPrice != null) return transactionInput.GasPrice;
            //if (DefaultGasPrice >= 0) return new HexBigInteger(DefaultGasPrice);
            var ethGetGasPrice = new EthGasPrice(Client);

            return(await ethGetGasPrice.SendRequestAsync().ConfigureAwait(false));
        }
コード例 #3
0
        public async Task <HexBigInteger> GetGasPriceAsync(TransactionInput transactionInput,
                                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            if (transactionInput.GasPrice != null)
            {
                return(transactionInput.GasPrice);
            }
            if (DefaultGasPrice >= 0)
            {
                return(new HexBigInteger(DefaultGasPrice));
            }
            var ethGetGasPrice = new EthGasPrice(Client);

            return(await ethGetGasPrice.SendRequestAsync(cancellationToken).ConfigureAwait(false));
        }
コード例 #4
0
 public async Task<dynamic> ExecuteTestAsync(RpcClient client)
 {
     var ethGasPrice = new EthGasPrice(client);
     return await ethGasPrice.SendRequestAsync();
 }
コード例 #5
0
        public async Task <dynamic> ExecuteTestAsync(RpcClient client)
        {
            var ethGasPrice = new EthGasPrice(client);

            return(await ethGasPrice.SendRequestAsync());
        }
コード例 #6
0
        public override async Task <HexBigInteger> ExecuteAsync(IClient client)
        {
            var ethGasPrice = new EthGasPrice(client);

            return(await ethGasPrice.SendRequestAsync());
        }
コード例 #7
0
ファイル: GasUtils.cs プロジェクト: HopeWallet/Hope.Ethereum
        /// <summary>
        /// Estimates the gas price of an ethereum transaction.
        /// </summary>
        /// <param name="gasPriceTarget"> The target gas price. </param>
        /// <returns> Task which returns the estimated gas price of an ethereum transaction. </returns>
        public static async Task <BigInteger> EstimateGasPrice(GasPriceTarget gasPriceTarget = GasPriceTarget.Standard)
        {
            EthGasPrice estimateGasPrice = new EthGasPrice(NetworkProvider.GetWeb3().Client);

            return(ModifyGasPrice(gasPriceTarget, (await estimateGasPrice.SendRequestAsync()).Value));
        }
コード例 #8
0
        public async Task <object> ExecuteTestAsync(IClient client)
        {
            var ethGasPrice = new EthGasPrice(client);

            return(await ethGasPrice.SendRequestAsync());
        }