four-flap-meme-sdk 1.6.48 → 1.6.49
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.
- package/dist/xlayer/dex.d.ts +3 -0
- package/dist/xlayer/dex.js +6 -4
- package/package.json +1 -1
package/dist/xlayer/dex.d.ts
CHANGED
|
@@ -47,9 +47,12 @@ export declare function encodeSwapExactETHForTokensV3(params: V3ExactInputSingle
|
|
|
47
47
|
* 使用 multicall 包装 exactInputSingle + unwrapWETH9
|
|
48
48
|
*
|
|
49
49
|
* 注意:V3 卖出返回的是 WOKB(ERC20),需要调用 unwrapWETH9 转换为 OKB
|
|
50
|
+
* ⚠️ X Layer 的 V3 Pool 不会把 ADDRESS_THIS(0x02) 解析为 Router,会把 WOKB 直接打到 0x02 导致资金卡死
|
|
51
|
+
* 必须把 recipient 设为实际 Router 地址,再由 unwrapWETH9 转回 OKB
|
|
50
52
|
*/
|
|
51
53
|
export declare function encodeSwapExactTokensForETHV3(params: V3ExactInputSingleParams & {
|
|
52
54
|
unwrapRecipient?: string;
|
|
55
|
+
routerAddress?: string;
|
|
53
56
|
}): string;
|
|
54
57
|
/**
|
|
55
58
|
* 编码 swapExactETHForTokens 调用
|
package/dist/xlayer/dex.js
CHANGED
|
@@ -60,16 +60,18 @@ export function encodeSwapExactETHForTokensV3(params) {
|
|
|
60
60
|
* 使用 multicall 包装 exactInputSingle + unwrapWETH9
|
|
61
61
|
*
|
|
62
62
|
* 注意:V3 卖出返回的是 WOKB(ERC20),需要调用 unwrapWETH9 转换为 OKB
|
|
63
|
+
* ⚠️ X Layer 的 V3 Pool 不会把 ADDRESS_THIS(0x02) 解析为 Router,会把 WOKB 直接打到 0x02 导致资金卡死
|
|
64
|
+
* 必须把 recipient 设为实际 Router 地址,再由 unwrapWETH9 转回 OKB
|
|
63
65
|
*/
|
|
64
66
|
export function encodeSwapExactTokensForETHV3(params) {
|
|
65
|
-
//
|
|
66
|
-
const
|
|
67
|
+
// 使用真实 Router 地址,避免 WOKB 打到 0x02
|
|
68
|
+
const routerAddr = params.routerAddress ?? '0xBB069e9465BcabC4F488d21e793BDEf0F2d41D41';
|
|
67
69
|
const swapParams = {
|
|
68
70
|
...params,
|
|
69
|
-
recipient:
|
|
71
|
+
recipient: routerAddr, // 直接发送到 Router,由 Router 持有 WOKB
|
|
70
72
|
};
|
|
71
73
|
const swapData = encodeExactInputSingle(swapParams);
|
|
72
|
-
// unwrap
|
|
74
|
+
// unwrap 到最终接收者(保留原有行为)
|
|
73
75
|
const finalRecipient = params.unwrapRecipient || params.recipient;
|
|
74
76
|
const unwrapData = encodeUnwrapWETH9(0n, finalRecipient); // amountMinimum = 0,不做最小值检查
|
|
75
77
|
return encodeV3Multicall([swapData, unwrapData]);
|