Swing Points Program is Live 🚀 Learn More →

Setup the Swing SDK

Swing enables secure, any blockchain to any blockchain communication to power multi-chain liquidity for applications.

The Swing SDK enables easy access to the Swing API, which allows you to find and execute the best multi-chain routes across major cross-chain bridges and exchanges.

Install @swing.xyz/sdk

The Swing SDK can be installed into your app using your favorite package manager.

yarn add @swing.xyz/sdk

Create a client

Import the SwingSDK from the package and create a new instance of the SwingSDK client.

import { SwingSDK } from '@swing.xyz/sdk';
 
const swingSDK = new SwingSDK({
  // Your Swing Platform project identifier
  projectId: 'swing-project-id',
 
  // Optionally enable the testnet Swing API
  // environment: 'production', // (or "testnet")
 
  // Optionally enable debug mode for verbose logging
  // debug: true,
});

Initialize the client

This method loads the SDK with all available chains, tokens and bridges.

await swingSDK.init();