-
Notifications
You must be signed in to change notification settings - Fork 614
[MNY-298] SDK: Remove Bridge.routes, Update Docs #8335
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
WalkthroughRemoves the Bridge.routes API and the useBridgeRoutes React hook; updates useSendTransaction to query Bridge.tokens instead; deletes related tests, documentation pages and sidebar links; and removes re-exports and a changeset noting a minor release. Changes
Sequence DiagramsequenceDiagram
participant Modal as Pay Modal
participant Tx as useSendTransaction
participant Bridge as Bridge API
participant Tokens as Bridge.tokens
rect rgb(220,240,200)
Note over Modal,Tokens: New flow (post-change)
Modal->>Tx: Funds insufficient
Tx->>Bridge: Bridge.tokens(chainId, tokenAddress)
Bridge-->>Tx: tokens[]
alt tokens empty
Tx-->>Modal: Show deposit mode
else tokens available
Tx-->>Modal: Show buy / funds-dynamic mode
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (16)
💤 Files with no reviewable changes (13)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used📓 Path-based instructions (1).changeset/*.md📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (3)📚 Learning: 2025-08-29T15:37:38.513ZApplied to files:
📚 Learning: 2025-07-18T19:19:55.613ZApplied to files:
📚 Learning: 2025-09-24T11:09:45.142ZApplied to files:
⏰ 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)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
🦋 Changeset detectedLatest commit: c83f1c6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (16)
.changeset/rotten-apes-sing.md(1 hunks)apps/portal/src/app/bridge/routes/page.mdx(0 hunks)apps/portal/src/app/bridge/sell/page.mdx(0 hunks)apps/portal/src/app/bridge/sidebar.tsx(0 hunks)apps/portal/src/app/bridge/swap/page.mdx(1 hunks)apps/portal/src/app/bridge/tokens/page.mdx(0 hunks)apps/portal/src/app/payments/send/page.mdx(0 hunks)apps/portal/src/app/payments/sidebar.tsx(0 hunks)apps/portal/src/app/payments/webhooks/page.mdx(0 hunks)packages/thirdweb/src/bridge/Routes.test.ts(0 hunks)packages/thirdweb/src/bridge/Routes.ts(0 hunks)packages/thirdweb/src/bridge/index.ts(0 hunks)packages/thirdweb/src/exports/react.ts(0 hunks)packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts(2 hunks)packages/thirdweb/src/react/core/hooks/useBridgeRoutes.test.ts(0 hunks)packages/thirdweb/src/react/core/hooks/useBridgeRoutes.ts(0 hunks)
💤 Files with no reviewable changes (13)
- apps/portal/src/app/payments/send/page.mdx
- packages/thirdweb/src/bridge/index.ts
- apps/portal/src/app/bridge/tokens/page.mdx
- apps/portal/src/app/bridge/sidebar.tsx
- packages/thirdweb/src/exports/react.ts
- apps/portal/src/app/payments/sidebar.tsx
- apps/portal/src/app/payments/webhooks/page.mdx
- apps/portal/src/app/bridge/routes/page.mdx
- packages/thirdweb/src/bridge/Routes.test.ts
- packages/thirdweb/src/bridge/Routes.ts
- packages/thirdweb/src/react/core/hooks/useBridgeRoutes.test.ts
- packages/thirdweb/src/react/core/hooks/useBridgeRoutes.ts
- apps/portal/src/app/bridge/sell/page.mdx
🧰 Additional context used
📓 Path-based instructions (4)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
.changeset/*.md: Each change inpackages/*must include a changeset for the appropriate package
Version bump rules: patch for non‑API changes; minor for new/modified public API
Files:
.changeset/rotten-apes-sing.md
**/*.{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/react/core/hooks/transaction/useSendTransaction.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/react/core/hooks/transaction/useSendTransaction.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/react/core/hooks/transaction/useSendTransaction.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Prefer API routes or server actions to keep tokens secret; the browser only sees relative paths.
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to .changeset/*.md : Version bump rules: patch for non‑API changes; minor for new/modified public API
Applied to files:
.changeset/rotten-apes-sing.md
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Surface breaking changes prominently in PR descriptions
Applied to files:
.changeset/rotten-apes-sing.md
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/exports/** : Export all public API via `packages/thirdweb/exports/`, grouped by feature
Applied to files:
.changeset/rotten-apes-sing.md
📚 Learning: 2025-09-24T11:09:45.142Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/script-exports/readme.md:6-7
Timestamp: 2025-09-24T11:09:45.142Z
Learning: For thirdweb Bridge Widget script exports, the module is exported with globalName: "BridgeWidget" in tsup config, making the global API `BridgeWidget.render()` rather than `window.thirdweb.BridgeWidget.render()`.
Applied to files:
.changeset/rotten-apes-sing.md
📚 Learning: 2025-10-03T23:36:00.631Z
Learnt from: MananTank
PR: thirdweb-dev/js#8181
File: packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx:27-27
Timestamp: 2025-10-03T23:36:00.631Z
Learning: In packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx, the component intentionally uses a hardcoded English locale (connectLocaleEn) rather than reading from the provider, as BuyWidget is designed to be English-only and does not require internationalization support.
Applied to files:
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
📚 Learning: 2025-08-28T20:50:33.170Z
Learnt from: joaquim-verges
PR: thirdweb-dev/js#7922
File: apps/playground-web/src/app/ai/ai-sdk/components/chat-container.tsx:167-181
Timestamp: 2025-08-28T20:50:33.170Z
Learning: The SignTransactionInput schema in thirdweb-dev/ai-sdk-provider uses snake_case field names (chain_id) rather than camelCase (chainId).
Applied to files:
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).
Applied to files:
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
📚 Learning: 2025-05-27T19:55:25.056Z
Learnt from: MananTank
PR: thirdweb-dev/js#7177
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_hooks/useTokenPriceData.ts:49-49
Timestamp: 2025-05-27T19:55:25.056Z
Learning: In the ERC20 public pages token price data hook (`useTokenPriceData.ts`), direct array access on `json.data[0]` without optional chaining is intentionally correct and should not be changed to use safety checks.
Applied to files:
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
📚 Learning: 2025-08-27T22:11:41.748Z
Learnt from: MananTank
PR: thirdweb-dev/js#7933
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/create-token-page-impl.tsx:465-473
Timestamp: 2025-08-27T22:11:41.748Z
Learning: In the token creation flow (create-token-page-impl.tsx), the createTokenOnUniversalBridge() call is intentionally not awaited (fire-and-forget pattern) to allow the token creation process to complete immediately without waiting for the bridge operation. This is a deliberate design choice to prioritize user experience by not blocking the main flow with supplementary bridge operations.
Applied to files:
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
📚 Learning: 2025-09-24T11:08:43.783Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx:34-41
Timestamp: 2025-09-24T11:08:43.783Z
Learning: In BridgeWidgetProps for packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx, the Swap onError callback signature requires a non-undefined SwapPreparedQuote parameter (unlike Buy's onError which allows undefined quote). This is intentional - SwapWidget's onError is only called when a quote is available.
Applied to files:
apps/portal/src/app/bridge/swap/page.mdx
🧬 Code graph analysis (1)
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (1)
packages/thirdweb/src/bridge/Token.ts (1)
tokens(131-193)
⏰ 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, esbuild)
- GitHub Check: Unit Tests
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Size
- GitHub Check: Build Packages
- GitHub Check: Lint Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
apps/portal/src/app/bridge/swap/page.mdx (2)
168-197: Code example uses correct APIs post-Bridge.routes removal.The SwapManager example uses
Bridge.Buy.prepare()andBridge.status()to fetch quotes and track transaction status. These APIs remain available and the example correctly avoids references to the removedBridge.routesAPI. The code is accurate for the updated SDK surface.
321-321: Line 321 link destination is valid and properly updated.The updated "Going Further" section correctly references
[Token Prices](/bridge/tokens), which points to a valid documentation page. The change appropriately replaces the removed Bridge.routes reference with a suitable alternative. No dangling references to removed APIs (Bridge.routes, getAvailableRoutes, PriceComparator) were found in the file.packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (2)
256-270: LGTM - Clean migration to Bridge.tokens with robust error handling.The replacement of
Bridge.routeswithBridge.tokensis implemented correctly:
- Parameters match the API signature (chainId, tokenAddress optional)
- Error handling tracks API failures and gracefully degrades by returning
null- The catch ensures users aren't blocked if the API is unavailable
272-296: LGTM - Correctly handles both API failures and unsupported tokens.The conditional logic appropriately checks for both
null(API error) and empty array (unsupported chain/token), showing the deposit screen in either case. The tracking event provides detailed context including chain ID and token address, which will help diagnose issues.
| "thirdweb": minor | ||
| --- | ||
|
|
||
| Remove `Bridge.routes` and `useBridgeRoutes` |
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.
Use "major" version bump for breaking API removals.
Removing public APIs (Bridge.routes and useBridgeRoutes) is a breaking change and requires a major version bump, not minor. Additionally, the changeset description should clearly surface the breaking nature of this change.
Apply this diff to correct the version bump and improve the changeset description:
---
-"thirdweb": minor
+"thirdweb": major
---
-Remove `Bridge.routes` and `useBridgeRoutes`
+BREAKING: Remove `Bridge.routes` and `useBridgeRoutes` public APIsPer coding guidelines and learnings: patch for non‑API changes; major for breaking API removals. Breaking changes should be surfaced prominently in PR descriptions.
🤖 Prompt for AI Agents
In .changeset/rotten-apes-sing.md around lines 2 to 5, the changeset incorrectly
uses a "minor" bump while removing public APIs (Bridge.routes and
useBridgeRoutes); change the version bump from "minor" to "major" and update the
changeset body to explicitly state this is a breaking change that removes those
public APIs and list migration guidance (e.g., alternative APIs or removal
notice) so the breaking nature is clearly surfaced in the description.
size-limit report 📦
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8335 +/- ##
==========================================
- Coverage 54.89% 54.87% -0.03%
==========================================
Files 920 919 -1
Lines 60715 60653 -62
Branches 4129 4117 -12
==========================================
- Hits 33331 33283 -48
+ Misses 27282 27268 -14
Partials 102 102
🚀 New features to boost your workflow:
|
Merge activity
|
<!--
## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"
If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):
## Notes for the reviewer
Anything important to call out? Be sure to also clarify these in your comments.
## How to test
Unit tests, playground, etc.
-->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR focuses on removing the `Bridge.routes` functionality and the `useBridgeRoutes` hook from the codebase, along with related references and documentation updates in various files.
### Detailed summary
- Deleted `Routes.ts`, `Routes.test.ts`, and `useBridgeRoutes.ts` files.
- Removed references to `Bridge.routes` in multiple `.mdx` files and sidebar components.
- Updated `index.ts` to stop exporting `routes`.
- Adjusted `useSendTransactionCore` to use `Bridge.tokens` instead of `Bridge.routes`.
- Removed the `PriceComparator` class and associated methods for route comparison.
> ✨ 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
* **Breaking Changes**
* Removed the Bridge.routes API, which previously supported route discovery with filtering by chains and tokens, pagination, and sorting
* Removed the useBridgeRoutes React hook
* **Documentation**
* Removed documentation pages covering bridge route discovery and filtering functionality
* Removed related sidebar and guide navigation links
* **Tests**
* Removed test suites for removed APIs
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
c45070d to
c83f1c6
Compare

PR-Codex overview
This PR focuses on removing the
Bridge.routesfunctionality and theuseBridgeRouteshook from the codebase, along with associated documentation and references.Detailed summary
Routes.ts,Routes.test.ts,useBridgeRoutes.ts,useBridgeRoutes.test.ts, and related documentation.Get Routesin various*.mdfiles.index.tsto stop exportingroutes.useSendTransactionCoreto useBridge.tokensinstead ofBridge.routes.getAvailableRoutesmethod and related route comparison logic.Summary by CodeRabbit
Breaking Changes
Documentation
Tests