four-flap-meme-sdk 1.2.44 → 1.2.46
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.
|
@@ -115,6 +115,9 @@ export async function flapBundleBuyFirstMerkle(params) {
|
|
|
115
115
|
txType
|
|
116
116
|
});
|
|
117
117
|
const profitAmount = calculateProfitAmount(estimatedSellFunds);
|
|
118
|
+
console.log('[DEBUG] estimatedSellFunds:', estimatedSellFunds.toString());
|
|
119
|
+
console.log('[DEBUG] profitAmount:', profitAmount.toString());
|
|
120
|
+
console.log('[DEBUG] PROFIT_CONFIG.RATE_BPS:', PROFIT_CONFIG.RATE_BPS);
|
|
118
121
|
await validateNativeBalances({
|
|
119
122
|
sameAddress,
|
|
120
123
|
buyerBalance,
|
|
@@ -134,6 +137,7 @@ export async function flapBundleBuyFirstMerkle(params) {
|
|
|
134
137
|
sameAddress,
|
|
135
138
|
nonceManager
|
|
136
139
|
});
|
|
140
|
+
console.log('[DEBUG] noncePlan:', noncePlan);
|
|
137
141
|
const buyTx = buildTransactionRequest(buyUnsigned, {
|
|
138
142
|
from: buyer.address,
|
|
139
143
|
nonce: noncePlan.buyerNonce,
|
|
@@ -165,6 +169,8 @@ export async function flapBundleBuyFirstMerkle(params) {
|
|
|
165
169
|
chainId: chainContext.chainId,
|
|
166
170
|
txType
|
|
167
171
|
});
|
|
172
|
+
console.log('[DEBUG] profitTx:', profitTx ? '✅ 已生成' : '❌ 未生成');
|
|
173
|
+
console.log('[DEBUG] profitTx length:', profitTx?.length);
|
|
168
174
|
nonceManager.clearTemp();
|
|
169
175
|
const allTransactions = [];
|
|
170
176
|
if (approvalTx)
|
|
@@ -172,6 +178,7 @@ export async function flapBundleBuyFirstMerkle(params) {
|
|
|
172
178
|
allTransactions.push(signedBuy, signedSell);
|
|
173
179
|
if (profitTx)
|
|
174
180
|
allTransactions.push(profitTx);
|
|
181
|
+
console.log('[DEBUG] allTransactions.length:', allTransactions.length);
|
|
175
182
|
return {
|
|
176
183
|
signedTransactions: allTransactions,
|
|
177
184
|
metadata: {
|
|
@@ -353,10 +360,16 @@ function buildTransactionRequest(unsigned, { from, nonce, gasLimit, gasPrice, pr
|
|
|
353
360
|
return tx;
|
|
354
361
|
}
|
|
355
362
|
async function buildProfitTransaction({ seller, profitAmount, profitNonce, gasPrice, chainId, txType }) {
|
|
356
|
-
|
|
363
|
+
console.log('[DEBUG buildProfitTransaction] profitNonce:', profitNonce);
|
|
364
|
+
console.log('[DEBUG buildProfitTransaction] profitAmount:', profitAmount.toString());
|
|
365
|
+
console.log('[DEBUG buildProfitTransaction] profitNonce === undefined:', profitNonce === undefined);
|
|
366
|
+
console.log('[DEBUG buildProfitTransaction] profitAmount === 0n:', profitAmount === 0n);
|
|
367
|
+
if (profitNonce === undefined || profitAmount === 0n) {
|
|
368
|
+
console.log('[DEBUG buildProfitTransaction] ❌ 返回 null');
|
|
357
369
|
return null;
|
|
358
370
|
}
|
|
359
|
-
|
|
371
|
+
console.log('[DEBUG buildProfitTransaction] ✅ 开始签名利润交易');
|
|
372
|
+
const signed = await seller.signTransaction({
|
|
360
373
|
to: getProfitRecipient(),
|
|
361
374
|
value: profitAmount,
|
|
362
375
|
nonce: profitNonce,
|
|
@@ -365,6 +378,8 @@ async function buildProfitTransaction({ seller, profitAmount, profitNonce, gasPr
|
|
|
365
378
|
chainId,
|
|
366
379
|
type: txType
|
|
367
380
|
});
|
|
381
|
+
console.log('[DEBUG buildProfitTransaction] ✅ 签名完成,长度:', signed.length);
|
|
382
|
+
return signed;
|
|
368
383
|
}
|
|
369
384
|
function countTruthy(values) {
|
|
370
385
|
return values.filter(Boolean).length;
|
|
@@ -354,7 +354,7 @@ async function planNonces({ buyer, seller, sameAddress, approvalExists, extractP
|
|
|
354
354
|
return { buyerNonce, sellerNonce };
|
|
355
355
|
}
|
|
356
356
|
async function buildProfitTransaction({ seller, profitAmount, profitNonce, gasPrice, chainId, txType }) {
|
|
357
|
-
if (
|
|
357
|
+
if (profitNonce === undefined || profitAmount === 0n) {
|
|
358
358
|
return null;
|
|
359
359
|
}
|
|
360
360
|
return await seller.signTransaction({
|