four-flap-meme-sdk 1.1.91 → 1.1.93

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.
@@ -3,6 +3,7 @@ import { MerkleClient } from '../../clients/merkle.js';
3
3
  import { NonceManager, getOptimizedGasPrice } from '../../utils/bundle-helpers.js';
4
4
  import { ADDRESSES } from '../../utils/constants.js';
5
5
  import { getTxType, getGasPriceConfig } from './config.js';
6
+ import { batchCheckAllowances } from '../../utils/erc20.js';
6
7
  // ==================== ERC20 ABI ====================
7
8
  const ERC20_ABI = [
8
9
  'function approve(address spender, uint256 amount) returns (bool)',
@@ -33,7 +34,6 @@ export async function approveFourTokenManagerBatch(params) {
33
34
  const wallets = privateKeys.map(k => new Wallet(k, provider));
34
35
  const amountsBigInt = amounts.map(a => a === 'max' ? ethers.MaxUint256 : ethers.parseUnits(a, decimals));
35
36
  // 检查现有授权,过滤掉已经足够的
36
- const { batchCheckAllowances } = await import('../../utils/erc20.js');
37
37
  const allowances = await batchCheckAllowances(provider, tokenAddress, wallets.map(w => w.address), tmAddr);
38
38
  // 只授权不足的
39
39
  const APPROVAL_THRESHOLD = ethers.MaxUint256 / 2n;
@@ -4,6 +4,7 @@ import { NonceManager, getOptimizedGasPrice } from '../../utils/bundle-helpers.j
4
4
  import { ADDRESSES } from '../../utils/constants.js';
5
5
  import { FourClient, buildLoginMessage } from '../../clients/four.js';
6
6
  import { getErrorMessage, getTxType, getGasPriceConfig, shouldExtractProfit, calculateProfit } from './config.js';
7
+ import { batchCheckAllowances } from '../../utils/erc20.js';
7
8
  // ==================== TokenManager2 ABI(仅需要的方法)====================
8
9
  const TM2_ABI = [
9
10
  'function createToken(bytes args, bytes signature) payable',
@@ -335,7 +336,6 @@ export async function batchSellWithBundleMerkle(params) {
335
336
  'function allowance(address owner, address spender) view returns (uint256)'
336
337
  ];
337
338
  console.log('🔍 使用 Multicall3 批量检查授权状态...');
338
- const { batchCheckAllowances } = await import('../../utils/erc20.js');
339
339
  const allowances = await batchCheckAllowances(provider, tokenAddress, sellers.map(w => w.address), tmAddr);
340
340
  // 找出需要授权的钱包索引
341
341
  // 使用 MaxUint256 的一半作为阈值,确保能处理超大供应量代币
@@ -3,6 +3,7 @@ import { MerkleClient } from '../../clients/merkle.js';
3
3
  import { NonceManager, getOptimizedGasPrice } from '../../utils/bundle-helpers.js';
4
4
  import { ADDRESSES } from '../../utils/constants.js';
5
5
  import { getTxType, getBundleOptions, getGasPriceConfig, shouldExtractProfit, calculateProfit, calculateBatchProfit } from './config.js';
6
+ import { batchCheckAllowances } from '../../utils/erc20.js';
6
7
  // 常量
7
8
  const WBNB_ADDRESS = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c';
8
9
  const FLAT_FEE = ethers.parseEther('0.0001'); // 合约固定手续费
@@ -364,7 +365,6 @@ export async function fourPancakeProxyBatchSellMerkle(params) {
364
365
  const amountsWei = sellAmounts.map(a => ethers.parseUnits(a, tokenDecimals));
365
366
  // ✅ Step 1: 使用 Multicall3 批量检查授权状态
366
367
  console.log('🔍 使用 Multicall3 批量检查授权状态...');
367
- const { batchCheckAllowances } = await import('../../utils/erc20.js');
368
368
  const allowances = await batchCheckAllowances(provider, tokenAddress, sellers.map(w => w.address), pancakeProxyAddress);
369
369
  // 找出需要授权的钱包索引
370
370
  const needApprovalIndexes = [];
@@ -3,6 +3,7 @@ import { MerkleClient } from '../../clients/merkle.js';
3
3
  import { NonceManager, getOptimizedGasPrice } from '../../utils/bundle-helpers.js';
4
4
  import { ADDRESSES } from '../../utils/constants.js';
5
5
  import { getTxType, getGasPriceConfig, shouldExtractProfit, calculateProfit, calculateBatchProfit } from './config.js';
6
+ import { batchCheckAllowances } from '../../utils/erc20.js';
6
7
  // ==================== TokenManager2 ABI(仅需要的方法)====================
7
8
  const TM2_ABI = [
8
9
  'function buyTokenAMAP(uint256 origin, address token, address to, uint256 funds, uint256 minAmount) payable',
@@ -244,7 +245,6 @@ export async function fourBatchPrivateSellMerkle(params) {
244
245
  const amountsWei = amounts.map((a) => ethers.parseUnits(a, 18));
245
246
  // ✅ Step 1: 使用 Multicall3 批量检查授权状态
246
247
  console.log('🔍 使用 Multicall3 批量检查授权状态...');
247
- const { batchCheckAllowances } = await import('../../utils/erc20.js');
248
248
  const allowances = await batchCheckAllowances(provider, tokenAddress, wallets.map(w => w.address), tmAddr);
249
249
  // 找出需要授权的钱包索引
250
250
  // 使用 MaxUint256 的一半作为阈值,确保能处理超大供应量代币
@@ -3,6 +3,7 @@ import { MerkleClient } from '../../clients/merkle.js';
3
3
  import { NonceManager, getOptimizedGasPrice } from '../../utils/bundle-helpers.js';
4
4
  import { ADDRESSES } from '../../utils/constants.js';
5
5
  import { CHAIN_ID_MAP, getTxType, getBundleOptions, getGasPriceConfig, shouldExtractProfit, calculateProfit, calculateBatchProfit } from './config.js';
6
+ import { batchCheckAllowances } from '../../utils/erc20.js';
6
7
  // 常量
7
8
  const WBNB_ADDRESS = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c';
8
9
  const FLAT_FEE = ethers.parseEther('0.0001'); // 合约固定手续费
@@ -367,7 +368,6 @@ export async function pancakeProxyBatchSellMerkle(params) {
367
368
  const amountsWei = sellAmounts.map(a => ethers.parseUnits(a, tokenDecimals));
368
369
  // ✅ Step 1: 使用 Multicall3 批量检查授权状态
369
370
  console.log('🔍 使用 Multicall3 批量检查授权状态...');
370
- const { batchCheckAllowances } = await import('../../utils/erc20.js');
371
371
  const allowances = await batchCheckAllowances(provider, tokenAddress, sellers.map(w => w.address), pancakeProxyAddress);
372
372
  // 找出需要授权的钱包索引
373
373
  const needApprovalIndexes = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.1.91",
3
+ "version": "1.1.93",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",