bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 27쪽 중 1쪽
# Overview
The cheapest, fastest, most reliable cross-chain layer, routing value for 1,000+ integrators including MetaMask, Ripple, and MiniPay.
## What is Squid?
Squid is a single integration for seamless cross-chain swaps, bridges, and contract calls across 100+ chains, including EVM, Bitcoin, Solana, Ripple, Hedera, and Cosmos.
Whether you're building a wallet, DEX, DeFi protocol, or any application that needs cross-chain functionality, Squid provides the infrastructure to connect your users across blockchains.
### Key Highlights
* **100+ Chains Supported** — EVM, Cosmos, Bitcoin, Solana, Hedera, XRPL, and more
* **Sub-5 Second Execution** — powered by Squid Intents
* **$6B+ Volume Securely Routed** — across[ 4M+ transactions](https://axelarscan.io/interchain?contractAddress=0xce16f69375520ab01377ce7b88f5ba8c48f8d666)
* **Multiple Integration Options** — Widget, API, or SDK
* **Custom Contract Calls** — execute any on-chain action cross-chain via hooks
* **No MEV, Zero Slippage** — trades executed exactly as intended
## Build With Squid
Squid issues Integrator IDs on a limited basis upon review. [**Submit a partnership request**](https://squidrouter.typeform.com/partnerships) to request an Integrator ID, then explore how to build below:
<table data-card-size="large" data-column-title-hidden data-view="cards" data-full-width="false"><thead><tr><th align="center"></th><th data-hidden data-type="content-ref"></th><th data-hidden><select></select></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Explore Widgets</strong></td><td></td><td></td><td></td><td><a href="https://4247625265-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtXbXyuWIO2PwzNc5Dets%2Fuploads%2FW6DERvedJB22nAPkF0s7%2FCross-chain%20Swap%20Widget%20(1).png?alt=media&token=39b7cf4b-88b4-4c3c-9e7f-5e683d5e1f31">Cross-chain Swap Widget (1).png</a></td><td><a href="/widget-integration/add-a-widget">Add A Widget</a></td></tr><tr><td align="center"><strong>Explore API & SDK</strong></td><td></td><td></td><td></td><td><a href="https://4247625265-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtXbXyuWIO2PwzNc5Dets%2Fuploads%2FDwqgoVAax0HVJg3kVzQN%2FAPI%3ASDK.png?alt=media&token=926543e3-3eab-49c7-8a2c-9c21066f3260">API:SDK.png</a></td><td><a href="/api-and-sdk-integration/api">API</a></td></tr></tbody></table>
### Choose Your Integration
| Integration | Best For | Get Started |
| ----------- | ---------------------------------------------------- | --------------------------------------------------- |
| **Widget** | Fastest to integrate — drop-in cross-chain swap UI | [Explore Widgets](/widget-integration/add-a-widget) |
| **API** | Full control using any language or client | [API Docs](/api-and-sdk-integration/api) |
| **SDK** | JavaScript/TypeScript projects with helper utilities | [SDK Docs](/api-and-sdk-integration/sdk) |
## Squid's Integrators Include
See us in [Metamask](https://metamask.io/), [MiniPay (Opera)](https://minipay.to/), [Brave Browser](https://brave.com/wallet/), [Keplr](https://www.keplr.app/), [Valora](https://valora.xyz/), and [many others](https://www.squidrouter.com/ecosystem)!
Try a [cross-chain swap](https://app.squidrouter.com/) and see the speed for yourself!
# Integrator Quickstart
Create your first Squid cross-chain route request
### Step 1: Request an Integrator ID
Squid issues Integrator IDs on a limited basis and upon review. To get started:
1. Submit a [partnership request](https://squidrouter.typeform.com/partnerships) to request an Integrator ID.
2. Once reviewed and approved, the Squid team will follow up with your credentials.
Step 2: Make Your First Route Request
Replace `YOUR_INTEGRATOR_ID` in the following curl command with your actual integrator ID and replace `ADD_ADDRESS` with an address, then paste it into your terminal and hit enter:
```xml
curl -X POST 'https://v2.api.squidrouter.com/v2/route' \
-H 'x-integrator-id: YOUR_INTEGRATOR_ID' \
-H 'Content-Type: application/json' \
-d '{
"fromAddress": "ADD_ADDRESS",
"fromChain": "56",
"fromToken": "0x55d398326f99059fF775485246999027B3197955",
"fromAmount": "1000000000000000",
"toChain": "42161",
"toToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"toAddress": "ADD_ADDRESS"
}'
```
**Congrats, you've submitted your first route request!**
#### Parameter Explanation:
* `fromAddress`: The address initiating the swap (replace with your address)
* `fromChain`: The source chain ID (56 is BNB Chain)
* `fromToken`: The token address to swap from (USDT on BNB Chain in this example)
* `fromAmount`: The amount to swap (in the smallest unit of the token)
* `toChain`: The destination chain ID (42161 is Arbitrum)
* `toToken`: The token address to swap to (USDC on Arbitrum in this example)
* `toAddress`: The address receiving the swapped tokens
### Step 3: Interpret the Response
If successful, you'll receive a JSON response with the optimal route details. Key fields include:
* `route.estimate.toAmount`: Estimated amount you'll receive
* `route.estimate.feeCosts`: Breakdown of fees
* `route.transactionRequest`: Data needed to execute the swap
### Build With Squid
Now that you've created a route request. Choose how you want to build with Squid.
<div><figure><img src="https://4247625265-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtXbXyuWIO2PwzNc5Dets%2Fuploads%2F1dMwuKU2I7mP5iLYwXwk%2FWidget.png?alt=media&token=1cb7e224-c047-47b3-b5fd-b82c097b19f6" alt=""><figcaption></figcaption></figure> <figure><img src="https://4247625265-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtXbXyuWIO2PwzNc5Dets%2Fuploads%2FDwqgoVAax0HVJg3kVzQN%2FAPI%3ASDK.png?alt=media&token=926543e3-3eab-49c7-8a2c-9c21066f3260" alt=""><figcaption></figcaption></figure></div>
## **Squid’s Integrators Include**
# Add A Widget
Squid's widgets are the easiest way to integrate Squid functionality into the frontend of your app. They are extremely customizable from a theming and functionality point of view.
Squid currently supports:
* A cross-chain [**Swap Widget**](/widget-integration/add-a-widget/widget) that can be integrated via iFrame, React, Next.js or Vite.
* A cross-chain [**Deposit Widget**](/widget-integration/add-a-widget/deposit-widget) for accepting deposits and one-shot payments into a fixed destination address and token.
<figure><picture><source srcset="/files/Qf1331BubT2delstqwlI" media="(prefers-color-scheme: dark)"><img src="https://4247625265-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtXbXyuWIO2PwzNc5Dets%2Fuploads%2FW6DERvedJB22nAPkF0s7%2FCross-chain%20Swap%20Widget%20(1).png?alt=media&token=39b7cf4b-88b4-4c3c-9e7f-5e683d5e1f31" alt=""></picture><figcaption><p>Swap Widget</p></figcaption></figure>
<figure><img src="https://4247625265-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtXbXyuWIO2PwzNc5Dets%2Fuploads%2Fgit-blob-042815abaa79219bb4438fe173e8c640bc62b551%2FCross-chain%20Deposit%20Widget.png?alt=media" alt=""><figcaption><p>Deposit Widget</p></figcaption></figure>
Our new [Widget Studio](https://studio.squidrouter.com/) allows you to customize the widget to your branding specifications.
# Swap widget
### Introduction
Squid has a widget for cross-chain swaps which can be customized and installed by partners with ease.
The widget is a UI component that leverages Squid’s API and SDK, making it easy to implement cross-chain functionality into any front end with minimal dev effort. It’s perfect for projects who are looking to go cross-chain and want to expand to new users across different crypto ecosystems.
### Widget features
* Set default chains and tokens to onboard liquidity
* 100+ Supported Chains and thousands of supported tokens
* Widget Studio to Customize the theme for any brand
* Speed and security powered by Axelar
* Custom slippage parameters and Degen Mode
* Transaction history to view recent sessions
{% hint style="info" %}
💡 Check out Squid's [Widget Studio ](https://studio.squidrouter.com/)to customize and use the widget, live on mainnet.
{% endhint %}
<figure><img src="https://4247625265-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtXbXyuWIO2PwzNc5Dets%2Fuploads%2F864xhwGHuMIpzVbZ4o30%2FScreenshot%202024-10-08%20at%201.42.51%20PM.png?alt=media&token=0e74e927-10bf-43fd-8f26-dae876bf0a2a" alt=""><figcaption></figcaption></figure>
# Getting Started
Supported environments, chains, tokens and wallets
### Environments
The widget itself is made with [React](https://reactjs.org/). Which means you can import it as a component on [NextJS](https://nextjs.org/) and other classic react apps (for example create-react-apps).
We will roll out support to other frameworks in the future based on their demand.
You can also use it as an Iframe. Check out \[[Iframe Installation](/old-v2-documentation-deprecated/add-a-widget/widget/iframe-installation) ]\(../../../old-v2-documentation-deprecated/add-a-widget/widget/iframe-installation.md)for more information.
**Currently supported environments:**
* React
* Next.js
* Vite
The widget currently uses the following dependencies wagmi and ethers dependencies.
```
yarn add wagmi@^2.12.8 ethers@^6
```
### Examples
Example repos for all our supported integrations can be found on [GitHub](https://github.com/0xsquid/widget-integrations).
### Supported chains and tokens
For all supported chains and tokens, check out [Supported Chains and Tokens](/chains-and-tokens/get-supported-tokens-and-chains)
### Supported wallets
**EVM:** Metamask, Trust Wallet, XDEFI Wallet, Rabbi, Zerion, Coinbase Wallet, WalletConnect, Rainbow, Blockchain.com, Cosmostation, BitGet Wallet, OKX Wallet, Coin98, Defi Connect, Exodus
**Cosmos:** Keplr, XDEFI Wallet, Leap, Cosmostation, Cosmos Extension
# Installing the Widget
Preparing to integrate the widget into your app
## Installing the Squid Widget
### Prerequisites
Before installing the Squid Widget, ensure you have:
1. Registered for an Integrator ID with the Squid Team.
2. Node.js and npm (or yarn) installed on your system.
### Requesting an Integrator ID
Squid issues Integrator IDs on a limited basis and upon review. To request an Integrator ID for your widget integration:
1. Submit a [partnership request](https://squidrouter.typeform.com/partnerships) outlining your use case and integration plans.
2. A Squid team member will review your request and follow up regarding approval and credential issuance.
### Installation
#### Step 1: Install the package
Install the Squid Widget npm package using one of the following commands:
Using npm:
```bash
npm install @0xsquid/widget
```
Using yarn:
```bash
yarn add @0xsquid/widget
```
#### Step 2: Update dependencies (if necessary)
Squid v2.0 uses Wagmi v2 and ethers v6. If you have these packages in your project, update them:
```bash
yarn add wagmi@^2.12.8 ethers@^6
```
For more information on upgrading Wagmi, refer to the [official Wagmi upgrade guide](https://wagmi.sh/react/migration-guide).
### Next Steps
After installation, you'll need to integrate the widget into your project. We provide specific guides for different frameworks:
* [React Integration Guide](/widget-integration/add-a-widget/widget/react-installation)
* [NextJS Integration Guide](/widget-integration/add-a-widget/widget/nextjs-installation)
* [Vite Integration Guide](/widget-integration/add-a-widget/widget/vite-installation)
* [iFrame Integration Guide](/widget-integration/add-a-widget/widget/iframe-installation)
Choose the guide that matches your project's setup.
### Support
If you have any questions or need assistance, please join our [Discord server](https://discord.gg/squidrouter) and post in the **#⛛│developers** channel.
### Breaking Changes
Be aware that Squid v2.0 introduces several breaking changes, including:
* Updated API URL(v2.api)
* Renamed and removed properties
* New theming system
For details on breaking changes, see the [API Changelog](/changelog/api) and [SDK Changelog](/changelog/sdk).
# React Installation
Installing the React component
## React Installation Guide for Squid Widget
This guide will help you integrate the Squid Widget into your React application. For a complete working example, check out our full React example.
### Prerequisites
Ensure you have completed the steps in the Installing the Widget guide before proceeding.
### Basic Integration
After installing the npm package, follow these steps to add the widget to your React app:
1. Import the SquidWidget component:
```jsx
import { SquidWidget } from "@0xsquid/widget";
```
2. Add the widget to your component:
```jsx
function App() {
return (
<div className="App">
<SquidWidget
config={{
integratorId: "<your-integrator-id>",
apiUrl: "https://v2.api.squidrouter.com",
defaultTokensPerChain: [
{
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
chainId: "1",
},
],
initialAssets: {
from: {
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
chainId: "1",
},
to: {
address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
chainId: "42161",
},
},
}}
/>
</div>
);
}
```
Make sure to replace `<your-integrator-id>` with the Integrator ID you received from Squid.
### Customization
To customize the widget's appearance and behavior:
1. Use the Squid Widget Studio to generate a custom configuration.
2. Copy the generated config and paste it into your `config` prop.
For example:
```jsx
<SquidWidget
config={{
integratorId: "<your-integrator-id>",
apiUrl: "https://v2.api.squidrouter.com",
theme: {
// Your custom theme options here
},
themeType: "dark", // or "light"
// Other configuration options
}}
/>
```
### Advanced Configuration
For more detailed configuration options, explore the [Widget Studio](https://studio.squidrouter.com/).
### Troubleshooting
If you encounter any issues:
1. Ensure you're using the latest version of the widget (^3.0.10).
2. Check that you've updated to Wagmi v2 and ethers v6 if your project uses these dependencies.
3. Review the Migration Guide if you're upgrading from an earlier version.
# NextJS Installation
Integrating the widget into a NextJS app
This guide will help you integrate the Squid Widget into your NextJS application. For a complete working example, check out our[ **full NextJS example**](https://github.com/0xsquid/widget-integrations/tree/main/packages/squid-v2/nextjs/next-13).
We have also built a [**NextJS 14 example**](https://github.com/0xsquid/widget-integrations/tree/main/packages/squid-v2/nextjs/next-14#client-components)**.**
### Prerequisites
Ensure you have completed the steps in the[ Installing the Widget guide ](/widget-integration/add-a-widget/widget/installing-the-widget)before proceeding.
### Installation Steps
#### Step 1: Install Dependencies
Install the Squid Widget and necessary dependencies:
```bash
yarn add @0xsquid/widget@^3.0.10
```
#### Step 2: Configure NextJS
The configuration differs based on your NextJS version:
**For NextJS 13.1 and newer**
Add the following to your `next.config.js`:
```javascript
const nextConfig = {
transpilePackages: ["@0xsquid/widget", "@0xsquid/react-hooks"]
}
module.exports = nextConfig
```
**For NextJS versions older than 13.1**
1. Install the `next-transpile-modules` package:
```bash
yarn add next-transpile-modules
```
2. Update your `next.config.js`:
```javascript
const withTM = require("next-transpile-modules")(["@0xsquid/widget", "@0xsquid/react-hooks"]);
const nextConfig = {
// Your NextJS config
};
module.exports = withTM(nextConfig);
```
#### Step 3: Integrate the Widget
Add the Squid Widget to your desired page. For example, in `src/pages/index.tsx`:
```jsx
import { SquidWidget } from "@0xsquid/widget";
export default function Home() {
return (
<div>
<SquidWidget
config={{
integratorId: "<your-integrator-id>",
apiUrl: "https://v2.api.squidrouter.com",
// Add other configuration options here
}}
/>
</div>
);
}
```
Replace `<your-integrator-id>` with the Integrator ID you received from Squid.
### Customization
To customize the widget's appearance and behavior:
1. Use the[ **Squid Widget Studio**](https://studio.squidrouter.com/) to generate a custom configuration.
2. Copy the generated config and paste it into your `config` prop.
### Running Your NextJS App
After setting up the widget, you can start your NextJS development server:
```bash
yarn dev
```
### Troubleshooting
If you encounter any issues:
1. Ensure you're using the latest version of the widget (^3.0.10).
2. Check that you've correctly configured the `next.config.js` file.
3. Verify that you've added the correct `integratorId` and `apiUrl` in the widget config.
4. Review the Migration Guide if you're upgrading from an earlier version.
# Vite Installation
## Vite Installation Guide for Squid Widget
This guide will help you integrate the Squid Widget into your Vite + TypeScript project.
For a complete working example, check out our [**full Vite example**](https://github.com/0xsquid/widget-integrations/tree/main/packages/squid-v2/vite/vite-5.5-typescript).
### Prerequisites
Ensure you have the following installed:
* Node.js
* Yarn or npm
* Git (for cloning the example repository)
### Installation Steps
#### Step 1: Install Dependencies
First, install the Squid Widget and necessary dependencies:
```bash
yarn add @0xsquid/widget@^3.0.10
```
#### Step 2: Add Polyfills
Squid requires some polyfills for browser compatibility. Follow these steps to add them:
1. Install the `vite-plugin-node-polyfills` plugin:
```bash
yarn add vite-plugin-node-polyfills -D
```
2. Update your `vite.config.ts` file:
```typescript
import { defineConfig } from "vite"
import react from "@vitejs/plugin-react"
import { nodePolyfills } from "vite-plugin-node-polyfills"
export default defineConfig({
plugins: [
react(),
nodePolyfills()
]
})
```
#### Step 3: Integrate the Widget
Add the Squid Widget to your desired component. For example, in `src/App.tsx`:
```tsx
import { SquidWidget } from "@0xsquid/widget";
function App() {
return (
<div>
<SquidWidget
config={{
integratorId: "<your-integrator-id>",
apiUrl: "https://v2.api.squidrouter.com",
// Add other configuration options here
}}
/>
</div>
);
}
export default App;
```
Replace `<your-integrator-id>` with the Integrator ID you received from Squid.
### Running Your Vite App
After setting up the widget, you can start your Vite development server:
```bash
yarn dev
```
### Example Project
For a full working example, you can clone our example repository:
```bash
# Clone the repo
git clone https://github.com/0xsquid/widget-integrations.git
# Move to the Vite example folder
cd packages/squid-v2/vite/vite-5.5-typescript
# Install dependencies
yarn install
# Start the development server
yarn dev
```
### Customization
To customize the widget's appearance and behavior:
1. Use the [**Squid Widget Studio** ](https://studio.squidrouter.com/)to generate a custom configuration.
2. Copy the generated config and paste it into your `config` prop in the `SquidWidget` component.
### Troubleshooting
If you encounter any issues:
1. Ensure you're using the latest version of the widget (^3.0.10).
2. Verify that you've correctly configured the `vite.config.ts` file with the polyfills.
3. Check that you've added the correct `integratorId` and `apiUrl` in the widget config.
4. Make sure all dependencies are properly installed.
# Iframe Installation
Integrating the widget as an Iframe
## Squid Widget iFrame Integration Guide
While the Squid Widget is primarily designed as a React component, you can integrate it into other frontend frameworks (such as Vue, Angular, etc.) using an iframe. This guide will walk you through the process of setting up 프로젝트로 돌아가기