Skip to main content

Setup


Install library

The Checkout SDK features are only available when the library is installed via a Package Manager such as npm or yarn.

Prerequisites

Node Version 20 or later
Immutable's Typescript SDK requires **Node v20** (Active LTS version) or **higher**. Node v20 can be installed via `nvm`.

To install nvm follow these instructions. Once installed, run:

nvm install --lts
  • (Optional) To enable Code Splitting (importing only the SDK modules you need) there are additional prerequisites.

Install the Immutable SDK

Run the following command in your project root directory.

npm install -D @imtbl/sdk
# if necessary, install dependencies
npm install -D typescript ts-node
Troubleshooting

The Immutable SDK is still in early development. If experiencing complications, use the following commands to ensure the most recent release of the SDK is correctly installed:

rm -Rf node_modules
npm cache clean --force
npm i

Initialisation

// Import the checkout module from the Immutable SDK package
import { checkout } from '@imtbl/sdk';

// Instantiate the Checkout SDKs with the default configurations
const checkoutSDK = new checkout.Checkout();

Further details on the Checkout class can be found in the Immutable SDK documentation.

Configuration

The following properties are configurations to correctly initialise the SDKs.

PropertyDescription
baseConfigApplication base configuration that specifies the application's environment. Default environment is SANDBOX.
swapConfigure the Swap feature (e.g. enable/disable).
bridgeConfigure the Bridge feature (e.g. enable/disable).
onRampConfigure the On-Ramp feature (e.g. enable/disable).
// Import the checkout and config modules from the Immutable SDK package
import { checkout, config } from '@imtbl/sdk';

// Create a new Immutable SDK configuration
const PUBLISHABLE_KEY = 'YOUR_PUBLISHABLE_KEY'; // Replace with your Publishable Key from the Immutable Hub

const baseConfig = {
environment: config.Environment.SANDBOX,
publishableKey: PUBLISHABLE_KEY,
};

// Instantiate the Checkout SDKs with the default configurations
const checkoutSDK = new checkout.Checkout({
baseConfig,
bridge: { enable: true },
onRamp: { enable: true },
swap: { enable: true },
// passport: <optionally add Passport instance>
});

IMX Whitepaper IMX Tokenomics Block Explorer Careers Contact Us