four-flap-meme-sdk 1.3.52 → 1.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,7 +22,7 @@ export declare const DIRECT_ROUTERS: {
|
|
|
22
22
|
readonly WMON: "0x3bd359c1119da7da1d913d1c4d2b7c461115433a";
|
|
23
23
|
};
|
|
24
24
|
readonly XLAYER: {
|
|
25
|
-
readonly POTATOSWAP_V2: "
|
|
25
|
+
readonly POTATOSWAP_V2: "0x881fb2f98c13d521009464e7d1cbf16e1b394e8e";
|
|
26
26
|
readonly POTATOSWAP_V3: "0xB45D0149249488333E3F3f9F359807F4b810C1FC";
|
|
27
27
|
readonly V3_ROUTER: "0xBB069e9465BcabC4F488d21e793BDEf0F2d41D41";
|
|
28
28
|
readonly V3_FACTORY: "0xa1415fAe79c4B196d087F02b8aD5a622B8A827E5";
|
|
@@ -33,12 +33,13 @@ export const DIRECT_ROUTERS = {
|
|
|
33
33
|
// Wrapped Native
|
|
34
34
|
WMON: '0x3bd359c1119da7da1d913d1c4d2b7c461115433a',
|
|
35
35
|
},
|
|
36
|
-
// ✅
|
|
36
|
+
// ✅ XLayer (PotatoSwap)
|
|
37
37
|
XLAYER: {
|
|
38
|
-
// PotatoSwap -
|
|
39
|
-
POTATOSWAP_V2: '
|
|
40
|
-
|
|
41
|
-
// V3
|
|
38
|
+
// PotatoSwap V2 Router - 标准 Uniswap V2 风格,支持 swapExactTokensForETHSupportingFeeOnTransferTokens
|
|
39
|
+
POTATOSWAP_V2: '0x881fb2f98c13d521009464e7d1cbf16e1b394e8e', // ✅ 真正的 V2 Router
|
|
40
|
+
// PotatoSwap SwapRouter02 - V3 风格,支持 multicall
|
|
41
|
+
POTATOSWAP_V3: '0xB45D0149249488333E3F3f9F359807F4b810C1FC', // SwapRouter02 (V3 风格)
|
|
42
|
+
// V3 专用 Router
|
|
42
43
|
V3_ROUTER: '0xBB069e9465BcabC4F488d21e793BDEf0F2d41D41',
|
|
43
44
|
V3_FACTORY: '0xa1415fAe79c4B196d087F02b8aD5a622B8A827E5',
|
|
44
45
|
// Wrapped Native
|
|
@@ -281,10 +282,12 @@ async function buildProfitTransaction(wallet, profitAmountWei, nonce, gasPrice,
|
|
|
281
282
|
function isSwapRouter02(chain, routerAddress) {
|
|
282
283
|
const chainUpper = chain.toUpperCase();
|
|
283
284
|
const addrLower = routerAddress.toLowerCase();
|
|
284
|
-
// ✅ 只有 XLayer PotatoSwap SwapRouter02 走这个逻辑
|
|
285
|
-
|
|
285
|
+
// ✅ 只有 XLayer PotatoSwap SwapRouter02 (V3 风格) 走这个逻辑
|
|
286
|
+
// 注意:POTATOSWAP_V2 现在是真正的 V2 Router,不需要 SwapRouter02 逻辑
|
|
287
|
+
if (chainUpper === 'XLAYER' && addrLower === DIRECT_ROUTERS.XLAYER.POTATOSWAP_V3.toLowerCase()) {
|
|
286
288
|
return true;
|
|
287
289
|
}
|
|
290
|
+
// ❌ XLayer POTATOSWAP_V2 (0x881fb...) 是标准 V2 Router,不走 SwapRouter02 逻辑
|
|
288
291
|
// ❌ BSC V2 交易使用传统 PancakeSwap V2 Router,不走 SwapRouter02 逻辑
|
|
289
292
|
// ❌ Monad V2 交易使用传统 V2 Router,不走 SwapRouter02 逻辑
|
|
290
293
|
return false;
|
|
@@ -491,29 +494,30 @@ export async function directV2BatchSell(params) {
|
|
|
491
494
|
if (useSwapRouter02) {
|
|
492
495
|
// ✅ SwapRouter02: 使用 multicall(deadline, bytes[]) 组合调用
|
|
493
496
|
//
|
|
494
|
-
//
|
|
495
|
-
//
|
|
496
|
-
//
|
|
497
|
+
// 重要:SwapRouter02 的 V2 swapExactTokensForTokens 直接把代币发给 to 地址
|
|
498
|
+
// 如果需要 ETH,把 WETH 发给 Router,然后调用 unwrapWETH9
|
|
499
|
+
//
|
|
500
|
+
// 根据合约源码,address(2) = ADDRESS_THIS = Router 合约自己
|
|
497
501
|
const ADDRESS_THIS = '0x0000000000000000000000000000000000000002';
|
|
498
|
-
const MSG_SENDER = '0x0000000000000000000000000000000000000001';
|
|
499
502
|
if (useNativeOutput) {
|
|
500
|
-
// 代币 -> ETH:
|
|
503
|
+
// 代币 -> ETH:
|
|
504
|
+
// 方案1:swapExactTokensForTokens(to=Router) + unwrapWETH9
|
|
505
|
+
// 方案2:直接发 WETH 给用户(用户需要手动 unwrap)
|
|
501
506
|
//
|
|
502
|
-
//
|
|
503
|
-
|
|
504
|
-
// 最后 unwrapWETH9 把 WETH 解包为 ETH 发给用户
|
|
507
|
+
// 使用方案1:发送到 Router 地址(真实地址,不是 address(2))
|
|
508
|
+
const routerRealAddress = routerAddress; // SwapRouter02 的真实地址
|
|
505
509
|
const multicallData = [];
|
|
506
|
-
// 1. swapExactTokensForTokens - 从用户转代币,换成 WETH
|
|
510
|
+
// 1. swapExactTokensForTokens - 从用户转代币,换成 WETH 发到 Router 真实地址
|
|
507
511
|
const swapData = routerIface.encodeFunctionData('swapExactTokensForTokens', [
|
|
508
512
|
sellAmount,
|
|
509
513
|
0n, // amountOutMin
|
|
510
514
|
path, // path: [token, ..., WETH]
|
|
511
|
-
ADDRESS_THIS, // to = address(2)
|
|
515
|
+
ADDRESS_THIS, // to = address(2),让 Router 接收 WETH
|
|
512
516
|
]);
|
|
513
517
|
multicallData.push(swapData);
|
|
514
518
|
// 2. unwrapWETH9 - 将 Router 中的 WETH 解包为 ETH 发送给用户
|
|
515
519
|
const unwrapData = routerIface.encodeFunctionData('unwrapWETH9(uint256,address)', [
|
|
516
|
-
0n, // amountMinimum
|
|
520
|
+
0n, // amountMinimum = 0,接受任意数量
|
|
517
521
|
wallet.address, // recipient = 用户
|
|
518
522
|
]);
|
|
519
523
|
multicallData.push(unwrapData);
|
|
@@ -53,7 +53,8 @@ export declare const ADDRESSES: {
|
|
|
53
53
|
readonly FlapPortal: "0xb30D8c4216E1f21F27444D2FfAee3ad577808678";
|
|
54
54
|
readonly WOKB: "0xe538905cf8410324e03a5a23c1c177a474d59b2b";
|
|
55
55
|
readonly Multicall3: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
56
|
-
readonly PotatoSwapV2Router: "
|
|
56
|
+
readonly PotatoSwapV2Router: "0x881fb2f98c13d521009464e7d1cbf16e1b394e8e";
|
|
57
|
+
readonly PotatoSwapSwapRouter02: "0xB45D0149249488333E3F3f9F359807F4b810C1FC";
|
|
57
58
|
readonly PotatoSwapV3Router: "0xBB069e9465BcabC4F488d21e793BDEf0F2d41D41";
|
|
58
59
|
readonly PotatoSwapV3Factory: "0xa1415fAe79c4B196d087F02b8aD5a622B8A827E5";
|
|
59
60
|
readonly USDT: "0x1e4a5963abfd975d8c9021ce480b42188849d41d";
|
package/dist/utils/constants.js
CHANGED
|
@@ -52,7 +52,8 @@ export const ADDRESSES = {
|
|
|
52
52
|
// Multicall3 合约
|
|
53
53
|
Multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
|
|
54
54
|
// PotatoSwap DEX 合约
|
|
55
|
-
PotatoSwapV2Router: '
|
|
55
|
+
PotatoSwapV2Router: '0x881fb2f98c13d521009464e7d1cbf16e1b394e8e', // ✅ V2 Router (标准 Uniswap V2 风格)
|
|
56
|
+
PotatoSwapSwapRouter02: '0xB45D0149249488333E3F3f9F359807F4b810C1FC', // SwapRouter02 (V3 风格)
|
|
56
57
|
PotatoSwapV3Router: '0xBB069e9465BcabC4F488d21e793BDEf0F2d41D41', // V3 Router
|
|
57
58
|
PotatoSwapV3Factory: '0xa1415fAe79c4B196d087F02b8aD5a622B8A827E5', // V3 Factory
|
|
58
59
|
// 稳定币
|
package/dist/utils/lp-inspect.js
CHANGED
|
@@ -60,10 +60,9 @@ const CHAIN_DEX_CONFIGS = {
|
|
|
60
60
|
dexes: {
|
|
61
61
|
POTATOSWAP: {
|
|
62
62
|
name: 'PotatoSwap',
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
v3Router: '0xB45D0149249488333E3F3f9F359807F4b810C1FC', // SwapRouter02
|
|
63
|
+
v2Factory: '0x630DB8E822805c82Ca40a54daE02dd5aC31f7fcF', // V2 Factory
|
|
64
|
+
v2Router: '0x881fb2f98c13d521009464e7d1cbf16e1b394e8e', // ✅ V2 Router (标准 Uniswap V2 风格)
|
|
65
|
+
v3Router: '0xB45D0149249488333E3F3f9F359807F4b810C1FC', // SwapRouter02 (V3 风格)
|
|
67
66
|
v3Factory: '0xa1415fAe79c4B196d087F02b8aD5a622B8A827E5', // V3 Factory
|
|
68
67
|
quoterV2: '0x5A6f3723346aF54a4D0693bfC1718D64d4915C3e', // QuoterV2
|
|
69
68
|
enabled: true,
|