four-flap-meme-sdk 1.7.27 → 1.7.28
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.
|
@@ -10,8 +10,8 @@ import { getErc20DecimalsMerkle as _getErc20DecimalsMerkle, generateHopWallets a
|
|
|
10
10
|
*/
|
|
11
11
|
function getProfitRateBps(userType) {
|
|
12
12
|
if (userType === 'v1')
|
|
13
|
-
return PROFIT_CONFIG.
|
|
14
|
-
return PROFIT_CONFIG.
|
|
13
|
+
return PROFIT_CONFIG.RATE_BPS_V1_DOUBLE; // v1 用户:万分之5
|
|
14
|
+
return PROFIT_CONFIG.RATE_BPS_V0_DOUBLE; // v0 用户(默认):万分之6
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* 计算利润金额
|
|
@@ -31,11 +31,11 @@ export declare const PROFIT_CONFIG: {
|
|
|
31
31
|
/** 利润比例(换手模式):6 bps = 0.06% */
|
|
32
32
|
readonly RATE_BPS_SWAP: 6;
|
|
33
33
|
/** 利润比例(单边基点):8 bps = 0.08%(用户类型 v0) */
|
|
34
|
-
readonly RATE_BPS_V0:
|
|
34
|
+
readonly RATE_BPS_V0: 4;
|
|
35
35
|
/** 利润比例(双边基点):4 bps = 0.04%(用户类型 v0) */
|
|
36
36
|
readonly RATE_BPS_V0_DOUBLE: 4;
|
|
37
37
|
/** 利润比例(单边基点):10 bps = 0.10%(用户类型 v1) */
|
|
38
|
-
readonly RATE_BPS_V1:
|
|
38
|
+
readonly RATE_BPS_V1: 5;
|
|
39
39
|
/** 利润比例(双边基点):5 bps = 0.05%(用户类型 v1) */
|
|
40
40
|
readonly RATE_BPS_V1_DOUBLE: 5;
|
|
41
41
|
};
|
|
@@ -43,11 +43,11 @@ export const PROFIT_CONFIG = {
|
|
|
43
43
|
/** 利润比例(换手模式):6 bps = 0.06% */
|
|
44
44
|
RATE_BPS_SWAP: 6,
|
|
45
45
|
/** 利润比例(单边基点):8 bps = 0.08%(用户类型 v0) */
|
|
46
|
-
RATE_BPS_V0:
|
|
46
|
+
RATE_BPS_V0: 4,
|
|
47
47
|
/** 利润比例(双边基点):4 bps = 0.04%(用户类型 v0) */
|
|
48
48
|
RATE_BPS_V0_DOUBLE: 4,
|
|
49
49
|
/** 利润比例(单边基点):10 bps = 0.10%(用户类型 v1) */
|
|
50
|
-
RATE_BPS_V1:
|
|
50
|
+
RATE_BPS_V1: 5,
|
|
51
51
|
/** 利润比例(双边基点):5 bps = 0.05%(用户类型 v1) */
|
|
52
52
|
RATE_BPS_V1_DOUBLE: 5,
|
|
53
53
|
};
|
package/dist/utils/erc20.d.ts
CHANGED
|
@@ -176,6 +176,8 @@ export type ApproveTokenBatchParams = {
|
|
|
176
176
|
gasLimit?: number;
|
|
177
177
|
/** 链ID(可选,默认56=BSC,signOnly=true 时生效) */
|
|
178
178
|
chainId?: number;
|
|
179
|
+
/** 跳过合约地址验证(可选,用于某些特殊场景) */
|
|
180
|
+
skipValidation?: boolean;
|
|
179
181
|
};
|
|
180
182
|
export type ApproveTokenBatchRawParams = {
|
|
181
183
|
rpcUrl: string;
|
|
@@ -193,6 +195,8 @@ export type ApproveTokenBatchRawParams = {
|
|
|
193
195
|
chainId?: number;
|
|
194
196
|
/** 外部 NonceManager(可选,用于同一钱包签多笔交易时共享 nonce 状态) */
|
|
195
197
|
nonceManager?: NonceManager;
|
|
198
|
+
/** 跳过合约地址验证(可选,用于某些特殊场景,如 RPC 返回异常时) */
|
|
199
|
+
skipValidation?: boolean;
|
|
196
200
|
};
|
|
197
201
|
/** signOnly=false 时的返回结果(直接发送交易) */
|
|
198
202
|
export type ApproveTokenBatchResult = {
|
package/dist/utils/erc20.js
CHANGED
|
@@ -483,12 +483,12 @@ export async function checkAllowanceBatchRaw(rpcUrl, tokenAddress, ownerAddresse
|
|
|
483
483
|
return batchCheckAllowances(provider, normalizedToken, normalizedOwners, normalizedSpender);
|
|
484
484
|
}
|
|
485
485
|
export async function approveTokenBatch(params) {
|
|
486
|
-
const { chain, platform, rpcUrl, privateKeys, tokenAddress, amounts, signOnly, gasPriceGwei, gasLimit, chainId } = params;
|
|
486
|
+
const { chain, platform, rpcUrl, privateKeys, tokenAddress, amounts, signOnly, gasPriceGwei, gasLimit, chainId, skipValidation } = params;
|
|
487
487
|
const spenderAddress = resolveSpenderAddress(chain, platform);
|
|
488
|
-
return approveTokenBatchRaw({ rpcUrl, privateKeys, tokenAddress, spenderAddress, amounts, signOnly, gasPriceGwei, gasLimit, chainId });
|
|
488
|
+
return approveTokenBatchRaw({ rpcUrl, privateKeys, tokenAddress, spenderAddress, amounts, signOnly, gasPriceGwei, gasLimit, chainId, skipValidation });
|
|
489
489
|
}
|
|
490
490
|
export async function approveTokenBatchRaw(params) {
|
|
491
|
-
const { rpcUrl, privateKeys, tokenAddress, spenderAddress, amounts, signOnly, gasPriceGwei, gasLimit, chainId = 56, nonceManager: externalNonceManager } = params;
|
|
491
|
+
const { rpcUrl, privateKeys, tokenAddress, spenderAddress, amounts, signOnly, gasPriceGwei, gasLimit, chainId = 56, nonceManager: externalNonceManager, skipValidation } = params;
|
|
492
492
|
if (privateKeys.length === 0 || amounts.length !== privateKeys.length) {
|
|
493
493
|
throw new Error('❌ 私钥数量和授权数量必须匹配');
|
|
494
494
|
}
|
|
@@ -496,9 +496,11 @@ export async function approveTokenBatchRaw(params) {
|
|
|
496
496
|
// ✅ 规范化地址(转为小写,避免 checksum 错误)
|
|
497
497
|
const normalizedToken = tokenAddress.toLowerCase();
|
|
498
498
|
const normalizedSpender = spenderAddress.toLowerCase();
|
|
499
|
-
//
|
|
500
|
-
|
|
501
|
-
|
|
499
|
+
// 验证地址(如果 skipValidation=true 则跳过)
|
|
500
|
+
if (!skipValidation) {
|
|
501
|
+
await validateContractAddress(provider, normalizedToken, 'Token');
|
|
502
|
+
await validateContractAddress(provider, normalizedSpender, 'Spender');
|
|
503
|
+
}
|
|
502
504
|
// ✅ 优化:批量创建钱包和合约实例
|
|
503
505
|
const wallets = privateKeys.map(key => new Wallet(key, provider));
|
|
504
506
|
const ownerAddresses = wallets.map(w => w.address);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "four-flap-meme-sdk",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.28",
|
|
4
4
|
"description": "SDK for Flap bonding curve and four.meme TokenManager",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,4 +38,4 @@
|
|
|
38
38
|
"solc": "^0.8.33",
|
|
39
39
|
"typescript": "^5.6.3"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|