From 10ea7a4da34025f2097dfe2f63ba75635cef0e3d Mon Sep 17 00:00:00 2001 From: alexander-sei Date: Fri, 9 Jan 2026 03:28:13 +0100 Subject: [PATCH 1/3] Add in app swaps page --- content/evm/_meta.js | 1 + content/evm/in-app-swaps.mdx | 516 +++++++++++++++++++++++++++++++++++ 2 files changed, 517 insertions(+) create mode 100644 content/evm/in-app-swaps.mdx diff --git a/content/evm/_meta.js b/content/evm/_meta.js index fe7b1f5a..8905aa7c 100644 --- a/content/evm/_meta.js +++ b/content/evm/_meta.js @@ -27,6 +27,7 @@ export default { title: 'Sei Global Wallet' }, 'building-a-frontend': 'Building a Frontend', + 'in-app-swaps': 'In-App Swaps', '-- Smart Contracts': { type: 'separator', diff --git a/content/evm/in-app-swaps.mdx b/content/evm/in-app-swaps.mdx new file mode 100644 index 00000000..ea80ce82 --- /dev/null +++ b/content/evm/in-app-swaps.mdx @@ -0,0 +1,516 @@ +--- +title: 'In-App Swaps - Complete Integration Guide' +description: 'Comprehensive guide to integrating swap widgets into your Sei application. Learn how to embed Symphony, Swing, Squid, Thirdweb, and other swap solutions.' +keywords: + - swap widget + - in-app swaps + - token exchange + - dex integration + - symphony + - swing + - squid + - thirdweb +--- + +import { Callout, Tabs } from 'nextra/components'; + +# In-App Swaps Integration Guide + +Integrating in-app swap functionality into your Sei application enables users to exchange tokens directly within your platform, enhancing user experience and engagement. This guide covers a broad range of available swap widgets compatible with Sei that you can use to integrate into your dApp to enable in-app swaps. + +## Overview + +Swap widgets are embeddable UI components that abstract the complexity of interacting with decentralized exchanges (DEXs) and liquidity aggregators. They provide: + +- **Seamless UX**: Users can swap tokens without leaving your app +- **Reduced Friction**: No need to redirect users to external DEX interfaces +- **Revenue Opportunities**: Many providers offer fee-sharing mechanisms +- **Cross-Chain Support**: Some widgets enable bridging assets from other chains + +## Available Swap Widgets + +| Provider | Type | Cross-Chain | Integration | Best For | +| --------------------------------- | ---------- | ----------- | -------------- | -------------------------------- | +| [Symphony](#symphony-swap-widget) | Native DEX | ❌ | iframe | Simple Sei-native swaps | +| [Swing](#swing-widget) | Aggregator | ✅ | React/iframe | Cross-chain with 30+ networks | +| [Thirdweb](#thirdweb-payments) | Payments | ✅ | React | Full payment stack with onramps | +| [LI.FI](#lifi-widget) | Aggregator | ✅ | React/Web Comp | Extensive cross-chain routing | +| [deBridge](#debridge-widget) | Bridge | ✅ | iframe | Fast cross-chain transfers (DLN) | + +--- + +## Symphony Swap Widget + +[Symphony](https://symph.ag) is a native DEX on Sei, offering the simplest integration via iframe embedding. + +### Quick Start + +```html + +``` + +### Size Requirements + +- **Minimum Width**: `377px` +- **Minimum Height**: `650px` (recommended to prevent wallet modal scrolling) +- **Optimal Height**: `680-685px` + +### URL Parameters + +Customize the widget by appending query parameters: + +| Parameter | Description | Example | +| --------------- | ----------------------------- | ----------------------------------------------------- | +| `tokenIn` | Input token contract address | `tokenIn=0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392` | +| `tokenOut` | Output token contract address | `tokenOut=0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7` | +| `bgColor` | Background color | `bgColor=%23FFFFFF` or `bgColor=white` | +| `theme` | Widget theme | `theme=light` or `theme=dark` | +| `notifications` | Show notifications | `notifications=true` or `notifications=false` | + +For hex colors, use `%23` instead of `#` in the URL (e.g., `%23FFFFFF` for white). + +### Complete Example + + + +```html + +``` + + +```jsx +function SwapWidget() { + const tokenIn = "0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392"; + const tokenOut = "0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7"; + + return ( + +``` + +📚 [deBridge Documentation](https://docs.debridge.finance) + +--- + +## Best Practices + +### Security Considerations + +**Security Checklist** - ✅ Only use widgets from reputable, audited providers - ✅ Keep widget scripts updated to latest versions - ✅ Validate that iframe sources match official domains - ✅ Implement Content Security Policy (CSP) headers - ✅ Never expose API keys in client-side code (use environment variables) + +### Performance Optimization + +```tsx +// Lazy load swap widgets to improve initial page load +import dynamic from 'next/dynamic'; + +const SwapWidget = dynamic(() => import('./SwapWidget'), { + loading: () =>
, + ssr: false +}); +``` + +### Responsive Design + +```css +/* Ensure swap widgets are responsive */ +.swap-container { + width: 100%; + max-width: 420px; + margin: 0 auto; +} + +.swap-container iframe { + width: 100%; + min-height: 650px; + border: none; + border-radius: 12px; +} + +@media (max-width: 480px) { + .swap-container { + max-width: 100%; + padding: 0 16px; + } +} +``` + +### Error Handling + +```tsx +import { useState } from 'react'; + +function SwapWidgetWithFallback() { + const [error, setError] = useState(false); + + if (error) { + return ( +
+

Swap widget failed to load.

+ + Open Symphony directly → + +
+ ); + } + + return -``` - -📚 [deBridge Documentation](https://docs.debridge.finance) +| Token | Address | +| ------------- | ------------------------------------------------------------------------------------------------------------------------ | +| WSEI | [`0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7`](https://seiscan.io/address/0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7) | +| USDC (native) | [`0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392`](https://seiscan.io/address/0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392) | +| USDT0 | [`0x9151434b16b9763660705744891fA906F660EcC5`](https://seiscan.io/address/0x9151434b16b9763660705744891fA906F660EcC5) | --- @@ -402,7 +123,12 @@ You can configure and generate a widget via the [deBridge Widget Builder](https: ### Security Considerations -**Security Checklist** - ✅ Only use widgets from reputable, audited providers - ✅ Keep widget scripts updated to latest versions - ✅ Validate that iframe sources match official domains - ✅ Implement Content Security Policy (CSP) headers - ✅ Never expose API keys in client-side code (use environment variables) + +**Security Checklist** + +- ✅ Validate that iframe sources match official domains +- ✅ Implement Content Security Policy (CSP) headers + ### Performance Optimization @@ -414,7 +140,7 @@ const SwapWidget = dynamic(() => import('./SwapWidget'), { loading: () =>
, ssr: false }); -``` +```` ### Responsive Design @@ -466,51 +192,6 @@ function SwapWidgetWithFallback() { --- -## Comparison Matrix - -| Feature | Symphony | Swing | Thirdweb | LI.FI | deBridge | -| ---------------- | -------- | ----- | -------- | ----- | -------- | -| **Supports Sei** | ✅ | ✅ | ✅ | ✅ | ✅ | -| **Cross-Chain** | ❌ | ✅ | ✅ | ✅ | ✅ | -| **Fiat Onramp** | ❌ | ❌ | ✅ | ❌ | ❌ | -| **React SDK** | ❌ | ✅ | ✅ | ✅ | ❌ | -| **iframe** | ✅ | ✅ | ❌ | ❌ | ✅ | -| **Fee Sharing** | ❓ | ✅ | ✅ | ✅ | ✅ | - ---- - -## Choosing the Right Widget - -### Use Symphony if: - -- You only need Sei-native token swaps -- You want the simplest possible integration -- Your users are already on the Sei network - -### Use Swing or LI.FI if: - -- You need deep cross-chain swaps and aggregation -- Your users are coming from other networks -- You want robust React components with customization - -### Use Thirdweb if: - -- You need a complete payment solution -- You want fiat onramps + swaps in one widget -- You're building a full-featured dApp with other Thirdweb tools - -### Use deBridge if: - -- You prefer simple iframe integrations -- You need support for many chains -- You want fast cross-chain execution with DLN - ---- - ## Additional Resources - [Symphony Swap Widget Documentation](https://docs.symph.ag/widget/symphony-swap-widget) -- [Swing Widget Documentation](https://developers.swing.xyz/reference/widget) -- [Thirdweb Payments Documentation](https://portal.thirdweb.com/payments) -- [LI.FI Widget Docs](https://docs.li.fi/widget/overview) -- [deBridge Widget Builder](https://app.debridge.finance/widget) From 547ec0278aa8c92b1b39c9ad043f10db99a88e2d Mon Sep 17 00:00:00 2001 From: alexander-sei Date: Sat, 10 Jan 2026 13:24:07 +0100 Subject: [PATCH 3/3] Add demo --- content/evm/in-app-swaps.mdx | 46 ++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/content/evm/in-app-swaps.mdx b/content/evm/in-app-swaps.mdx index a433601f..85d72121 100644 --- a/content/evm/in-app-swaps.mdx +++ b/content/evm/in-app-swaps.mdx @@ -21,7 +21,7 @@ Swap widgets are embeddable UI components that abstract the complexity of intera ## Symphony Swap Widget -[Symphony](https://symph.ag) is a native DEX on Sei, offering the simplest integration via iframe embedding. +[Symphony](https://symph.ag) is a native DEX aggregator on Sei, offering the simplest integration via iframe embedding. ### Quick Start @@ -29,6 +29,12 @@ Swap widgets are embeddable UI components that abstract the complexity of intera ``` +### Live Demo + +
+