four-flap-meme-sdk 1.7.30 → 1.7.31
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.
|
@@ -306,9 +306,15 @@ export async function sweep(params) {
|
|
|
306
306
|
const feeData = results[1];
|
|
307
307
|
const balances = results[2].map(b => typeof b === 'bigint' ? b : BigInt(b.toString()));
|
|
308
308
|
// 计算转账金额
|
|
309
|
-
|
|
309
|
+
// ✅ 修复:当 percent=100 时,不预留 gas,归集全部余额
|
|
310
|
+
const isFullSweep = percent >= 100;
|
|
311
|
+
const gasReserve = (reserveGas && isNative && !isFullSweep) ? ethers.parseEther('0.001') : 0n;
|
|
310
312
|
const percentBigInt = BigInt(Math.min(100, Math.max(1, percent)));
|
|
311
313
|
const transferAmounts = balances.map(b => {
|
|
314
|
+
if (isFullSweep) {
|
|
315
|
+
// 100% 归集:使用全部余额
|
|
316
|
+
return b;
|
|
317
|
+
}
|
|
312
318
|
const afterReserve = b > gasReserve ? b - gasReserve : 0n;
|
|
313
319
|
return (afterReserve * percentBigInt) / 100n;
|
|
314
320
|
});
|