# XpansionChain SDK - Typescript

## XpansionChain SDK - Typescript

This SDK provides access to a wide range of features allowing you to integrate your game with key blockchain functionality.

💡ROLLUPS THIS SDK SUPPORTS

* XpansionChain <mark style="color:blue;">X</mark>
* XpansionChain <mark style="color:blue;">zkEVM</mark>

CONTENTS

* <mark style="color:blue;">Installation</mark>
* <mark style="color:blue;">Initialization</mark>
* <mark style="color:blue;">Further documentation</mark>

***

📚SDK LINKS

* <mark style="color:blue;">npm package</mark>

### Installation[​](https://docs.x.immutable.com/docs/x/sdks/typescript#installation) <a href="#installation" id="installation"></a>

📋PREREQUISITES

* Node v18 or higher
* Ethers v6 or higher

#### Install the XpansionChain <mark style="color:blue;">SDK</mark>[​](https://docs.x.immutable.com/docs/x/sdks/typescript#install-the-immutable-sdk) <a href="#install-the-immutable-sdk" id="install-the-immutable-sdk"></a>

Run the following in the root directory of your project:

```
npm install -D @imtbl/sdk@alpha
# or
yarn add --dev @imtbl/sdk@alpha
```

TROUBLESHOOTING

The XpansionChain SDK is still in `alpha`. Should complications arise during the installation, please use the following commands to ensure the most recent release of the SDK is correctly installed:

```
rm -Rf node_modules
yarn cache clean
yarn
# or
rm -Rf node_modules
npm cache clean --force
npm i
```

#### Install Typescript dependencies:[​](https://docs.x.immutable.com/docs/x/sdks/typescript#install-typescript-dependencies) <a href="#install-typescript-dependencies" id="install-typescript-dependencies"></a>

```
# Typescript dependencies
npm install -D typescript
# or
yarn add --dev typescript

npm install -D ts-node
# or
yarn add --dev ts-node
```

### Initialization[​](https://docs.x.immutable.com/docs/x/sdks/typescript#initialization) <a href="#initialization" id="initialization"></a>

Each module of the XpansionChain SDK must be initialised with an instance of an XpansionChain`Configuration`. The XpansionChain`Configuration` defines configuration that is shared across modules, such as the current environment. An instance of an XpansionChain`Configuration` can be initialised as follows:

```
import { XpansionChainConfiguration, Environment } from '@imtbl/sdk';

const baseConfig = new XpansionChainConfiguration({
  environment: Environment.PRODUCTION,
});
```

💡ENVIRONMENTS

The `environment` argument can be one of the following:

| Environment Configuration | Description                                        |
| ------------------------- | -------------------------------------------------- |
| Environment.SANDBOX       | The default test network (currently, it is Goërli) |
| Environment.PRODUCTION    | The Ethereum mainnet network                       |

SDK modules can then be initialised as follows:

```
import { Passport, Provider } from '@imtbl/sdk';

const passport = new Passport({
  baseConfig,
  // Passport specific configuration
});

const provider = new Provider({
  baseConfig,
  // Provider specific configuration
});
```

### Further documentation[​](https://docs.x.immutable.com/docs/x/sdks/typescript#further-documentation) <a href="#further-documentation" id="further-documentation"></a>

* See the <mark style="color:blue;">Developer homepage</mark> for general information on building on XpansionChain.
* Build on XpansionChain zkEVM:
  * <mark style="color:blue;">Documentation</mark>
  * <mark style="color:blue;">API reference</mark>
  * <mark style="color:blue;">Support</mark>
* Build on XpansionChain:
  * <mark style="color:blue;">Documentation</mark>
  * <mark style="color:blue;">API reference</mark>
  * <mark style="color:blue;">Support</mark>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xpansionchain-1.gitbook.io/xpansionchain/sdks/xpansionchain-sdk-typescript.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
