Installation
This guide explains how to integrate the Cross SDK into a React application step by step.
1. Project Setup
1.1 Prepare Your Project
- Make sure your JavaScript-based project is ready to use the Cross SDK.
1.2 Configure GitHub Package Registry
Create a .npmrc
file in the root of your project and add the following settings:
registry=https://registry.npmjs.org/
@to-nexus:registry=https://package.cross-nexus.com/repository/cross-sdk-js/
1.3 Install the Cross SDK
Install the Cross SDK in your project:
npm install @to-nexus/sdk
yarn add @to-nexus/sdk
pnpm add @to-nexus/sdk
2. Set Environment Variables
Create a .env
file and add the required environment variables:
VITE_PROJECT_ID=your_project_id_here
VITE_NODE_ENV=production
PROJECT_ID=your_project_id_here
NODE_ENV=production
projectId
is required. You must use a valid project ID.
If you don’t have one, please contact the Cross team.nodeEnv
is required and must be set toproduction
:production
: Production environment for general usersdevelopment
: For CROSS chain developers only (developer permission required)
3) SDK Initialization
3.1 Initialize the SDK
Initialize the SDK in the entry point of your application:
import {
initCrossSdk,
} from '@to-nexus/sdk/react'
const projectId = "your_project_id_here"
initCrossSdk(projectId)
Updated 2 days ago