four-flap-meme-sdk 1.5.50 → 1.5.51
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/xlayer/dex-bundle-swap.js +15 -4
- package/dist/xlayer/dex.js +3 -0
- package/package.json +1 -1
|
@@ -202,19 +202,30 @@ export class AADexSwapExecutor {
|
|
|
202
202
|
nonce: payerStartNonce,
|
|
203
203
|
});
|
|
204
204
|
const signedTransactions = [signedHandleOps];
|
|
205
|
+
let currentNonce = Number(ethers.Transaction.from(signedHandleOps).nonce) + 1;
|
|
206
|
+
// 1. 处理 Route Tail Tx (如果存在)
|
|
205
207
|
if (routeAddress) {
|
|
206
|
-
const tx = ethers.Transaction.from(signedHandleOps);
|
|
207
208
|
const tailTx = await payerWallet.signTransaction({
|
|
208
209
|
to: routeAddress,
|
|
209
210
|
value: 0n,
|
|
210
|
-
nonce:
|
|
211
|
+
nonce: currentNonce++,
|
|
211
212
|
gasLimit: 21000n,
|
|
212
|
-
gasPrice:
|
|
213
|
-
chainId:
|
|
213
|
+
gasPrice: ethers.Transaction.from(signedHandleOps).gasPrice,
|
|
214
|
+
chainId: this.config.chainId ?? 196,
|
|
214
215
|
type: 0,
|
|
215
216
|
});
|
|
216
217
|
signedTransactions.push(tailTx);
|
|
217
218
|
}
|
|
219
|
+
// 2. ✅ 处理 Profit Tail Tx (修复:补全缺失的利润签名)
|
|
220
|
+
if (extractProfit && profitWei > 0n) {
|
|
221
|
+
const tailTx = await this.bundleExecutor['signProfitTransaction']({
|
|
222
|
+
payerWallet,
|
|
223
|
+
profitWei,
|
|
224
|
+
recipient: profitRecipient,
|
|
225
|
+
nonce: currentNonce++,
|
|
226
|
+
});
|
|
227
|
+
signedTransactions.push(tailTx);
|
|
228
|
+
}
|
|
218
229
|
return {
|
|
219
230
|
signedTransactions,
|
|
220
231
|
metadata: {
|
package/dist/xlayer/dex.js
CHANGED
|
@@ -220,6 +220,7 @@ export class DexExecutor {
|
|
|
220
220
|
* 使用 SupportingFeeOnTransferTokens 版本,支持有手续费/分红的代币
|
|
221
221
|
*/
|
|
222
222
|
async swapOkbForTokenViaAA(privateKey, tokenAddress, okbAmount, minTokenAmount = 0n) {
|
|
223
|
+
console.log('[DEX-Swap] swapOkbForTokenViaAA -> Token 交易 (AA)');
|
|
223
224
|
await this.assertRouter();
|
|
224
225
|
const wallet = createWallet(privateKey, this.config);
|
|
225
226
|
const accountInfo = await this.aaManager.getAccountInfo(wallet.address);
|
|
@@ -312,6 +313,7 @@ export class DexExecutor {
|
|
|
312
313
|
* 通过 AA 账户执行 QuoteToken -> Token 交易
|
|
313
314
|
*/
|
|
314
315
|
async swapQuoteTokenForTokenViaAA(privateKey, quoteTokenAddress, tokenAddress, quoteAmount, minTokenAmount = 0n) {
|
|
316
|
+
console.log('[DEX-Swap] swapQuoteTokenForTokenViaAA -> Token 交易 (AA)');
|
|
315
317
|
await this.assertRouter();
|
|
316
318
|
const wallet = createWallet(privateKey, this.config);
|
|
317
319
|
const accountInfo = await this.aaManager.getAccountInfo(wallet.address);
|
|
@@ -426,6 +428,7 @@ export class DexExecutor {
|
|
|
426
428
|
* 签名 Token -> OKB 交易 (AA + Profit Tail)
|
|
427
429
|
*/
|
|
428
430
|
async signDexSell(params) {
|
|
431
|
+
console.log('[DEX-Sell] Token -> OKB 交易 (AA + Profit Tail)');
|
|
429
432
|
await this.assertRouter();
|
|
430
433
|
const wallet = createWallet(params.privateKey, this.config);
|
|
431
434
|
const accountInfo = await this.aaManager.getAccountInfo(wallet.address);
|