four-flap-meme-sdk 1.9.45 → 1.9.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.
@@ -0,0 +1,50 @@
1
+ /**
2
+ * ENI BatchRouter — 发币+首买 (FairLaunch + BatchBuy)
3
+ *
4
+ * 原子化操作:在同一笔交易中完成 launchToken + V2/V3 batchBuy
5
+ */
6
+ import { type FairLaunchParamsForRouter } from './utils.js';
7
+ import type { BatchRouterConfig } from './types.js';
8
+ export interface FairLaunchAndBatchBuyParams extends BatchRouterConfig {
9
+ launcher?: string;
10
+ launchParams: FairLaunchParamsForRouter;
11
+ /** msg.value for launchToken (initialQuote when using native quote) */
12
+ launchValue: bigint;
13
+ router?: string;
14
+ token: string;
15
+ buyers: string[];
16
+ buyAmounts: bigint[];
17
+ }
18
+ export interface FairLaunchAndBatchBuyResult {
19
+ signedTx: string;
20
+ from: string;
21
+ nonce: number;
22
+ totalValue: bigint;
23
+ estimatedGas: bigint;
24
+ }
25
+ /**
26
+ * 公平发射 + V2 批量买入(原子化)
27
+ */
28
+ export declare function fairLaunchAndBatchBuyV2(params: FairLaunchAndBatchBuyParams & {
29
+ path?: string[];
30
+ }): Promise<FairLaunchAndBatchBuyResult>;
31
+ /**
32
+ * 公平发射 + V3 批量买入(原子化)
33
+ */
34
+ export declare function fairLaunchAndBatchBuyV3(params: FairLaunchAndBatchBuyParams & {
35
+ fee: number;
36
+ }): Promise<FairLaunchAndBatchBuyResult>;
37
+ export interface CreateAndBatchBuyParams extends BatchRouterConfig {
38
+ portal: string;
39
+ name: string;
40
+ symbol: string;
41
+ salt: string;
42
+ createValue: bigint;
43
+ token: string;
44
+ buyers: string[];
45
+ buyAmounts: bigint[];
46
+ }
47
+ /**
48
+ * DAOaaS 内盘发币 + 批量买入(原子化)
49
+ */
50
+ export declare function createAndBatchBuy(params: CreateAndBatchBuyParams): Promise<FairLaunchAndBatchBuyResult>;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * ENI BatchRouter — 发币+首买 (FairLaunch + BatchBuy)
3
+ *
4
+ * 原子化操作:在同一笔交易中完成 launchToken + V2/V3 batchBuy
5
+ */
6
+ import { DSWAP_V2_ROUTER } from '../constants.js';
7
+ import { LP_FAIR_LAUNCHER_ADDRESS } from '../platforms/fair-launch/constants.js';
8
+ import { estimateGas } from './constants.js';
9
+ import { encodeFairLaunchAndBatchBuyV2, encodeFairLaunchAndBatchBuyV3, encodeCreateAndBatchBuy, buildBatchRouterTx, } from './utils.js';
10
+ const LAUNCH_EXTRA_GAS = 3000000n;
11
+ /**
12
+ * 公平发射 + V2 批量买入(原子化)
13
+ */
14
+ export async function fairLaunchAndBatchBuyV2(params) {
15
+ const { launcher = LP_FAIR_LAUNCHER_ADDRESS, launchParams, launchValue, router = DSWAP_V2_ROUTER, token, buyers, buyAmounts, } = params;
16
+ const totalBuyAmount = buyAmounts.reduce((a, b) => a + b, 0n);
17
+ const totalValue = launchValue + totalBuyAmount;
18
+ const calldata = encodeFairLaunchAndBatchBuyV2(launcher, launchParams, launchValue, router, token, buyers, buyAmounts);
19
+ const gasLimit = LAUNCH_EXTRA_GAS + estimateGas(buyers.length, 'v2');
20
+ const result = await buildBatchRouterTx({
21
+ rpcUrl: params.rpcUrl,
22
+ mainPrivateKey: params.mainPrivateKey,
23
+ batchRouterAddress: params.batchRouterAddress,
24
+ calldata,
25
+ value: totalValue,
26
+ gasLimit,
27
+ gasPrice: params.gasPrice,
28
+ });
29
+ return { ...result, totalValue, estimatedGas: gasLimit };
30
+ }
31
+ /**
32
+ * 公平发射 + V3 批量买入(原子化)
33
+ */
34
+ export async function fairLaunchAndBatchBuyV3(params) {
35
+ const { launcher = LP_FAIR_LAUNCHER_ADDRESS, launchParams, launchValue, router, token, fee, buyers, buyAmounts, } = params;
36
+ if (!router)
37
+ throw new Error('fairLaunchAndBatchBuyV3 requires router address');
38
+ const totalBuyAmount = buyAmounts.reduce((a, b) => a + b, 0n);
39
+ const totalValue = launchValue + totalBuyAmount;
40
+ const calldata = encodeFairLaunchAndBatchBuyV3(launcher, launchParams, launchValue, router, token, fee, buyers, buyAmounts);
41
+ const gasLimit = LAUNCH_EXTRA_GAS + estimateGas(buyers.length, 'v3');
42
+ const result = await buildBatchRouterTx({
43
+ rpcUrl: params.rpcUrl,
44
+ mainPrivateKey: params.mainPrivateKey,
45
+ batchRouterAddress: params.batchRouterAddress,
46
+ calldata,
47
+ value: totalValue,
48
+ gasLimit,
49
+ gasPrice: params.gasPrice,
50
+ });
51
+ return { ...result, totalValue, estimatedGas: gasLimit };
52
+ }
53
+ /**
54
+ * DAOaaS 内盘发币 + 批量买入(原子化)
55
+ */
56
+ export async function createAndBatchBuy(params) {
57
+ const { portal, name, symbol, salt, createValue, token, buyers, buyAmounts, } = params;
58
+ const totalBuyAmount = buyAmounts.reduce((a, b) => a + b, 0n);
59
+ const totalValue = createValue + totalBuyAmount;
60
+ const calldata = encodeCreateAndBatchBuy(portal, name, symbol, salt, createValue, token, buyers, buyAmounts);
61
+ const gasLimit = LAUNCH_EXTRA_GAS + estimateGas(buyers.length, 'portal');
62
+ const result = await buildBatchRouterTx({
63
+ rpcUrl: params.rpcUrl,
64
+ mainPrivateKey: params.mainPrivateKey,
65
+ batchRouterAddress: params.batchRouterAddress,
66
+ calldata,
67
+ value: totalValue,
68
+ gasLimit,
69
+ gasPrice: params.gasPrice,
70
+ });
71
+ return { ...result, totalValue, estimatedGas: gasLimit };
72
+ }
@@ -11,4 +11,5 @@ export { batchSellPortal, batchSellV2, batchSellV3 } from './bundle-sell.js';
11
11
  export { atomicSwapPortal, batchSwapPortal, atomicSwapV2, batchSwapV2, atomicSwapV3, batchSwapV3, type V3SwapParams, } from './bundle-swap.js';
