Bridge and Swap tokens across any
chain, instantly
diff --git a/apps/dashboard/src/app/bridge/embed/layout.tsx b/apps/dashboard/src/app/bridge/widget/layout.tsx
similarity index 100%
rename from apps/dashboard/src/app/bridge/embed/layout.tsx
rename to apps/dashboard/src/app/bridge/widget/layout.tsx
diff --git a/apps/dashboard/src/app/bridge/embed/opengraph-image.png b/apps/dashboard/src/app/bridge/widget/opengraph-image.png
similarity index 100%
rename from apps/dashboard/src/app/bridge/embed/opengraph-image.png
rename to apps/dashboard/src/app/bridge/widget/opengraph-image.png
diff --git a/apps/dashboard/src/app/bridge/embed/page.tsx b/apps/dashboard/src/app/bridge/widget/page.tsx
similarity index 80%
rename from apps/dashboard/src/app/bridge/embed/page.tsx
rename to apps/dashboard/src/app/bridge/widget/page.tsx
index 3bee0a0c9dc..815686bbe1b 100644
--- a/apps/dashboard/src/app/bridge/embed/page.tsx
+++ b/apps/dashboard/src/app/bridge/widget/page.tsx
@@ -3,6 +3,7 @@ import { isAddress, NATIVE_TOKEN_ADDRESS } from "thirdweb";
import { UniversalBridgeEmbed } from "../(general)/components/client/UniversalBridgeEmbed";
import { bridgeStats } from "../(general)/data";
import "@workspace/ui/global.css";
+import type { SupportedFiatCurrency } from "thirdweb/react";
import { NEXT_PUBLIC_BRIDGE_IFRAME_CLIENT_ID } from "@/constants/public-envs";
import { BridgeProviders } from "../(general)/components/client/Providers.client";
@@ -38,15 +39,28 @@ export default async function Page(props: {
const buyChain = parse(searchParams.outputChain, onlyNumber);
const buyCurrency = parse(searchParams.outputCurrency, onlyAddress);
+ const persistTokenSelections =
+ parse(searchParams.persistTokenSelections, (v) =>
+ v === "false" ? "false" : "true",
+ ) || "true";
+
const theme =
parse(searchParams.theme, (v) => (v === "light" ? "light" : "dark")) ||
"dark";
+ const currency = parse(searchParams.currency, (v) =>
+ VALID_CURRENCIES.includes(v as SupportedFiatCurrency)
+ ? (v as SupportedFiatCurrency)
+ : undefined,
+ );
+
return (
(
value: string | string[] | undefined,
fn: (value: string) => T | undefined,
diff --git a/apps/portal/redirects.mjs b/apps/portal/redirects.mjs
index ac62178ca3c..1a87cbb4eab 100644
--- a/apps/portal/redirects.mjs
+++ b/apps/portal/redirects.mjs
@@ -1093,6 +1093,10 @@ const walletRefactorRedirects = {
"/typescript/v5/supported-wallets/:path*": "/wallets/external-wallets",
};
+const bridgeRedirects = {
+ "/bridge/bridge-widget-script": "/bridge/bridge-widget/script",
+};
+
/**
* @type {import('next').NextConfig['redirects']}
*/
@@ -1115,6 +1119,7 @@ export const redirects = async () => {
...createRedirects(glossaryRedirects),
...createRedirects(payRedirects),
...createRedirects(walletRefactorRedirects),
+ ...createRedirects(bridgeRedirects),
];
};
diff --git a/apps/portal/src/app/bridge/bridge-widget-script/bridge-widget-dark.png b/apps/portal/src/app/bridge/bridge-widget/bridge-widget-dark.png
similarity index 100%
rename from apps/portal/src/app/bridge/bridge-widget-script/bridge-widget-dark.png
rename to apps/portal/src/app/bridge/bridge-widget/bridge-widget-dark.png
diff --git a/apps/portal/src/app/bridge/bridge-widget-script/bridge-widget-light.png b/apps/portal/src/app/bridge/bridge-widget/bridge-widget-light.png
similarity index 100%
rename from apps/portal/src/app/bridge/bridge-widget-script/bridge-widget-light.png
rename to apps/portal/src/app/bridge/bridge-widget/bridge-widget-light.png
diff --git a/apps/portal/src/app/bridge/bridge-widget/iframe/iframe-code-preview.tsx b/apps/portal/src/app/bridge/bridge-widget/iframe/iframe-code-preview.tsx
new file mode 100644
index 00000000000..b390253c997
--- /dev/null
+++ b/apps/portal/src/app/bridge/bridge-widget/iframe/iframe-code-preview.tsx
@@ -0,0 +1,33 @@
+import { CodeBlock, Tabs, TabsContent, TabsList, TabsTrigger } from "@doc";
+
+export function IframeCodePreview(props: { src: string }) {
+ return (
+
+
+ Code
+ Preview
+
+
+ `}
+ lang="html"
+ />
+
+
+
+
+
+ );
+}
diff --git a/apps/portal/src/app/bridge/bridge-widget/iframe/page.mdx b/apps/portal/src/app/bridge/bridge-widget/iframe/page.mdx
new file mode 100644
index 00000000000..f7d0daf0ebc
--- /dev/null
+++ b/apps/portal/src/app/bridge/bridge-widget/iframe/page.mdx
@@ -0,0 +1,153 @@
+import {
+ Details,
+ createMetadata,
+ DocImage
+} from "@doc";
+import bridgeWidgetDark from "../bridge-widget-dark.png";
+import bridgeWidgetLight from "../bridge-widget-light.png";
+import { Tabs, TabsList, TabsTrigger, TabsContent } from "@doc";
+import { IframeCodePreview } from "./iframe-code-preview";
+
+export const metadata = createMetadata({
+ image: {
+ title: "Bridge widget iframe",
+ icon: "payments",
+ },
+ title: "Bridge widget iframe",
+ description: "Add a widget to add cross chain swaps and fiat onramp to your app using an iframe",
+});
+
+# Bridge widget iframe
+
+The Bridge widget iframe makes it easy to embed cross-chain swaps and fiat onramp UI into your app. Just add an iframe to your HTML and get a fully customizable widget - no build setup required.
+
+## Features
+- Cross-chain token swaps across 85+ blockchains
+- Fiat onramp support to buy tokens with credit/debit cards
+- dark and light mode support
+- Set custom default token selections using query parameters
+- Display fiat values in multiple currencies
+
+
+
+
+
+
+
+
+
+
+## Iframe Integration
+
+
+
+
+## Options
+
+You can customize theme, currencies, token selections etc using query parameters as mentioned below
+
+### Theme
+
+By default the widget uses the "dark" theme.
+
+You can set the light theme by passing the `theme=light` query parameter.
+
+
+
+
+### Change default token selections
+
+By default no tokens are selected in the widget UI.
+
+You can change the default token selections by using query parameters mentioned below:
+
+* `inputCurrency`, `inputChain` to set sell token.
+* `outputCurrency`, `outputChain` to set buy token.
+
+Chain parameter should be the chain id (eg. 1 for Ethereum Mainnet, 137 for Polygon Mainnet, 8453 for Base Mainnet, etc.)
+and currency parameter should be the token address. You can use [thirdweb chainlist](https://thirdweb.com/chainlist?service=pay) to find the chain id for a chain.
+
+To set native token of the chain,
+only specify the chain parameter and omit the currency parameter.
+
+
+#### Examples
+
+
+
+Set USDC on Base as the default sell token.
+
+
+
+
+
+
+
+Set Base native token as the default sell token.
+
+
+
+
+
+
+
+
+
+Set USDC on Base as the default sell token and USDC on Polygon as the default buy token.
+
+
+
+
+
+
+### Persist Token Selections
+
+By default, the widget saves the last used token selections to localStorage so that if the user revisits the widget later, last used tokens are selected by default. To disable this feature, you can set the `persistTokenSelections` query parameter to `false`.
+
+if the custom default token selection is specified using the query params mentioned above, it overrides the last used tokens to ensure that configuration specified in query params is always respected.
+
+
+
+
+### Currency
+
+By default the fiat value of the token amounts is displayed in USD.
+
+You can change the currency by setting the `currency` query parameter to the desired currency.
+
+
+
+- `USD` - US Dollar (default)
+- `EUR` - Euro
+- `GBP` - British Pound
+- `JPY` - Japanese Yen
+- `KRW` - Korean Won
+- `CNY` - Chinese Yuan
+- `INR` - Indian Rupee
+- `NOK` - Norwegian Krone
+- `SEK` - Swedish Krona
+- `CHF` - Swiss Franc
+- `AUD` - Australian Dollar
+- `CAD` - Canadian Dollar
+- `NZD` - New Zealand Dollar
+- `MXN` - Mexican Peso
+- `BRL` - Brazilian Real
+- `CLP` - Chilean Peso
+- `CZK` - Czech Koruna
+- `DKK` - Danish Krone
+- `HKD` - Hong Kong Dollar
+- `HUF` - Hungarian Forint
+- `IDR` - Indonesian Rupiah
+- `ILS` - Israeli New Sheqel
+- `ISK` - Icelandic Krona
+
+
+
+
+#### Example
+
+Show fiat values in Japanese Yen (JPY) in the widget.
+
+
+
+
diff --git a/apps/portal/src/app/bridge/bridge-widget/page.mdx b/apps/portal/src/app/bridge/bridge-widget/page.mdx
new file mode 100644
index 00000000000..84c413117c8
--- /dev/null
+++ b/apps/portal/src/app/bridge/bridge-widget/page.mdx
@@ -0,0 +1,61 @@
+import {
+ Details,
+ createMetadata,
+ DocImage
+} from "@doc";
+import bridgeWidgetDark from "./bridge-widget-dark.png";
+import bridgeWidgetLight from "./bridge-widget-light.png";
+import { ArticleIconCard, Grid } from "@doc";
+import { CodeIcon, FrameIcon } from "lucide-react";
+import { ReactIcon } from "@/icons";
+
+export const metadata = createMetadata({
+ image: {
+ title: "Bridge widget",
+ icon: "payments",
+ },
+ title: "Bridge widget",
+ description: "Add a widget to add cross chain swaps and fiat onramp to your app",
+});
+
+# Bridge widget
+
+The Bridge widget makes it easy to embed cross-chain swaps and fiat onramp UI into your app.
+
+
+
+
+
+
+
+
+
+
+## Get Started
+
+You can integrate the bridge widget into your website using an iframe, a script tag, or a React component
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/portal/src/app/bridge/bridge-widget/react/page.mdx b/apps/portal/src/app/bridge/bridge-widget/react/page.mdx
new file mode 100644
index 00000000000..a7ea3d25ac9
--- /dev/null
+++ b/apps/portal/src/app/bridge/bridge-widget/react/page.mdx
@@ -0,0 +1,83 @@
+import {
+ Details,
+ createMetadata,
+ DocImage
+} from "@doc";
+import bridgeWidgetDark from "../bridge-widget-dark.png";
+import bridgeWidgetLight from "../bridge-widget-light.png";
+import { Tabs, TabsList, TabsTrigger, TabsContent } from "@doc";
+import { ReactIcon } from "@/icons";
+import { ArticleIconCard } from "@doc";
+
+export const metadata = createMetadata({
+ image: {
+ title: "Bridge widget component",
+ icon: "payments",
+ },
+ title: "Bridge widget component",
+ description: "Add a widget to add cross chain swaps and fiat onramp to your app using a React component",
+});
+
+# Bridge widget component
+
+The Bridge widget component makes it easy to embed cross-chain swaps and fiat onramp UI into your app using thirdweb SDK.
+
+## Features
+- Cross-chain token swaps across 85+ blockchains
+- Fiat onramp support to buy tokens with credit/debit cards
+- Customizable UI - use prebuilt themes or override with your brand colors
+- Prefill token selections for a smoother user experience
+- Display fiat values in multiple currencies
+- Event callbacks to track user actions (success, error, cancel, disconnect)
+
+
+
+
+
+
+
+
+
+## Example
+
+You will need a thirdweb project client id to use the `BridgeWidget` component. You can get your clientId by creating a project in the [thirdweb dashboard](https://thirdweb.com/team).
+
+```tsx
+import { BridgeWidget } from "thirdweb/react";
+import { createThirdwebClient } from "thirdweb";
+
+const client = createThirdwebClient({
+ clientId: "YOUR_THIRDWEB_CLIENT_ID",
+});
+
+function Example() {
+ return (
+
+ );
+}
+```
+
+Make sure to wrap component containing `BridgeWidget` with the `ThirdwebProvider` component.
+
+```tsx
+import { ThirdwebProvider } from "thirdweb/react";
+
+function Example() {
+ return (
+
+
+
+ );
+}
+```
+
+## API Reference
+
+
\ No newline at end of file
diff --git a/apps/portal/src/app/bridge/bridge-widget-script/page.mdx b/apps/portal/src/app/bridge/bridge-widget/script/page.mdx
similarity index 95%
rename from apps/portal/src/app/bridge/bridge-widget-script/page.mdx
rename to apps/portal/src/app/bridge/bridge-widget/script/page.mdx
index d8ab12a9b5d..6073fbe374a 100644
--- a/apps/portal/src/app/bridge/bridge-widget-script/page.mdx
+++ b/apps/portal/src/app/bridge/bridge-widget/script/page.mdx
@@ -3,24 +3,23 @@ import {
createMetadata,
DocImage
} from "@doc";
-import bridgeWidgetDark from "./bridge-widget-dark.png";
-import bridgeWidgetLight from "./bridge-widget-light.png";
-
+import bridgeWidgetDark from "../bridge-widget-dark.png";
+import bridgeWidgetLight from "../bridge-widget-light.png";
export const metadata = createMetadata({
image: {
- title: "BridgeWidget Script",
+ title: "Bridge widget script",
icon: "payments",
},
- title: "Bridge Widget",
- description: "Add a widget to add cross swaps and fiat onramp to your app",
+ title: "Bridge widget script",
+ description: "Add a widget to add cross chain swaps and fiat onramp to your app using a script tag",
});
-# BridgeWidget Script
+# Bridge widget script
-The BridgeWidget Script makes it easy to embed cross-chain swaps and fiat onramp UI into your app. Just add a script tag to your HTML and get a fully customizable widget — no build setup required.
+The Bridge widget script makes it easy to embed cross-chain swaps and fiat onramp UI into your app. Just add a script tag to your HTML and get a fully customizable widget — no build setup required.
-## Key Features
+## Features
- Cross-chain token swaps across 85+ blockchains
- Fiat onramp support to buy tokens with credit/debit cards
- Customizable UI - use prebuilt themes or override with your brand colors
diff --git a/apps/portal/src/app/bridge/page.mdx b/apps/portal/src/app/bridge/page.mdx
index a8016ee3794..d2b6c73a93b 100644
--- a/apps/portal/src/app/bridge/page.mdx
+++ b/apps/portal/src/app/bridge/page.mdx
@@ -127,7 +127,8 @@ const preparedQuote = await Bridge.Buy.prepare({
### Create a Client
- First, create a client file for reuse throughout your app:
+ First, create a client file for reuse throughout your app. You can get your clientId by creating a project in the [thirdweb dashboard](https://thirdweb.com/team)
+
```typescript
// thirdwebClient.ts
diff --git a/apps/portal/src/app/bridge/sidebar.tsx b/apps/portal/src/app/bridge/sidebar.tsx
index d9312f1d428..41de118b6d5 100644
--- a/apps/portal/src/app/bridge/sidebar.tsx
+++ b/apps/portal/src/app/bridge/sidebar.tsx
@@ -26,8 +26,22 @@ export const sidebar: SideBar = {
name: "Swap Tokens",
},
{
- href: `${bridgeSlug}/bridge-widget-script`,
- name: "BridgeWidget Script",
+ name: "Bridge Widget",
+ href: `${bridgeSlug}/bridge-widget`,
+ links: [
+ {
+ href: `${bridgeSlug}/bridge-widget/iframe`,
+ name: "Iframe",
+ },
+ {
+ href: `${bridgeSlug}/bridge-widget/script`,
+ name: "Script",
+ },
+ {
+ href: `${bridgeSlug}/bridge-widget/react`,
+ name: "React Component",
+ },
+ ],
},
{
href: `${bridgeSlug}/fund`,
diff --git a/apps/portal/src/app/bridge/swap/page.mdx b/apps/portal/src/app/bridge/swap/page.mdx
index 43f30106c98..64a2d163122 100644
--- a/apps/portal/src/app/bridge/swap/page.mdx
+++ b/apps/portal/src/app/bridge/swap/page.mdx
@@ -307,7 +307,7 @@ async function swapEthToMatic(amount: string, userAccount: Account) {
-## Key Features
+## Features
- **Cross-chain swaps** - Exchange tokens across 50+ supported chains
- **Real-time quotes** - Get up-to-date pricing and execution estimates
diff --git a/apps/portal/src/components/others/Sidebar.tsx b/apps/portal/src/components/others/Sidebar.tsx
index 8728f1dbe38..863c0b5b92c 100644
--- a/apps/portal/src/components/others/Sidebar.tsx
+++ b/apps/portal/src/components/others/Sidebar.tsx
@@ -203,7 +203,7 @@ function DocSidebarCategory(props: {
"text-muted-foreground hover:text-foreground",
)}
>
-