Skip to main content

Immutable X SDK

The Immutable X SDK is a Javascript package created by Immutable to allow simple interfacing with Immutable X’s API. The primarily used packages are Link SDK and the Immutable X Client.

The Immutable X Client is used for most backend operations, and the Link SDK is used for frontend, user-facing interactions.

The IMX Client ('ImmutableXClient') is a module wrapping the REST requests in a method call. Using this package, developers can make sure their calls are up to date with the latest API standards.

The Link SDK provides a clean popup and UI to help users navigate through the final signing process with their wallets. While information about current market state and assets can be derived with web requests, the Link SDK handles the more complicated stark signature signing most developers should not need to code. Using the Link SDK also maintains a unified view for users, allowing them to be more comfortable during signing when using marketplaces powered by Immutable X.

Applications monitoring the status of the assets will use the IMX Client to retrieve data. Marketplace and applications relying on user interaction will use both packages.

Setting up the SDK

Note: If you are using the latest version of 'create-react-app'...

You will encounter a bunch of webpack errors when you try use the @imbt/imx-sdk SDK with your app.

Follow this guide: How to resolve webpack errors

For this tutorial we will assume Yarn is being used as the package manager. The following node modules need to be added to the project:

yarn add @imtbl/imx-sdk

Importing the packages

The following imports are needed for the Link SDK and IMX Client packages:

import { ImmutableXClient, Link } from '@imtbl/imx-sdk';

Setting the connection urls

Immutable X provides connection addresses for both the mainnet and testnet. Here we will default to the mainnet for the examples, but show the testnet connection strings as well.

const linkAddress = '';
const apiAddress = '';

// Sandbox/Goerli Testnet
//const linkAddress = '';
//const apiAddress = '';

Once the Link SDK and IMX Client are imported, they can be initialized. Note that the client library initialization is asynchronous.

// Link SDK
const link = new Link(linkAddress);

// IMX Client
const client = await{ publicApiUrl: apiAddress });

For more details, see the Link SDK docs and the package on NPM.