12
12
  export { batchApprove } from './bundle-approve.js';
13
13
  export { washVolume, washVolumeV2, washVolumeV3, type WashVolumeParams, type WashVolumeResult, } from './volume.js';
14
+ export { fairLaunchAndBatchBuyV2, fairLaunchAndBatchBuyV3, createAndBatchBuy, type FairLaunchAndBatchBuyParams, type FairLaunchAndBatchBuyResult, type CreateAndBatchBuyParams, } from './bundle-launch.js';
14
15
  export { batchTransferEgas, batchTransferToken, batchSweepToken, batchSweepEgas, eniDisperseForSubmit, eniSweepForSubmit, type BatchTransferTokenParams, type BatchSweepTokenParams, type BatchSweepTokenResult, type BatchSweepEgasParams, type EniDisperseParams, type EniDisperseResult, type EniSweepParams, type EniSweepResult, } from './transfer.js';
@@ -41,4 +41,5 @@ export { batchSellPortal, batchSellV2, batchSellV3 } from './bundle-sell.js';
41
41
  export { atomicSwapPortal, batchSwapPortal, atomicSwapV2, batchSwapV2, atomicSwapV3, batchSwapV3, } from './bundle-swap.js';
42
42
  export { batchApprove } from './bundle-approve.js';
43
43
  export { washVolume, washVolumeV2, washVolumeV3, } from './volume.js';
