Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
const response = await fetch('https://api.1inch.com/web3/56', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${API_KEY}`,
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_estimateGas',
params: [
{
type: 'string',
nonce: 'string',
to: null,
from: 'string',
gas: 'string',
value: 'string',
input: 'string',
gasPrice: 'string',
maxPriorityFeePerGas: 'string',
maxFeePerGas: 'string',
maxFeePerBlobGas: 'string',
accessList: [
{
address: 'string',
storageKeys: ['string'],
},
],
blobVersionedHashes: ['string'],
blobs: ['string'],
chainId: 'string',
authorizationList: [
{
chainId: 'string',
nonce: 'string',
address: 'string',
yParity: 'string',
r: 'string',
s: 'string',
},
],
},
'string',
],
id: 1,
}),
});
const data = await response.json();
console.log(data);
"0x5208"