four-flap-meme-sdk 1.5.43 → 1.5.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.
- package/dist/xlayer/bundle.js +16 -13
- package/package.json +1 -1
package/dist/xlayer/bundle.js
CHANGED
|
@@ -1135,8 +1135,8 @@ export class BundleExecutor {
|
|
|
1135
1135
|
// 2. 构造 UserOperations (主要涵盖发币和购买)
|
|
1136
1136
|
const ops = [];
|
|
1137
1137
|
const nonceMap = new AANonceMap();
|
|
1138
|
-
const
|
|
1139
|
-
nonceMap.init(
|
|
1138
|
+
const payerAccount = await this.aaManager.getAccountInfo(payer.address);
|
|
1139
|
+
nonceMap.init(payerAccount.sender, payerAccount.nonce);
|
|
1140
1140
|
const useV4 = params.dexId !== undefined || params.lpFeeProfile !== undefined;
|
|
1141
1141
|
const useV3 = !useV4 && !!params.extensionID;
|
|
1142
1142
|
let createCallData;
|
|
@@ -1195,14 +1195,14 @@ export class BundleExecutor {
|
|
|
1195
1195
|
});
|
|
1196
1196
|
}
|
|
1197
1197
|
const devCreateOp = await this.aaManager.buildUserOpWithFixedGas({
|
|
1198
|
-
ownerWallet:
|
|
1199
|
-
sender:
|
|
1198
|
+
ownerWallet: payer, // ✅ 改用 payer 作为发币者
|
|
1199
|
+
sender: payerAccount.sender,
|
|
1200
1200
|
callData: encodeExecute(this.portalAddress, params.quoteAmt || 0n, createCallData),
|
|
1201
|
-
nonce: nonceMap.next(
|
|
1202
|
-
initCode:
|
|
1203
|
-
deployed:
|
|
1201
|
+
nonce: nonceMap.next(payerAccount.sender),
|
|
1202
|
+
initCode: payerAccount.deployed ? '0x' : this.aaManager.generateInitCode(payer.address),
|
|
1203
|
+
deployed: payerAccount.deployed
|
|
1204
1204
|
});
|
|
1205
|
-
const signedDevOp = await this.aaManager.signUserOp(devCreateOp.userOp,
|
|
1205
|
+
const signedDevOp = await this.aaManager.signUserOp(devCreateOp.userOp, payer);
|
|
1206
1206
|
ops.push(signedDevOp.userOp);
|
|
1207
1207
|
const profitSettings = resolveProfitSettings(effConfig);
|
|
1208
1208
|
const inputToken = params.quoteToken && params.quoteToken !== ZERO_ADDRESS ? params.quoteToken : ZERO_ADDRESS;
|
|
@@ -1270,6 +1270,10 @@ export class BundleExecutor {
|
|
|
1270
1270
|
const provider = this.aaManager.getProvider();
|
|
1271
1271
|
const startNonce = params.payerStartNonce ?? await provider.getTransactionCount(payer.address, 'pending');
|
|
1272
1272
|
const signedTransactions = [];
|
|
1273
|
+
const feeData = await provider.getFeeData();
|
|
1274
|
+
const gasPrice = feeData.gasPrice ?? 100000000n;
|
|
1275
|
+
const chainId = (await provider.getNetwork()).chainId;
|
|
1276
|
+
// === 1. AA handleOps 交易(包含所有 UserOps:创建 + 买入)===
|
|
1273
1277
|
const signedMainTx = await this.signHandleOpsTx({
|
|
1274
1278
|
ops,
|
|
1275
1279
|
payerWallet: payer,
|
|
@@ -1277,17 +1281,16 @@ export class BundleExecutor {
|
|
|
1277
1281
|
nonce: startNonce
|
|
1278
1282
|
});
|
|
1279
1283
|
signedTransactions.push(signedMainTx);
|
|
1284
|
+
// === 2. 利润提取交易(独立的 EOA 转账)===
|
|
1280
1285
|
if (nativeProfitAmount > 0n) {
|
|
1281
1286
|
console.log(`[利润提取-签名] 非 AA 转账: ${useNativeToken ? formatOkb(nativeProfitAmount) : `${formatOkb(totalBuyProfitWei)} (ERC20) -> ${formatOkb(nativeProfitAmount)} (OKB)`} -> ${profitSettings.profitRecipient}`);
|
|
1282
|
-
const feeData = await provider.getFeeData();
|
|
1283
|
-
const gasPrice = feeData.gasPrice ?? 100000000n;
|
|
1284
1287
|
const profitTxRequest = {
|
|
1285
1288
|
to: profitSettings.profitRecipient,
|
|
1286
1289
|
value: nativeProfitAmount,
|
|
1287
1290
|
nonce: startNonce + 1,
|
|
1288
1291
|
gasLimit: 21000n,
|
|
1289
|
-
gasPrice
|
|
1290
|
-
chainId
|
|
1292
|
+
gasPrice,
|
|
1293
|
+
chainId
|
|
1291
1294
|
};
|
|
1292
1295
|
const signedProfitTx = await payer.signTransaction(profitTxRequest);
|
|
1293
1296
|
signedTransactions.push(signedProfitTx);
|
|
@@ -1298,7 +1301,7 @@ export class BundleExecutor {
|
|
|
1298
1301
|
metadata: {
|
|
1299
1302
|
tokenAddress,
|
|
1300
1303
|
devOwner: devWallet.address,
|
|
1301
|
-
devSender:
|
|
1304
|
+
devSender: payerAccount.sender,
|
|
1302
1305
|
buyerOwners: buyerWallets.map(w => w.address),
|
|
1303
1306
|
buyerSenders,
|
|
1304
1307
|
totalBuyWei: totalBuyWei.toString()
|