four-flap-meme-sdk 1.5.65 → 1.5.67
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/aa-account.js +2 -1
- package/dist/xlayer/bundle.js +30 -22
- package/package.json +1 -1
|
@@ -803,7 +803,8 @@ export function encodeExecute(dest, value, data) {
|
|
|
803
803
|
*/
|
|
804
804
|
export function encodeExecuteBatch(dests, values, datas) {
|
|
805
805
|
const iface = new Interface(SIMPLE_ACCOUNT_ABI);
|
|
806
|
-
|
|
806
|
+
// 使用完整签名消除 ethers v6 对重载函数的歧义
|
|
807
|
+
return iface.encodeFunctionData('executeBatch(address[],uint256[],bytes[])', [dests, values, datas]);
|
|
807
808
|
}
|
|
808
809
|
/**
|
|
809
810
|
* 创建 AA 账户管理器
|
package/dist/xlayer/bundle.js
CHANGED
|
@@ -1596,7 +1596,7 @@ export class BundleExecutor {
|
|
|
1596
1596
|
// 5. 构建 UserOps
|
|
1597
1597
|
const effConfig = { ...(this.config ?? {}), ...(config ?? {}) };
|
|
1598
1598
|
const signedTransactions = [];
|
|
1599
|
-
const
|
|
1599
|
+
const allOps = [];
|
|
1600
1600
|
// --- 内盘 Ops ---
|
|
1601
1601
|
const curveBuyerInfos = await mapWithConcurrency(curveBuyers.map(b => b.wallet), 5, async (w) => {
|
|
1602
1602
|
const info = await aaManager.getAccountInfo(w.address);
|
|
@@ -1620,18 +1620,7 @@ export class BundleExecutor {
|
|
|
1620
1620
|
const signedBuyOp = await aaManager.signUserOp(buyOpRes.userOp, wallet);
|
|
1621
1621
|
return signedBuyOp.userOp;
|
|
1622
1622
|
});
|
|
1623
|
-
|
|
1624
|
-
// 签名第一个 handleOps (内盘)
|
|
1625
|
-
const startNonce = params.payerStartNonce ?? (await provider.getTransactionCount(payerWallet.address, 'pending'));
|
|
1626
|
-
const signedMainTx = await this.signHandleOpsTx({
|
|
1627
|
-
ops: ops1,
|
|
1628
|
-
payerWallet: payerWallet,
|
|
1629
|
-
beneficiary: params.beneficiary ?? payerWallet.address,
|
|
1630
|
-
nonce: startNonce,
|
|
1631
|
-
gasLimit: effConfig.gasLimit,
|
|
1632
|
-
gasPrice: effConfig.minGasPriceGwei ? ethers.parseUnits(effConfig.minGasPriceGwei.toString(), 'gwei') : undefined
|
|
1633
|
-
});
|
|
1634
|
-
signedTransactions.push(signedMainTx);
|
|
1623
|
+
allOps.push(...signedCurveBuyOps);
|
|
1635
1624
|
// --- 外盘 Ops ---
|
|
1636
1625
|
let totalDexBuyWei = 0n;
|
|
1637
1626
|
if (enableDexBuy && dexBuyers.length > 0) {
|
|
@@ -1640,7 +1629,6 @@ export class BundleExecutor {
|
|
|
1640
1629
|
nonceMap.init(info.sender, info.nonce);
|
|
1641
1630
|
return info;
|
|
1642
1631
|
});
|
|
1643
|
-
const ops2 = [];
|
|
1644
1632
|
const deadline = Math.floor(Date.now() / 1000) + 1200;
|
|
1645
1633
|
const signedDexBuyOps = await mapWithConcurrency(dexBuyers, 5, async (data, i) => {
|
|
1646
1634
|
const { wallet, amount } = data;
|
|
@@ -1661,16 +1649,36 @@ export class BundleExecutor {
|
|
|
1661
1649
|
const signedDexBuyOp = await aaManager.signUserOp(dexBuyOpRes.userOp, wallet);
|
|
1662
1650
|
return signedDexBuyOp.userOp;
|
|
1663
1651
|
});
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1652
|
+
allOps.push(...signedDexBuyOps);
|
|
1653
|
+
}
|
|
1654
|
+
// 6. 签名唯一的 handleOps 交易
|
|
1655
|
+
const startNonce = params.payerStartNonce ?? (await provider.getTransactionCount(payerWallet.address, 'pending'));
|
|
1656
|
+
const signedMainTx = await this.signHandleOpsTx({
|
|
1657
|
+
ops: allOps,
|
|
1658
|
+
payerWallet: payerWallet,
|
|
1659
|
+
beneficiary: params.beneficiary ?? payerWallet.address,
|
|
1660
|
+
nonce: startNonce,
|
|
1661
|
+
gasLimit: effConfig.gasLimit,
|
|
1662
|
+
gasPrice: effConfig.minGasPriceGwei ? ethers.parseUnits(effConfig.minGasPriceGwei.toString(), 'gwei') : undefined
|
|
1663
|
+
});
|
|
1664
|
+
signedTransactions.push(signedMainTx);
|
|
1665
|
+
// 7. 计算并签利润提取交易 (EOA 转账,千分之 4)
|
|
1666
|
+
const totalBuyWei = currentCurveTotal + totalDexBuyWei;
|
|
1667
|
+
const profitWei = (totalBuyWei * 4n) / 1000n; // 0.4%
|
|
1668
|
+
if (profitWei > 0n) {
|
|
1669
|
+
const profitRecipient = effConfig.profitRecipient || PROFIT_CONFIG.RECIPIENT;
|
|
1670
|
+
const feeData = await provider.getFeeData();
|
|
1671
|
+
const gasPrice = effConfig.minGasPriceGwei ? ethers.parseUnits(effConfig.minGasPriceGwei.toString(), 'gwei') : (feeData.gasPrice ?? 100000000n);
|
|
1672
|
+
const profitTx = await payerWallet.signTransaction({
|
|
1673
|
+
to: profitRecipient,
|
|
1674
|
+
value: profitWei,
|
|
1669
1675
|
nonce: startNonce + 1,
|
|
1670
|
-
gasLimit:
|
|
1671
|
-
gasPrice
|
|
1676
|
+
gasLimit: 21000n,
|
|
1677
|
+
gasPrice,
|
|
1678
|
+
chainId: effConfig.chainId ?? 196,
|
|
1679
|
+
type: 0,
|
|
1672
1680
|
});
|
|
1673
|
-
signedTransactions.push(
|
|
1681
|
+
signedTransactions.push(profitTx);
|
|
1674
1682
|
}
|
|
1675
1683
|
return {
|
|
1676
1684
|
signedTransactions,
|