Skip to main content

Network Configuration

The SDK provides pre-configured network settings for different environments. Understanding how to configure these properly is essential for connecting to the correct chain.

Built-in Networks

The SDK includes two pre-configured networks:
Use staging for development and testing:
import { Network } from "@oraichain/lfg-client-js";

const network = Network.staging();

// Network properties
console.log(network.chainId);          // "lfg-staging-1"
console.log(network.indexerConfig);    // Indexer endpoints
console.log(network.validatorConfig);  // Validator endpoints
Staging network uses test tokens with no real value. Perfect for development.

Custom Network Configuration

For advanced use cases, you can create a custom network configuration with your own RPC endpoints.

IndexerConfig

The Indexer provides read-only access to market data and account information:
import { IndexerConfig } from "@oraichain/lfg-client-js";

const indexerConfig = new IndexerConfig(
  "https://indexer.lfg.land/v4", // REST endpoint
  "wss://indexer.lfg.land/v4/ws" // WebSocket endpoint
);

ValidatorConfig

The Validator handles transaction submission and blockchain queries:
import { ValidatorConfig } from "@oraichain/lfg-client-js";

const validatorConfig = new ValidatorConfig(
  "https://rpc.lfg.land", // RPC endpoint
  "lfg-mainnet-1", // Chain ID
  {
    CHAINTOKEN_DENOM: "uorai", // Native token denom
    USDC_DENOM: "ibc/...", // USDC denom
    USDC_GAS_DENOM: "uusdc", // Gas denom
    USDC_DECIMALS: 6, // USDC decimals
    CHAINTOKEN_DECIMALS: 6, // Chain token decimals
  },
  undefined, // Optional: custom denominations
  "My Trading Bot v1.0" // User agent
);

Chain Configuration Reference

Staging Network

PropertyValue
Chain IDlfg-staging-1
Address Prefixlfg
Indexer RESThttps://indexer-staging.lfg.land/v4
Indexer WebSocketwss://indexer-staging.lfg.land/v4/ws
RPC Endpointhttps://rpc-staging.lfg.land
USDC Decimals6

Mainnet Network

PropertyValue
Chain IDlfg-mainnet-1
Address Prefixlfg
Indexer RESThttps://indexer.lfg.land/v4
Indexer WebSocketwss://indexer.lfg.land/v4/ws
RPC Endpointhttps://rpc.lfg.land
USDC Decimals6

Next Steps