SDK

Overview

The SDK is ideal for integrating cross-chain swaps, bridges, and deposits into applications that utilize JavaScript or Typescript, while the API can be used for similar purposes in a more language-agnostic manner.

Types

We recommend using the types from our npm package. If you are using our API without our SDK, you can find the types inside node_modules/@0xsquid/sdk/dist/types/index.d.ts after Installing our SDK

import { Token, ChainData } from '@0xsquid/sdk/dist/types'

Installing the SDK

From the terminal, install our SDK

npm install --save @0xsquid/sdk@2.8.0-beta.0 # or higher

Now in your typescript file

import { Squid } from "@0xsquid/sdk";

(async () => {
  // instantiate the SDK with config
   const squid = new Squid({
    baseUrl: "https://v2.api.squidrouter.com",
    integratorId: "your-integrator-id"
  });

  // init the SDK
  await squid.init();
  console.log("Squid inited");
})();

Next, explore the first Swap & Bridging with the Squid SDK to understand the fundamentals.

Last updated