four-flap-meme-sdk 1.4.20 → 1.4.21

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.
Files changed (103) hide show
  1. package/dist/flap/portal-bundle-merkle/encryption.d.ts +16 -0
  2. package/dist/flap/portal-bundle-merkle/encryption.js +146 -0
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +0 -1
  5. package/package.json +3 -38
  6. package/dist/sol/constants.d.ts +0 -126
  7. package/dist/sol/constants.js +0 -145
  8. package/dist/sol/dex/index.d.ts +0 -8
  9. package/dist/sol/dex/index.js +0 -12
  10. package/dist/sol/dex/meteora/client.d.ts +0 -76
  11. package/dist/sol/dex/meteora/client.js +0 -219
  12. package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +0 -61
  13. package/dist/sol/dex/meteora/damm-v1-bundle.js +0 -112
  14. package/dist/sol/dex/meteora/damm-v1.d.ts +0 -118
  15. package/dist/sol/dex/meteora/damm-v1.js +0 -315
  16. package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +0 -82
  17. package/dist/sol/dex/meteora/damm-v2-bundle.js +0 -242
  18. package/dist/sol/dex/meteora/damm-v2.d.ts +0 -172
  19. package/dist/sol/dex/meteora/damm-v2.js +0 -632
  20. package/dist/sol/dex/meteora/dbc-bundle.d.ts +0 -123
  21. package/dist/sol/dex/meteora/dbc-bundle.js +0 -304
  22. package/dist/sol/dex/meteora/dbc.d.ts +0 -192
  23. package/dist/sol/dex/meteora/dbc.js +0 -619
  24. package/dist/sol/dex/meteora/dlmm-bundle.d.ts +0 -39
  25. package/dist/sol/dex/meteora/dlmm-bundle.js +0 -189
  26. package/dist/sol/dex/meteora/dlmm.d.ts +0 -157
  27. package/dist/sol/dex/meteora/dlmm.js +0 -671
  28. package/dist/sol/dex/meteora/index.d.ts +0 -25
  29. package/dist/sol/dex/meteora/index.js +0 -65
  30. package/dist/sol/dex/meteora/types.d.ts +0 -787
  31. package/dist/sol/dex/meteora/types.js +0 -110
  32. package/dist/sol/dex/orca/index.d.ts +0 -10
  33. package/dist/sol/dex/orca/index.js +0 -16
  34. package/dist/sol/dex/orca/orca-bundle.d.ts +0 -41
  35. package/dist/sol/dex/orca/orca-bundle.js +0 -173
  36. package/dist/sol/dex/orca/orca.d.ts +0 -65
  37. package/dist/sol/dex/orca/orca.js +0 -474
  38. package/dist/sol/dex/orca/types.d.ts +0 -263
  39. package/dist/sol/dex/orca/types.js +0 -38
  40. package/dist/sol/dex/orca/wavebreak-bundle.d.ts +0 -34
  41. package/dist/sol/dex/orca/wavebreak-bundle.js +0 -198
  42. package/dist/sol/dex/orca/wavebreak-types.d.ts +0 -227
  43. package/dist/sol/dex/orca/wavebreak-types.js +0 -23
  44. package/dist/sol/dex/orca/wavebreak.d.ts +0 -78
  45. package/dist/sol/dex/orca/wavebreak.js +0 -497
  46. package/dist/sol/dex/pump/index.d.ts +0 -9
  47. package/dist/sol/dex/pump/index.js +0 -14
  48. package/dist/sol/dex/pump/pump-bundle.d.ts +0 -92
  49. package/dist/sol/dex/pump/pump-bundle.js +0 -383
  50. package/dist/sol/dex/pump/pump-swap-bundle.d.ts +0 -103
  51. package/dist/sol/dex/pump/pump-swap-bundle.js +0 -380
  52. package/dist/sol/dex/pump/pump-swap.d.ts +0 -46
  53. package/dist/sol/dex/pump/pump-swap.js +0 -199
  54. package/dist/sol/dex/pump/pump.d.ts +0 -35
  55. package/dist/sol/dex/pump/pump.js +0 -352
  56. package/dist/sol/dex/pump/types.d.ts +0 -215
  57. package/dist/sol/dex/pump/types.js +0 -5
  58. package/dist/sol/dex/raydium/index.d.ts +0 -8
  59. package/dist/sol/dex/raydium/index.js +0 -12
  60. package/dist/sol/dex/raydium/launchlab.d.ts +0 -68
  61. package/dist/sol/dex/raydium/launchlab.js +0 -210
  62. package/dist/sol/dex/raydium/raydium-bundle.d.ts +0 -64
  63. package/dist/sol/dex/raydium/raydium-bundle.js +0 -324
  64. package/dist/sol/dex/raydium/raydium.d.ts +0 -40
  65. package/dist/sol/dex/raydium/raydium.js +0 -366
  66. package/dist/sol/dex/raydium/types.d.ts +0 -240
  67. package/dist/sol/dex/raydium/types.js +0 -5
  68. package/dist/sol/index.d.ts +0 -10
  69. package/dist/sol/index.js +0 -16
  70. package/dist/sol/jito/bundle.d.ts +0 -90
  71. package/dist/sol/jito/bundle.js +0 -263
  72. package/dist/sol/jito/index.d.ts +0 -7
  73. package/dist/sol/jito/index.js +0 -7
  74. package/dist/sol/jito/tip.d.ts +0 -51
  75. package/dist/sol/jito/tip.js +0 -83
  76. package/dist/sol/jito/types.d.ts +0 -100
  77. package/dist/sol/jito/types.js +0 -5
  78. package/dist/sol/token/create-complete.d.ts +0 -115
  79. package/dist/sol/token/create-complete.js +0 -235
  80. package/dist/sol/token/create-token.d.ts +0 -57
  81. package/dist/sol/token/create-token.js +0 -230
  82. package/dist/sol/token/index.d.ts +0 -9
  83. package/dist/sol/token/index.js +0 -14
  84. package/dist/sol/token/metadata-upload.d.ts +0 -86
  85. package/dist/sol/token/metadata-upload.js +0 -173
  86. package/dist/sol/token/metadata.d.ts +0 -92
  87. package/dist/sol/token/metadata.js +0 -274
  88. package/dist/sol/token/types.d.ts +0 -153
  89. package/dist/sol/token/types.js +0 -5
  90. package/dist/sol/types.d.ts +0 -176
  91. package/dist/sol/types.js +0 -7
  92. package/dist/sol/utils/balance.d.ts +0 -160
  93. package/dist/sol/utils/balance.js +0 -638
  94. package/dist/sol/utils/connection.d.ts +0 -78
  95. package/dist/sol/utils/connection.js +0 -168
  96. package/dist/sol/utils/index.d.ts +0 -9
  97. package/dist/sol/utils/index.js +0 -9
  98. package/dist/sol/utils/lp-inspect.d.ts +0 -129
  99. package/dist/sol/utils/lp-inspect.js +0 -900
  100. package/dist/sol/utils/transfer.d.ts +0 -125
  101. package/dist/sol/utils/transfer.js +0 -220
  102. package/dist/sol/utils/wallet.d.ts +0 -107
  103. package/dist/sol/utils/wallet.js +0 -210
