Home

Environment Settings#

The following guide uses TypeScript as a reference.

Install the Following Libraries#

npm install @okx-dex/okx-dex-sdk
npm install dotenv

Create .env#

  1. You will always need your OKX API credentials. Put those in the .env file

OKX_API_KEY=
OKX_SECRET_KEY=
OKX_API_PASSPHRASE=
Explanation

Parameter values need to be obtained from the OKX developer platform

  1. Network dependencies

Import the required variables into the .env file based on the network you're interacting with. For example:

# Solana
SOLANA_WALLET_ADDRESS=
SOLANA_PRIVATE_KEY=
SOLANA_RPC_URL=
Explanation
  • SOLANA_RPC_URL: Paid RPC service is recommended to ensure stability.
  • It is recommended to manage private parameters (such as SOLANA_PRIVATE_KEY) through encryption.
Tip
  1. Use process.env to read environment variables
  2. Add .env to .gitignore to prevent sensitive information leakage
  3. When developing multiple chains, you can create environment configuration files such as .env.solana and .env.evm