four-flap-meme-sdk 1.7.53 → 1.7.54
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.
|
@@ -365,14 +365,12 @@ export async function bundleSwap(params) {
|
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
// 3. 买家买入(使用买家自己的 OKB)
|
|
368
|
-
const buyAmount = estimatedOkbOut - profitAmount;
|
|
369
368
|
const buyCall = buildBuyCallInternal(buyerWallet, buyAmount, tokenAddress, tradeType, actualRouter, fee, delegateInterface, portalInterface);
|
|
370
369
|
calls.push(buyCall);
|
|
371
370
|
}
|
|
372
371
|
else {
|
|
373
|
-
//
|
|
372
|
+
// 资金利用率模式:卖出 -> 扣利润 -> 转账 -> 买入
|
|
374
373
|
const firstRecipient = hopWallets.length > 0 ? hopWallets[0].address : buyerWallet.address;
|
|
375
|
-
const buyAmount = estimatedOkbOut - profitAmount;
|
|
376
374
|
// 1. 卖家卖出 (独立卖出,不包含转账)
|
|
377
375
|
const sellCall = buildSellCallWithAmountInternal(sellerWallet, sellAmountWei, tokenAddress, tradeType, actualRouter, fee, delegateInterface, portalInterface);
|
|
378
376
|
calls.push(sellCall);
|
|
@@ -811,8 +809,8 @@ function buildSellCallWithAmountInternal(wallet, amount, tokenAddress, tradeType
|
|
|
811
809
|
target: wallet.address,
|
|
812
810
|
allowFailure: false,
|
|
813
811
|
value: 0n,
|
|
814
|
-
// ✅
|
|
815
|
-
callData: delegateInterface.encodeFunctionData('executeSellV2', [routerAddress, path,
|
|
812
|
+
// ✅ 修复:传入实际数量,避免卖出全部
|
|
813
|
+
callData: delegateInterface.encodeFunctionData('executeSellV2', [routerAddress, path, amount]),
|
|
816
814
|
};
|
|
817
815
|
}
|
|
818
816
|
case 'V3': {
|
|
@@ -820,9 +818,9 @@ function buildSellCallWithAmountInternal(wallet, amount, tokenAddress, tradeType
|
|
|
820
818
|
target: wallet.address,
|
|
821
819
|
allowFailure: false,
|
|
822
820
|
value: 0n,
|
|
823
|
-
// ✅
|
|
821
|
+
// ✅ 修复:传入实际数量,避免卖出全部
|
|
824
822
|
callData: delegateInterface.encodeFunctionData('executeSell', [
|
|
825
|
-
routerAddress, tokenAddress, WOKB_ADDRESS, fee,
|
|
823
|
+
routerAddress, tokenAddress, WOKB_ADDRESS, fee, amount
|
|
826
824
|
]),
|
|
827
825
|
};
|
|
828
826
|
}
|
|
@@ -677,20 +677,22 @@ function buildSellCall(wallet, tokenAddress, sellPercent, tokenDecimals, poolTyp
|
|
|
677
677
|
}
|
|
678
678
|
case 'V2': {
|
|
679
679
|
const path = [tokenAddress, WOKB_ADDRESS];
|
|
680
|
+
// ✅ 修复:传入实际数量,避免卖出全部
|
|
680
681
|
return {
|
|
681
682
|
target: wallet.address,
|
|
682
683
|
allowFailure: false,
|
|
683
684
|
value: 0n,
|
|
684
|
-
callData: delegateInterface.encodeFunctionData('executeSellV2', [routerAddress, path, 0]),
|
|
685
|
+
callData: delegateInterface.encodeFunctionData('executeSellV2', [routerAddress, path, sellPercent === 100 ? 0 : 0n]),
|
|
685
686
|
};
|
|
686
687
|
}
|
|
687
688
|
case 'V3': {
|
|
689
|
+
// ✅ 修复:传入实际数量,避免卖出全部
|
|
688
690
|
return {
|
|
689
691
|
target: wallet.address,
|
|
690
692
|
allowFailure: false,
|
|
691
693
|
value: 0n,
|
|
692
694
|
callData: delegateInterface.encodeFunctionData('executeSell', [
|
|
693
|
-
routerAddress, tokenAddress, WOKB_ADDRESS, fee, 0
|
|
695
|
+
routerAddress, tokenAddress, WOKB_ADDRESS, fee, sellPercent === 100 ? 0 : 0n
|
|
694
696
|
]),
|
|
695
697
|
};
|
|
696
698
|
}
|