bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 27쪽 중 8쪽
eted without any reversions and the user has received the intended funds.
#### NEEDS\_GAS
This state is specific for Axelar transactions. If the gas price has spiked on the destination chain and execution cannot complete, Squid will return this status. The best user flow in this case is to send the user to Axelarscan to view the paused transaction.
#### ONGOING
There is nothing wrong, nothing to do, just relax and wait. The transaction should have an `estimatedRouteDuration` in seconds that you can read from the `/route` response. We generally recommend contacting support after either 15 minutes has passed, or double the `estimatedRouteDuration`, whichever is larger.
#### PARTIAL\_SUCCESS
This status indicates that the transaction has completed some of its steps. Currently, there is only one case that could cause this state. In the future there will be many, but we will provide more metadata around the `PARTIAL_SUCCESS`. For now, this is what has happened:
* The source chain transaction successfully executed, along with any swaps or contract calls.
* The destination chain transaction has executed, but reverted during execution. This is usually due to slippage on volatile assets, but if you are trying to buy an NFT or do some cross-chain staking, then it could indicate that the custom hook had a failure.
If there is a partial success, the user will have received the bridged token in their wallet on the destination chain. In most cases this is axlUSDC.
#### NOT\_FOUND
The Squid API cannot find an on-chain record of the transaction. This is usually due to our various services or service providers not having indexed the completed transaction. This state is often returned for 5-10 seconds after the transaction was executed, while chain indexing occurs.
This should not persist after maximum a few minutes (some chains such as Filecoin take a very long time to index, and for block inclusion). If it does, then get in touch with us on Discord.
#### REFUND
This status is specific to failed Squid Intents routes. When a Squid Intents transaction fails, the funds are automatically refunded on the source chain. This is the default behavior for Squid Intents routes when passing the user's address as the `fromAddress`.
**How Squid Intents refunds work:**
* Funds are always transferred from the `msg.sender` on the source chain (this could be the user for direct calls to Squid Intents, or a smart contract like Multicall)
* When refunded, funds are sent to the `order.fromAddress` which is encoded to the user, not the caller
* The `fromAddress` from the route request is used as the `order.fromAddress` for refunds
* This ensures that even if the transaction was initiated through a smart contract, the refund goes to the actual user
### How to Share Block Explorer Links
Generally, the best thing to do is to share `https://axelarscan.io/gmp/<txHash>` with a user.
With the caveat that if you are doing a transaction between two Cosmos chains, this link may not be correct. For now we simply recommend you always using this approach, we are upgrading our status capability and the status endpoint will always return the correct block explorer link to share.
### Response Parameters
The response includes detailed information about both source and destination chains, transaction URLs, timing data, and the current status.
#### Example Response
```json
{
"id": "0x7591aa38d646ac26b57f7235836cb7e7b63a32534bdd2e5dcecf06136744a94d",
"status": "success",
"gasStatus": "",
"isGMPTransaction": false,
"axelarTransactionUrl": "",
"fromChain": {
"transactionId": "0x7591aa38d646ac26b57f7235836cb7e7b63a32534bdd2e5dcecf06136744a94d",
"blockNumber": "339763809",
"callEventStatus": "",
"callEventLog": [],
"chainData": {
"id": "42161",
"chainId": "42161",
"networkIdentifier": "arbitrum",
"chainName": "Chain 42161",
"axelarChainName": "Arbitrum",
"type": "evm",
"networkName": "Arbitrum",
"nativeCurrency": {
"name": "Arbitrum",
"symbol": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/axelarnetwork/axelar-docs/main/public/images/chains/arbitrum.svg"
},
"chainIconURI": "https://raw.githubusercontent.com/0xsquid/assets/main/images/webp128/chains/arbitrum.webp",
"blockExplorerUrls": [
"https://arbiscan.io/"
],
"swapAmountForGas": "2000000",
"sameChainSwapsSupported": true,
"compliance": {
"trmIdentifier": "arbitrum"
},
"rpcList": [
"https://arb1.arbitrum.io/rpc"
],
"visible": true,
"chainNativeContracts": {
"wrappedNativeToken": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
"ensRegistry": "",
"multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
"usdcToken": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"
},
"feeCurrencies": [],
"currencies": [],
"features": []
},
"transactionUrl": "https://arbiscan.io/tx/0x7591aa38d646ac26b57f7235836cb7e7b63a32534bdd2e5dcecf06136744a94d"
},
"toChain": {
"transactionId": "0x4579e4df67994f4b1790d51c1586cbe79048dafd9c69467de1ecc887b4a25186",
"blockNumber": "30616439",
"callEventStatus": "",
"callEventLog": [],
"chainData": {
"id": "8453",
"chainId": "8453",
"networkIdentifier": "base",
"chainName": "Chain 8453",
"axelarChainName": "base",
"type": "evm",
"networkName": "Base",
"nativeCurrency": {
"name": "Base",
"symbol": "ETH",
"decimals": 18,
"icon": "https://raw.githubusercontent.com/axelarnetwork/axelar-docs/main/public/images/chains/base.svg"
},
"chainIconURI": "https://raw.githubusercontent.com/0xsquid/assets/main/images/chains/base.svg",
"blockExplorerUrls": [
"https://basescan.org/"
],
"swapAmountForGas": "2000000",
"sameChainSwapsSupported": true,
"rpcList": [
"https://developer-access-mainnet.base.org"
],
"visible": true,
"chainNativeContracts": {
"wrappedNativeToken": "0x4200000000000000000000000000000000000006",
"ensRegistry": "",
"multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
"usdcToken": "0x66627F389ae46D881773B7131139b2411980E09E"
},
"feeCurrencies": [],
"currencies": [],
"features": [],
"axelarFeeMultiplier": 150
},
"transactionUrl": "https://basescan.org/tx/0x4579e4df67994f4b1790d51c1586cbe79048dafd9c69467de1ecc887b4a25186"
},
"timeSpent": {
"total": 2
},
"routeStatus": [
{
"chainId": "42161",
"txHash": "0x7591aa38d646ac26b57f7235836cb7e7b63a32534bdd2e5dcecf06136744a94d",
"status": "success",
"action": "send"
},
{
"chainId": "8453",
"txHash": "0x4579e4df67994f4b1790d51c1586cbe79048dafd9c69467de1ecc887b4a25186",
"status": "success",
"action": "call"
}
],
"squidTransactionStatus": "success"
}
```
# Chains, Tokens & Prices
The Squid SDK provides utility methods for querying chain configurations, token data, and prices. These methods are available after calling `squid.init()`.
## Setup
```typescript
import { Squid } from "@0xsquid/sdk";
const squid = new Squid({
baseUrl: "https://v2.api.squidrouter.com",
integratorId: "your-integrator-id",
});
await squid.init();
// After init(), these properties are populated:
console.log(squid.chains.length); // e.g. 92 supported chains
console.log(squid.tokens.length); // e.g. 9689 supported tokens
```
***
## Chain Data
### `squid.chains`
After `init()`, the `chains` property contains an array of all supported chains.
### `squid.getChainData(chainId)`
Look up a specific chain by its chain ID.
```typescript
const chain = squid.getChainData("42161");
```
**Returns:**
```json
{
"chainId": "42161",
"chainName": "Chain 42161",
"networkName": "Arbitrum",
"chainType": "evm",
"nativeCurrency": {
"name": "Arbitrum",
"symbol": "ETH",
"decimals": 18,
"icon": "https://..."
},
"squidContracts": {
"squidRouter": "0xce16F69375520ab01377ce7B88f5BA8C48F8D666"
}
}
```
| Field | Type | Description |
| ---------------- | -------- | ------------------------------------------------------------------------------------ |
| `chainId` | `string` | Chain identifier |
| `chainName` | `string` | Internal chain name |
| `networkName` | `string` | Human-readable network name (e.g. `"Arbitrum"`, `"Ethereum"`) |
| `chainType` | `string` | Chain ecosystem: `"evm"`, `"cosmos"`, `"solana"`, `"bitcoin"`, `"xrpl"`, `"stellar"` |
| `nativeCurrency` | `object` | Native token details (name, symbol, decimals, icon) |
| `squidContracts` | `object` | Squid contract addresses on this chain (e.g. `squidRouter`) |
***
## Token Data
### `squid.tokens`
After `init()`, the `tokens` property contains an array of all supported tokens across all chains.
### `squid.getTokenData(address, chainId)`
Look up a specific token by its address and chain ID.
```typescript
const token = squid.getTokenData("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "1");
```
**Returns:**
```json
{
"symbol": "USDC",
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"chainId": "1",
"name": "USDC",
"decimals": 6,
"coingeckoId": "usd-coin",
"type": "evm",
"logoURI": "https://...",
"usdPrice": 0.9996
}
```
| Field | Type | Description |
| ------------- | -------- | -------------------------------------- |
| `symbol` | `string` | Token symbol |
| `address` | `string` | Token contract address |
| `chainId` | `string` | Chain ID |
| `name` | `string` | Full token name |
| `decimals` | `number` | Token decimal places |
| `coingeckoId` | `string` | CoinGecko identifier for price lookups |
| `type` | `string` | Chain type (e.g. `"evm"`) |
| `logoURI` | `string` | Token logo URL |
| `usdPrice` | `number` | Current USD price |
***
## Token Prices
### `squid.getTokenPrice({ tokenAddress, chainId })`
Get the current USD price for a single token.
```typescript
const price = await squid.getTokenPrice({
tokenAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
chainId: "1",
});
// Returns: 0.9996203987960182 (number)
```
**Returns:** `number` — The current USD price of the token.
### `squid.getMultipleTokensPrice({ chainId? })`
Get all tokens with their current USD prices, optionally filtered by chain ID.
```typescript
// Get prices for all tokens on Arbitrum
const tokens = await squid.getMultipleTokensPrice({ chainId: "42161" });
tokens.forEach(token => {
console.log(`${token.symbol}: $${token.usdPrice}`);
});
```
**Returns:** `Token[]` — An array of token objects, each including a `usdPrice` field.
### `squid.getFromAmount({ fromToken, toToken, toAmount })`
Estimate how much of a source token is needed to receive a specific amount of a destination token. Useful for "exact output" UIs.
```typescript
const fromAmount = await squid.getFromAmount({
fromToken: squid.getTokenData("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "1"),
toToken: squid.getTokenData("0xaf88d065e77c8cc2239327c5edb3a432268e5831", "42161"),
toAmount: "1000000", // 1 USDC (6 decimals)
});
// Returns: "1015000" (string — ~1.015 USDC needed, accounting for fees)
```
**Returns:** `string` — The estimated source amount in the token's smallest unit.
***
## Token Approval
### `squid.isRouteApproved({ route, sender })`
Check if the sender has approved the Squid router to spend the required source token amount.
```typescript
const { isApproved, message } = await squid.isRouteApproved({
route: routeResponse.route,
sender: "0x...",
});
if (!isApproved) {
console.log(message); // Describes what approval is needed
}
```
### `squid.approveRoute({ signer, route })`
Approve the Squid router to spend the source token. Required before executing ERC-20 swaps.
```typescript
const tx = await squid.approveRoute({
signer, // ethers.js Signer
route: routeResponse.route,
});
if (tx) {
await tx.wait(); // Wait for approval to be mined
}
```
# Key Concepts
## Overview
These concepts are functionalities that persist throughout Squid's Widget, API, and SDK that enable a seamless cross-chain experience for both users and developer. Please read through each feature to understand how they are implemented across Squid
## Squid Functionality
The functionality of the Squid boils down to **3 main functionalities**:
1. [**Route Requests**](/old-v2-documentation-deprecated/key-concepts/get-a-route)**(Fetching a Route):** Calculating the most optimized path from one asset to another.
2. [**Route Execution**](/old-v2-documentation-deprecated/key-concepts/execute-the-route)**:** The submission and execution of that path on chain.
3. [**Transaction Status**](/old-v2-documentation-deprecated/key-concepts/track-status)**:** The validation that the transaction has been completed.
There are **2 advanced functionalities** that enhance Squid's API capabilities:
1. [**Transaction Hooks**](https://docs.squidrouter.com/) **(Pre/Post):** Allow transactions to be prepended(prehook) or appended(posthook) to asset transfers for a user. Think unstaking then transferring an asset or transfering an asset across chain then staking.
2. [**Collecting Fees**](/old-v2-documentation-deprecated/key-concepts/collect-fees-1)**:** Always integrators to collect fees associated with transactions. Note, this function is currently not available for v2 yet.
## Transaction Types
When requesting a route, the API returns a `transactionType` field that determines how the transaction should be constructed and submitted on-chain. Different source chains use different transaction types. See [**Transaction Types**](/api-and-sdk-integration/key-concepts/transaction-types) for the full reference.
#### **A Note On Up-Time**
Squid aims for 100% up-time with multiple guardrails in place to prevent unintended downtime. If you believe Squid may be experiencing downtime you can check our [status page ](https://status.v2.api.squidrouter.com)to see if there are any outages.
# Squid Aggregator
The Squid Aggregator is the routing layer that connects users to the best cross-chain execution paths across the entire crypto ecosystem.
Instead of relying on a single bridge or liquidity source, Squid indexes multiple interoperability protocols, liquidity networks, and settlement systems. When a user submits an action, Squid determines the best route across these services to execute it quickly, securely, and efficiently.
Think of it as the connectivity layer of crypto.
Just like internet routers decide how packets move across networks, the Squid Aggregator decides how value moves across chains.
This architecture allows Squid to support swaps, contract calls, and complex cross-chain actions while abstracting away the complexity of fragmented infrastructure.
## Widget
# Squid Intents
Squid’s intent-based execution protocol designed for fast, solver-driven cross-chain settlement.
**What it enables**
* Intent-based swaps
* Solver auctions for optimal execution
* TEE-verified settlement
* Support for EVM and non-EVM chains
# Cosmos
Access liquidity and assets across the Cosmos ecosystem through IBC-connected chains.
**What it enables**
* Native Cosmos asset transfers
* IBC interoperability
* Access to Cosmos ecosystem liquidity
# CCTP
Circle’s **Cross-Chain Transfer Protocol** for native USDC transfers across supported chains.
**What it enables**
* Native USDC bridging
* Burn-and-mint settlement
* Reduced bridge risk
# Chainflip
A decentralized cross-chain liquidity protocol designed for native asset swaps.
**What it enables**
* Native asset swaps across chains
* BTC, ETH, and other non-EVM assets
* Decentralized liquidity routing
# Axelar
A decentralized interoperability network providing cross-chain messaging and execution.
**What it enables**
* General Message Passing (GMP)
* Cross-chain contract execution
* Access to all Axelar-connected ecosystems
# Layer Zero
A cross-chain messaging protocol designed to enable applications to communicate across multiple blockchains.
**What it enables**
* Cross-chain messaging between applications
* Omnichain application development
* Secure communication between supported chains
# Route Request Parameters
Building with Squid, fundamentally starts with requesting a route.
The `getRoute` type is used to define the parameters required for bridging assets between different blockchain networks.
```typescript
const params = {
fromChain: number | string; //the chainID assets are being bridged FROM
toChain: number | string; //the chainID assets are being bridged TO
fromToken: string; //the asset address being swapped FROM, "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" for native assets
toToken: string; // The asset address being swapped TO, "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" for native assets
fromAmount: string; // The unadjusted decimal amount of assets to send. Mutually exclusive with toAmount.
toAmount: string; // The unadjusted decimal amount of assets to receive (exact output). Mutually exclusive with fromAmount. Requires ExactOutputRouting feature flag.
fromAddress: string; // The address FROM which assets are being sent to be bridged
toAddress: string; // The address TO which bridged assets will be sent to
slippage: number; //OPTIONAL, If set it determines the max slippage across the route (0.01-99.99) 1 = 1% slippage.
quoteOnly: boolean; //OPTIONAL, If true, returns only a quote for the route. Omits transaction data needed for execution. Defaults to false
overrideGasRefundAddress: string; //OPTIONAL, For Axelar transactions, refund gas to a gas sponsor address on source chain
preHook: Hook; //OPTIONAL, Contract calls to execute on the source chain before bridging
postHook: Hook; //OPTIONAL, Contract calls to execute on the destination chain after bridging
};
```
## Parameter Summaries
| Parameter | Type | Required | Description |
| -------------------------- | ------------------ | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fromChain` | `number \| string` | Yes | The chain ID of the network from which assets are being bridged. |
| `toChain` | `number \| string` | Yes | The chain ID of the network to which assets are being bridged. |
| `fromToken` | `string` | Yes | The address of the asset being swapped from. Use `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` for native assets. |
| `toToken` | `string` | Yes | The address of the asset being swapped to. Use `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` for native assets. |
| `fromAmount` | `string` | One of `fromAmount` / `toAmount` | The unadjusted decimal amount of assets to send. Mutually exclusive with `toAmount`. |
| `toAmount` | `string` | One of `fromAmount` / `toAmount` | The unadjusted decimal amount of assets to receive (exact output). The system calculates the required `fromAmount`. Requires `ExactOutputRouting` feature flag. See [Exact Output](broken://pages/EtTOfm66wSSHbSk0W1Wx). |
| `fromAddress` | `string` | Yes | The address from which assets are being sent for bridging. |
| `toAddress` | `string` | Yes | The address to which bridged assets will be sent. |
| `slippage` | `number` | No | Maximum allowable slippage across the route (0.01–99.99). A value of 1 = 1% slippage. |
| `quoteOnly` | `boolean` | No | If `true`, returns only a price quote and estimated output without generating transaction call data. Useful for displaying estimated amounts to users before they commit. Defaults to `false`. **Note:** Submitting duplicate requests with the same wallet and `quoteOnly: false` is rate-limited. |
| `overrideGasRefundAddress` | `string` | No | For Axelar transactions, allows gas refunds to be sent to a gas sponsor address on the source chain instead of the sender. |
| `preHook` | `Hook` | No | Contract calls to execute on the source chain **before** bridging. See [Build a preHook](/api-and-sdk-integration/key-concepts/hooks/build-a-prehook). |
| `postHook` | `Hook` | No | Contract calls to execute on the destination chain **after** bridging. See [Build a postHook](/api-and-sdk-integration/key-concepts/hooks/build-a-프로젝트로 돌아가기