Introduction

This document provides a practical guide for integrating with the INTMAX network using the intmax2-server-sdk and intmax2-client-sdk, complete with real code examples.

Each section covers key steps—from SDK installation and client initialization to login, token deposits and withdrawals, transaction history retrieval, and signature verification—enabling developers to build applications that leverage Intmax’s privacy-preserving features with ease.

By following the examples in order, you’ll gain an intuitive understanding of how to effectively use the INTMAX SDK in real-world scenarios.

How to Use intmax2-server-sdk

This guide provides step-by-step examples for using the intmax2-server-sdk to interact with the INTMAX network. It covers everything from setting up the client, performing login, to managing deposits, withdrawals, and transaction histories.

First Example

Installation

Install the SDK using your preferred package manager:

# npm
npm i intmax2-server-sdk

# yarn
yarn add intmax2-server-sdk

# pnpm
pnpm i intmax2-server-sdk

Initiate INTMAX Client

INTMAXClient is a core component of the INTMAX SDK that provides seamless interaction with the INTMAX network. This class simplifies the process of integrating applications with the INTMAX network, enabling developers to interact with both the mainnet and testnet environments effortlessly.

const { IntMaxNodeClient } = require('intmax2-server-sdk');
const client = new IntMaxNodeClient({
  environment: 'testnet',
  eth_private_key: process.env.ETH_PRIVATE_KEY,
  l1_rpc_url: process.env.L1_RPC_URL,
});

Retrieve INTMAX Private Key

Here is an example of retrieving the login status as well as the INTMAX PrivateKey. To communicate with the INTMAX network, you need to log in first.

const loginResponse = await client.login();
const isLoggedIn = client.isLoggedIn; // true
const privateKey = await client.getPrivateKey(); // 0x021...
const address = client.address; // 0x267...