Skip to main content

General Questions

The @oraichain/lfg-client-js SDK is the official TypeScript/JavaScript client for interacting with the Oraichain LFG Perpetual DEX. It provides complete access to trading, market data, and account management.
The SDK supports:
  • Staging/Testnet: For development and testing with test tokens
  • Mainnet: For production trading with real assets
Access via Network.staging() and Network.mainnet().
  • Node.js 18+ or modern browser
  • TypeScript 5+ (recommended)
  • Internet connection for API access

Trading Questions

Use client.placeShortTermOrder() for quick orders or client.placeOrder() for long-term orders:
See the Orders Guide for details.
  • Short-term orders: Expire based on block height, lower gas, faster execution
  • Long-term orders: Expire based on timestamp, can stay on orderbook for days
Use short-term for HFT/market-making, long-term for position building.
Use client.cancelOrder() with the original client ID:

Account Questions

Subaccounts are isolated trading accounts under your wallet. Each has:
  • Separate collateral balance
  • Independent positions and orders
  • Risk isolation from other subaccounts
You can have up to 128 subaccounts (0-127).
Use client.depositToSubaccount():
See the Transfers Guide for details.
Query the Indexer:

Technical Questions

Implement retry logic:
Yes! The SDK works in modern browsers. However, never expose private keys in client-side code. Consider using a backend API for sensitive operations.
Create an API key wallet and use SubaccountInfo.forPermissionedWallet():
See the Wallets Guide for details.

Troubleshooting

Common reasons:
  • Price too far from market (limit order)
  • Insufficient liquidity
  • Order expired
Check market price and orderbook depth before placing orders.
You need more free collateral. Either:
  • Deposit more USDC
  • Close some positions
  • Reduce order size
Check: account.subaccount.freeCollateral
Common causes:
  • Insufficient gas
  • Expired block height
  • Network connectivity
  • Invalid parameters
Check error message and see Error Handling.

Error Handling

Common errors and solutions

Security

Security best practices

Discord Community

Get help from the community