|
|
@@ -187,6 +187,13 @@ export class JupiterSwapper {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /** 稳定币 mint:用 USDC 换这些币时无需 swap,直接视为已有 */
|
|
|
+ static STABLECOIN_MINTS = [
|
|
|
+ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
|
|
|
+ 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', // USDT
|
|
|
+ 'USD1ttGY1N17NEEHLmELoaybftRBUSErhqYiQzvEmuB', // USD1
|
|
|
+ ];
|
|
|
+
|
|
|
/**
|
|
|
* Swap a fixed USD amount of USDC into the output token (ExactIn).
|
|
|
* Uses valueUsd from calculation API - no ExactOut, no token amount.
|
|
|
@@ -201,6 +208,13 @@ export class JupiterSwapper {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ const mint = String(outputMint || '').trim();
|
|
|
+ const isStablecoin = JupiterSwapper.STABLECOIN_MINTS.includes(mint) || mint === USDC_MINT;
|
|
|
+ if (isStablecoin) {
|
|
|
+ logger.info(`Skip swap: output is stablecoin (USDC/USDT), no need to swap USDC -> same`);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
if (!this.apiKey) {
|
|
|
logger.error('═══════════════════════════════════════════════════');
|
|
|
logger.error('Jupiter API Key is required!');
|