Quick Start

The Quick Start section is intended to give you a preview of the implementations of Squid's SDK, API, and Widget.

Remember you must have an integrator-id to be able to implement one of these applications.

Example of a cross-chain swap from Avalanche-AVAX to Polygon-MATIC.

First, install the Squid SDK and Squid types:

npm i @0xsquid/sdk@2.8.0-beta.0 @0xsquid/squid-types # 2.8.0-beta.0 
import { Squid } from "@0xsquid/sdk"
import { ethers } from "ethers"
const userAddress = "<your address>"
const integratorId = "<your integrator id>"
const squid = new Squid({
  baseUrl: "https://v2.api.squidrouter.com",
  integratorId: integratorId
// initialize the Squid client
await squid.init()
const { route } = await squid.getRoute({
  fromChain: "43114", // Avalanche
  fromAmount: "10000000000000000", // 0.1 AVAX
  fromToken: "0xEEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
  toChain: "137", // Polygon
  toToken: "0xEEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
  fromAddress: userAddress,
  toAddress: userAddress,
  slippageConfig: {
autoMode: 1 }
const privateKey = "<your private key>"
const rpcUrl = "https://avalanche.drpc.org" // fromChain RPC URL
const provider = new ethers.JsonRpcProvider(rpcUrl)
const signer = new ethers.Wallet(privateKey, provider)
const result = await squid.executeRoute({
signer })

Last updated