Skip to main content
Version: v1

Setup

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​

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

// Instantiate the Checkout SDKs with the default configurations
export 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).
Custom setupView on GitHub
// Import the checkout and config modules from the Immutable SDK package
import { checkout, config } from '@imtbl/sdk';

// Create a new Immutable SDK configuration

// Replace with your Publishable Key from the Immutable Hub
const PUBLISHABLE_KEY = process.env.NEXT_PUBLIC_PUBLISHABLE_KEY ?? ''

// Set the environment to SANDBOX for testnet or PRODUCTION for mainnet
const baseConfig = {
environment: config.Environment.SANDBOX,
publishableKey: PUBLISHABLE_KEY,
};

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