four-flap-meme-sdk 1.2.41 → 1.2.43

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.
@@ -256,9 +256,6 @@ export class Club48Client {
256
256
  if (lastStatus?.status === 'INCLUDED') {
257
257
  return lastStatus;
258
258
  }
259
- // 超时但可能已成功:返回 PENDING 状态,让调用者决定如何处理
260
- // 注意:Bundle 可能已经成功,但 explorer API 还没索引到
261
- console.warn(`Bundle timeout after ${timeout}ms. Last known status: ${lastStatus?.status || 'unknown'}. The bundle may still be processing or succeeded but not yet indexed by explorer.`);
262
259
  // 如果有最后状态,返回它;否则创建一个 PENDING 状态
263
260
  if (lastStatus) {
264
261
  return lastStatus;
@@ -112,7 +112,6 @@ export class MerkleClient {
112
112
  return String(result.hash);
113
113
  }
114
114
  // 否则转为 JSON 字符串(但这不是理想情况)
115
- console.warn('Unexpected bundle result format, serializing to JSON:', result);
116
115
  return JSON.stringify(result);
117
116
  }
118
117
  throw new Error('Invalid bundle result format');
@@ -150,7 +149,6 @@ export class MerkleClient {
150
149
  // 检查目标区块是否已经过期
151
150
  if (targetBlock <= currentBlock) {
152
151
  if (autoRetry && attempt < maxRetries) {
153
- console.warn(`Target block ${targetBlock} is in the past (current: ${currentBlock}), retrying with updated block...`);
154
152
  attempt++;
155
153
  await new Promise(resolve => setTimeout(resolve, 300)); // 短暂延迟
156
154
  continue;
@@ -182,12 +180,10 @@ export class MerkleClient {
182
180
  txHashes.push(tx.hash);
183
181
  }
184
182
  else {
185
- console.warn(`Transaction at index ${i} has no hash, using empty string`);
186
183
  txHashes.push('');
187
184
  }
188
185
  }
189
186
  catch (error) {
190
- console.error(`Failed to parse transaction at index ${i}:`, error.message);
191
187
  txHashes.push('');
192
188
  }
193
189
  }
@@ -202,7 +198,6 @@ export class MerkleClient {
202
198
  lastError = error;
203
199
  // 如果启用了重试且还有重试次数
204
200
  if (autoRetry && attempt < maxRetries) {
205
- console.warn(`Bundle submission failed (attempt ${attempt + 1}/${maxRetries + 1}): ${error.message}, retrying...`);
206
201
  attempt++;
207
202
  // 等待一个区块时间再重试
208
203
  const blockTime = this.chainId === 56 ? 3000 : 12000;
@@ -357,7 +352,6 @@ export class MerkleClient {
357
352
  }
358
353
  catch (error) {
359
354
  lastError = error;
360
- console.warn(`Failed to get block number (attempt ${attempts + 1}/${maxAttempts}):`, error.message);
361
355
  // 继续重试
362
356
  }
363
357
  // 等待下一次检查
@@ -366,7 +360,6 @@ export class MerkleClient {
366
360
  }
367
361
  // 达到最大尝试次数
368
362
  if (lastError) {
369
- console.error('waitForBlock failed after max attempts:', lastError.message);
370
363
  }
371
364
  return false;
372
365
  }
@@ -38,12 +38,6 @@ export async function approveFourTokenManagerBatch(params) {
38
38
  decimals = await tokenContract.decimals();
39
39
  }
40
40
  catch (error) {
41
- console.error('⚠️ 查询代币 decimals 失败:', error.message);
42
- console.error(' 代币地址:', tokenAddress);
43
- console.error(' 请确认:');
44
- console.error(' 1. 代币地址是否正确');
45
- console.error(' 2. 代币是否已部署在 BSC 主网');
46
- console.error(' 3. RPC URL 是否可用');
47
41
  throw new Error(`查询代币 decimals 失败: ${error.message}`);
48
42
  }
49
43
  }
@@ -52,9 +46,6 @@ export async function approveFourTokenManagerBatch(params) {
52
46
  // ✅ 检查是否有非 'max' 的授权
53
47
  const hasNonMaxAmount = amounts.some(a => a !== 'max');
54
48
  if (hasNonMaxAmount) {
55
- console.log(`⚠️ 警告:检测到非 'max' 的授权数量`);
56
- console.log(` 建议使用 'max' 授权,避免多次卖出时授权额度不足`);
57
- console.log(` 示例: amounts: ['max', 'max', ...]`);
58
49
  }
59
50
  // 检查现有授权,过滤掉已经足够的
60
51
  const allowances = await batchCheckAllowances(provider, tokenAddress, wallets.map(w => w.address), tmAddr);
@@ -65,7 +56,6 @@ export async function approveFourTokenManagerBatch(params) {
65
56
  const needApprovalAmounts = amountsBigInt.filter((_, i) => allowances[i] < APPROVAL_THRESHOLD);
66
57
  const skippedCount = wallets.length - needApproval.length;
67
58
  if (needApproval.length === 0) {
68
- console.log('✅ 所有钱包已授权');
69
59
  return {
70
60
  success: true,
71
61
  signedTransactions: [],
@@ -99,21 +89,12 @@ export async function approveFourTokenManagerBatch(params) {
99
89
  type: getTxType(config)
100
90
  })));
101
91
  nonceManager.clearTemp();
102
- console.log(`✅ 已生成 ${signedTxs.length} 个授权交易签名`);
103
- // ✅ 直接通过传入的 RPC 提交授权交易到链上
104
- console.log(`📤 正在提交授权交易到链上...`);
105
92
  try {
106
93
  // 广播所有授权交易
107
94
  const txResponses = await Promise.all(signedTxs.map(tx => provider.broadcastTransaction(tx)));
108
95
  const txHashes = txResponses.map(r => r.hash);
109
- console.log(`✅ 授权交易已提交,共 ${txHashes.length} 笔`);
110
- txHashes.forEach((hash, i) => {
111
- console.log(` 交易 ${i + 1}: ${hash}`);
112
- });
113
96
  // 等待所有授权交易确认(至少1个确认)
114
- console.log(`⏳ 等待授权确认(约3-5秒)...`);
115
97
  await Promise.all(txResponses.map(tx => tx.wait(1)));
116
- console.log(`✅ 所有授权交易已确认!`);
117
98
  return {
118
99
  success: true,
119
100
  signedTransactions: signedTxs,
@@ -124,7 +105,6 @@ export async function approveFourTokenManagerBatch(params) {
124
105
  };
125
106
  }
126
107
  catch (error) {
127
- console.error('❌ 授权交易提交失败:', error.message);
128
108
  return {
129
109
  success: false,
130
110
  signedTransactions: signedTxs,
@@ -1,21 +1,4 @@
1
1
  import { FourCreateWithBundleBuySignParams, FourCreateWithBundleBuyMerkleResult, FourBatchBuySignParams, FourBatchBuyMerkleResult, FourBatchSellSignParams, FourBatchSellMerkleResult } from './types.js';
2
- /**
3
- * four.meme: 创建代币 + 捆绑购买(仅签名版本 - 不依赖 Merkle)
4
- * ✅ 精简版:只负责签名交易,不提交到 Merkle
5
- *
6
- * ⚠️ 重要:
7
- * - 创建代币:使用原始 four.meme 合约(不收费)
8
- * - 购买交易:使用收费版合约
9
- * - 创建者地址会被验证,确保与私钥匹配
10
- */
11
2
  export declare function createTokenWithBundleBuyMerkle(params: FourCreateWithBundleBuySignParams): Promise<FourCreateWithBundleBuyMerkleResult>;
12
- /**
13
- * four.meme: 批量购买(仅签名版本 - 不依赖 Merkle)
14
- * ✅ 精简版:只负责签名交易,不提交到 Merkle
15
- */
16
3
  export declare function batchBuyWithBundleMerkle(params: FourBatchBuySignParams): Promise<FourBatchBuyMerkleResult>;
17
- /**
18
- * four.meme: 批量卖出(仅签名版本 - 不依赖 Merkle)
19
- * ✅ 精简版:只负责签名交易,不提交到 Merkle
20
- */
21
4
  export declare function batchSellWithBundleMerkle(params: FourBatchSellSignParams): Promise<FourBatchSellMerkleResult>;