44
+ export { fairLaunchAndBatchBuyV2, fairLaunchAndBatchBuyV3, createAndBatchBuy, } from './bundle-launch.js';
44
45
  export { batchTransferEgas, batchTransferToken, batchSweepToken, batchSweepEgas, eniDisperseForSubmit, eniSweepForSubmit, } from './transfer.js';
package/dist/index.d.ts CHANGED
@@ -73,7 +73,8 @@ export type { LaunchParams as EniLaunchParams, FairLaunchTokenInfo as EniFairLau
73
73
  export { FairPoolQuery as EniFairPoolQuery, claimFromPool as eniClaimFromPool, claimFromPoolForSubmit as eniClaimFromPoolForSubmit, batchClaimForSubmit as eniBatchClaimForSubmit, } from './chains/eni/index.js';
74
74
  export type { PoolOverview as EniPoolOverview, PoolClaimParams as EniPoolClaimParams, PoolClaimResult as EniPoolClaimResult, } from './chains/eni/index.js';
75
75
  export { batchBuyPortal as eniBatchBuyPortal, batchBuyV2 as eniBatchBuyV2, batchSellPortal as eniBatchSellPortal, batchSellV2 as eniBatchSellV2, atomicSwapPortal as eniAtomicSwapPortal, batchSwapPortal as eniBatchSwapPortal, atomicSwapV2 as eniAtomicSwapV2, batchSwapV2 as eniBatchSwapV2, batchApprove as eniBatchApprove, washVolume as eniWashVolume, washVolumeV2 as eniWashVolumeV2, batchTransferEgas as eniBatchTransferEgas, batchTransferToken as eniBatchTransferToken, batchSweepToken as eniBatchSweepToken, batchSweepEgas as eniBatchSweepEgas, eniDisperseForSubmit, eniSweepForSubmit, validateBatchParams as eniValidateBatchParams, encodeBatchBuy as eniEncodeBatchBuy, encodeBatchSell as eniEncodeBatchSell, encodeAtomicSwap as eniEncodeAtomicSwap, encodeBatchSwap as eniEncodeBatchSwap, encodeAtomicSwapV2 as eniEncodeAtomicSwapV2, encodeBatchSwapV2 as eniEncodeBatchSwapV2, encodeBatchTransfer as eniEncodeBatchTransfer, encodeBatchSweepToken as eniEncodeBatchSweepToken, buildBatchRouterTx as eniBuildBatchRouterTx, estimateGas as eniEstimateGas, BATCH_ROUTER_ADDRESS as ENI_BATCH_ROUTER_ADDRESS, BATCH_ROUTER_ABI as ENI_BATCH_ROUTER_ABI, MAX_BATCH_SIZE as ENI_MAX_BATCH_SIZE, } from './chains/eni/batch-router/index.js';
76
- export type { BatchRouterConfig as EniBatchRouterConfig, BatchBuyParams as EniBatchBuyParams, BatchBuyResult as EniBatchBuyResult, BatchSellParams as EniBatchSellParams, BatchSellResult as EniBatchSellResult, AtomicSwapParams as EniAtomicSwapParams, AtomicSwapResult as EniAtomicSwapResult, BatchApproveParams as EniBatchApproveParams, BatchApproveResult as EniBatchApproveResult, BatchTransferParams as EniBatchTransferParams, BatchTransferResult as EniBatchTransferResult, WashVolumeParams as EniWashVolumeParams, WashVolumeResult as EniWashVolumeResult, BatchSweepTokenParams as EniBatchSweepTokenParams, BatchSweepTokenResult as EniBatchSweepTokenResult, BatchSweepEgasParams as EniBatchSweepEgasParams, BatchTransferTokenParams as EniBatchTransferTokenParams, EniDisperseParams, EniDisperseResult, EniSweepParams, EniSweepResult, } from './chains/eni/batch-router/index.js';
76
+ export type { BatchRouterConfig as EniBatchRouterConfig, BatchBuyParams as EniBatchBuyParams, BatchBuyResult as EniBatchBuyResult, BatchSellParams as EniBatchSellParams, BatchSellResult as EniBatchSellResult, AtomicSwapParams as EniAtomicSwapParams, AtomicSwapResult as EniAtomicSwapResult, BatchApproveParams as EniBatchApproveParams, BatchApproveResult as EniBatchApproveResult, BatchTransferParams as EniBatchTransferParams, BatchTransferResult as EniBatchTransferResult, WashVolumeParams as EniWashVolumeParams, WashVolumeResult as EniWashVolumeResult, BatchSweepTokenParams as EniBatchSweepTokenParams, BatchSweepTokenResult as EniBatchSweepTokenResult, BatchSweepEgasParams as EniBatchSweepEgasParams, BatchTransferTokenParams as EniBatchTransferTokenParams, EniDisperseParams, EniDisperseResult, EniSweepParams, EniSweepResult, FairLaunchAndBatchBuyParams as EniFairLaunchAndBatchBuyParams, FairLaunchAndBatchBuyResult as EniFairLaunchAndBatchBuyResult, CreateAndBatchBuyParams as EniCreateAndBatchBuyParams, } from './chains/eni/batch-router/index.js';
77
+ export type { FairLaunchParamsForRouter, } from './chains/eni/batch-router/utils.js';
77
78
  export { getLPPairInfo as eniGetLPPairInfo, batchGetLPPairInfo as eniBatchGetLPPairInfo, getPairAddress as eniGetPairAddress, addLiquidityETHForSubmit as eniAddLiquidityETHForSubmit, removeLiquidityETHForSubmit as eniRemoveLiquidityETHForSubmit, addLiquidityForSubmit as eniAddLiquidityForSubmit, removeLiquidityForSubmit as eniRemoveLiquidityForSubmit, } from './chains/eni/index.js';
78
79
  export type { LPPairInfo as EniLPPairInfo, GetLPInfoParams as EniGetLPInfoParams, AddLiquidityETHParams as EniAddLiquidityETHParams, RemoveLiquidityETHParams as EniRemoveLiquidityETHParams, AddLiquidityParams as EniAddLiquidityParams, RemoveLiquidityParams as EniRemoveLiquidityParams, LiquidityForSubmitResult as EniLiquidityForSubmitResult, } from './chains/eni/index.js';
79
80
  export { EniIroFactoryQuery, eniIroEncodeCreateProjectCall, eniIroCreateProject, eniIroParseCreateProjectEvent, EniIroTokenQuery, eniIroSubscribe, eniIroPledge, eniIroBatchSubscribe, eniIroBatchSubscribeForSubmit, EniIroPoolQuery, eniIroPoolRemovePledge, eniIroPoolExtract, eniIroPoolTransferAwards, eniIroBatchExtract, ENI_IRO_FACTORY_ADDRESS, ENI_IRO_OWNER_ADDRESS, ENI_IRO_SELL_FEE_CONTRACT, ENI_IROSWAP_V2_ROUTER, ENI_IROSWAP_V2_FACTORY, ENI_IRO_FACTORY_ABI, ENI_IRO_TOKEN_ABI, ENI_IRO_POOL_ABI, ENI_IRO_PLATFORM_URL, setEniIroApiBase, eniIroApiCreateProject, eniIroApiUploadImage, eniIroGetTokenWhiteList, eniIroAddTokenWhiteListForSubmit, eniIroBatchAddTokenWhiteListForSubmit, eniIroRemoveTokenWhiteListForSubmit, ENI_IRO_OWNER_WHITELIST_ABI, } from './chains/eni/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "four-flap-meme-sdk",
3
- "version": "1.9.45",
3
+ "version": "1.9.46",
4
4
  "description": "SDK for Flap bonding curve and four.meme TokenManager",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",