four-flap-meme-sdk 1.4.95 → 1.4.97
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/config.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/config.js +0 -1
- package/dist/contracts/tm-bundle-merkle/core.js +13 -9
- package/dist/flap/portal-bundle-merkle/config.d.ts +0 -1
- package/dist/flap/portal-bundle-merkle/config.js +0 -1
- package/dist/flap/portal-bundle-merkle/create-to-dex.js +6 -4
- package/package.json +2 -2
|
@@ -45,7 +45,6 @@ export declare function shouldExtractProfit(config?: FourAnyConfig): boolean;
|
|
|
45
45
|
export declare function getProfitRateBps(config?: FourAnyConfig): number;
|
|
46
46
|
/**
|
|
47
47
|
* 获取利润接收地址
|
|
48
|
-
* ✅ 硬编码:0xe8D0334fAf713884133640CAEe4ECdd2106AF103
|
|
49
48
|
*/
|
|
50
49
|
export declare function getProfitRecipient(config?: FourAnyConfig): string;
|
|
51
50
|
/**
|
|
@@ -54,6 +54,9 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
54
54
|
}
|
|
55
55
|
const accessToken = await loginFourClient(devWallet, fourClient);
|
|
56
56
|
const imgUrl = await resolveTokenImage(fourClient, tokenInfo, accessToken);
|
|
57
|
+
// ✅ 兼容:历史调用可能把 Dev 首买金额塞在 buyAmounts[0],而不是 tokenInfo.preSale
|
|
58
|
+
// Four 官方 API/链上 createArg 使用 preSale 表达“创建者预购金额”
|
|
59
|
+
const effectivePreSaleStr = (tokenInfo.preSale && String(tokenInfo.preSale).trim().length > 0 ? String(tokenInfo.preSale) : String(buyAmounts[0] ?? '0'));
|
|
57
60
|
const createResp = await fourClient.createToken(accessToken, {
|
|
58
61
|
name: tokenInfo.name,
|
|
59
62
|
shortName: tokenInfo.symbol,
|
|
@@ -64,7 +67,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
64
67
|
webUrl: tokenInfo.webUrl,
|
|
65
68
|
twitterUrl: tokenInfo.twitterUrl,
|
|
66
69
|
telegramUrl: tokenInfo.telegramUrl,
|
|
67
|
-
preSale:
|
|
70
|
+
preSale: effectivePreSaleStr || '0',
|
|
68
71
|
onlyMPC: false,
|
|
69
72
|
lpTradingFee: 0.0025,
|
|
70
73
|
symbol: 'BNB',
|
|
@@ -83,7 +86,8 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
83
86
|
// ✅ 单笔交易: 和 Four.meme 官网一样
|
|
84
87
|
// 计算利润
|
|
85
88
|
const extractProfit = shouldExtractProfit(config);
|
|
86
|
-
|
|
89
|
+
// ✅ 对 create 流程来说,“买入金额”就是 preSale(创建者预购)
|
|
90
|
+
const originalBuyAmount = ethers.parseEther(effectivePreSaleStr || '0');
|
|
87
91
|
let actualBuyFunds;
|
|
88
92
|
let profitAmount;
|
|
89
93
|
if (extractProfit) {
|
|
@@ -99,13 +103,13 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
99
103
|
const bribeAmount = getBribeAmount(config);
|
|
100
104
|
const needBribeTx = bribeAmount > 0n;
|
|
101
105
|
const b0AmountWei = ethers.parseEther(params.b0Amount ?? '0');
|
|
102
|
-
const preSaleWei =
|
|
103
|
-
// ✅
|
|
104
|
-
//
|
|
105
|
-
|
|
106
|
+
const preSaleWei = effectivePreSaleStr ? ethers.parseEther(effectivePreSaleStr) : 0n;
|
|
107
|
+
// ✅ 关键修复:
|
|
108
|
+
// createToken 的预购金额由 createArg.preSale 决定;因此这里只需要支付:创建费 + b0Amount + preSale
|
|
109
|
+
// 不要把“其它买入金额”额外塞进 msg.value,否则会被合约退回,造成“看起来没买到”的误解。
|
|
110
|
+
const valueWei = PLATFORM_CREATE_FEE + b0AmountWei + preSaleWei;
|
|
106
111
|
const tmCreate = new ethers.Contract(tmCreateAddr, TM2_ABI, devWallet);
|
|
107
|
-
const createTxUnsigned = await tmCreate.createToken.populateTransaction(createResp.createArg, createResp.signature, { value: valueWei }
|
|
108
|
-
);
|
|
112
|
+
const createTxUnsigned = await tmCreate.createToken.populateTransaction(createResp.createArg, createResp.signature, { value: valueWei });
|
|
109
113
|
// ✅ 贿赂交易放在首位(由 devWallet 发送)
|
|
110
114
|
let bribeNonce;
|
|
111
115
|
if (needBribeTx) {
|
|
@@ -125,7 +129,7 @@ export async function createTokenWithBundleBuyMerkle(params) {
|
|
|
125
129
|
...createTxUnsigned,
|
|
126
130
|
from: devWallet.address,
|
|
127
131
|
nonce: await nonceManager.getNextNonce(devWallet),
|
|
128
|
-
gasLimit: getGasLimit(config, 1500000),
|
|
132
|
+
gasLimit: getGasLimit(config, 1500000),
|
|
129
133
|
gasPrice,
|
|
130
134
|
chainId,
|
|
131
135
|
type: getTxType(config),
|
|
@@ -46,7 +46,6 @@ export declare function shouldExtractProfit(config?: FlapAnyConfig): boolean;
|
|
|
46
46
|
export declare function getProfitRateBps(config?: FlapAnyConfig): number;
|
|
47
47
|
/**
|
|
48
48
|
* 获取利润接收地址
|
|
49
|
-
* ✅ 硬编码:0xe8D0334fAf713884133640CAEe4ECdd2106AF103
|
|
50
49
|
*/
|
|
51
50
|
export declare function getProfitRecipient(config?: FlapAnyConfig): string;
|
|
52
51
|
/**
|
|
@@ -249,7 +249,7 @@ export async function flapBundleCreateToDex(params) {
|
|
|
249
249
|
const profitAmount = (totalBuyAmount * BigInt(PROFIT_CONFIG.RATE_BPS)) / 10000n;
|
|
250
250
|
// ==================== 构建交易 ====================
|
|
251
251
|
const allTransactions = [];
|
|
252
|
-
//
|
|
252
|
+
// 使用第一个内盘买家作为贿赂支付者(提高 bundle 打包优先级)
|
|
253
253
|
const mainBuyerWallet = curveWallets[0].wallet;
|
|
254
254
|
// 1. 贿赂交易
|
|
255
255
|
if (needBribeTx) {
|
|
@@ -479,11 +479,13 @@ export async function flapBundleCreateToDex(params) {
|
|
|
479
479
|
// 5. 利润多跳转账
|
|
480
480
|
let profitHopWallets;
|
|
481
481
|
if (profitAmount > 0n) {
|
|
482
|
-
|
|
483
|
-
|
|
482
|
+
// ✅ 调整:利润从 Dev 钱包(devPrivateKey)支付,避免第一个内盘买家余额不足导致 want 过高
|
|
483
|
+
// 注意:利润交易会额外消耗原生币(profitAmount + gas),请确保 Dev 钱包留足余额
|
|
484
|
+
const devAddr = devWallet.address.toLowerCase();
|
|
485
|
+
const profitNonce = noncesMap.get(devAddr);
|
|
484
486
|
const profitResult = await buildProfitHopTransactions({
|
|
485
487
|
provider,
|
|
486
|
-
payerWallet:
|
|
488
|
+
payerWallet: devWallet,
|
|
487
489
|
profitAmount,
|
|
488
490
|
profitRecipient: getProfitRecipient(),
|
|
489
491
|
hopCount: PROFIT_HOP_COUNT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "four-flap-meme-sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.97",
|
|
4
4
|
"description": "SDK for Flap bonding curve and four.meme TokenManager",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"typescript": "^5.6.3"
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|