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.
- package/dist/flap/portal-bundle-merkle/encryption.d.ts +16 -0
- package/dist/flap/portal-bundle-merkle/encryption.js +146 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +3 -38
- package/dist/sol/constants.d.ts +0 -126
- package/dist/sol/constants.js +0 -145
- package/dist/sol/dex/index.d.ts +0 -8
- package/dist/sol/dex/index.js +0 -12
- package/dist/sol/dex/meteora/client.d.ts +0 -76
- package/dist/sol/dex/meteora/client.js +0 -219
- package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +0 -61
- package/dist/sol/dex/meteora/damm-v1-bundle.js +0 -112
- package/dist/sol/dex/meteora/damm-v1.d.ts +0 -118
- package/dist/sol/dex/meteora/damm-v1.js +0 -315
- package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +0 -82
- package/dist/sol/dex/meteora/damm-v2-bundle.js +0 -242
- package/dist/sol/dex/meteora/damm-v2.d.ts +0 -172
- package/dist/sol/dex/meteora/damm-v2.js +0 -632
- package/dist/sol/dex/meteora/dbc-bundle.d.ts +0 -123
- package/dist/sol/dex/meteora/dbc-bundle.js +0 -304
- package/dist/sol/dex/meteora/dbc.d.ts +0 -192
- package/dist/sol/dex/meteora/dbc.js +0 -619
- package/dist/sol/dex/meteora/dlmm-bundle.d.ts +0 -39
- package/dist/sol/dex/meteora/dlmm-bundle.js +0 -189
- package/dist/sol/dex/meteora/dlmm.d.ts +0 -157
- package/dist/sol/dex/meteora/dlmm.js +0 -671
- package/dist/sol/dex/meteora/index.d.ts +0 -25
- package/dist/sol/dex/meteora/index.js +0 -65
- package/dist/sol/dex/meteora/types.d.ts +0 -787
- package/dist/sol/dex/meteora/types.js +0 -110
- package/dist/sol/dex/orca/index.d.ts +0 -10
- package/dist/sol/dex/orca/index.js +0 -16
- package/dist/sol/dex/orca/orca-bundle.d.ts +0 -41
- package/dist/sol/dex/orca/orca-bundle.js +0 -173
- package/dist/sol/dex/orca/orca.d.ts +0 -65
- package/dist/sol/dex/orca/orca.js +0 -474
- package/dist/sol/dex/orca/types.d.ts +0 -263
- package/dist/sol/dex/orca/types.js +0 -38
- package/dist/sol/dex/orca/wavebreak-bundle.d.ts +0 -34
- package/dist/sol/dex/orca/wavebreak-bundle.js +0 -198
- package/dist/sol/dex/orca/wavebreak-types.d.ts +0 -227
- package/dist/sol/dex/orca/wavebreak-types.js +0 -23
- package/dist/sol/dex/orca/wavebreak.d.ts +0 -78
- package/dist/sol/dex/orca/wavebreak.js +0 -497
- package/dist/sol/dex/pump/index.d.ts +0 -9
- package/dist/sol/dex/pump/index.js +0 -14
- package/dist/sol/dex/pump/pump-bundle.d.ts +0 -92
- package/dist/sol/dex/pump/pump-bundle.js +0 -383
- package/dist/sol/dex/pump/pump-swap-bundle.d.ts +0 -103
- package/dist/sol/dex/pump/pump-swap-bundle.js +0 -380
- package/dist/sol/dex/pump/pump-swap.d.ts +0 -46
- package/dist/sol/dex/pump/pump-swap.js +0 -199
- package/dist/sol/dex/pump/pump.d.ts +0 -35
- package/dist/sol/dex/pump/pump.js +0 -352
- package/dist/sol/dex/pump/types.d.ts +0 -215
- package/dist/sol/dex/pump/types.js +0 -5
- package/dist/sol/dex/raydium/index.d.ts +0 -8
- package/dist/sol/dex/raydium/index.js +0 -12
- package/dist/sol/dex/raydium/launchlab.d.ts +0 -68
- package/dist/sol/dex/raydium/launchlab.js +0 -210
- package/dist/sol/dex/raydium/raydium-bundle.d.ts +0 -64
- package/dist/sol/dex/raydium/raydium-bundle.js +0 -324
- package/dist/sol/dex/raydium/raydium.d.ts +0 -40
- package/dist/sol/dex/raydium/raydium.js +0 -366
- package/dist/sol/dex/raydium/types.d.ts +0 -240
- package/dist/sol/dex/raydium/types.js +0 -5
- package/dist/sol/index.d.ts +0 -10
- package/dist/sol/index.js +0 -16
- package/dist/sol/jito/bundle.d.ts +0 -90
- package/dist/sol/jito/bundle.js +0 -263
- package/dist/sol/jito/index.d.ts +0 -7
- package/dist/sol/jito/index.js +0 -7
- package/dist/sol/jito/tip.d.ts +0 -51
- package/dist/sol/jito/tip.js +0 -83
- package/dist/sol/jito/types.d.ts +0 -100
- package/dist/sol/jito/types.js +0 -5
- package/dist/sol/token/create-complete.d.ts +0 -115
- package/dist/sol/token/create-complete.js +0 -235
- package/dist/sol/token/create-token.d.ts +0 -57
- package/dist/sol/token/create-token.js +0 -230
- package/dist/sol/token/index.d.ts +0 -9
- package/dist/sol/token/index.js +0 -14
- package/dist/sol/token/metadata-upload.d.ts +0 -86
- package/dist/sol/token/metadata-upload.js +0 -173
- package/dist/sol/token/metadata.d.ts +0 -92
- package/dist/sol/token/metadata.js +0 -274
- package/dist/sol/token/types.d.ts +0 -153
- package/dist/sol/token/types.js +0 -5
- package/dist/sol/types.d.ts +0 -176
- package/dist/sol/types.js +0 -7
- package/dist/sol/utils/balance.d.ts +0 -160
- package/dist/sol/utils/balance.js +0 -638
- package/dist/sol/utils/connection.d.ts +0 -78
- package/dist/sol/utils/connection.js +0 -168
- package/dist/sol/utils/index.d.ts +0 -9
- package/dist/sol/utils/index.js +0 -9
- package/dist/sol/utils/lp-inspect.d.ts +0 -129
- package/dist/sol/utils/lp-inspect.js +0 -900
- package/dist/sol/utils/transfer.d.ts +0 -125
- package/dist/sol/utils/transfer.js +0 -220
- package/dist/sol/utils/wallet.d.ts +0 -107
- package/dist/sol/utils/wallet.js +0 -210
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Meteora DLMM Bundle 批量交易
|
|
3
|
-
*
|
|
4
|
-
* 支持 Jito Bundle 的批量买卖
|
|
5
|
-
*/
|
|
6
|
-
import BN from 'bn.js';
|
|
7
|
-
import { getConnection, getDlmmPool } from './client.js';
|
|
8
|
-
import { buildTipInstruction } from '../../jito/tip.js';
|
|
9
|
-
// ============================================================================
|
|
10
|
-
// Bundle 批量买入
|
|
11
|
-
// ============================================================================
|
|
12
|
-
/**
|
|
13
|
-
* 签名 DLMM Bundle 批量买入交易
|
|
14
|
-
*
|
|
15
|
-
* @param params Bundle 参数
|
|
16
|
-
* @param connection 可选连接
|
|
17
|
-
*/
|
|
18
|
-
export async function signDlmmBundleBuy(params, connection) {
|
|
19
|
-
const conn = getConnection(connection);
|
|
20
|
-
const dlmmPool = await getDlmmPool(params.poolAddress, connection);
|
|
21
|
-
const signedTransactions = [];
|
|
22
|
-
// 确定交易方向 - 买入代币 = 用 Y 换 X
|
|
23
|
-
const swapForY = false;
|
|
24
|
-
// 获取 bin arrays
|
|
25
|
-
const binArrays = await dlmmPool.getBinArrayForSwap(swapForY);
|
|
26
|
-
const binArraysPubkey = binArrays.map((ba) => ba.publicKey);
|
|
27
|
-
// 为每个钱包构建交易
|
|
28
|
-
for (let i = 0; i < params.trades.length; i++) {
|
|
29
|
-
const trade = params.trades[i];
|
|
30
|
-
// 获取报价
|
|
31
|
-
const quote = dlmmPool.swapQuote(trade.amountIn, swapForY, new BN(params.slippageBps || 100), binArrays);
|
|
32
|
-
const minAmountOut = trade.minAmountOut || quote.minOutAmount;
|
|
33
|
-
// 构建 Swap 交易
|
|
34
|
-
const swapTx = await dlmmPool.swap({
|
|
35
|
-
inToken: dlmmPool.tokenY.publicKey,
|
|
36
|
-
binArraysPubkey,
|
|
37
|
-
inAmount: trade.amountIn,
|
|
38
|
-
lbPair: dlmmPool.pubkey,
|
|
39
|
-
user: trade.wallet.publicKey,
|
|
40
|
-
minOutAmount: minAmountOut,
|
|
41
|
-
outToken: dlmmPool.tokenX.publicKey,
|
|
42
|
-
});
|
|
43
|
-
// 如果是最后一笔交易,添加 Jito tip
|
|
44
|
-
if (i === params.trades.length - 1 && params.jitoTipLamports) {
|
|
45
|
-
const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
|
|
46
|
-
swapTx.add(tipIx);
|
|
47
|
-
}
|
|
48
|
-
// 设置 blockhash
|
|
49
|
-
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
50
|
-
swapTx.recentBlockhash = blockhash;
|
|
51
|
-
swapTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
52
|
-
swapTx.feePayer = trade.wallet.publicKey;
|
|
53
|
-
// 签名
|
|
54
|
-
swapTx.sign(trade.wallet);
|
|
55
|
-
signedTransactions.push(swapTx);
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
signedTransactions,
|
|
59
|
-
type: 'dlmm_bundle_buy',
|
|
60
|
-
poolAddress: params.poolAddress,
|
|
61
|
-
tradeCount: params.trades.length,
|
|
62
|
-
jitoTipLamports: params.jitoTipLamports || 0,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// ============================================================================
|
|
66
|
-
// Bundle 批量卖出
|
|
67
|
-
// ============================================================================
|
|
68
|
-
/**
|
|
69
|
-
* 签名 DLMM Bundle 批量卖出交易
|
|
70
|
-
*
|
|
71
|
-
* @param params Bundle 参数
|
|
72
|
-
* @param connection 可选连接
|
|
73
|
-
*/
|
|
74
|
-
export async function signDlmmBundleSell(params, connection) {
|
|
75
|
-
const conn = getConnection(connection);
|
|
76
|
-
const dlmmPool = await getDlmmPool(params.poolAddress, connection);
|
|
77
|
-
const signedTransactions = [];
|
|
78
|
-
// 确定交易方向 - 卖出代币 = 用 X 换 Y
|
|
79
|
-
const swapForY = true;
|
|
80
|
-
// 获取 bin arrays
|
|
81
|
-
const binArrays = await dlmmPool.getBinArrayForSwap(swapForY);
|
|
82
|
-
const binArraysPubkey = binArrays.map((ba) => ba.publicKey);
|
|
83
|
-
// 为每个钱包构建交易
|
|
84
|
-
for (let i = 0; i < params.trades.length; i++) {
|
|
85
|
-
const trade = params.trades[i];
|
|
86
|
-
// 获取报价
|
|
87
|
-
const quote = dlmmPool.swapQuote(trade.amountIn, swapForY, new BN(params.slippageBps || 100), binArrays);
|
|
88
|
-
const minAmountOut = trade.minAmountOut || quote.minOutAmount;
|
|
89
|
-
// 构建 Swap 交易
|
|
90
|
-
const swapTx = await dlmmPool.swap({
|
|
91
|
-
inToken: dlmmPool.tokenX.publicKey,
|
|
92
|
-
binArraysPubkey,
|
|
93
|
-
inAmount: trade.amountIn,
|
|
94
|
-
lbPair: dlmmPool.pubkey,
|
|
95
|
-
user: trade.wallet.publicKey,
|
|
96
|
-
minOutAmount: minAmountOut,
|
|
97
|
-
outToken: dlmmPool.tokenY.publicKey,
|
|
98
|
-
});
|
|
99
|
-
// 如果是最后一笔交易,添加 Jito tip
|
|
100
|
-
if (i === params.trades.length - 1 && params.jitoTipLamports) {
|
|
101
|
-
const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
|
|
102
|
-
swapTx.add(tipIx);
|
|
103
|
-
}
|
|
104
|
-
// 设置 blockhash
|
|
105
|
-
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
106
|
-
swapTx.recentBlockhash = blockhash;
|
|
107
|
-
swapTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
108
|
-
swapTx.feePayer = trade.wallet.publicKey;
|
|
109
|
-
// 签名
|
|
110
|
-
swapTx.sign(trade.wallet);
|
|
111
|
-
signedTransactions.push(swapTx);
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
signedTransactions,
|
|
115
|
-
type: 'dlmm_bundle_sell',
|
|
116
|
-
poolAddress: params.poolAddress,
|
|
117
|
-
tradeCount: params.trades.length,
|
|
118
|
-
jitoTipLamports: params.jitoTipLamports || 0,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
// ============================================================================
|
|
122
|
-
// Bundle 通用 Swap
|
|
123
|
-
// ============================================================================
|
|
124
|
-
/**
|
|
125
|
-
* 签名 DLMM Bundle 通用 Swap 交易
|
|
126
|
-
*
|
|
127
|
-
* @param params Bundle 参数
|
|
128
|
-
* @param swapForY 是否用 X 换 Y (true = 卖出, false = 买入)
|
|
129
|
-
* @param connection 可选连接
|
|
130
|
-
*/
|
|
131
|
-
export async function signDlmmBundleSwap(params, swapForY, connection) {
|
|
132
|
-
const conn = getConnection(connection);
|
|
133
|
-
const dlmmPool = await getDlmmPool(params.poolAddress, connection);
|
|
134
|
-
const signedTransactions = [];
|
|
135
|
-
// 获取 bin arrays
|
|
136
|
-
const binArrays = await dlmmPool.getBinArrayForSwap(swapForY);
|
|
137
|
-
const binArraysPubkey = binArrays.map((ba) => ba.publicKey);
|
|
138
|
-
const inToken = swapForY ? dlmmPool.tokenX.publicKey : dlmmPool.tokenY.publicKey;
|
|
139
|
-
const outToken = swapForY ? dlmmPool.tokenY.publicKey : dlmmPool.tokenX.publicKey;
|
|
140
|
-
// 为每个钱包构建交易
|
|
141
|
-
for (let i = 0; i < params.trades.length; i++) {
|
|
142
|
-
const trade = params.trades[i];
|
|
143
|
-
// 获取报价
|
|
144
|
-
const quote = dlmmPool.swapQuote(trade.amountIn, swapForY, new BN(params.slippageBps || 100), binArrays);
|
|
145
|
-
const minAmountOut = trade.minAmountOut || quote.minOutAmount;
|
|
146
|
-
// 构建 Swap 交易
|
|
147
|
-
const swapTx = await dlmmPool.swap({
|
|
148
|
-
inToken,
|
|
149
|
-
binArraysPubkey,
|
|
150
|
-
inAmount: trade.amountIn,
|
|
151
|
-
lbPair: dlmmPool.pubkey,
|
|
152
|
-
user: trade.wallet.publicKey,
|
|
153
|
-
minOutAmount: minAmountOut,
|
|
154
|
-
outToken,
|
|
155
|
-
});
|
|
156
|
-
// 如果是最后一笔交易,添加 Jito tip
|
|
157
|
-
if (i === params.trades.length - 1 && params.jitoTipLamports) {
|
|
158
|
-
const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
|
|
159
|
-
swapTx.add(tipIx);
|
|
160
|
-
}
|
|
161
|
-
// 设置 blockhash
|
|
162
|
-
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
163
|
-
swapTx.recentBlockhash = blockhash;
|
|
164
|
-
swapTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
165
|
-
swapTx.feePayer = trade.wallet.publicKey;
|
|
166
|
-
// 签名
|
|
167
|
-
swapTx.sign(trade.wallet);
|
|
168
|
-
signedTransactions.push(swapTx);
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
signedTransactions,
|
|
172
|
-
type: swapForY ? 'dlmm_bundle_sell' : 'dlmm_bundle_buy',
|
|
173
|
-
poolAddress: params.poolAddress,
|
|
174
|
-
tradeCount: params.trades.length,
|
|
175
|
-
jitoTipLamports: params.jitoTipLamports || 0,
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* 将 Bundle 结果转换为后端 API 请求格式
|
|
180
|
-
*/
|
|
181
|
-
export function toDlmmBundleApiRequest(result) {
|
|
182
|
-
return {
|
|
183
|
-
transactions: result.signedTransactions.map((tx) => tx.serialize().toString('base64')),
|
|
184
|
-
type: result.type,
|
|
185
|
-
poolAddress: result.poolAddress,
|
|
186
|
-
tradeCount: result.tradeCount,
|
|
187
|
-
jitoTipLamports: result.jitoTipLamports,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Meteora DLMM (Dynamic Liquidity Market Maker) 集成
|
|
3
|
-
*
|
|
4
|
-
* 基于 https://github.com/MeteoraAg/dlmm-sdk 源码分析
|
|
5
|
-
* DLMM 是 Meteora 的集中流动性池,类似于 Uniswap V3
|
|
6
|
-
*/
|
|
7
|
-
import { Connection, Keypair, Transaction } from '@solana/web3.js';
|
|
8
|
-
import BN from 'bn.js';
|
|
9
|
-
import type { DlmmPoolInfo, DlmmSwapParams, DlmmAddLiquidityParams, DlmmRemoveLiquidityParams, MeteoraSignedResult } from './types.js';
|
|
10
|
-
/**
|
|
11
|
-
* 获取 DLMM 池信息
|
|
12
|
-
* @param poolAddress 池地址
|
|
13
|
-
* @param connection 可选连接
|
|
14
|
-
*/
|
|
15
|
-
export declare function getDlmmPoolInfo(poolAddress: string, connection?: Connection): Promise<DlmmPoolInfo>;
|
|
16
|
-
/**
|
|
17
|
-
* 通过 Token Mint 查找 DLMM 池
|
|
18
|
-
* 优化: 使用 Meteora API 替代全量链上查询
|
|
19
|
-
* @param tokenXMint Token X Mint 地址
|
|
20
|
-
* @param tokenYMint Token Y Mint 地址
|
|
21
|
-
* @param connection 可选连接(备用)
|
|
22
|
-
*/
|
|
23
|
-
export declare function findDlmmPool(tokenXMint: string, tokenYMint: string, _connection?: Connection): Promise<string | null>;
|
|
24
|
-
/**
|
|
25
|
-
* 通过代币地址获取所有相关的 DLMM 池子
|
|
26
|
-
* 使用 Meteora API,不再全量查询链上数据
|
|
27
|
-
*/
|
|
28
|
-
export declare function findDlmmPoolsByToken(tokenMint: string): Promise<Array<{
|
|
29
|
-
address: string;
|
|
30
|
-
tokenX: string;
|
|
31
|
-
tokenY: string;
|
|
32
|
-
binStep: number;
|
|
33
|
-
}>>;
|
|
34
|
-
/**
|
|
35
|
-
* 签名 DLMM Swap 交易
|
|
36
|
-
* @param params Swap 参数
|
|
37
|
-
* @param wallet 钱包
|
|
38
|
-
* @param connection 可选连接
|
|
39
|
-
*/
|
|
40
|
-
export declare function signDlmmSwap(params: DlmmSwapParams, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
41
|
-
/**
|
|
42
|
-
* 签名 DLMM 添加流动性交易
|
|
43
|
-
* @param params 添加流动性参数
|
|
44
|
-
* @param wallet 钱包
|
|
45
|
-
* @param positionKeypair 仓位 Keypair(如果创建新仓位)
|
|
46
|
-
* @param connection 可选连接
|
|
47
|
-
*/
|
|
48
|
-
export declare function signDlmmAddLiquidity(params: DlmmAddLiquidityParams, wallet: Keypair, positionKeypair?: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
49
|
-
/**
|
|
50
|
-
* 签名 DLMM 移除流动性交易
|
|
51
|
-
* @param params 移除流动性参数
|
|
52
|
-
* @param wallet 钱包
|
|
53
|
-
* @param connection 可选连接
|
|
54
|
-
*/
|
|
55
|
-
export declare function signDlmmRemoveLiquidity(params: DlmmRemoveLiquidityParams, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult & {
|
|
56
|
-
signedTransactions?: Transaction[];
|
|
57
|
-
}>;
|
|
58
|
-
/**
|
|
59
|
-
* 签名创建 DLMM 池交易
|
|
60
|
-
* @param tokenXMint Token X Mint 地址
|
|
61
|
-
* @param tokenYMint Token Y Mint 地址
|
|
62
|
-
* @param binStep Bin Step
|
|
63
|
-
* @param activeId 初始活跃 Bin ID
|
|
64
|
-
* @param feeBps 费率 (bps)
|
|
65
|
-
* @param wallet 钱包
|
|
66
|
-
* @param connection 可选连接
|
|
67
|
-
*/
|
|
68
|
-
export declare function signDlmmCreatePool(tokenXMint: string, tokenYMint: string, binStep: number, activeId: number, feeBps: number, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
69
|
-
/**
|
|
70
|
-
* 签名领取 DLMM 手续费交易
|
|
71
|
-
* @param poolAddress 池地址
|
|
72
|
-
* @param positionAddress 仓位地址
|
|
73
|
-
* @param wallet 钱包
|
|
74
|
-
* @param connection 可选连接
|
|
75
|
-
*/
|
|
76
|
-
export declare function signDlmmClaimFees(poolAddress: string, positionAddress: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
77
|
-
/**
|
|
78
|
-
* 获取用户在池中的所有仓位
|
|
79
|
-
* @param poolAddress 池地址
|
|
80
|
-
* @param userAddress 用户地址
|
|
81
|
-
* @param connection 可选连接
|
|
82
|
-
*/
|
|
83
|
-
export declare function getDlmmUserPositions(poolAddress: string, userAddress: string, connection?: Connection): Promise<any[]>;
|
|
84
|
-
/**
|
|
85
|
-
* 获取 DLMM Swap 报价
|
|
86
|
-
* @param poolAddress 池地址
|
|
87
|
-
* @param amountIn 输入金额
|
|
88
|
-
* @param swapYtoX 是否从 Y 交换到 X
|
|
89
|
-
* @param slippageBps 滑点 (bps)
|
|
90
|
-
* @param connection 可选连接
|
|
91
|
-
*/
|
|
92
|
-
export declare function getDlmmSwapQuote(poolAddress: string, amountIn: BN, swapYtoX: boolean, slippageBps?: number, connection?: Connection): Promise<{
|
|
93
|
-
consumedInAmount: string;
|
|
94
|
-
outAmount: string;
|
|
95
|
-
minOutAmount: string;
|
|
96
|
-
fee: string;
|
|
97
|
-
priceImpact: string;
|
|
98
|
-
}>;
|
|
99
|
-
/**
|
|
100
|
-
* 签名 DLMM Swap Exact Out 交易 (指定输出金额)
|
|
101
|
-
* @param poolAddress 池地址
|
|
102
|
-
* @param amountOut 期望输出金额
|
|
103
|
-
* @param inputMint 输入代币 Mint
|
|
104
|
-
* @param maxAmountIn 最大输入金额
|
|
105
|
-
* @param wallet 钱包
|
|
106
|
-
* @param connection 可选连接
|
|
107
|
-
*/
|
|
108
|
-
export declare function signDlmmSwapExactOut(poolAddress: string, amountOut: BN, inputMint: string, maxAmountIn: BN, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
109
|
-
/**
|
|
110
|
-
* 签名领取 DLMM 所有奖励交易
|
|
111
|
-
* @param poolAddress 池地址
|
|
112
|
-
* @param positionAddresses 仓位地址列表
|
|
113
|
-
* @param wallet 钱包
|
|
114
|
-
* @param connection 可选连接
|
|
115
|
-
*/
|
|
116
|
-
export declare function signDlmmClaimAllRewards(poolAddress: string, positionAddresses: string[], wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
117
|
-
/**
|
|
118
|
-
* 签名关闭 DLMM 仓位交易
|
|
119
|
-
* @param poolAddress 池地址
|
|
120
|
-
* @param positionAddress 仓位地址
|
|
121
|
-
* @param wallet 钱包
|
|
122
|
-
* @param connection 可选连接
|
|
123
|
-
*/
|
|
124
|
-
export declare function signDlmmClosePosition(poolAddress: string, positionAddress: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
125
|
-
/**
|
|
126
|
-
* 签名创建空的 DLMM 仓位交易
|
|
127
|
-
* @param poolAddress 池地址
|
|
128
|
-
* @param wallet 钱包
|
|
129
|
-
* @param positionKeypair 仓位 Keypair
|
|
130
|
-
* @param connection 可选连接
|
|
131
|
-
*/
|
|
132
|
-
export declare function signDlmmCreateEmptyPosition(poolAddress: string, wallet: Keypair, positionKeypair: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
133
|
-
/**
|
|
134
|
-
* 获取用户在所有 DLMM 池中的仓位
|
|
135
|
-
* @param userAddress 用户地址
|
|
136
|
-
* @param connection 可选连接
|
|
137
|
-
*/
|
|
138
|
-
export declare function getAllDlmmUserPositions(userAddress: string, connection?: Connection): Promise<{
|
|
139
|
-
poolAddress: string;
|
|
140
|
-
positions: any[];
|
|
141
|
-
}[]>;
|
|
142
|
-
/**
|
|
143
|
-
* 计算 Bin ID 对应的价格
|
|
144
|
-
* @param binId Bin ID
|
|
145
|
-
* @param binStep Bin Step
|
|
146
|
-
* @param tokenXDecimals Token X 精度
|
|
147
|
-
* @param tokenYDecimals Token Y 精度
|
|
148
|
-
*/
|
|
149
|
-
export declare function calculatePriceFromBinId(binId: number, binStep: number, tokenXDecimals: number, tokenYDecimals: number): number;
|
|
150
|
-
/**
|
|
151
|
-
* 计算价格对应的 Bin ID
|
|
152
|
-
* @param price 价格
|
|
153
|
-
* @param binStep Bin Step
|
|
154
|
-
* @param tokenXDecimals Token X 精度
|
|
155
|
-
* @param tokenYDecimals Token Y 精度
|
|
156
|
-
*/
|
|
157
|
-
export declare function calculateBinIdFromPrice(price: number, binStep: number, tokenXDecimals: number, tokenYDecimals: number): number;
|