four-flap-meme-sdk 1.1.84 → 1.1.86
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.
- package/dist/contracts/tm-bundle-merkle/core.js +4 -38
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +18 -36
- package/dist/contracts/tm-bundle-merkle/private.js +4 -34
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +10 -13
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +10 -27
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +13 -14
- package/dist/contracts/tm-bundle-merkle/swap.js +11 -65
- package/dist/contracts/tm-bundle-merkle/types.d.ts +45 -121
- package/dist/contracts/tm-bundle-merkle/utils.js +6 -32
- package/dist/flap/portal-bundle-merkle/core.js +5 -39
- package/dist/flap/portal-bundle-merkle/pancake-proxy.js +18 -36
- package/dist/flap/portal-bundle-merkle/private.js +4 -34
- package/dist/flap/portal-bundle-merkle/swap-buy-first.d.ts +10 -12
- package/dist/flap/portal-bundle-merkle/swap-buy-first.js +10 -26
- package/dist/flap/portal-bundle-merkle/swap.d.ts +10 -14
- package/dist/flap/portal-bundle-merkle/swap.js +8 -71
- package/dist/flap/portal-bundle-merkle/types.d.ts +33 -51
- package/dist/pancake/bundle-buy-first.d.ts +10 -12
- package/dist/pancake/bundle-buy-first.js +9 -25
- package/dist/pancake/bundle-swap.d.ts +10 -14
- package/dist/pancake/bundle-swap.js +8 -69
- package/package.json +1 -1
- package/dist/contracts/tm-bundle-merkle.d.ts +0 -187
- package/dist/contracts/tm-bundle-merkle.js +0 -917
- package/dist/flap/portal-bundle-merkle.d.ts +0 -152
- package/dist/flap/portal-bundle-merkle.js +0 -742
|
@@ -203,22 +203,10 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
203
203
|
}
|
|
204
204
|
// ✅ 清理临时 nonce 缓存
|
|
205
205
|
nonceManager.clearTemp();
|
|
206
|
-
// ✅
|
|
207
|
-
const emptyStatus = {
|
|
208
|
-
bundleHash: '',
|
|
209
|
-
txHashes: [],
|
|
210
|
-
results: [],
|
|
211
|
-
successCount: 0,
|
|
212
|
-
totalGasUsed: 0n,
|
|
213
|
-
targetBlock: 0
|
|
214
|
-
};
|
|
206
|
+
// ✅ 简化返回:只返回签名交易和必要信息
|
|
215
207
|
return {
|
|
216
|
-
bundleHash: '',
|
|
217
|
-
tokenAddress: predictedTokenAddress,
|
|
218
|
-
status: emptyStatus,
|
|
219
|
-
createTx: signedCreateTx,
|
|
220
|
-
buyTxs: [],
|
|
221
208
|
signedTransactions: signedTxs,
|
|
209
|
+
tokenAddress: predictedTokenAddress,
|
|
222
210
|
metadata: extractProfit ? {
|
|
223
211
|
totalBuyAmount: ethers.formatEther(totalBuyAmount),
|
|
224
212
|
profitAmount: ethers.formatEther(totalProfit),
|
|
@@ -300,19 +288,8 @@ export async function batchBuyWithBundleMerkle(params) {
|
|
|
300
288
|
}
|
|
301
289
|
// ✅ 清理临时 nonce 缓存
|
|
302
290
|
nonceManager.clearTemp();
|
|
303
|
-
// ✅
|
|
304
|
-
const emptyStatus = {
|
|
305
|
-
bundleHash: '',
|
|
306
|
-
txHashes: [],
|
|
307
|
-
results: [],
|
|
308
|
-
successCount: 0,
|
|
309
|
-
totalGasUsed: 0n,
|
|
310
|
-
targetBlock: 0
|
|
311
|
-
};
|
|
291
|
+
// ✅ 简化返回:只返回签名交易和元数据
|
|
312
292
|
return {
|
|
313
|
-
bundleHash: '',
|
|
314
|
-
status: emptyStatus,
|
|
315
|
-
buyTxs: [],
|
|
316
293
|
signedTransactions: signedTxs,
|
|
317
294
|
metadata: extractProfit ? {
|
|
318
295
|
totalBuyAmount: ethers.formatEther(totalBuyAmount),
|
|
@@ -393,19 +370,8 @@ export async function batchSellWithBundleMerkle(params) {
|
|
|
393
370
|
signedTxs.push(...signedList);
|
|
394
371
|
// ✅ 清理临时 nonce 缓存
|
|
395
372
|
nonceManager.clearTemp();
|
|
396
|
-
// ✅
|
|
397
|
-
const emptyStatus = {
|
|
398
|
-
bundleHash: '',
|
|
399
|
-
txHashes: [],
|
|
400
|
-
results: [],
|
|
401
|
-
successCount: 0,
|
|
402
|
-
totalGasUsed: 0n,
|
|
403
|
-
targetBlock: 0
|
|
404
|
-
};
|
|
373
|
+
// ✅ 简化返回:只返回签名交易
|
|
405
374
|
return {
|
|
406
|
-
bundleHash: '',
|
|
407
|
-
status: emptyStatus,
|
|
408
|
-
sellTxs: [],
|
|
409
375
|
signedTransactions: signedTxs
|
|
410
376
|
};
|
|
411
377
|
}
|
|
@@ -218,16 +218,7 @@ export async function approveFourPancakeProxyBatch(params) {
|
|
|
218
218
|
if (needApproval.length === 0) {
|
|
219
219
|
// 全部已授权,直接返回
|
|
220
220
|
return {
|
|
221
|
-
|
|
222
|
-
status: {
|
|
223
|
-
bundleHash: '',
|
|
224
|
-
txHashes: [],
|
|
225
|
-
results: [],
|
|
226
|
-
successCount: 0,
|
|
227
|
-
totalGasUsed: 0n,
|
|
228
|
-
targetBlock: 0
|
|
229
|
-
},
|
|
230
|
-
approvalTxs: []
|
|
221
|
+
signedTransactions: []
|
|
231
222
|
};
|
|
232
223
|
}
|
|
233
224
|
// 构建授权交易
|
|
@@ -235,13 +226,22 @@ export async function approveFourPancakeProxyBatch(params) {
|
|
|
235
226
|
const unsignedApprovals = await Promise.all(needApprovalTokens.map((token, i) => token.approve.populateTransaction(pancakeProxyAddress, needApprovalAmounts[i])));
|
|
236
227
|
// ✅ 使用前端传入的 gasLimit,否则使用默认值
|
|
237
228
|
const finalGasLimit = getGasLimit(config);
|
|
238
|
-
//
|
|
239
|
-
const
|
|
240
|
-
const
|
|
229
|
+
// ✅ 直接签名交易(不提交到Merkle)
|
|
230
|
+
const nonceManager = new NonceManager(provider);
|
|
231
|
+
const nonces = await Promise.all(needApproval.map(w => nonceManager.getNextNonce(w)));
|
|
232
|
+
const signedTxs = await Promise.all(unsignedApprovals.map((unsigned, i) => needApproval[i].signTransaction({
|
|
233
|
+
...unsigned,
|
|
234
|
+
from: needApproval[i].address,
|
|
235
|
+
nonce: nonces[i],
|
|
236
|
+
gasLimit: finalGasLimit,
|
|
237
|
+
gasPrice,
|
|
238
|
+
chainId: 56,
|
|
239
|
+
type: getTxType(config)
|
|
240
|
+
})));
|
|
241
|
+
nonceManager.clearTemp();
|
|
242
|
+
// ✅ 简化返回:只返回签名交易
|
|
241
243
|
return {
|
|
242
|
-
|
|
243
|
-
status,
|
|
244
|
-
approvalTxs: []
|
|
244
|
+
signedTransactions: signedTxs
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
@@ -335,17 +335,8 @@ export async function fourPancakeProxyBatchBuyMerkle(params) {
|
|
|
335
335
|
// ✅ 清理临时 nonce 缓存
|
|
336
336
|
nonceManager.clearTemp();
|
|
337
337
|
// ✅ 直接返回签名交易(不提交到Merkle)
|
|
338
|
+
// ✅ 简化返回:只返回签名交易
|
|
338
339
|
return {
|
|
339
|
-
bundleHash: '',
|
|
340
|
-
status: {
|
|
341
|
-
bundleHash: '',
|
|
342
|
-
txHashes: [],
|
|
343
|
-
results: [],
|
|
344
|
-
successCount: 0,
|
|
345
|
-
totalGasUsed: 0n,
|
|
346
|
-
targetBlock: 0
|
|
347
|
-
},
|
|
348
|
-
buyTxs: [],
|
|
349
340
|
signedTransactions: signedTxs
|
|
350
341
|
};
|
|
351
342
|
}
|
|
@@ -529,17 +520,8 @@ export async function fourPancakeProxyBatchSellMerkle(params) {
|
|
|
529
520
|
// ✅ 清理临时 nonce 缓存
|
|
530
521
|
nonceManager.clearTemp();
|
|
531
522
|
// ✅ 直接返回签名交易(不提交到Merkle)
|
|
523
|
+
// ✅ 简化返回:只返回签名交易
|
|
532
524
|
return {
|
|
533
|
-
bundleHash: '',
|
|
534
|
-
status: {
|
|
535
|
-
bundleHash: '',
|
|
536
|
-
txHashes: [],
|
|
537
|
-
results: [],
|
|
538
|
-
successCount: 0,
|
|
539
|
-
totalGasUsed: 0n,
|
|
540
|
-
targetBlock: 0
|
|
541
|
-
},
|
|
542
|
-
sellTxs: [],
|
|
543
525
|
signedTransactions: signedTxs
|
|
544
526
|
};
|
|
545
527
|
}
|
|
@@ -67,12 +67,8 @@ export async function fourPrivateBuyMerkle(params) {
|
|
|
67
67
|
signedTxs.push(profitTx);
|
|
68
68
|
}
|
|
69
69
|
// ✅ 直接返回签名交易(不提交到Merkle)
|
|
70
|
+
// ✅ 简化返回:只返回签名交易
|
|
70
71
|
return {
|
|
71
|
-
txHash: '',
|
|
72
|
-
success: false,
|
|
73
|
-
blockNumber: undefined,
|
|
74
|
-
gasUsed: undefined,
|
|
75
|
-
error: undefined,
|
|
76
72
|
signedTransactions: signedTxs
|
|
77
73
|
};
|
|
78
74
|
}
|
|
@@ -153,12 +149,8 @@ export async function fourPrivateSellMerkle(params) {
|
|
|
153
149
|
// ✅ 清理临时 nonce 缓存
|
|
154
150
|
nonceManager.clearTemp();
|
|
155
151
|
// ✅ 直接返回签名交易(不提交到Merkle)
|
|
152
|
+
// ✅ 简化返回:只返回签名交易
|
|
156
153
|
return {
|
|
157
|
-
txHash: '',
|
|
158
|
-
success: false,
|
|
159
|
-
blockNumber: undefined,
|
|
160
|
-
gasUsed: undefined,
|
|
161
|
-
error: undefined,
|
|
162
154
|
signedTransactions: signedTxs
|
|
163
155
|
};
|
|
164
156
|
}
|
|
@@ -220,19 +212,8 @@ export async function fourBatchPrivateBuyMerkle(params) {
|
|
|
220
212
|
}
|
|
221
213
|
// ✅ 清理临时 nonce 缓存
|
|
222
214
|
nonceManager.clearTemp();
|
|
223
|
-
// ✅
|
|
224
|
-
const emptyStatus = {
|
|
225
|
-
bundleHash: '',
|
|
226
|
-
txHashes: [],
|
|
227
|
-
results: [],
|
|
228
|
-
successCount: 0,
|
|
229
|
-
totalGasUsed: 0n,
|
|
230
|
-
targetBlock: 0
|
|
231
|
-
};
|
|
215
|
+
// ✅ 简化返回:只返回签名交易
|
|
232
216
|
return {
|
|
233
|
-
bundleHash: '',
|
|
234
|
-
status: emptyStatus,
|
|
235
|
-
txs: [],
|
|
236
217
|
signedTransactions: signedTxs
|
|
237
218
|
};
|
|
238
219
|
}
|
|
@@ -320,19 +301,8 @@ export async function fourBatchPrivateSellMerkle(params) {
|
|
|
320
301
|
}
|
|
321
302
|
// ✅ 清理临时 nonce 缓存
|
|
322
303
|
nonceManager.clearTemp();
|
|
323
|
-
// ✅
|
|
324
|
-
const emptyStatus = {
|
|
325
|
-
bundleHash: '',
|
|
326
|
-
txHashes: [],
|
|
327
|
-
results: [],
|
|
328
|
-
successCount: 0,
|
|
329
|
-
totalGasUsed: 0n,
|
|
330
|
-
targetBlock: 0
|
|
331
|
-
};
|
|
304
|
+
// ✅ 简化返回:只返回签名交易
|
|
332
305
|
return {
|
|
333
|
-
bundleHash: '',
|
|
334
|
-
status: emptyStatus,
|
|
335
|
-
txs: [],
|
|
336
306
|
signedTransactions: signedTxs
|
|
337
307
|
};
|
|
338
308
|
}
|
|
@@ -21,17 +21,14 @@ export interface FourBundleBuyFirstParams {
|
|
|
21
21
|
tokenAddress: string;
|
|
22
22
|
config: FourBuyFirstConfig;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
buySuccess: boolean;
|
|
35
|
-
sellSuccess: boolean;
|
|
36
|
-
}
|
|
24
|
+
/** ✅ BuyFirst 结果(简化版) */
|
|
25
|
+
export type FourBuyFirstResult = {
|
|
26
|
+
signedTransactions: string[];
|
|
27
|
+
metadata?: {
|
|
28
|
+
buyerAddress: string;
|
|
29
|
+
sellerAddress: string;
|
|
30
|
+
buyAmount: string;
|
|
31
|
+
sellAmount: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
37
34
|
export declare function fourBundleBuyFirstMerkle(params: FourBundleBuyFirstParams): Promise<FourBuyFirstResult>;
|
|
@@ -130,34 +130,17 @@ export async function fourBundleBuyFirstMerkle(params) {
|
|
|
130
130
|
type: txType
|
|
131
131
|
})
|
|
132
132
|
]);
|
|
133
|
-
//
|
|
134
|
-
const bundleResult = await merkle.sendBundle({
|
|
135
|
-
transactions: [signedBuy, signedSell],
|
|
136
|
-
blockOffset: config.bundleBlockOffset || 5,
|
|
137
|
-
minTimestamp: 0,
|
|
138
|
-
maxTimestamp: 0
|
|
139
|
-
});
|
|
140
|
-
// ✅ Bundle 提交成功后才清除 nonce 缓存
|
|
133
|
+
// ✅ 清理临时 nonce 缓存
|
|
141
134
|
nonceManager.clearTemp();
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const buyResult = results[0];
|
|
145
|
-
const sellResult = results[1];
|
|
146
|
-
if (!buyResult?.success || !sellResult?.success) {
|
|
147
|
-
throw new Error(`换手失败:\n - 买入: ${buyResult?.success ? '✅' : '❌'} ${buyResult?.error || ''}\n - 卖出: ${sellResult?.success ? '✅' : '❌'} ${sellResult?.error || ''}`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
135
|
+
console.log('✅ BuyFirst 交易签名完成!');
|
|
136
|
+
// ✅ 简化返回:只返回签名交易
|
|
150
137
|
return {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
sellAmount: ethers.formatUnits(sellAmountWei, decimals),
|
|
159
|
-
sellerGotBNB: 'N/A (需从链上查询)',
|
|
160
|
-
buySuccess: config.waitForConfirmation !== false,
|
|
161
|
-
sellSuccess: config.waitForConfirmation !== false
|
|
138
|
+
signedTransactions: [signedBuy, signedSell],
|
|
139
|
+
metadata: {
|
|
140
|
+
buyerAddress: buyer.address,
|
|
141
|
+
sellerAddress: seller.address,
|
|
142
|
+
buyAmount: ethers.formatEther(buyerFundsWei),
|
|
143
|
+
sellAmount: ethers.formatUnits(sellAmountWei, decimals)
|
|
144
|
+
}
|
|
162
145
|
};
|
|
163
146
|
}
|
|
@@ -22,20 +22,19 @@ export interface FourBundleSwapParams {
|
|
|
22
22
|
slippageTolerance?: number;
|
|
23
23
|
config: FourSwapConfig;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
25
|
+
/**
|
|
26
|
+
* ✅ Swap 结果(简化版)
|
|
27
|
+
* 使用统一的 MerkleSignedResult 类型
|
|
28
|
+
*/
|
|
29
|
+
export type FourSwapResult = {
|
|
30
|
+
signedTransactions: string[];
|
|
31
|
+
metadata?: {
|
|
32
|
+
sellerAddress: string;
|
|
33
|
+
buyerAddress: string;
|
|
34
|
+
sellAmount: string;
|
|
35
|
+
buyAmount: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
39
38
|
/**
|
|
40
39
|
* Four内盘捆绑换手
|
|
41
40
|
*/
|
|
@@ -143,73 +143,19 @@ export async function fourBundleSwapMerkle(params) {
|
|
|
143
143
|
value: buyerFunds // ✅ 使用卖方获得的 BNB
|
|
144
144
|
})
|
|
145
145
|
]);
|
|
146
|
-
//
|
|
147
|
-
// Step 5: 提交Bundle
|
|
148
|
-
// ============================================================
|
|
149
|
-
console.log('🚀 提交换手Bundle...\n');
|
|
150
|
-
const bundleResult = await merkle.sendBundle({
|
|
151
|
-
transactions: [signedSell, signedBuy],
|
|
152
|
-
blockOffset: config.bundleBlockOffset || 5,
|
|
153
|
-
minTimestamp: 0,
|
|
154
|
-
maxTimestamp: 0
|
|
155
|
-
});
|
|
156
|
-
// ✅ Bundle 提交成功后才清除 nonce 缓存
|
|
146
|
+
// ✅ 清理临时 nonce 缓存
|
|
157
147
|
nonceManager.clearTemp();
|
|
158
|
-
console.log(
|
|
159
|
-
console.log(`
|
|
160
|
-
console.log(`
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (config.waitForConfirmation !== false) {
|
|
166
|
-
console.log('⏳ 等待Bundle确认...\n');
|
|
167
|
-
const results = await merkle.waitForBundleConfirmation(bundleResult.txHashes, 1, config.waitTimeoutMs || 120000);
|
|
168
|
-
const sellResult = results[0];
|
|
169
|
-
const buyResult = results[1];
|
|
170
|
-
if (!sellResult?.success || !buyResult?.success) {
|
|
171
|
-
throw new Error(`换手失败:\n` +
|
|
172
|
-
` - 卖出: ${sellResult?.success ? '✅' : '❌'} ${sellResult?.error || ''}\n` +
|
|
173
|
-
` - 买入: ${buyResult?.success ? '✅' : '❌'} ${buyResult?.error || ''}`);
|
|
174
|
-
}
|
|
175
|
-
// 查询实际结果
|
|
176
|
-
const [sellReceipt, buyReceipt] = await Promise.all([
|
|
177
|
-
provider.getTransactionReceipt(bundleResult.txHashes[0]),
|
|
178
|
-
provider.getTransactionReceipt(bundleResult.txHashes[1])
|
|
179
|
-
]);
|
|
180
|
-
// 解析实际数据(简化版,实际应该解析事件)
|
|
181
|
-
// TODO: 从 receipt 解析实际的 BNB 和代币数量
|
|
182
|
-
console.log('✅ 换手完成!');
|
|
183
|
-
console.log(` - A 卖出: ${ethers.formatUnits(sellAmountWei, decimals)} TOKEN → 获得 ${ethers.formatEther(sellerWillGetBNB)} BNB`);
|
|
184
|
-
console.log(` - B 买入: 用 ${ethers.formatEther(buyerFunds)} BNB 买入 (实际数量需从链上查询)\n`);
|
|
185
|
-
return {
|
|
186
|
-
bundleHash: bundleResult.bundleHash,
|
|
187
|
-
sellTxHash: bundleResult.txHashes[0],
|
|
188
|
-
buyTxHash: bundleResult.txHashes[1],
|
|
148
|
+
console.log('✅ 换手交易签名完成!');
|
|
149
|
+
console.log(` - 卖出交易: ${ethers.formatUnits(sellAmountWei, decimals)} TOKEN`);
|
|
150
|
+
console.log(` - 买入交易: ${ethers.formatEther(buyerFunds)} BNB\n`);
|
|
151
|
+
// ✅ 简化返回:只返回签名交易
|
|
152
|
+
return {
|
|
153
|
+
signedTransactions: [signedSell, signedBuy],
|
|
154
|
+
metadata: {
|
|
189
155
|
sellerAddress: seller.address,
|
|
190
|
-
sellAmount: ethers.formatUnits(sellAmountWei, decimals),
|
|
191
|
-
sellerGotBNB: ethers.formatEther(sellerWillGetBNB),
|
|
192
156
|
buyerAddress: buyer.address,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
sellSuccess: true,
|
|
197
|
-
buySuccess: true
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
// 不等待确认,返回基础信息
|
|
201
|
-
return {
|
|
202
|
-
bundleHash: bundleResult.bundleHash,
|
|
203
|
-
sellTxHash: bundleResult.txHashes[0],
|
|
204
|
-
buyTxHash: bundleResult.txHashes[1],
|
|
205
|
-
sellerAddress: seller.address,
|
|
206
|
-
sellAmount: ethers.formatUnits(sellAmountWei, decimals),
|
|
207
|
-
sellerGotBNB: ethers.formatEther(sellerWillGetBNB),
|
|
208
|
-
buyerAddress: buyer.address,
|
|
209
|
-
buyAmount: 'N/A (需等待确认)',
|
|
210
|
-
buyerSpentBNB: ethers.formatEther(buyerFunds),
|
|
211
|
-
swapLoss: '< 1% (由手续费差异决定)',
|
|
212
|
-
sellSuccess: false,
|
|
213
|
-
buySuccess: false
|
|
157
|
+
sellAmount: ethers.formatUnits(sellAmountWei, decimals),
|
|
158
|
+
buyAmount: ethers.formatEther(buyerFunds)
|
|
159
|
+
}
|
|
214
160
|
};
|
|
215
161
|
}
|
|
@@ -39,6 +39,22 @@ export type MerkleBundleStatus = {
|
|
|
39
39
|
totalGasUsed: bigint;
|
|
40
40
|
targetBlock: number;
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* 统一的 Merkle 方法返回类型
|
|
44
|
+
* SDK 不再内部提交,只返回签名交易和元数据
|
|
45
|
+
*/
|
|
46
|
+
export type MerkleSignedResult = {
|
|
47
|
+
/** 已签名的交易数组(发送到服务器进行提交) */
|
|
48
|
+
signedTransactions: string[];
|
|
49
|
+
/** 创建代币时返回的代币地址(仅 create 方法使用) */
|
|
50
|
+
tokenAddress?: string;
|
|
51
|
+
/** 多跳钱包的私钥(仅 disperse/sweep 使用,按接收者分组) */
|
|
52
|
+
hopWallets?: string[][];
|
|
53
|
+
/** 元数据(如利润信息等) */
|
|
54
|
+
metadata?: {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
42
58
|
export type FourCreateWithBundleBuyMerkleParams = {
|
|
43
59
|
privateKeys: string[];
|
|
44
60
|
buyAmounts: string[];
|
|
@@ -57,56 +73,27 @@ export type FourCreateWithBundleBuyMerkleParams = {
|
|
|
57
73
|
};
|
|
58
74
|
config: FourBundleMerkleConfig;
|
|
59
75
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
buyTxs: string[];
|
|
66
|
-
signedTransactions?: string[];
|
|
67
|
-
metadata?: {
|
|
68
|
-
totalBuyAmount: string;
|
|
69
|
-
profitAmount: string;
|
|
70
|
-
profitRecipient: string;
|
|
71
|
-
buyerCount: number;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
76
|
+
/**
|
|
77
|
+
* ✅ 创建代币 + 购买结果(简化版)
|
|
78
|
+
* 包含 tokenAddress 用于返回创建的代币地址
|
|
79
|
+
*/
|
|
80
|
+
export type FourCreateWithBundleBuyMerkleResult = MerkleSignedResult;
|
|
74
81
|
export type FourBatchBuyMerkleParams = {
|
|
75
82
|
privateKeys: string[];
|
|
76
83
|
buyAmounts: string[];
|
|
77
84
|
tokenAddress: string;
|
|
78
85
|
config: FourBundleMerkleConfig;
|
|
79
86
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
status: MerkleBundleStatus;
|
|
83
|
-
buyTxs: string[];
|
|
84
|
-
signedTransactions?: string[];
|
|
85
|
-
metadata?: {
|
|
86
|
-
totalBuyAmount: string;
|
|
87
|
-
profitAmount: string;
|
|
88
|
-
profitRecipient: string;
|
|
89
|
-
buyerCount: number;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
87
|
+
/** ✅ 批量购买结果(简化版) */
|
|
88
|
+
export type FourBatchBuyMerkleResult = MerkleSignedResult;
|
|
92
89
|
export type FourBatchSellMerkleParams = {
|
|
93
90
|
privateKeys: string[];
|
|
94
91
|
sellAmounts: string[];
|
|
95
92
|
tokenAddress: string;
|
|
96
93
|
config: FourBundleMerkleConfig;
|
|
97
94
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
status: MerkleBundleStatus;
|
|
101
|
-
sellTxs: string[];
|
|
102
|
-
signedTransactions?: string[];
|
|
103
|
-
metadata?: {
|
|
104
|
-
totalSellAmount: string;
|
|
105
|
-
profitAmount: string;
|
|
106
|
-
profitRecipient: string;
|
|
107
|
-
sellerCount: number;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
95
|
+
/** ✅ 批量卖出结果(简化版) */
|
|
96
|
+
export type FourBatchSellMerkleResult = MerkleSignedResult;
|
|
110
97
|
export type FourPrivateMerkleBase = {
|
|
111
98
|
config: FourBundleMerkleConfig;
|
|
112
99
|
};
|
|
@@ -122,14 +109,8 @@ export type FourPrivateSellMerkleParams = FourPrivateMerkleBase & {
|
|
|
122
109
|
amount: string;
|
|
123
110
|
minFunds?: bigint;
|
|
124
111
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
success: boolean;
|
|
128
|
-
blockNumber?: number;
|
|
129
|
-
gasUsed?: string;
|
|
130
|
-
error?: string;
|
|
131
|
-
signedTransactions?: string[];
|
|
132
|
-
};
|
|
112
|
+
/** ✅ 私有交易结果(简化版) */
|
|
113
|
+
export type FourPrivateTransactionResult = MerkleSignedResult;
|
|
133
114
|
export type FourBatchPrivateBuyMerkleParams = FourPrivateMerkleBase & {
|
|
134
115
|
privateKeys: string[];
|
|
135
116
|
fundsList: string[];
|
|
@@ -141,18 +122,8 @@ export type FourBatchPrivateSellMerkleParams = FourPrivateMerkleBase & {
|
|
|
141
122
|
tokenAddress: string;
|
|
142
123
|
minFundsEach?: bigint;
|
|
143
124
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
status: MerkleBundleStatus;
|
|
147
|
-
txs: string[];
|
|
148
|
-
signedTransactions?: string[];
|
|
149
|
-
metadata?: {
|
|
150
|
-
totalAmount: string;
|
|
151
|
-
profitAmount: string;
|
|
152
|
-
profitRecipient: string;
|
|
153
|
-
walletCount: number;
|
|
154
|
-
};
|
|
155
|
-
};
|
|
125
|
+
/** ✅ 批量私有交易结果(简化版) */
|
|
126
|
+
export type FourBatchPrivateMerkleResult = MerkleSignedResult;
|
|
156
127
|
export type DisperseMerkleParams = {
|
|
157
128
|
fromPrivateKey: string;
|
|
158
129
|
recipients: string[];
|
|
@@ -170,21 +141,11 @@ export type DisperseMerkleParams = {
|
|
|
170
141
|
}>;
|
|
171
142
|
config: FourBundleMerkleConfig;
|
|
172
143
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
signedTransactions?: string[];
|
|
179
|
-
metadata?: {
|
|
180
|
-
totalAmount: string;
|
|
181
|
-
profitAmount: string;
|
|
182
|
-
profitRecipient: string;
|
|
183
|
-
recipientCount: number;
|
|
184
|
-
isNative: boolean;
|
|
185
|
-
tokenAddress?: string;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
144
|
+
/**
|
|
145
|
+
* ✅ 分发结果(简化版)
|
|
146
|
+
* 包含 hopWallets 用于返回生成的多跳钱包私钥
|
|
147
|
+
*/
|
|
148
|
+
export type DisperseMerkleResult = MerkleSignedResult;
|
|
188
149
|
export type SweepMerkleParams = {
|
|
189
150
|
sourcePrivateKeys: string[];
|
|
190
151
|
target: string;
|
|
@@ -206,21 +167,11 @@ export type SweepMerkleParams = {
|
|
|
206
167
|
}>;
|
|
207
168
|
config: FourBundleMerkleConfig;
|
|
208
169
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
signedTransactions?: string[];
|
|
215
|
-
metadata?: {
|
|
216
|
-
totalAmount: string;
|
|
217
|
-
profitAmount: string;
|
|
218
|
-
profitRecipient: string;
|
|
219
|
-
sourceCount: number;
|
|
220
|
-
isNative: boolean;
|
|
221
|
-
tokenAddress?: string;
|
|
222
|
-
};
|
|
223
|
-
};
|
|
170
|
+
/**
|
|
171
|
+
* ✅ 归集结果(简化版)
|
|
172
|
+
* 包含 hopWallets 用于返回生成的多跳钱包私钥
|
|
173
|
+
*/
|
|
174
|
+
export type SweepMerkleResult = MerkleSignedResult;
|
|
224
175
|
export type FourPancakeProxyBatchBuyParams = {
|
|
225
176
|
privateKeys: string[];
|
|
226
177
|
buyAmounts: string[];
|
|
@@ -234,18 +185,8 @@ export type FourPancakeProxyBatchBuyParams = {
|
|
|
234
185
|
minOutputAmounts?: (string | bigint)[];
|
|
235
186
|
config: FourBundleMerkleConfig;
|
|
236
187
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
status: MerkleBundleStatus;
|
|
240
|
-
buyTxs: string[];
|
|
241
|
-
signedTransactions?: string[];
|
|
242
|
-
metadata?: {
|
|
243
|
-
totalBuyAmount: string;
|
|
244
|
-
profitAmount: string;
|
|
245
|
-
profitRecipient: string;
|
|
246
|
-
buyerCount: number;
|
|
247
|
-
};
|
|
248
|
-
};
|
|
188
|
+
/** ✅ PancakeProxy 批量购买结果(简化版) */
|
|
189
|
+
export type FourPancakeProxyBatchBuyResult = MerkleSignedResult;
|
|
249
190
|
export type FourPancakeProxyBatchSellParams = {
|
|
250
191
|
privateKeys: string[];
|
|
251
192
|
sellAmounts: string[];
|
|
@@ -259,18 +200,8 @@ export type FourPancakeProxyBatchSellParams = {
|
|
|
259
200
|
minOutputAmounts?: (string | bigint)[];
|
|
260
201
|
config: FourBundleMerkleConfig;
|
|
261
202
|
};
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
status: MerkleBundleStatus;
|
|
265
|
-
sellTxs: string[];
|
|
266
|
-
signedTransactions?: string[];
|
|
267
|
-
metadata?: {
|
|
268
|
-
totalSellAmount: string;
|
|
269
|
-
profitAmount: string;
|
|
270
|
-
profitRecipient: string;
|
|
271
|
-
sellerCount: number;
|
|
272
|
-
};
|
|
273
|
-
};
|
|
203
|
+
/** ✅ PancakeProxy 批量卖出结果(简化版) */
|
|
204
|
+
export type FourPancakeProxyBatchSellResult = MerkleSignedResult;
|
|
274
205
|
export type FourPancakeProxyApprovalParams = {
|
|
275
206
|
privateKey: string;
|
|
276
207
|
tokenAddress: string;
|
|
@@ -283,12 +214,5 @@ export type FourPancakeProxyApprovalBatchParams = {
|
|
|
283
214
|
amounts: (string | 'max')[];
|
|
284
215
|
config: FourBundleMerkleConfig;
|
|
285
216
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
status: MerkleBundleStatus;
|
|
289
|
-
approvalTxs: string[];
|
|
290
|
-
signedTransactions?: string[];
|
|
291
|
-
metadata?: {
|
|
292
|
-
approvalCount: number;
|
|
293
|
-
};
|
|
294
|
-
};
|
|
217
|
+
/** ✅ PancakeProxy 批量授权结果(简化版) */
|
|
218
|
+
export type FourPancakeProxyApprovalBatchResult = MerkleSignedResult;
|