-
Notifications
You must be signed in to change notification settings - Fork 619
polygon amoy gasstation update #8004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
WalkthroughUpdated the gas station URL returned by getGasStationUrl for chainId 80002 to https://gasstation.polygon.technology/amoy. No other logic, signatures, or cases were changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5–10 minutes 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
✨ Finishing Touches
🧪 Generate unit tests
Comment |
Merge activity
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/thirdweb/src/gas/fee-data.ts (3)
185-187: Update stale comment: “mumbai” → “amoy”.The comment still references Mumbai. Suggest aligning it with the new testnet name.
- // mumbai & polygon + // amoy & polygon
256-270: Add timeout and JSON guards around gas-station fetch to avoid hangs and shape drift.External call has no timeout and assumes shape; a slow/unreachable endpoint can stall, and non-conforming JSON will throw. Add an AbortController-based timeout, check
res.ok, and narrow the parsed JSON before using it.- try { - const data = await (await fetch(gasStationUrl)).json(); - // take the standard speed here, SDK options will define the extra tip - const priorityFee = data.fast.maxPriorityFee; - if (priorityFee > 0) { - const fixedFee = Number.parseFloat(priorityFee).toFixed(9); - return toUnits(fixedFee, 9); - } - } catch (e) { + try { + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), 3_000); + try { + const res = await fetch(gasStationUrl, { signal: controller.signal }); + if (!res.ok) throw new Error(`gas station responded ${res.status}`); + const data: { fast?: { maxPriorityFee?: number | string } } = await res.json(); + // take the standard speed here, SDK options will define the extra tip + const raw = data?.fast?.maxPriorityFee; + const num = raw != null ? Number(raw) : NaN; + if (Number.isFinite(num) && num > 0) { + return toUnits(num.toFixed(9), 9); + } + } finally { + clearTimeout(timeoutId); + } + } catch (e) { console.error("failed to fetch gas", e); }
249-249: Fallback aligns with Polygon’s 30 gwei minimum (mainnet).31 gwei floor is consistent with the documented ≥30 gwei priority fee requirement on PoS mainnet; safe as a universal fallback.
Source: Polygon docs note a 30 gwei minimum tip. (docs.polygon.technology)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/thirdweb/src/gas/fee-data.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes
Avoidanyandunknownunless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial,Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from@/typeswhere applicable
Prefertypealiases overinterfaceexcept for nominal shapes
Avoidanyandunknownunless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size
Files:
packages/thirdweb/src/gas/fee-data.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Files:
packages/thirdweb/src/gas/fee-data.ts
packages/thirdweb/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling@exampleand a custom tag (@beta,@internal,@experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g.,const { jsPDF } = await import("jspdf"))
Files:
packages/thirdweb/src/gas/fee-data.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: Lint Packages
- GitHub Check: Build Packages
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Unit Tests
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
packages/thirdweb/src/gas/fee-data.ts (2)
240-246: Correct Amoy gas station endpoint; matches Polygon docs.The Amoy URL is now
https://gasstation.polygon.technology/amoy, and mainnet remains at/v2. Response shape withfast.maxPriorityFeeis consistent with our parser. Looks good.Sources: Polygon docs list these exact endpoints and example payload including
fast.maxPriorityFee. (docs.polygon.technology)
240-246: Confirmed.fast.maxPriorityFeepresent on both Amoy and mainnet endpoints—no changes required
size-limit report 📦
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8004 +/- ##
=======================================
Coverage 56.64% 56.65%
=======================================
Files 904 904
Lines 58677 58677
Branches 4164 4165 +1
=======================================
+ Hits 33236 33241 +5
+ Misses 25335 25330 -5
Partials 106 106
🚀 New features to boost your workflow:
|
<!-- start pr-codex --> ## PR-Codex overview This PR updates the gas fee data source for the Polygon network in the `fee-data.ts` file, specifically changing the URL for the testnet case. ### Detailed summary - In the `fee-data.ts` file, the return URL for the case `80002` has been changed from `"https://gasstation-testnet.polygon.technology/v2"` to `"https://gasstation.polygon.technology/amoy"`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Updated the gas fee data source for Polygon Amoy (chain 80002) to the current gas station endpoint, improving accuracy and reliability of priority fee estimates. * Enhances transaction success rates and fee predictions for users interacting with the Amoy network. * No changes for Polygon mainnet (137). <!-- end of auto-generated comment: release notes by coderabbit.ai -->
b8ee43b to
e78a984
Compare
PR-Codex overview
This PR updates the URL returned for the
80002case in thefee-data.tsfile, changing it from a testnet gas station to a specific endpoint.Detailed summary
fee-data.tsfile, the return value for the case80002was changed from:"https://gasstation-testnet.polygon.technology/v2""https://gasstation.polygon.technology/amoy".Summary by CodeRabbit