Skip to main content

Prerequisites

Before installing the SDK, ensure your development environment meets these requirements:

Node.js

Version 18.0.0 or higher

TypeScript

Version 5.0.0 or higher (recommended)
We recommend using Node.js 18 LTS or later for the best compatibility and performance.

Package Manager Installation

Install the SDK using your preferred package manager:
bash npm install @oraichain/lfg-client-js

Verify Installation

Create a test file to verify the installation:
test.ts
import { Network, CompositeClient } from "@oraichain/lfg-client-js";

async function testInstallation() {
  try {
    const network = Network.staging();
    const client = await CompositeClient.connect(network);
    console.log("✅ SDK installed successfully!");
    console.log("Connected to:", network.chainId);
  } catch (error) {
    console.error("❌ Installation test failed:", error);
  }
}

testInstallation();
Run the test:
npx tsx test.ts
If you see “SDK installed successfully!”, the installation is complete and working correctly.

TypeScript Configuration

For optimal TypeScript support, add these settings to your tsconfig.json:
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "lib": ["ES2020"],
    "moduleResolution": "node",
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "declaration": true,
    "outDir": "./dist"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

Dependencies

The SDK automatically installs these peer dependencies:
PackagePurpose
@cosmjs/proto-signingTransaction signing
@cosmjs/stargateCosmos SDK integration
bignumber.jsPrecise decimal math
long64-bit integer support
You don’t need to manually install these dependencies - they’re included automatically.

Optional Tools

Consider installing these tools to enhance your development experience:
Execute TypeScript files directly without compilation:
npm install -D tsx
Usage:
npx tsx your-script.ts
Manage API keys and secrets securely:
npm install dotenv
Usage:
import 'dotenv/config';
const privateKey = process.env.PRIVATE_KEY;
Type definitions for Node.js APIs:
npm install -D @types/node

Next Steps

Now that the SDK is installed, you’re ready to start building: