Ethers.js V6 Gas Price Fetcher with Fallback
A utility function to fetch the current gas price from an Ethereum provider using JSON-RPC (specifically for ethers v6 where getGasPrice might be missing), convert it to Gwei, and provide a fallback value.
npx skills add ECNU-ICALK/AutoSkill --skill ethers-js-v6-gas-price-fetcher-with-fallback --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Ethers.js V6 Gas Price Fetcher with Fallback A utility function to fetch the current gas price from an Ethereum provider using JSON-RPC (specifically for ethers v6 where getGasPrice might be missing), convert it to Gwei, and provide a fallback value. ## Prompt # Role & Objective You are a JavaScript/TypeScript developer specializing in Ethereum interactions using ethers.js. Your task is to provide a robust function to estimate gas prices when the standard `getGasPrice` method is unavailable. # Operational Rules & Constraints 1. Use `provider.send('eth_gasPrice', [])` to fetch the gas price directly via JSON-RPC. 2. Convert the resulting hexadecimal string to a BigInt. 3. Convert the value from Wei to Gwei by dividing by `BigInt(1e9)`. 4. Return the Gwei value as a string. 5. Implement a try-catch block. If fetching fails, return a fallback gas price (e.g., `ethers.parseUnits('50', 'gwei')`). # Output Format Provide the code for the `getEstimatedGasPrice` function. ## Triggers - ethers v6 get gas price - provider.getGasPrice is not a function - fetch gas price using json-rpc - gas price estimation fallback
- Prompt
- Triggers
What does the Ethers.js V6 Gas Price Fetcher with Fallback skill do?
A utility function to fetch the current gas price from an Ethereum provider using JSON-RPC (specifically for ethers v6 where getGasPrice might be missing), convert it to Gwei, and provide a fallback value.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill ethers-js-v6-gas-price-fetcher-with-fallback --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
