Skip to content

Conversation

@nischitpra
Copy link
Contributor

@nischitpra nischitpra commented Sep 8, 2025

PR-Codex overview

This PR updates the URL returned for the 80002 case in the fee-data.ts file, changing it from a testnet gas station to a specific endpoint.

Detailed summary

  • In the fee-data.ts file, the return value for the case 80002 was 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}

Summary by CodeRabbit

  • Bug Fixes
    • Updated the gas fee data source for Polygon Amoy (chain 80002) to the current Amoy 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).

@nischitpra nischitpra requested review from a team as code owners September 8, 2025 12:26
@changeset-bot
Copy link

changeset-bot bot commented Sep 8, 2025

⚠️ No Changeset found

Latest commit: e78a984

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Sep 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Sep 8, 2025 0:54am
nebula Ready Ready Preview Comment Sep 8, 2025 0:54am
thirdweb_playground Ready Ready Preview Comment Sep 8, 2025 0:54am
thirdweb-www Ready Ready Preview Comment Sep 8, 2025 0:54am
wallet-ui Ready Ready Preview Comment Sep 8, 2025 0:54am

@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 8, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 8, 2025

Walkthrough

Updated 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

Cohort / File(s) Summary
Gas station endpoint update
packages/thirdweb/src/gas/fee-data.ts
Changed the returned URL for chainId 80002 from https://gasstation-testnet.polygon.technology/v2 to https://gasstation.polygon.technology/amoy. Case for 137 unchanged; function structure intact.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5–10 minutes


📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between b8ee43b and e78a984.

📒 Files selected for processing (1)
  • packages/thirdweb/src/gas/fee-data.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • 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). (2)
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch np/polygon_gasstation

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Sep 8, 2025
@nischitpra nischitpra added the merge-queue Adds the pull request to Graphite's merge queue. label Sep 8, 2025 — with Graphite App
Copy link
Contributor Author

nischitpra commented Sep 8, 2025

Merge activity

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between e37bd8e and b8ee43b.

📒 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 @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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 @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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 @example and 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 with fast.maxPriorityFee is 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.maxPriorityFee present on both Amoy and mainnet endpoints—no changes required

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 63.96 KB (-0.09% 🔽) 1.3 s (-0.09% 🔽) 771 ms (+118.43% 🔺) 2.1 s
thirdweb (cjs) 356.86 KB (-0.13% 🔽) 7.2 s (-0.13% 🔽) 2.8 s (+11.94% 🔺) 9.9 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 300 ms (+1139.12% 🔺) 414 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 108 ms (+1640.95% 🔺) 118 ms
thirdweb/react (minimal + tree-shaking) 19.15 KB (0%) 383 ms (0%) 246 ms (+484.53% 🔺) 629 ms

@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 56.65%. Comparing base (e37bd8e) to head (e78a984).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/gas/fee-data.ts 0.00% 1 Missing ⚠️
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           
Flag Coverage Δ
packages 56.65% <0.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
packages/thirdweb/src/gas/fee-data.ts 63.09% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

<!-- 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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants