Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/services/quotes/quote-sources/okx-dex-quote-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ const OKX_DEX_METADATA: QuoteSourceMetadata<OKXDexSupport> = {
name: 'OKX Dex',
supports: {
chains: SUPPORTED_CHAINS.map(({ chainId }) => chainId),
swapAndTransfer: false,
swapAndTransfer: true,
buyOrders: false,
},
logoURI: 'ipfs://QmarS9mPPLegvNaazZ8Kqg1gLvkbsvQE2tkdF6uZCvBrFn',
};
type OKXDexConfig = { apiKey: string; secretKey: string; passphrase: string };
type OKXDexSupport = { buyOrders: false; swapAndTransfer: false };
type OKXDexSupport = { buyOrders: false; swapAndTransfer: true };
type OKXDexData = { tx: SourceQuoteTransaction };
export class OKXDexQuoteSource implements IQuoteSource<OKXDexSupport, OKXDexConfig> {
getMetadata() {
Expand Down Expand Up @@ -134,19 +134,18 @@ async function calculateQuote({
buyToken,
order,
config: { slippagePercentage, timeout },
accounts: { takeFrom },
accounts: { takeFrom, recipient },
},
config,
}: QuoteParams<OKXDexSupport, OKXDexConfig>) {
const queryParams = {
chainId,
chainIndex: chainId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHY? xD

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷

amount: order.sellAmount.toString(),
fromTokenAddress: sellToken,
toTokenAddress: buyToken,
slippage: slippagePercentage / 100,
userWalletAddress: takeFrom,
referrerAddress: config.referrer?.address,
feePercent: config.referrer?.address ? 0 : undefined,
swapReceiverAddress: recipient,
};
const queryString = qs.stringify(queryParams, { skipNulls: true, arrayFormat: 'comma' });
const path = `/api/v5/dex/aggregator/swap?${queryString}`;
Expand Down Expand Up @@ -190,7 +189,7 @@ async function fetch({
['OK-ACCESS-SIGN']: base64,
};

const url = `https://www.okx.com${path}`;
const url = `https://web3.okx.com${path}`;
const response = await fetchService.fetch(url, { timeout, headers });
if (!response.ok) {
failed(OKX_DEX_METADATA, chainId, sellToken, buyToken, await response.text());
Expand Down