using System;
using System.Threading.Tasks;
using Nethereum.Hex.HexTypes;
using Nethereum.JsonRpc.Client;
using Nethereum.RPC.Eth.DTOs;
namespace Nethereum.RPC.Eth.Transactions
{
///
/// eth_estimateGas
/// Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for
/// estimating the used gas.
/// Parameters
/// See eth_call parameters, expect that all properties are optional.
/// Returns
/// QUANTITY - the amount of gas used.
/// Example
/// Request
/// curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{see above}],"id":1}'
/// Result
/// {
/// "id":1,
/// "jsonrpc": "2.0",
/// "result": "0x5208" // 21000
/// }
///
public class EthEstimateGas : RpcRequestResponseHandler, IEthEstimateGas
{
public EthEstimateGas(IClient client) : base(client, ApiMethods.eth_estimateGas.ToString())
{
}
public Task SendRequestAsync(CallInput callInput, object id = null)
{
if (callInput == null) throw new ArgumentNullException(nameof(callInput));
return SendRequestAsync(id, callInput);
}
public RpcRequest BuildRequest(CallInput callInput, object id = null)
{
if (callInput == null) throw new ArgumentNullException(nameof(callInput));
return base.BuildRequest(id, callInput);
}
}
}