eth_feeHistory
Overview
Returns base fee per gas and reward percentiles for a range of recent blocks.
Movement-Specific Considerations
- Use with
eth_maxPriorityFeePerGas
to suggest fees.
Parameters
Name | Type | Required | Description |
---|---|---|---|
blockCount | hex | Yes | Number of blocks in the requested range |
newestBlock | string | Yes | latest or block number hex |
rewardPercentiles | number[] | No | Percentiles (e.g., [25,50,75] ) |
Returns
EIP-1559 fee history object.
Code Examples
cURL
curl -X POST https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_feeHistory","params":["0x5","latest",[25,50,75]],"id":1}'
Ethers.js v6
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1');
const hist = await provider.send('eth_feeHistory', ['0x5','latest',[25,50,75]]);
console.log(hist);
Web3.js
import Web3 from 'web3';
const web3 = new Web3('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1');
const hist = await web3.eth.getFeeHistory(5, 'latest', [25,50,75]);
console.log(hist);
viem
import { createPublicClient, http } from 'viem';
const movement = {
id: 3073,
name: 'Movement',
nativeCurrency: { name: 'MOVE', symbol: 'MOVE', decimals: 18 },
rpcUrls: { default: { http: ['https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1'] } },
} as const;
const client = createPublicClient({ chain: movement, transport: http('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1') });
const hist = await client.getFeeHistory({ blockCount: 5n, rewardPercentiles: [25,50,75] });
console.log(hist);