Immutable X SDK

Install and configure the SDK

What is the 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

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 = 'https://link.x.immutable.com';
const apiAddress = 'https://api.x.immutable.com/v1';

// Ropsten Testnet
//const linkAddress = 'https://link.ropsten.x.immutable.com';
//const apiAddress = 'https://api.ropsten.x.immutable.com/v1';

Creating the Link objects

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 ImmutableXClient.build({ publicApiUrl: apiAddress });

More details can be found in the Immutable X SDK section and the package on NPM.


Did this page help you?