Ejemplo n.º 1
0
        public async Task <BigInteger> EstimateGas(IAccount account, string toAddress, BigInteger value)
        {
            var callInput = new Nethereum.RPC.Eth.DTOs.CallInput(null, toAddress, new HexBigInteger(value));
            var gasPrice  = await Web3Instance(account)
                            .Eth
                            .GasPrice
                            .SendRequestAsync();

            var estimatedGas = (await Web3Instance(account)
                                .Eth
                                .Transactions
                                .EstimateGas
                                .SendRequestAsync(callInput)).Value;

            return(BigInteger.Multiply(gasPrice, estimatedGas));
        }
Ejemplo n.º 2
0
        public IEnumerator SendRequest(Nethereum.RPC.Eth.DTOs.CallInput callInput)
        {
            var request = _ethEstimateGas.BuildRequest(callInput);

            yield return(SendRequest(request));
        }
Ejemplo n.º 3
0
        public IEnumerator SendRequest(Nethereum.RPC.Eth.DTOs.CallInput callInput, Nethereum.RPC.Eth.DTOs.BlockParameter block)
        {
            var request = _ethCall.BuildRequest(callInput, block);

            yield return(SendRequest(request));
        }