four-flap-meme-sdk 1.5.88 → 1.5.89

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.
@@ -1614,6 +1614,13 @@ export class BundleExecutor {
1614
1614
  }
1615
1615
  // 3. 计算每个钱包的金额
1616
1616
  // ✅ 修复:同时支持 Owner 和 Sender 地址匹配
1617
+ // ✅ 关键修复:将 walletAmounts 的 key 规范化为 lowercase,避免 checksummed 格式匹配失败
1618
+ const normalizedWalletAmounts = {};
1619
+ if (walletAmounts) {
1620
+ for (const [key, value] of Object.entries(walletAmounts)) {
1621
+ normalizedWalletAmounts[key.toLowerCase()] = value;
1622
+ }
1623
+ }
1617
1624
  let finalAmounts = [];
1618
1625
  if (amountMode === 'average') {
1619
1626
  const avg = (totalBuyAmount || 0) / wallets.length;
@@ -1628,15 +1635,24 @@ export class BundleExecutor {
1628
1635
  });
1629
1636
  }
1630
1637
  else if (amountMode === 'custom') {
1631
- finalAmounts = wallets.map(w => {
1638
+ console.log(`[GraduateBuy] Custom mode - walletAmounts keys:`, Object.keys(normalizedWalletAmounts).slice(0, 5));
1639
+ console.log(`[GraduateBuy] Wallet owners:`, wallets.slice(0, 5).map(w => w.address.toLowerCase()));
1640
+ console.log(`[GraduateBuy] Owner->Sender mapping:`, Array.from(ownerToSender.entries()).slice(0, 5));
1641
+ finalAmounts = wallets.map((w, i) => {
1632
1642
  const ownerAddr = w.address.toLowerCase();
1633
1643
  const senderAddr = ownerToSender.get(ownerAddr) || '';
1634
- // ✅ 双重匹配:先按 Owner 地址查找,再按 Sender 地址查找
1635
- return walletAmounts?.[w.address] ||
1636
- walletAmounts?.[w.address.toLowerCase()] ||
1637
- walletAmounts?.[senderAddr] ||
1638
- (senderAddr ? (walletAmounts?.[senderAddr.toLowerCase()] || 0) : 0);
1644
+ // ✅ 使用规范化后的 walletAmounts(全部 lowercase),双重匹配 Owner Sender
1645
+ const amount = normalizedWalletAmounts[ownerAddr] ?? normalizedWalletAmounts[senderAddr] ?? 0;
1646
+ if (i < 5) {
1647
+ console.log(`[GraduateBuy] Wallet[${i}]: owner=${ownerAddr}, sender=${senderAddr}, amount=${amount}`);
1648
+ }
1649
+ return amount;
1639
1650
  });
1651
+ // ✅ 检查是否有金额为 0 的钱包(可能是匹配失败)
1652
+ const zeroAmountCount = finalAmounts.filter(a => a === 0).length;
1653
+ if (zeroAmountCount > 0) {
1654
+ console.warn(`[GraduateBuy] Warning: ${zeroAmountCount}/${finalAmounts.length} wallets have zero amount (possible address mismatch)`);
1655
+ }
1640
1656
  }
1641
1657
  // 4. 钱包分组
1642
1658
  const curveBuyers = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.5.88",
3
+ "version": "1.5.89",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",