four-flap-meme-sdk 1.6.73 → 1.6.75
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.
|
@@ -7,10 +7,10 @@ import { POTATOSWAP_V2_ROUTER, POTATOSWAP_V3_ROUTER, POTATOSWAP_V3_FACTORY, WOKB
|
|
|
7
7
|
// 多跳 prefund 估算用的 gas 常量(可配置)
|
|
8
8
|
const HOP_CALL_GAS_LIMIT = 150000n; // hop 转账操作
|
|
9
9
|
const DEX_BUY_CALL_GAS_LIMIT = 650000n; // DEX V3 买入操作
|
|
10
|
-
// ✅ 余额检查 buffer
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
const PREFUND_BUFFER_PERCENT = 200n; //
|
|
10
|
+
// ✅ 余额检查 buffer:预充值时使用 350%,这里检查只要求 200%
|
|
11
|
+
// 这样即使有1-2次交易失败消耗了部分 prefund,剩余余额仍然足够通过检查
|
|
12
|
+
// hop-wallet-manager.ts 预充值使用 DEFAULT_BUFFER_PERCENT = 350n (3.5x)
|
|
13
|
+
const PREFUND_BUFFER_PERCENT = 200n; // 执行检查阈值 (200 = 2.0x)
|
|
14
14
|
import { AAAccountManager, encodeExecute, encodeExecuteBatch, encodeExecuteViaMulticall3 } from './aa-account.js';
|
|
15
15
|
import { encodeApproveCall, lpFeeProfileToV3Fee, } from './portal-ops.js';
|
|
16
16
|
import { DexQuery, encodeSwapExactETHForTokensSupportingFee, encodeSwapExactTokensForETHSupportingFee, encodeSwapExactETHForTokensV3, encodeSwapExactTokensForETHV3, encodeSwapExactTokensForTokensSupportingFee, } from './dex.js';
|
|
@@ -14,8 +14,9 @@ import { VERIFICATION_GAS_LIMIT_DEPLOY, VERIFICATION_GAS_LIMIT_NORMAL, PRE_VERIF
|
|
|
14
14
|
// HopWalletManager
|
|
15
15
|
// ============================================================================
|
|
16
16
|
const DEFAULT_HOP_CALL_GAS_LIMIT = 150000n;
|
|
17
|
-
// ✅ 增加预充值 buffer
|
|
18
|
-
|
|
17
|
+
// ✅ 增加预充值 buffer 到 350%,确保即使有1-2次交易失败消耗 gas 后仍有足够余额重试
|
|
18
|
+
// 失败的交易会消耗 prefund(验证阶段的 gas),增加 buffer 可以应对这种情况
|
|
19
|
+
const DEFAULT_BUFFER_PERCENT = 350n; // 3.5x
|
|
19
20
|
export class HopWalletManager {
|
|
20
21
|
constructor(config = {}) {
|
|
21
22
|
this.config = config;
|
|
@@ -7,10 +7,10 @@ import { FLAP_PORTAL, ZERO_ADDRESS, MULTICALL3, VERIFICATION_GAS_LIMIT_DEPLOY, V
|
|
|
7
7
|
// 多跳 prefund 估算用的 gas 常量(可配置)
|
|
8
8
|
const HOP_CALL_GAS_LIMIT = 150000n; // hop 转账操作
|
|
9
9
|
const PORTAL_BUY_CALL_GAS_LIMIT = 450000n; // Portal 买入操作
|
|
10
|
-
// ✅ 余额检查 buffer
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
const PREFUND_BUFFER_PERCENT = 200n; //
|
|
10
|
+
// ✅ 余额检查 buffer:预充值时使用 350%,这里检查只要求 200%
|
|
11
|
+
// 这样即使有1-2次交易失败消耗了部分 prefund,剩余余额仍然足够通过检查
|
|
12
|
+
// hop-wallet-manager.ts 预充值使用 DEFAULT_BUFFER_PERCENT = 350n (3.5x)
|
|
13
|
+
const PREFUND_BUFFER_PERCENT = 200n; // 执行检查阈值 (200 = 2.0x)
|
|
14
14
|
import { AAAccountManager, encodeExecute, encodeExecuteBatch, encodeExecuteViaMulticall3 } from './aa-account.js';
|
|
15
15
|
import { encodeBuyCall, encodeSellCall, encodeBuyCallWithQuote, encodeSellCallWithQuote, encodeApproveCall, PortalQuery, parseOkb, } from './portal-ops.js';
|
|
16
16
|
import { BundleExecutor } from './bundle.js';
|
package/dist/xlayer/wash-ops.js
CHANGED
|
@@ -266,19 +266,18 @@ export async function buildWashOps(params) {
|
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
268
|
else if (poolType === 'v3') {
|
|
269
|
-
// ✅ V3 报价:使用 slot0
|
|
269
|
+
// ✅ V3 报价:使用 slot0 现货价(不加安全边际,确保卖干净)
|
|
270
270
|
expectedTokenAmounts = await mapWithConcurrency(buyWeiList, 4, async (buyWei) => {
|
|
271
271
|
if (buyWei <= 0n)
|
|
272
272
|
return 0n;
|
|
273
273
|
try {
|
|
274
|
-
//
|
|
275
|
-
|
|
274
|
+
// 直接使用 slot0 现货价(无币模式需要卖干净,不留残余)
|
|
275
|
+
return await quoteV3BuyViaSlot0({
|
|
276
276
|
rpcUrl: config.rpcUrl,
|
|
277
277
|
tokenAddress: params.tokenAddress,
|
|
278
278
|
wokbAmount: buyWei,
|
|
279
279
|
fee: v3Fee,
|
|
280
280
|
});
|
|
281
|
-
return (slotQuoted * 95n) / 100n;
|
|
282
281
|
}
|
|
283
282
|
catch {
|
|
284
283
|
return 0n;
|