four-flap-meme-sdk 1.7.69 → 1.7.70
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.
|
@@ -853,7 +853,10 @@ export async function directV3BatchBuy(params) {
|
|
|
853
853
|
const refundData = routerIface.encodeFunctionData('refundETH', []);
|
|
854
854
|
return { txData: routerIface.encodeFunctionData('multicall(uint256,bytes[])', [deadline, [swapData, refundData]]), txValue: amountWei };
|
|
855
855
|
}
|
|
856
|
-
|
|
856
|
+
// ✅ 修复:ERC20 买入也需要使用 multicall 包装以传递 deadline
|
|
857
|
+
// SwapRouter02 的 exactInputSingle 不包含 deadline 参数,必须通过 multicall 传递
|
|
858
|
+
const swapData = routerIface.encodeFunctionData('exactInputSingle', [swapParams]);
|
|
859
|
+
return { txData: routerIface.encodeFunctionData('multicall(uint256,bytes[])', [deadline, [swapData]]), txValue: 0n };
|
|
857
860
|
}
|
|
858
861
|
};
|
|
859
862
|
const maxFlowIndex = findMaxFlowIndex(flowAmounts);
|
|
@@ -981,14 +984,16 @@ export async function directV3BatchSell(params) {
|
|
|
981
984
|
if (useNativeOutput) {
|
|
982
985
|
return routerIface.encodeFunctionData('multicall(bytes[])', [[routerIface.encodeFunctionData('exactInputSingle', [swapParams]), routerIface.encodeFunctionData('unwrapWETH9', [0n, wallet.address])]]);
|
|
983
986
|
}
|
|
984
|
-
|
|
987
|
+
// ✅ 修复:ERC20 输出也需要使用 multicall 包装以传递 deadline
|
|
988
|
+
return routerIface.encodeFunctionData('multicall(bytes[])', [[routerIface.encodeFunctionData('exactInputSingle', [swapParams])]]);
|
|
985
989
|
}
|
|
986
990
|
else {
|
|
987
991
|
const swapParams = { tokenIn: tokenAddress, tokenOut: outputToken, fee, recipient: useNativeOutput ? routerAddress : wallet.address, amountIn: sellAmount, amountOutMinimum: 0n, sqrtPriceLimitX96: 0n };
|
|
988
992
|
if (useNativeOutput) {
|
|
989
993
|
return routerIface.encodeFunctionData('multicall(uint256,bytes[])', [deadline, [routerIface.encodeFunctionData('exactInputSingle', [swapParams]), routerIface.encodeFunctionData('unwrapWETH9', [0n, wallet.address])]]);
|
|
990
994
|
}
|
|
991
|
-
|
|
995
|
+
// ✅ 修复:ERC20 输出也需要使用 multicall 包装以传递 deadline
|
|
996
|
+
return routerIface.encodeFunctionData('multicall(uint256,bytes[])', [deadline, [routerIface.encodeFunctionData('exactInputSingle', [swapParams])]]);
|
|
992
997
|
}
|
|
993
998
|
};
|
|
994
999
|
const maxOutputIndex = findMaxFlowIndex(sellAmountsWei);
|