Skip to content

Commit 24113f6

Browse files
committed
fix: update OKX API URL and adjust parameter names for consistency
1 parent 87c75a9 commit 24113f6

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

packages/swap/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"scripts": {
1717
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
1818
"lint": "prettier --write .",
19-
"test": "vitest run"
19+
"test": "vitest run tests/okx*"
2020
},
2121
"engines": {
2222
"node": ">=14.15.0"

packages/swap/src/providers/okx/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { OKXQuoteResponse, OKXSwapResponse, OKXTokenInfo } from "./types";
4747
const logger = new DebugLogger("swap:okx");
4848
const DEFAULT_TOKEN_ACCOUNT_RENT_EXEMPTION = 2039280;
4949
const SOL_NATIVE_ADDRESS = "11111111111111111111111111111111";
50-
const OKX_API_URL = "https://partners.mewapi.io/okxswapv5";
50+
const OKX_API_URL = "https://partners.mewapi.io/okxswapv6";
5151
const OKX_TOKENS_URL = "/all-tokens";
5252
const OKX_QUOTE_URL = "/quote";
5353
const OKX_SWAP_URL = "/swap";
@@ -482,7 +482,7 @@ export class OKX extends ProviderClass {
482482
private async getOKXTokens(): Promise<OKXTokenInfo[]> {
483483
return retryRequest(async () => {
484484
const params = {
485-
chainId: "501", // Solana Chain ID
485+
chainIndex: "501", // Solana Chain ID
486486
};
487487

488488
const requestPath = OKX_TOKENS_URL;
@@ -526,7 +526,7 @@ export class OKX extends ProviderClass {
526526
const { srcMint, dstMint, amount } = params;
527527

528528
const quoteParams: Record<string, string> = {
529-
chainId: "501", // Solana Chain ID
529+
chainIndex: "501", // Solana Chain ID
530530
fromTokenAddress: srcMint.toBase58(),
531531
toTokenAddress: dstMint.toBase58(),
532532
amount: amount.toString(10),
@@ -729,12 +729,12 @@ export class OKX extends ProviderClass {
729729
// Build swap parameters with required and optional fields
730730
const swapParams: Record<string, string> = {
731731
// Required parameters
732-
chainId: "501", // Solana Chain ID - required for swap API
732+
chainIndex: "501", // Solana Chain ID - required for swap API
733733
amount: options.amount.toString(10),
734734
fromTokenAddress: swapSrcTokenAddress,
735735
toTokenAddress: swapDstTokenAddress,
736736
userWalletAddress: options.fromAddress,
737-
slippage: parseFloat(meta.slippage || DEFAULT_SLIPPAGE).toString(),
737+
slippagePercent: parseFloat(meta.slippage || DEFAULT_SLIPPAGE).toString(),
738738
swapMode: "exactIn",
739739

740740
// Solana-required parameters

0 commit comments

Comments
 (0)