@@ -1,123 +0,0 @@
1
- /**
2
- * Meteora DBC Bundle 批量交易
3
- *
4
- * 支持 Jito Bundle 的批量买卖
5
- */
6
- import { Connection, Keypair } from '@solana/web3.js';
7
- import BN from 'bn.js';
8
- import type { DbcBundleSwapParams, MeteoraBundleSignedResult } from './types.js';
9
- /**
10
- * 创建池并捆绑首买参数
11
- */
12
- export interface DbcCreatePoolAndBundleBuyParams {
13
- /** 配置地址 */
14
- configAddress: string;
15
- /** 代币名称 */
16
- name: string;
17
- /** 代币符号 */
18
- symbol: string;
19
- /** 代币 URI (metadata) */
20
- uri: string;
21
- /** Base Mint Keypair */
22
- baseMintKeypair: Keypair;
23
- /** 池创建者钱包 */
24
- creatorWallet: Keypair;
25
- /** 创建者首买金额 (可选) */
26
- creatorBuyAmount?: BN;
27
- /** 批量首买交易列表 */
28
- bundleBuys: {
29
- wallet: Keypair;
30
- buyAmount: BN;
31
- minAmountOut?: BN;
32
- }[];
33
- /** 滑点 (bps) */
34
- slippageBps?: number;
35
- /** Jito 小费 */
36
- jitoTipLamports?: number;
37
- }
38
- /**
39
- * 创建池并捆绑首买结果
40
- */
41
- export interface DbcCreatePoolBundleResult extends MeteoraBundleSignedResult {
42
- /** 池地址 */
43
- poolAddress: string;
44
- /** Base Mint 地址 */
45
- baseMint: string;
46
- }
47
- /**
48
- * 签名 DBC Bundle 批量买入交易
49
- *
50
- * @param params Bundle 参数
51
- * @param connection 可选连接
52
- */
53
- export declare function signDbcBundleBuy(params: DbcBundleSwapParams, connection?: Connection): Promise<MeteoraBundleSignedResult>;
54
- /**
55
- * 签名 DBC Bundle 批量卖出交易
56
- *
57
- * @param params Bundle 参数
58
- * @param connection 可选连接
59
- */
60
- export declare function signDbcBundleSell(params: DbcBundleSwapParams, connection?: Connection): Promise<MeteoraBundleSignedResult>;
61
- /**
62
- * 将 Bundle 结果转换为后端 API 请求格式
63
- */
64
- export declare function toDbcBundleApiRequest(result: MeteoraBundleSignedResult): {
65
- transactions: string[];
66
- type: string;
67
- poolAddress: string;
68
- tradeCount: number;
69
- jitoTipLamports: number;
70
- };
71
- /**
72
- * 签名 DBC 创建池并捆绑多地址首买交易
73
- *
74
- * 交易顺序:
75
- * 1. 创建池交易 (由创建者签名)
76
- * 2. 创建者首买交易 (可选)
77
- * 3. 多个地址的首买交易
78
- * 4. 最后一笔交易包含 Jito tip
79
- *
80
- * @param params 创建池并捆绑首买参数
81
- * @param connection 可选连接
82
- */
83
- export declare function signDbcCreatePoolAndBundleBuy(params: DbcCreatePoolAndBundleBuyParams, connection?: Connection): Promise<DbcCreatePoolBundleResult>;
84
- /**
85
- * 签名 DBC 创建池并捆绑多地址首买交易 (使用已有配置)
86
- *
87
- * 适用于使用平台方已有的 Config,只需创建池并首买
88
- *
89
- * @param params 创建池并捆绑首买参数
90
- * @param connection 可选连接
91
- */
92
- export declare function signDbcCreatePoolBundleBuyWithConfig(params: {
93
- /** 配置地址 */
94
- configAddress: string;
95
- /** 代币名称 */
96
- name: string;
97
- /** 代币符号 */
98
- symbol: string;
99
- /** 代币 URI */
100
- uri: string;
101
- /** Base Mint Keypair */
102
- baseMintKeypair: Keypair;
103
- /** 池创建者钱包 (付款并创建池) */
104
- creatorWallet: Keypair;
105
- /** 批量首买交易列表 (第一个地址会和创建池合并在同一笔交易) */
106
- bundleBuys: {
107
- wallet: Keypair;
108
- buyAmount: BN;
109
- minAmountOut?: BN;
110
- }[];
111
- /** 滑点 (bps) */
112
- slippageBps?: number;
113
- /** Jito 小费 */
114
- jitoTipLamports?: number;
115
- }, connection?: Connection): Promise<DbcCreatePoolBundleResult>;
116
- /**
117
- * 签名 DBC 通用 Bundle Swap 交易
118
- *
119
- * @param params Bundle 参数
120
- * @param swapBaseForQuote 是否卖出 (true = 卖出 base 换 quote, false = 买入)
121
- * @param connection 可选连接
122
- */
123
- export declare function signDbcBundleSwap(params: DbcBundleSwapParams, swapBaseForQuote: boolean, connection?: Connection): Promise<MeteoraBundleSignedResult>;
@@ -1,304 +0,0 @@
1
- /**
2
- * Meteora DBC Bundle 批量交易
3
- *
4
- * 支持 Jito Bundle 的批量买卖
5
- */
6
- import { PublicKey, } from '@solana/web3.js';
7
- import BN from 'bn.js';
8
- import { getCurrentPoint } from '@meteora-ag/dynamic-bonding-curve-sdk';
9
- import { getConnection, getDbcClient } from './client.js';
10
- import { buildTipInstruction } from '../../jito/tip.js';
11
- // ============================================================================
12
- // Bundle 批量买入
13
- // ============================================================================
14
- /**
15
- * 签名 DBC Bundle 批量买入交易
16
- *
17
- * @param params Bundle 参数
18
- * @param connection 可选连接
19
- */
20
- export async function signDbcBundleBuy(params, connection) {
21
- const conn = getConnection(connection);
22
- const client = getDbcClient(connection);
23
- const poolPubkey = new PublicKey(params.poolAddress);
24
- const poolState = await client.state.getPool(poolPubkey);
25
- const configState = await client.state.getPoolConfig(poolState.config);
26
- const currentPoint = await getCurrentPoint(conn, configState.activationType);
27
- const signedTransactions = [];
28
- for (let i = 0; i < params.trades.length; i++) {
29
- const trade = params.trades[i];
30
- const quote = client.pool.swapQuote({
31
- virtualPool: poolState,
32
- config: configState,
33
- swapBaseForQuote: false,
34
- amountIn: trade.amountIn,
35
- hasReferral: false,
36
- currentPoint,
37
- slippageBps: params.slippageBps || 100,
38
- });
39
- const minAmountOut = trade.minAmountOut || quote.minimumAmountOut;
40
- const swapTx = await client.pool.swap({
41
- owner: trade.wallet.publicKey,
42
- pool: poolPubkey,
43
- amountIn: trade.amountIn,
44
- minimumAmountOut: minAmountOut,
45
- swapBaseForQuote: false,
46
- referralTokenAccount: null,
47
- });
48
- if (i === params.trades.length - 1 && params.jitoTipLamports) {
49
- const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
50
- swapTx.add(tipIx);
51
- }
52
- const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
53
- swapTx.recentBlockhash = blockhash;
54
- swapTx.lastValidBlockHeight = lastValidBlockHeight;
55
- swapTx.feePayer = trade.wallet.publicKey;
56
- swapTx.sign(trade.wallet);
57
- signedTransactions.push(swapTx);
58
- }
59
- return {
60
- signedTransactions,
61
- type: 'dbc_bundle_buy',
62
- poolAddress: params.poolAddress,
63
- tradeCount: params.trades.length,
64
- jitoTipLamports: params.jitoTipLamports || 0,
65
- };
66
- }
67
- // ============================================================================
68
- // Bundle 批量卖出
69
- // ============================================================================
70
- /**
71
- * 签名 DBC Bundle 批量卖出交易
72
- *
73
- * @param params Bundle 参数
74
- * @param connection 可选连接
75
- */
76
- export async function signDbcBundleSell(params, connection) {
77
- const conn = getConnection(connection);
78
- const client = getDbcClient(connection);
79
- const poolPubkey = new PublicKey(params.poolAddress);
80
- const poolState = await client.state.getPool(poolPubkey);
81
- const configState = await client.state.getPoolConfig(poolState.config);
82
- const currentPoint = await getCurrentPoint(conn, configState.activationType);
83
- const signedTransactions = [];
84
- for (let i = 0; i < params.trades.length; i++) {
85
- const trade = params.trades[i];
86
- const quote = client.pool.swapQuote({
87
- virtualPool: poolState,
88
- config: configState,
89
- swapBaseForQuote: true,
90
- amountIn: trade.amountIn,
91
- hasReferral: false,
92
- currentPoint,
93
- slippageBps: params.slippageBps || 100,
94
- });
95
- const minAmountOut = trade.minAmountOut || quote.minimumAmountOut;
96
- const swapTx = await client.pool.swap({
97
- owner: trade.wallet.publicKey,
98
- pool: poolPubkey,
99
- amountIn: trade.amountIn,
100
- minimumAmountOut: minAmountOut,
101
- swapBaseForQuote: true,
102
- referralTokenAccount: null,
103
- });
104
- if (i === params.trades.length - 1 && params.jitoTipLamports) {
105
- const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
106
- swapTx.add(tipIx);
107
- }
108
- const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
109
- swapTx.recentBlockhash = blockhash;
110
- swapTx.lastValidBlockHeight = lastValidBlockHeight;
111
- swapTx.feePayer = trade.wallet.publicKey;
112
- swapTx.sign(trade.wallet);
113
- signedTransactions.push(swapTx);
114
- }
115
- return {
116
- signedTransactions,
117
- type: 'dbc_bundle_sell',
118
- poolAddress: params.poolAddress,
119
- tradeCount: params.trades.length,
120
- jitoTipLamports: params.jitoTipLamports || 0,
121
- };
122
- }
123
- /**
124
- * 将 Bundle 结果转换为后端 API 请求格式
125
- */
126
- export function toDbcBundleApiRequest(result) {
127
- return {
128
- transactions: result.signedTransactions.map((tx) => tx.serialize().toString('base64')),
129
- type: result.type,
130
- poolAddress: result.poolAddress,
131
- tradeCount: result.tradeCount,
132
- jitoTipLamports: result.jitoTipLamports,
133
- };
134
- }
135
- // ============================================================================
136
- // Bundle 创建池 + 批量首买
137
- // ============================================================================
138
- /**
139
- * 签名 DBC 创建池并捆绑多地址首买交易
140
- *
141
- * 交易顺序:
142
- * 1. 创建池交易 (由创建者签名)
143
- * 2. 创建者首买交易 (可选)
144
- * 3. 多个地址的首买交易
145
- * 4. 最后一笔交易包含 Jito tip
146
- *
147
- * @param params 创建池并捆绑首买参数
148
- * @param connection 可选连接
149
- */
150
- export async function signDbcCreatePoolAndBundleBuy(params, connection) {
151
- const conn = getConnection(connection);
152
- const client = getDbcClient(connection);
153
- const signedTransactions = [];
154
- const configPubkey = new PublicKey(params.configAddress);
155
- // 获取配置状态,用于后续报价
156
- const configState = await client.state.getPoolConfig(configPubkey);
157
- const currentPoint = await getCurrentPoint(conn, configState.activationType);
158
- // ============ 1. 创建池交易 ============
159
- const { createPoolTx, swapBuyTx } = await client.pool.createPoolWithFirstBuy({
160
- createPoolParam: {
161
- baseMint: params.baseMintKeypair.publicKey,
162
- config: configPubkey,
163
- name: params.name,
164
- symbol: params.symbol,
165
- uri: params.uri,
166
- payer: params.creatorWallet.publicKey,
167
- poolCreator: params.creatorWallet.publicKey,
168
- },
169
- firstBuyParam: params.creatorBuyAmount ? {
170
- buyer: params.creatorWallet.publicKey,
171
- buyAmount: params.creatorBuyAmount,
172
- minimumAmountOut: new BN(1),
173
- referralTokenAccount: null,
174
- } : undefined,
175
- });
176
- // 派生池地址
177
- const [poolAddress] = PublicKey.findProgramAddressSync([Buffer.from('pool'), params.baseMintKeypair.publicKey.toBuffer()], new PublicKey('dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN'));
178
- // 签名创建池交易
179
- const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
180
- createPoolTx.recentBlockhash = blockhash;
181
- createPoolTx.lastValidBlockHeight = lastValidBlockHeight;
182
- createPoolTx.feePayer = params.creatorWallet.publicKey;
183
- createPoolTx.sign(params.creatorWallet, params.baseMintKeypair);
184
- signedTransactions.push(createPoolTx);
185
- // ============ 2. 创建者首买交易 (如果有) ============
186
- if (swapBuyTx && params.creatorBuyAmount) {
187
- swapBuyTx.recentBlockhash = blockhash;
188
- swapBuyTx.lastValidBlockHeight = lastValidBlockHeight;
189
- swapBuyTx.feePayer = params.creatorWallet.publicKey;
190
- swapBuyTx.sign(params.creatorWallet);
191
- signedTransactions.push(swapBuyTx);
192
- }
193
- // ============ 3. 批量首买交易 ============
194
- // 需要等池创建后才能获取池状态,这里使用预估的报价
195
- for (let i = 0; i < params.bundleBuys.length; i++) {
196
- const trade = params.bundleBuys[i];
197
- // 构建买入交易
198
- const buyTx = await client.pool.swap({
199
- owner: trade.wallet.publicKey,
200
- pool: poolAddress,
201
- amountIn: trade.buyAmount,
202
- minimumAmountOut: trade.minAmountOut || new BN(1),
203
- swapBaseForQuote: false, // 买入 = 用 quote 换 base
204
- referralTokenAccount: null,
205
- });
206
- // 如果是最后一笔交易,添加 Jito tip
207
- if (i === params.bundleBuys.length - 1 && params.jitoTipLamports) {
208
- const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
209
- buyTx.add(tipIx);
210
- }
211
- buyTx.recentBlockhash = blockhash;
212
- buyTx.lastValidBlockHeight = lastValidBlockHeight;
213
- buyTx.feePayer = trade.wallet.publicKey;
214
- buyTx.sign(trade.wallet);
215
- signedTransactions.push(buyTx);
216
- }
217
- return {
218
- signedTransactions,
219
- type: 'dbc_create_pool_bundle_buy',
220
- poolAddress: poolAddress.toBase58(),
221
- baseMint: params.baseMintKeypair.publicKey.toBase58(),
222
- tradeCount: params.bundleBuys.length + (params.creatorBuyAmount ? 1 : 0),
223
- jitoTipLamports: params.jitoTipLamports || 0,
224
- };
225
- }
226
- /**
227
- * 签名 DBC 创建池并捆绑多地址首买交易 (使用已有配置)
228
- *
229
- * 适用于使用平台方已有的 Config,只需创建池并首买
230
- *
231
- * @param params 创建池并捆绑首买参数
232
- * @param connection 可选连接
233
- */
234
- export async function signDbcCreatePoolBundleBuyWithConfig(params, connection) {
235
- const conn = getConnection(connection);
236
- const client = getDbcClient(connection);
237
- const signedTransactions = [];
238
- const configPubkey = new PublicKey(params.configAddress);
239
- // 获取 blockhash
240
- const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
241
- // 派生池地址
242
- const [poolAddress] = PublicKey.findProgramAddressSync([Buffer.from('pool'), params.baseMintKeypair.publicKey.toBuffer()], new PublicKey('dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN'));
243
- // ============ 1. 创建池交易 ============
244
- const createPoolTx = await client.pool.createPool({
245
- baseMint: params.baseMintKeypair.publicKey,
246
- config: configPubkey,
247
- name: params.name,
248
- symbol: params.symbol,
249
- uri: params.uri,
250
- payer: params.creatorWallet.publicKey,
251
- poolCreator: params.creatorWallet.publicKey,
252
- });
253
- createPoolTx.recentBlockhash = blockhash;
254
- createPoolTx.lastValidBlockHeight = lastValidBlockHeight;
255
- createPoolTx.feePayer = params.creatorWallet.publicKey;
256
- createPoolTx.sign(params.creatorWallet, params.baseMintKeypair);
257
- signedTransactions.push(createPoolTx);
258
- // ============ 2. 批量首买交易 ============
259
- for (let i = 0; i < params.bundleBuys.length; i++) {
260
- const trade = params.bundleBuys[i];
261
- // 构建买入交易
262
- const buyTx = await client.pool.swap({
263
- owner: trade.wallet.publicKey,
264
- pool: poolAddress,
265
- amountIn: trade.buyAmount,
266
- minimumAmountOut: trade.minAmountOut || new BN(1),
267
- swapBaseForQuote: false, // 买入
268
- referralTokenAccount: null,
269
- });
270
- // 如果是最后一笔交易,添加 Jito tip
271
- if (i === params.bundleBuys.length - 1 && params.jitoTipLamports) {
272
- const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
273
- buyTx.add(tipIx);
274
- }
275
- buyTx.recentBlockhash = blockhash;
276
- buyTx.lastValidBlockHeight = lastValidBlockHeight;
277
- buyTx.feePayer = trade.wallet.publicKey;
278
- buyTx.sign(trade.wallet);
279
- signedTransactions.push(buyTx);
280
- }
281
- return {
282
- signedTransactions,
283
- type: 'dbc_create_pool_bundle_buy',
284
- poolAddress: poolAddress.toBase58(),
285
- baseMint: params.baseMintKeypair.publicKey.toBase58(),
286
- tradeCount: params.bundleBuys.length,
287
- jitoTipLamports: params.jitoTipLamports || 0,
288
- };
289
- }
290
- /**
291
- * 签名 DBC 通用 Bundle Swap 交易
292
- *
293
- * @param params Bundle 参数
294
- * @param swapBaseForQuote 是否卖出 (true = 卖出 base 换 quote, false = 买入)
295
- * @param connection 可选连接
296
- */
297
- export async function signDbcBundleSwap(params, swapBaseForQuote, connection) {
298
- if (swapBaseForQuote) {
299
- return signDbcBundleSell(params, connection);
300
- }
301
- else {
302
- return signDbcBundleBuy(params, connection);
303
- }
304
- }
@@ -1,192 +0,0 @@
1
- /**
2
- * Meteora Dynamic Bonding Curve (DBC) 集成
3
- *
4
- * 基于 https://github.com/MeteoraAg/dynamic-bonding-curve-sdk 源码分析
5
- * DBC 是 Meteora 的代币发射平台,类似于 Pump.fun
6
- */
7
- import { Connection, Keypair } from '@solana/web3.js';
8
- import BN from 'bn.js';
9
- import type { DbcPoolInfo, DbcSwapParams, DbcSwapQuote, DbcLockedVestingParams, MeteoraSignedResult } from './types.js';
10
- /**
11
- * 获取 DBC 池信息
12
- * @param poolAddress 池地址
13
- * @param connection 可选连接
14
- */
15
- export declare function getDbcPoolInfo(poolAddress: string, connection?: Connection): Promise<DbcPoolInfo>;
16
- /**
17
- * 通过 Base Mint 查找 DBC 池
18
- * @param baseMint Base Mint 地址
19
- * @param connection 可选连接
20
- */
21
- export declare function findDbcPoolByBaseMint(baseMint: string, connection?: Connection): Promise<string | null>;
22
- /**
23
- * 获取 DBC Swap 报价
24
- * @param params Swap 参数
25
- * @param connection 可选连接
26
- */
27
- export declare function getDbcSwapQuote(params: DbcSwapParams, connection?: Connection): Promise<DbcSwapQuote>;
28
- /**
29
- * 签名 DBC Swap 交易
30
- * @param params Swap 参数
31
- * @param wallet 钱包
32
- * @param connection 可选连接
33
- */
34
- export declare function signDbcSwap(params: DbcSwapParams, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
35
- /**
36
- * 签名迁移到 DAMM V1 交易
37
- */
38
- export declare function signDbcMigrateToDammV1(poolAddress: string, dammConfig: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
39
- /**
40
- * 签名迁移到 DAMM V2 交易
41
- */
42
- export declare function signDbcMigrateToDammV2(poolAddress: string, dammV2Config: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
43
- /**
44
- * 签名领取创建者交易费
45
- */
46
- export declare function signDbcClaimCreatorFee(poolAddress: string, wallet: Keypair, maxBaseAmount: BN, maxQuoteAmount: BN, connection?: Connection): Promise<MeteoraSignedResult>;
47
- /**
48
- * 签名领取 Partner 交易费
49
- */
50
- export declare function signDbcClaimPartnerFee(poolAddress: string, wallet: Keypair, maxBaseAmount: BN, maxQuoteAmount: BN, connection?: Connection): Promise<MeteoraSignedResult>;
51
- /**
52
- * 签名创建锁仓交易
53
- */
54
- export declare function signDbcCreateLocker(poolAddress: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
55
- /**
56
- * 计算锁仓 Vesting 参数
57
- */
58
- export declare function calculateLockedVestingParams(totalVestingAmount: BN, cliffDurationSeconds: number, vestingDurationSeconds: number, vestingFrequencySeconds: number, cliffUnlockPercent: number): DbcLockedVestingParams;
59
- /**
60
- * 签名创建 DBC Config 交易
61
- * @param params 配置参数
62
- * @param configKeypair Config Keypair
63
- * @param wallet 钱包
64
- * @param connection 可选连接
65
- */
66
- export declare function signDbcCreateConfig(params: {
67
- feeClaimer: string;
68
- leftoverReceiver: string;
69
- quoteMint: string;
70
- poolFees: {
71
- baseFee: {
72
- cliffFeeNumerator: BN;
73
- firstFactor: number;
74
- secondFactor: BN;
75
- thirdFactor: BN;
76
- baseFeeMode: number;
77
- };
78
- dynamicFee: {
79
- binStep: number;
80
- binStepU128: BN;
81
- filterPeriod: number;
82
- decayPeriod: number;
83
- reductionFactor: number;
84
- variableFeeControl: number;
85
- maxVolatilityAccumulator: number;
86
- } | null;
87
- };
88
- activationType: number;
89
- collectFeeMode: number;
90
- migrationOption: number;
91
- tokenType: number;
92
- tokenDecimal: number;
93
- migrationQuoteThreshold: BN;
94
- partnerLpPercentage: number;
95
- creatorLpPercentage: number;
96
- partnerLockedLpPercentage: number;
97
- creatorLockedLpPercentage: number;
98
- sqrtStartPrice: BN;
99
- lockedVesting: DbcLockedVestingParams;
100
- migrationFeeOption: number;
101
- tokenSupply: {
102
- preMigrationTokenSupply: BN;
103
- postMigrationTokenSupply: BN;
104
- } | null;
105
- creatorTradingFeePercentage: number;
106
- tokenUpdateAuthority: number;
107
- migrationFee: {
108
- feePercentage: number;
109
- creatorFeePercentage: number;
110
- };
111
- migratedPoolFee?: {
112
- collectFeeMode: number;
113
- dynamicFee: number;
114
- poolFeeBps: number;
115
- };
116
- curve: {
117
- sqrtPrice: BN;
118
- liquidity: BN;
119
- }[];
120
- }, configKeypair: Keypair, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
121
- /**
122
- * 签名创建 DBC Pool 交易
123
- * @param params 创建池参数
124
- * @param baseMintKeypair Base Mint Keypair
125
- * @param wallet 钱包
126
- * @param connection 可选连接
127
- */
128
- export declare function signDbcCreatePool(params: {
129
- config: string;
130
- name: string;
131
- symbol: string;
132
- uri: string;
133
- }, baseMintKeypair: Keypair, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
134
- /**
135
- * 签名创建 DBC Pool 并首次买入交易
136
- * @param params 创建池并买入参数
137
- * @param baseMintKeypair Base Mint Keypair
138
- * @param wallet 钱包
139
- * @param connection 可选连接
140
- */
141
- export declare function signDbcCreatePoolWithFirstBuy(params: {
142
- config: string;
143
- name: string;
144
- symbol: string;
145
- uri: string;
146
- buyAmount: BN;
147
- minimumAmountOut?: BN;
148
- }, baseMintKeypair: Keypair, wallet: Keypair, connection?: Connection): Promise<{
149
- createPoolResult: MeteoraSignedResult;
150
- buyResult?: MeteoraSignedResult;
151
- }>;
152
- /**
153
- * 签名 Partner 提取迁移费用交易
154
- */
155
- export declare function signDbcPartnerWithdrawMigrationFee(poolAddress: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
156
- /**
157
- * 签名 Partner 提取剩余资金交易
158
- */
159
- export declare function signDbcPartnerWithdrawSurplus(poolAddress: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
160
- /**
161
- * 签名 Creator 提取迁移费用交易
162
- */
163
- export declare function signDbcCreatorWithdrawMigrationFee(poolAddress: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
164
- /**
165
- * 签名 Creator 提取剩余资金交易
166
- */
167
- export declare function signDbcCreatorWithdrawSurplus(poolAddress: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
168
- /**
169
- * 签名领取迁移后的 LP Token (用于 DAMM V1 迁移)
170
- * 当池子迁移到 DAMM V1 后,创建者或合作伙伴可以通过此方法领取锁定的 LP Token
171
- * @param poolAddress 池地址
172
- * @param dammConfig DAMM 配置地址
173
- * @param isPartner 是否是合作伙伴领取
174
- * @param wallet 钱包
175
- * @param connection 可选连接
176
- */
177
- export declare function signDbcClaimDammV1LpToken(poolAddress: string, dammConfig: string, isPartner: boolean, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
178
- /**
179
- * 获取 DBC Config 信息
180
- */
181
- export declare function getDbcConfigInfo(configAddress: string, connection?: Connection): Promise<any>;
182
- /**
183
- * 获取所有 DBC 池
184
- */
185
- export declare function getAllDbcPools(connection?: Connection): Promise<any[]>;
186
- /**
187
- * 获取用户在 DBC 池中的余额
188
- */
189
- export declare function getDbcUserBalance(poolAddress: string, userAddress: string, connection?: Connection): Promise<{
190
- baseBalance: string;
191
- quoteBalance: string;
192
- }>;