eth_maxPriorityFeePerGas
Returns the current max priority fee per gas in wei.
Parameters
None
Examples
- cURL
- Ethers.js v6
- Viem
- web3.py
curl -X POST https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_maxPriorityFeePerGas",
"params": [],
"id": 1
}'
import { JsonRpcProvider, formatUnits } from 'ethers';
const provider = new JsonRpcProvider(
'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
);
// Get max priority fee per gas
const maxPriorityFee = await provider.send('eth_maxPriorityFeePerGas', []);
console.log(`Max priority fee: ${formatUnits(maxPriorityFee, 'gwei')} gwei`);
import { createPublicClient, http, defineChain, formatGwei } from 'viem';
const chiliz = defineChain({
id: 88888,
name: 'Chiliz',
nativeCurrency: {
decimals: 18,
name: 'CHZ',
symbol: 'CHZ',
},
rpcUrls: {
default: {
http: ['https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'],
},
},
blockExplorers: {
default: { name: 'ChilizScan', url: 'https://chiliscan.com' },
},
});
const client = createPublicClient({
chain: chiliz,
transport: http('https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'),
});
// Get max priority fee per gas
const maxPriorityFee = await client.request({
method: 'eth_maxPriorityFeePerGas'
});
console.log(`Max priority fee: ${formatGwei(BigInt(maxPriorityFee))} gwei`);
from web3 import Web3
w3 = Web3(Web3.HTTPProvider(
'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
))
# Get max priority fee per gas
max_priority_fee = w3.eth.max_priority_fee
max_priority_fee_gwei = w3.from_wei(max_priority_fee, 'gwei')
print(f"Max priority fee: {max_priority_fee_gwei} gwei")
Response
Returns the max priority fee per gas in wei as a hexadecimal string. Common error responses:
{"code": -32700, "message": "Parse error"}
- Invalid JSON{"code": -32602, "message": "Invalid params"}
- Invalid parameters{"code": -32603, "message": "Internal error"}
- Server error