Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 92f41d0

Browse files
committed
add swap route coin
1 parent 9b549b8 commit 92f41d0

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/utils/swap.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,27 @@ export function getSwapOutAmountStable(
279279
}
280280

281281
export function getSwapRouter(poolInfos: LiquidityPoolInfo[], fromCoinMint: string, toCoinMint: string) {
282-
const routerCoinDefault = ['USDC', 'RAY', 'SOL', 'WSOL', 'mSOL', 'PAI', 'stSOL']
282+
const routerCoinDefault = [
283+
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
284+
'4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', // RAY
285+
'11111111111111111111111111111111', // SOL
286+
'So11111111111111111111111111111111111111112', // WSOL
287+
'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So', // mSOL
288+
'Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS', // PAI
289+
'7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj', // stSOL
290+
'USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX', // USDH
291+
'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB' // USDT
292+
]
283293
const ret: [LiquidityPoolInfo, LiquidityPoolInfo][] = []
284294
const avaPools: LiquidityPoolInfo[] = []
285295
for (const p of poolInfos) {
286296
if (!([4, 5].includes(p.version) && p.status === 1)) continue
287-
if ([fromCoinMint, toCoinMint].includes(p.coin.mintAddress) && routerCoinDefault.includes(p.pc.symbol)) {
297+
if ([fromCoinMint, toCoinMint].includes(p.coin.mintAddress) && routerCoinDefault.includes(p.pc.mintAddress)) {
288298
avaPools.push(p)
289-
} else if ([fromCoinMint, toCoinMint].includes(p.pc.mintAddress) && routerCoinDefault.includes(p.coin.symbol)) {
299+
} else if (
300+
[fromCoinMint, toCoinMint].includes(p.pc.mintAddress) &&
301+
routerCoinDefault.includes(p.coin.mintAddress)
302+
) {
290303
avaPools.push(p)
291304
}
292305
}

0 commit comments

Comments
 (0)