four-flap-meme-sdk 1.6.37 → 1.6.39

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.
@@ -697,14 +697,17 @@ export class AADexSwapExecutor {
697
697
  for (let h = 0; h < effectiveHopCount; h++) {
698
698
  const prefundedHop = prefundedHopWallets[hopIdx];
699
699
  const wallet = new ethers.Wallet(prefundedHop.privateKey, provider);
700
+ // ✅ 关键修复:根据真实 nonce 判断是否已部署
701
+ // 如果 nonce > 0,说明钱包已经被使用过,肯定已部署,initCode 必须为 '0x'
702
+ const realNonce = hopNonces[hopIdx] ?? 0n;
703
+ const isDeployed = realNonce > 0n || prefundedHop.deployed;
704
+ const effectiveInitCode = isDeployed ? '0x' : prefundedHop.initCode;
700
705
  chainHops.push({
701
706
  wallet,
702
707
  sender: prefundedHop.senderAddress,
703
- deployed: prefundedHop.deployed,
704
- initCode: prefundedHop.initCode,
708
+ deployed: isDeployed,
709
+ initCode: effectiveInitCode,
705
710
  });
706
- // ✅ 使用从链上获取的真实 nonce(而非硬编码 0)
707
- const realNonce = hopNonces[hopIdx] ?? 0n;
708
711
  nonceMap.init(prefundedHop.senderAddress, realNonce);
709
712
  hopIdx++;
710
713
  }
@@ -405,8 +405,9 @@ export class HopWalletManager {
405
405
  // 发送 handleOps
406
406
  try {
407
407
  const connectedPayer = payerWallet.connect(this.provider);
408
- const entryPoint = this.aaManager.getEntryPoint();
409
- const entryPointWithSigner = entryPoint.connect(connectedPayer);
408
+ const entryPointAddress = this.aaManager.getEntryPointAddress();
409
+ // 直接创建新 Contract 实例(跟其他地方一样)
410
+ const entryPointWithSigner = new ethers.Contract(entryPointAddress, ['function handleOps((address sender,uint256 nonce,bytes initCode,bytes callData,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas,bytes paymasterAndData,bytes signature)[] ops, address payable beneficiary) external'], connectedPayer);
410
411
  const tx = await entryPointWithSigner.handleOps(userOps, payerWallet.address, {
411
412
  gasPrice,
412
413
  gasLimit: 500000n * BigInt(userOps.length),
@@ -504,14 +504,17 @@ export class AAPortalSwapExecutor {
504
504
  for (let h = 0; h < effectiveHopCount; h++) {
505
505
  const prefundedHop = prefundedHopWallets[hopIdx];
506
506
  const wallet = new ethers.Wallet(prefundedHop.privateKey, provider);
507
+ // ✅ 关键修复:根据真实 nonce 判断是否已部署
508
+ // 如果 nonce > 0,说明钱包已经被使用过,肯定已部署,initCode 必须为 '0x'
509
+ const realNonce = hopNonces[hopIdx] ?? 0n;
510
+ const isDeployed = realNonce > 0n || prefundedHop.deployed;
511
+ const effectiveInitCode = isDeployed ? '0x' : prefundedHop.initCode;
507
512
  chainHops.push({
508
513
  wallet,
509
514
  sender: prefundedHop.senderAddress,
510
- deployed: prefundedHop.deployed,
511
- initCode: prefundedHop.initCode,
515
+ deployed: isDeployed,
516
+ initCode: effectiveInitCode,
512
517
  });
513
- // ✅ 使用从链上获取的真实 nonce(而非硬编码 0)
514
- const realNonce = hopNonces[hopIdx] ?? 0n;
515
518
  nonceMap.init(prefundedHop.senderAddress, realNonce);
516
519
  hopIdx++;
517
520
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.6.37",
3
+ "version": "1.6.39",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",