four-flap-meme-sdk 1.6.41 → 1.6.42
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.
|
@@ -696,11 +696,15 @@ export class AADexSwapExecutor {
|
|
|
696
696
|
const hopDeployed = hopCodes.map(code => code !== null && code !== '0x' && code.length > 2);
|
|
697
697
|
// ✅ 检查 hop 钱包余额是否足够(之前的失败交易可能已消耗 prefund)
|
|
698
698
|
const hopBalances = await Promise.all(hopSenders.map(s => provider.getBalance(s)));
|
|
699
|
-
|
|
699
|
+
// ✅ 关键修复:使用每个 hop 的实际部署状态来估算 minPrefund
|
|
700
|
+
// 未部署钱包需要 VERIFICATION_GAS_LIMIT_DEPLOY (800,000)
|
|
701
|
+
// 已部署钱包只需要 VERIFICATION_GAS_LIMIT_NORMAL (250,000)
|
|
700
702
|
const insufficientHops = [];
|
|
701
703
|
for (let i = 0; i < hopSenders.length; i++) {
|
|
704
|
+
const isDeployed = hopDeployed[i] ?? false;
|
|
705
|
+
const minPrefundNeeded = estimatePrefund(HOP_CALL_GAS_LIMIT, isDeployed);
|
|
702
706
|
if (hopBalances[i] < minPrefundNeeded) {
|
|
703
|
-
insufficientHops.push(`${hopSenders[i]} (余额: ${ethers.formatEther(hopBalances[i])} OKB, 需要: ${ethers.formatEther(minPrefundNeeded)} OKB)`);
|
|
707
|
+
insufficientHops.push(`${hopSenders[i]} (余额: ${ethers.formatEther(hopBalances[i])} OKB, 需要: ${ethers.formatEther(minPrefundNeeded)} OKB, 已部署: ${isDeployed})`);
|
|
704
708
|
}
|
|
705
709
|
}
|
|
706
710
|
if (insufficientHops.length > 0) {
|
|
@@ -503,12 +503,16 @@ export class AAPortalSwapExecutor {
|
|
|
503
503
|
const hopDeployed = hopCodes.map(code => code !== null && code !== '0x' && code.length > 2);
|
|
504
504
|
// ✅ 检查 hop 钱包余额是否足够(之前的失败交易可能已消耗 prefund)
|
|
505
505
|
const hopBalances = await Promise.all(hopSenders.map(s => provider.getBalance(s)));
|
|
506
|
-
//
|
|
507
|
-
|
|
506
|
+
// ✅ 关键修复:使用每个 hop 的实际部署状态来估算 minPrefund
|
|
507
|
+
// 未部署钱包需要 VERIFICATION_GAS_LIMIT_DEPLOY (800,000)
|
|
508
|
+
// 已部署钱包只需要 VERIFICATION_GAS_LIMIT_NORMAL (250,000)
|
|
508
509
|
const insufficientHops = [];
|
|
509
510
|
for (let i = 0; i < hopSenders.length; i++) {
|
|
511
|
+
const isDeployed = hopDeployed[i] ?? false;
|
|
512
|
+
const verifyGas = isDeployed ? VERIFICATION_GAS_LIMIT_NORMAL : VERIFICATION_GAS_LIMIT_DEPLOY;
|
|
513
|
+
const minPrefundNeeded = (HOP_CALL_GAS_LIMIT + verifyGas + PRE_VERIFICATION_GAS) * gasPrice * PREFUND_BUFFER_PERCENT / 100n;
|
|
510
514
|
if (hopBalances[i] < minPrefundNeeded) {
|
|
511
|
-
insufficientHops.push(`${hopSenders[i]} (余额: ${ethers.formatEther(hopBalances[i])} OKB, 需要: ${ethers.formatEther(minPrefundNeeded)} OKB)`);
|
|
515
|
+
insufficientHops.push(`${hopSenders[i]} (余额: ${ethers.formatEther(hopBalances[i])} OKB, 需要: ${ethers.formatEther(minPrefundNeeded)} OKB, 已部署: ${isDeployed})`);
|
|
512
516
|
}
|
|
513
517
|
}
|
|
514
518
|
if (insufficientHops.length > 0) {
|