four-flap-meme-sdk 1.3.89 → 1.3.91
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/clients/blockrazor.js +1 -0
- package/dist/contracts/tm-bundle-merkle/core.js +3 -6
- package/dist/contracts/tm-bundle-merkle/pancake-proxy.js +38 -30
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.d.ts +1 -0
- package/dist/contracts/tm-bundle-merkle/swap-buy-first.js +3 -4
- package/dist/contracts/tm-bundle-merkle/swap.d.ts +3 -0
- package/dist/contracts/tm-bundle-merkle/swap.js +2 -2
- package/dist/flap/portal-bundle-merkle/core.js +6 -2
- package/dist/flap/portal-bundle-merkle/pancake-proxy.js +35 -55
- package/dist/flap/portal-bundle-merkle/swap-buy-first.d.ts +2 -0
- package/dist/flap/portal-bundle-merkle/swap-buy-first.js +11 -6
- package/dist/flap/portal-bundle-merkle/swap.d.ts +2 -0
- package/dist/flap/portal-bundle-merkle/swap.js +22 -10
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/pancake/bundle-buy-first.d.ts +1 -0
- package/dist/pancake/bundle-buy-first.js +9 -4
- package/dist/pancake/bundle-swap.d.ts +4 -0
- package/dist/pancake/bundle-swap.js +14 -7
- package/dist/sol/constants.d.ts +126 -0
- package/dist/sol/constants.js +145 -0
- package/dist/sol/dex/index.d.ts +8 -0
- package/dist/sol/dex/index.js +12 -0
- package/dist/sol/dex/meteora/client.d.ts +76 -0
- package/dist/sol/dex/meteora/client.js +219 -0
- package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +61 -0
- package/dist/sol/dex/meteora/damm-v1-bundle.js +112 -0
- package/dist/sol/dex/meteora/damm-v1.d.ts +118 -0
- package/dist/sol/dex/meteora/damm-v1.js +315 -0
- package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +82 -0
- package/dist/sol/dex/meteora/damm-v2-bundle.js +242 -0
- package/dist/sol/dex/meteora/damm-v2.d.ts +172 -0
- package/dist/sol/dex/meteora/damm-v2.js +632 -0
- package/dist/sol/dex/meteora/dbc-bundle.d.ts +123 -0
- package/dist/sol/dex/meteora/dbc-bundle.js +304 -0
- package/dist/sol/dex/meteora/dbc.d.ts +192 -0
- package/dist/sol/dex/meteora/dbc.js +619 -0
- package/dist/sol/dex/meteora/dlmm-bundle.d.ts +39 -0
- package/dist/sol/dex/meteora/dlmm-bundle.js +189 -0
- package/dist/sol/dex/meteora/dlmm.d.ts +146 -0
- package/dist/sol/dex/meteora/dlmm.js +593 -0
- package/dist/sol/dex/meteora/index.d.ts +25 -0
- package/dist/sol/dex/meteora/index.js +65 -0
- package/dist/sol/dex/meteora/types.d.ts +787 -0
- package/dist/sol/dex/meteora/types.js +110 -0
- package/dist/sol/dex/orca/index.d.ts +10 -0
- package/dist/sol/dex/orca/index.js +16 -0
- package/dist/sol/dex/orca/orca-bundle.d.ts +41 -0
- package/dist/sol/dex/orca/orca-bundle.js +173 -0
- package/dist/sol/dex/orca/orca.d.ts +65 -0
- package/dist/sol/dex/orca/orca.js +474 -0
- package/dist/sol/dex/orca/types.d.ts +263 -0
- package/dist/sol/dex/orca/types.js +38 -0
- package/dist/sol/dex/orca/wavebreak-bundle.d.ts +34 -0
- package/dist/sol/dex/orca/wavebreak-bundle.js +198 -0
- package/dist/sol/dex/orca/wavebreak-types.d.ts +227 -0
- package/dist/sol/dex/orca/wavebreak-types.js +23 -0
- package/dist/sol/dex/orca/wavebreak.d.ts +78 -0
- package/dist/sol/dex/orca/wavebreak.js +497 -0
- package/dist/sol/dex/pump/index.d.ts +9 -0
- package/dist/sol/dex/pump/index.js +14 -0
- package/dist/sol/dex/pump/pump-bundle.d.ts +92 -0
- package/dist/sol/dex/pump/pump-bundle.js +383 -0
- package/dist/sol/dex/pump/pump-swap-bundle.d.ts +103 -0
- package/dist/sol/dex/pump/pump-swap-bundle.js +380 -0
- package/dist/sol/dex/pump/pump-swap.d.ts +46 -0
- package/dist/sol/dex/pump/pump-swap.js +199 -0
- package/dist/sol/dex/pump/pump.d.ts +35 -0
- package/dist/sol/dex/pump/pump.js +352 -0
- package/dist/sol/dex/pump/types.d.ts +215 -0
- package/dist/sol/dex/pump/types.js +5 -0
- package/dist/sol/dex/raydium/index.d.ts +8 -0
- package/dist/sol/dex/raydium/index.js +12 -0
- package/dist/sol/dex/raydium/launchlab.d.ts +68 -0
- package/dist/sol/dex/raydium/launchlab.js +210 -0
- package/dist/sol/dex/raydium/raydium-bundle.d.ts +64 -0
- package/dist/sol/dex/raydium/raydium-bundle.js +324 -0
- package/dist/sol/dex/raydium/raydium.d.ts +40 -0
- package/dist/sol/dex/raydium/raydium.js +366 -0
- package/dist/sol/dex/raydium/types.d.ts +240 -0
- package/dist/sol/dex/raydium/types.js +5 -0
- package/dist/sol/index.d.ts +10 -0
- package/dist/sol/index.js +16 -0
- package/dist/sol/jito/bundle.d.ts +90 -0
- package/dist/sol/jito/bundle.js +263 -0
- package/dist/sol/jito/index.d.ts +7 -0
- package/dist/sol/jito/index.js +7 -0
- package/dist/sol/jito/tip.d.ts +51 -0
- package/dist/sol/jito/tip.js +83 -0
- package/dist/sol/jito/types.d.ts +100 -0
- package/dist/sol/jito/types.js +5 -0
- package/dist/sol/token/create-complete.d.ts +115 -0
- package/dist/sol/token/create-complete.js +235 -0
- package/dist/sol/token/create-token.d.ts +57 -0
- package/dist/sol/token/create-token.js +230 -0
- package/dist/sol/token/index.d.ts +9 -0
- package/dist/sol/token/index.js +14 -0
- package/dist/sol/token/metadata-upload.d.ts +86 -0
- package/dist/sol/token/metadata-upload.js +173 -0
- package/dist/sol/token/metadata.d.ts +92 -0
- package/dist/sol/token/metadata.js +274 -0
- package/dist/sol/token/types.d.ts +153 -0
- package/dist/sol/token/types.js +5 -0
- package/dist/sol/types.d.ts +176 -0
- package/dist/sol/types.js +7 -0
- package/dist/sol/utils/balance.d.ts +160 -0
- package/dist/sol/utils/balance.js +638 -0
- package/dist/sol/utils/connection.d.ts +78 -0
- package/dist/sol/utils/connection.js +168 -0
- package/dist/sol/utils/index.d.ts +9 -0
- package/dist/sol/utils/index.js +9 -0
- package/dist/sol/utils/lp-inspect.d.ts +129 -0
- package/dist/sol/utils/lp-inspect.js +529 -0
- package/dist/sol/utils/transfer.d.ts +125 -0
- package/dist/sol/utils/transfer.js +220 -0
- package/dist/sol/utils/wallet.d.ts +107 -0
- package/dist/sol/utils/wallet.js +210 -0
- package/dist/utils/erc20.d.ts +2 -108
- package/dist/utils/erc20.js +17 -65
- package/package.json +39 -4
- package/dist/flap/portal-bundle-merkle/encryption.d.ts +0 -16
- package/dist/flap/portal-bundle-merkle/encryption.js +0 -146
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meteora DAMM v1 Bundle 批量交易
|
|
3
|
+
*
|
|
4
|
+
* 支持 Jito Bundle 的批量买卖
|
|
5
|
+
*/
|
|
6
|
+
import { Connection, Keypair } from '@solana/web3.js';
|
|
7
|
+
import BN from 'bn.js';
|
|
8
|
+
import type { MeteoraBundleSignedResult } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* DAMM v1 Bundle Swap 参数
|
|
11
|
+
*/
|
|
12
|
+
export interface DammV1BundleSwapParams {
|
|
13
|
+
/** 池地址 */
|
|
14
|
+
poolAddress: string;
|
|
15
|
+
/** 输入代币地址 */
|
|
16
|
+
inputMint: string;
|
|
17
|
+
/** 输出代币地址 */
|
|
18
|
+
outputMint: string;
|
|
19
|
+
/** 交易列表 */
|
|
20
|
+
trades: {
|
|
21
|
+
wallet: Keypair;
|
|
22
|
+
amountIn: BN;
|
|
23
|
+
minAmountOut?: BN;
|
|
24
|
+
}[];
|
|
25
|
+
/** 滑点 (bps) */
|
|
26
|
+
slippageBps?: number;
|
|
27
|
+
/** Jito 小费 */
|
|
28
|
+
jitoTipLamports?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 签名 DAMM v1 Bundle 批量买入交易
|
|
32
|
+
*
|
|
33
|
+
* @param params Bundle 参数
|
|
34
|
+
* @param connection 可选连接
|
|
35
|
+
*/
|
|
36
|
+
export declare function signDammV1BundleBuy(params: DammV1BundleSwapParams, connection?: Connection): Promise<MeteoraBundleSignedResult>;
|
|
37
|
+
/**
|
|
38
|
+
* 签名 DAMM v1 Bundle 批量卖出交易
|
|
39
|
+
*
|
|
40
|
+
* @param params Bundle 参数
|
|
41
|
+
* @param connection 可选连接
|
|
42
|
+
*/
|
|
43
|
+
export declare function signDammV1BundleSell(params: DammV1BundleSwapParams, connection?: Connection): Promise<MeteoraBundleSignedResult>;
|
|
44
|
+
/**
|
|
45
|
+
* 签名 DAMM v1 Bundle 通用 Swap 交易
|
|
46
|
+
*
|
|
47
|
+
* @param params Bundle 参数
|
|
48
|
+
* @param isBuy 是否买入 (true = 买入, false = 卖出)
|
|
49
|
+
* @param connection 可选连接
|
|
50
|
+
*/
|
|
51
|
+
export declare function signDammV1BundleSwap(params: DammV1BundleSwapParams, isBuy: boolean, connection?: Connection): Promise<MeteoraBundleSignedResult>;
|
|
52
|
+
/**
|
|
53
|
+
* 将 Bundle 结果转换为后端 API 请求格式
|
|
54
|
+
*/
|
|
55
|
+
export declare function toDammV1BundleApiRequest(result: MeteoraBundleSignedResult): {
|
|
56
|
+
transactions: string[];
|
|
57
|
+
type: string;
|
|
58
|
+
poolAddress: string;
|
|
59
|
+
tradeCount: number;
|
|
60
|
+
jitoTipLamports: number;
|
|
61
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meteora DAMM v1 Bundle 批量交易
|
|
3
|
+
*
|
|
4
|
+
* 支持 Jito Bundle 的批量买卖
|
|
5
|
+
*/
|
|
6
|
+
import { PublicKey, } from '@solana/web3.js';
|
|
7
|
+
import { getConnection, getDammV1Pool } from './client.js';
|
|
8
|
+
import { buildTipInstruction } from '../../jito/tip.js';
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Bundle 批量买入
|
|
11
|
+
// ============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* 签名 DAMM v1 Bundle 批量买入交易
|
|
14
|
+
*
|
|
15
|
+
* @param params Bundle 参数
|
|
16
|
+
* @param connection 可选连接
|
|
17
|
+
*/
|
|
18
|
+
export async function signDammV1BundleBuy(params, connection) {
|
|
19
|
+
const conn = getConnection(connection);
|
|
20
|
+
const pool = await getDammV1Pool(params.poolAddress, connection);
|
|
21
|
+
const signedTransactions = [];
|
|
22
|
+
for (let i = 0; i < params.trades.length; i++) {
|
|
23
|
+
const trade = params.trades[i];
|
|
24
|
+
const swapQuote = pool.getSwapQuote(new PublicKey(params.inputMint), trade.amountIn, params.slippageBps || 100);
|
|
25
|
+
const minAmountOut = trade.minAmountOut || swapQuote.minSwapOutAmount;
|
|
26
|
+
const swapTx = await pool.swap(trade.wallet.publicKey, new PublicKey(params.inputMint), trade.amountIn, minAmountOut);
|
|
27
|
+
if (i === params.trades.length - 1 && params.jitoTipLamports) {
|
|
28
|
+
const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
|
|
29
|
+
swapTx.add(tipIx);
|
|
30
|
+
}
|
|
31
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
32
|
+
swapTx.recentBlockhash = blockhash;
|
|
33
|
+
swapTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
34
|
+
swapTx.feePayer = trade.wallet.publicKey;
|
|
35
|
+
swapTx.sign(trade.wallet);
|
|
36
|
+
signedTransactions.push(swapTx);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
signedTransactions,
|
|
40
|
+
type: 'damm_v1_bundle_buy',
|
|
41
|
+
poolAddress: params.poolAddress,
|
|
42
|
+
tradeCount: params.trades.length,
|
|
43
|
+
jitoTipLamports: params.jitoTipLamports || 0,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Bundle 批量卖出
|
|
48
|
+
// ============================================================================
|
|
49
|
+
/**
|
|
50
|
+
* 签名 DAMM v1 Bundle 批量卖出交易
|
|
51
|
+
*
|
|
52
|
+
* @param params Bundle 参数
|
|
53
|
+
* @param connection 可选连接
|
|
54
|
+
*/
|
|
55
|
+
export async function signDammV1BundleSell(params, connection) {
|
|
56
|
+
const conn = getConnection(connection);
|
|
57
|
+
const pool = await getDammV1Pool(params.poolAddress, connection);
|
|
58
|
+
const signedTransactions = [];
|
|
59
|
+
for (let i = 0; i < params.trades.length; i++) {
|
|
60
|
+
const trade = params.trades[i];
|
|
61
|
+
const swapQuote = pool.getSwapQuote(new PublicKey(params.inputMint), trade.amountIn, params.slippageBps || 100);
|
|
62
|
+
const minAmountOut = trade.minAmountOut || swapQuote.minSwapOutAmount;
|
|
63
|
+
const swapTx = await pool.swap(trade.wallet.publicKey, new PublicKey(params.inputMint), trade.amountIn, minAmountOut);
|
|
64
|
+
if (i === params.trades.length - 1 && params.jitoTipLamports) {
|
|
65
|
+
const tipIx = buildTipInstruction(trade.wallet.publicKey, BigInt(params.jitoTipLamports));
|
|
66
|
+
swapTx.add(tipIx);
|
|
67
|
+
}
|
|
68
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
69
|
+
swapTx.recentBlockhash = blockhash;
|
|
70
|
+
swapTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
71
|
+
swapTx.feePayer = trade.wallet.publicKey;
|
|
72
|
+
swapTx.sign(trade.wallet);
|
|
73
|
+
signedTransactions.push(swapTx);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
signedTransactions,
|
|
77
|
+
type: 'damm_v1_bundle_sell',
|
|
78
|
+
poolAddress: params.poolAddress,
|
|
79
|
+
tradeCount: params.trades.length,
|
|
80
|
+
jitoTipLamports: params.jitoTipLamports || 0,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
// ============================================================================
|
|
84
|
+
// Bundle 通用 Swap
|
|
85
|
+
// ============================================================================
|
|
86
|
+
/**
|
|
87
|
+
* 签名 DAMM v1 Bundle 通用 Swap 交易
|
|
88
|
+
*
|
|
89
|
+
* @param params Bundle 参数
|
|
90
|
+
* @param isBuy 是否买入 (true = 买入, false = 卖出)
|
|
91
|
+
* @param connection 可选连接
|
|
92
|
+
*/
|
|
93
|
+
export async function signDammV1BundleSwap(params, isBuy, connection) {
|
|
94
|
+
if (isBuy) {
|
|
95
|
+
return signDammV1BundleBuy(params, connection);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return signDammV1BundleSell(params, connection);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 将 Bundle 结果转换为后端 API 请求格式
|
|
103
|
+
*/
|
|
104
|
+
export function toDammV1BundleApiRequest(result) {
|
|
105
|
+
return {
|
|
106
|
+
transactions: result.signedTransactions.map((tx) => tx.serialize().toString('base64')),
|
|
107
|
+
type: result.type,
|
|
108
|
+
poolAddress: result.poolAddress,
|
|
109
|
+
tradeCount: result.tradeCount,
|
|
110
|
+
jitoTipLamports: result.jitoTipLamports,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meteora DAMM v1 (Dynamic AMM) 集成
|
|
3
|
+
*
|
|
4
|
+
* 基于 https://github.com/MeteoraAg/dynamic-amm-sdk 源码分析
|
|
5
|
+
* DAMM v1 是 DBC 迁移后的目标池之一
|
|
6
|
+
*/
|
|
7
|
+
import { Connection, Keypair } from '@solana/web3.js';
|
|
8
|
+
import BN from 'bn.js';
|
|
9
|
+
import type { DammV1PoolInfo, DammV1SwapParams, MeteoraSignedResult } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* 获取 DAMM v1 池信息
|
|
12
|
+
* @param poolAddress 池地址
|
|
13
|
+
* @param connection 可选连接
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDammV1PoolInfo(poolAddress: string, connection?: Connection): Promise<DammV1PoolInfo>;
|
|
16
|
+
/**
|
|
17
|
+
* 签名 DAMM v1 Swap 交易
|
|
18
|
+
* @param params Swap 参数
|
|
19
|
+
* @param wallet 钱包
|
|
20
|
+
* @param connection 可选连接
|
|
21
|
+
*/
|
|
22
|
+
export declare function signDammV1Swap(params: DammV1SwapParams, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
23
|
+
/**
|
|
24
|
+
* 签名 DAMM v1 添加流动性交易
|
|
25
|
+
*/
|
|
26
|
+
export declare function signDammV1Deposit(poolAddress: string, amountA: BN, amountB: BN, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
27
|
+
/**
|
|
28
|
+
* 签名 DAMM v1 移除流动性交易
|
|
29
|
+
*/
|
|
30
|
+
export declare function signDammV1Withdraw(poolAddress: string, lpAmount: BN, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
31
|
+
/**
|
|
32
|
+
* 签名锁定 LP 交易
|
|
33
|
+
*/
|
|
34
|
+
export declare function signDammV1LockLiquidity(poolAddress: string, lpAmount: BN, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
35
|
+
/**
|
|
36
|
+
* 签名领取锁定 LP 费用交易
|
|
37
|
+
*/
|
|
38
|
+
export declare function signDammV1ClaimLockFee(poolAddress: string, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
39
|
+
/**
|
|
40
|
+
* 获取 LP Token Mint 地址
|
|
41
|
+
*/
|
|
42
|
+
export declare function getDammV1LpMint(poolAddress: string, connection?: Connection): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* 获取 LP 供应量
|
|
45
|
+
*/
|
|
46
|
+
export declare function getDammV1LpSupply(poolAddress: string, connection?: Connection): Promise<BN>;
|
|
47
|
+
/**
|
|
48
|
+
* 获取锁定的 LP 数量
|
|
49
|
+
*/
|
|
50
|
+
export declare function getDammV1LockedLpAmount(poolAddress: string, connection?: Connection): Promise<BN>;
|
|
51
|
+
/**
|
|
52
|
+
* 签名创建 DAMM v1 池交易
|
|
53
|
+
* @param tokenAMint Token A Mint
|
|
54
|
+
* @param tokenBMint Token B Mint
|
|
55
|
+
* @param tokenAAmount 初始 Token A 数量
|
|
56
|
+
* @param tokenBAmount 初始 Token B 数量
|
|
57
|
+
* @param wallet 钱包
|
|
58
|
+
* @param connection 可选连接
|
|
59
|
+
*/
|
|
60
|
+
export declare function signDammV1CreatePool(tokenAMint: string, tokenBMint: string, tokenAAmount: BN, tokenBAmount: BN, wallet: Keypair, connection?: Connection): Promise<MeteoraSignedResult>;
|
|
61
|
+
/**
|
|
62
|
+
* 获取 DAMM v1 Swap 报价
|
|
63
|
+
* @param poolAddress 池地址
|
|
64
|
+
* @param inputMint 输入 Mint
|
|
65
|
+
* @param amountIn 输入数量
|
|
66
|
+
* @param slippageBps 滑点 (bps)
|
|
67
|
+
* @param connection 可选连接
|
|
68
|
+
*/
|
|
69
|
+
export declare function getDammV1SwapQuote(poolAddress: string, inputMint: string, amountIn: BN, slippageBps?: number, connection?: Connection): Promise<{
|
|
70
|
+
swapInAmount: string;
|
|
71
|
+
swapOutAmount: string;
|
|
72
|
+
minSwapOutAmount: string;
|
|
73
|
+
priceImpact: string;
|
|
74
|
+
fee: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* 获取 DAMM v1 存款报价
|
|
78
|
+
* @param poolAddress 池地址
|
|
79
|
+
* @param tokenAAmount Token A 数量
|
|
80
|
+
* @param tokenBAmount Token B 数量
|
|
81
|
+
* @param slippageBps 滑点 (bps)
|
|
82
|
+
* @param connection 可选连接
|
|
83
|
+
*/
|
|
84
|
+
export declare function getDammV1DepositQuote(poolAddress: string, tokenAAmount: BN, tokenBAmount: BN, slippageBps?: number, connection?: Connection): Promise<{
|
|
85
|
+
tokenAInAmount: string;
|
|
86
|
+
tokenBInAmount: string;
|
|
87
|
+
poolTokenAmountOut: string;
|
|
88
|
+
minPoolTokenAmountOut: string;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* 获取 DAMM v1 提款报价
|
|
92
|
+
* @param poolAddress 池地址
|
|
93
|
+
* @param lpAmount LP 数量
|
|
94
|
+
* @param slippageBps 滑点 (bps)
|
|
95
|
+
* @param connection 可选连接
|
|
96
|
+
*/
|
|
97
|
+
export declare function getDammV1WithdrawQuote(poolAddress: string, lpAmount: BN, slippageBps?: number, connection?: Connection): Promise<{
|
|
98
|
+
tokenAOutAmount: string;
|
|
99
|
+
tokenBOutAmount: string;
|
|
100
|
+
minTokenAOutAmount: string;
|
|
101
|
+
minTokenBOutAmount: string;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* 获取用户的 LP 余额
|
|
105
|
+
* @param poolAddress 池地址
|
|
106
|
+
* @param userAddress 用户地址
|
|
107
|
+
* @param connection 可选连接
|
|
108
|
+
*/
|
|
109
|
+
export declare function getDammV1UserLpBalance(poolAddress: string, userAddress: string, connection?: Connection): Promise<{
|
|
110
|
+
balance: string;
|
|
111
|
+
lockedBalance: string;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* 获取池的虚拟价格
|
|
115
|
+
* @param poolAddress 池地址
|
|
116
|
+
* @param connection 可选连接
|
|
117
|
+
*/
|
|
118
|
+
export declare function getDammV1VirtualPrice(poolAddress: string, connection?: Connection): Promise<number>;
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meteora DAMM v1 (Dynamic AMM) 集成
|
|
3
|
+
*
|
|
4
|
+
* 基于 https://github.com/MeteoraAg/dynamic-amm-sdk 源码分析
|
|
5
|
+
* DAMM v1 是 DBC 迁移后的目标池之一
|
|
6
|
+
*/
|
|
7
|
+
import { PublicKey, } from '@solana/web3.js';
|
|
8
|
+
import BN from 'bn.js';
|
|
9
|
+
import { getConnection, getDammV1Pool } from './client.js';
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// 池信息查询
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* 获取 DAMM v1 池信息
|
|
15
|
+
* @param poolAddress 池地址
|
|
16
|
+
* @param connection 可选连接
|
|
17
|
+
*/
|
|
18
|
+
export async function getDammV1PoolInfo(poolAddress, connection) {
|
|
19
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
20
|
+
const poolInfo = pool.poolInfo;
|
|
21
|
+
return {
|
|
22
|
+
poolAddress,
|
|
23
|
+
tokenAMint: pool.tokenAMint.address.toString(),
|
|
24
|
+
tokenBMint: pool.tokenBMint.address.toString(),
|
|
25
|
+
curveType: pool.isStablePool ? 'StableSwap' : 'ConstantProduct',
|
|
26
|
+
currentPrice: poolInfo.virtualPrice,
|
|
27
|
+
feeBps: pool.fees?.tradeFeeNumerator?.toNumber() || 0,
|
|
28
|
+
tokenAReserve: poolInfo.tokenAAmount.toString(),
|
|
29
|
+
tokenBReserve: poolInfo.tokenBAmount.toString(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Swap
|
|
34
|
+
// ============================================================================
|
|
35
|
+
/**
|
|
36
|
+
* 签名 DAMM v1 Swap 交易
|
|
37
|
+
* @param params Swap 参数
|
|
38
|
+
* @param wallet 钱包
|
|
39
|
+
* @param connection 可选连接
|
|
40
|
+
*/
|
|
41
|
+
export async function signDammV1Swap(params, wallet, connection) {
|
|
42
|
+
const conn = getConnection(connection);
|
|
43
|
+
const pool = await getDammV1Pool(params.poolAddress, connection);
|
|
44
|
+
const swapQuote = pool.getSwapQuote(new PublicKey(params.inputMint), params.amountIn, 100);
|
|
45
|
+
const minAmountOut = params.minAmountOut || swapQuote.minSwapOutAmount;
|
|
46
|
+
const swapTx = await pool.swap(wallet.publicKey, new PublicKey(params.inputMint), params.amountIn, minAmountOut);
|
|
47
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
48
|
+
swapTx.recentBlockhash = blockhash;
|
|
49
|
+
swapTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
50
|
+
swapTx.feePayer = wallet.publicKey;
|
|
51
|
+
swapTx.sign(wallet);
|
|
52
|
+
return {
|
|
53
|
+
signedTransaction: swapTx,
|
|
54
|
+
type: 'damm_v1_swap',
|
|
55
|
+
poolAddress: params.poolAddress,
|
|
56
|
+
metadata: {
|
|
57
|
+
amountIn: params.amountIn.toString(),
|
|
58
|
+
minAmountOut: minAmountOut.toString(),
|
|
59
|
+
inputMint: params.inputMint,
|
|
60
|
+
outputMint: params.outputMint,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// ============================================================================
|
|
65
|
+
// 添加流动性
|
|
66
|
+
// ============================================================================
|
|
67
|
+
/**
|
|
68
|
+
* 签名 DAMM v1 添加流动性交易
|
|
69
|
+
*/
|
|
70
|
+
export async function signDammV1Deposit(poolAddress, amountA, amountB, wallet, connection) {
|
|
71
|
+
const conn = getConnection(connection);
|
|
72
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
73
|
+
const depositQuote = pool.getDepositQuote(amountA, amountB, true, 100);
|
|
74
|
+
const depositTx = await pool.deposit(wallet.publicKey, depositQuote.tokenAInAmount, depositQuote.tokenBInAmount, depositQuote.minPoolTokenAmountOut);
|
|
75
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
76
|
+
depositTx.recentBlockhash = blockhash;
|
|
77
|
+
depositTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
78
|
+
depositTx.feePayer = wallet.publicKey;
|
|
79
|
+
depositTx.sign(wallet);
|
|
80
|
+
return {
|
|
81
|
+
signedTransaction: depositTx,
|
|
82
|
+
type: 'damm_v1_deposit',
|
|
83
|
+
poolAddress,
|
|
84
|
+
metadata: {
|
|
85
|
+
amountA: amountA.toString(),
|
|
86
|
+
amountB: amountB.toString(),
|
|
87
|
+
minLpAmount: depositQuote.minPoolTokenAmountOut.toString(),
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// ============================================================================
|
|
92
|
+
// 移除流动性
|
|
93
|
+
// ============================================================================
|
|
94
|
+
/**
|
|
95
|
+
* 签名 DAMM v1 移除流动性交易
|
|
96
|
+
*/
|
|
97
|
+
export async function signDammV1Withdraw(poolAddress, lpAmount, wallet, connection) {
|
|
98
|
+
const conn = getConnection(connection);
|
|
99
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
100
|
+
const withdrawQuote = pool.getWithdrawQuote(lpAmount, 100);
|
|
101
|
+
const withdrawTx = await pool.withdraw(wallet.publicKey, lpAmount, withdrawQuote.minTokenAOutAmount, withdrawQuote.minTokenBOutAmount);
|
|
102
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
103
|
+
withdrawTx.recentBlockhash = blockhash;
|
|
104
|
+
withdrawTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
105
|
+
withdrawTx.feePayer = wallet.publicKey;
|
|
106
|
+
withdrawTx.sign(wallet);
|
|
107
|
+
return {
|
|
108
|
+
signedTransaction: withdrawTx,
|
|
109
|
+
type: 'damm_v1_withdraw',
|
|
110
|
+
poolAddress,
|
|
111
|
+
metadata: {
|
|
112
|
+
lpAmount: lpAmount.toString(),
|
|
113
|
+
minTokenAOut: withdrawQuote.minTokenAOutAmount.toString(),
|
|
114
|
+
minTokenBOut: withdrawQuote.minTokenBOutAmount.toString(),
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// ============================================================================
|
|
119
|
+
// 锁定流动性
|
|
120
|
+
// ============================================================================
|
|
121
|
+
/**
|
|
122
|
+
* 签名锁定 LP 交易
|
|
123
|
+
*/
|
|
124
|
+
export async function signDammV1LockLiquidity(poolAddress, lpAmount, wallet, connection) {
|
|
125
|
+
const conn = getConnection(connection);
|
|
126
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
127
|
+
const lockTx = await pool.lock(wallet.publicKey, lpAmount);
|
|
128
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
129
|
+
lockTx.recentBlockhash = blockhash;
|
|
130
|
+
lockTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
131
|
+
lockTx.feePayer = wallet.publicKey;
|
|
132
|
+
lockTx.sign(wallet);
|
|
133
|
+
return {
|
|
134
|
+
signedTransaction: lockTx,
|
|
135
|
+
type: 'damm_v1_lock',
|
|
136
|
+
poolAddress,
|
|
137
|
+
metadata: { lpAmount: lpAmount.toString() },
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 签名领取锁定 LP 费用交易
|
|
142
|
+
*/
|
|
143
|
+
export async function signDammV1ClaimLockFee(poolAddress, wallet, connection) {
|
|
144
|
+
const conn = getConnection(connection);
|
|
145
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
146
|
+
const claimTx = await pool.claimLockFee(wallet.publicKey);
|
|
147
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
148
|
+
claimTx.recentBlockhash = blockhash;
|
|
149
|
+
claimTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
150
|
+
claimTx.feePayer = wallet.publicKey;
|
|
151
|
+
claimTx.sign(wallet);
|
|
152
|
+
return {
|
|
153
|
+
signedTransaction: claimTx,
|
|
154
|
+
type: 'damm_v1_claim_lock_fee',
|
|
155
|
+
poolAddress,
|
|
156
|
+
metadata: {},
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// ============================================================================
|
|
160
|
+
// 辅助函数
|
|
161
|
+
// ============================================================================
|
|
162
|
+
/**
|
|
163
|
+
* 获取 LP Token Mint 地址
|
|
164
|
+
*/
|
|
165
|
+
export async function getDammV1LpMint(poolAddress, connection) {
|
|
166
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
167
|
+
const lpMint = await pool.getPoolTokenMint();
|
|
168
|
+
return lpMint.toString();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 获取 LP 供应量
|
|
172
|
+
*/
|
|
173
|
+
export async function getDammV1LpSupply(poolAddress, connection) {
|
|
174
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
175
|
+
return pool.getLpSupply();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 获取锁定的 LP 数量
|
|
179
|
+
*/
|
|
180
|
+
export async function getDammV1LockedLpAmount(poolAddress, connection) {
|
|
181
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
182
|
+
return pool.getLockedLpAmount();
|
|
183
|
+
}
|
|
184
|
+
// ============================================================================
|
|
185
|
+
// 创建池
|
|
186
|
+
// ============================================================================
|
|
187
|
+
/**
|
|
188
|
+
* 签名创建 DAMM v1 池交易
|
|
189
|
+
* @param tokenAMint Token A Mint
|
|
190
|
+
* @param tokenBMint Token B Mint
|
|
191
|
+
* @param tokenAAmount 初始 Token A 数量
|
|
192
|
+
* @param tokenBAmount 初始 Token B 数量
|
|
193
|
+
* @param wallet 钱包
|
|
194
|
+
* @param connection 可选连接
|
|
195
|
+
*/
|
|
196
|
+
export async function signDammV1CreatePool(tokenAMint, tokenBMint, tokenAAmount, tokenBAmount, wallet, connection) {
|
|
197
|
+
const conn = getConnection(connection);
|
|
198
|
+
// 需要使用 DynamicAmm 类的静态方法
|
|
199
|
+
const DynamicAmm = (await import('@meteora-ag/dynamic-amm-sdk')).default;
|
|
200
|
+
// 创建 Constant Product Pool
|
|
201
|
+
const createPoolTx = await DynamicAmm.createPermissionlessConstantProductPool(conn, wallet.publicKey, new PublicKey(tokenAMint), new PublicKey(tokenBMint), tokenAAmount, tokenBAmount, {
|
|
202
|
+
tradeFeeNumerator: new BN(25), // 0.25% 交易费
|
|
203
|
+
});
|
|
204
|
+
const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash();
|
|
205
|
+
createPoolTx.recentBlockhash = blockhash;
|
|
206
|
+
createPoolTx.lastValidBlockHeight = lastValidBlockHeight;
|
|
207
|
+
createPoolTx.feePayer = wallet.publicKey;
|
|
208
|
+
createPoolTx.sign(wallet);
|
|
209
|
+
return {
|
|
210
|
+
signedTransaction: createPoolTx,
|
|
211
|
+
type: 'damm_v1_create_pool',
|
|
212
|
+
poolAddress: '',
|
|
213
|
+
metadata: {
|
|
214
|
+
tokenAMint,
|
|
215
|
+
tokenBMint,
|
|
216
|
+
tokenAAmount: tokenAAmount.toString(),
|
|
217
|
+
tokenBAmount: tokenBAmount.toString(),
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
// ============================================================================
|
|
222
|
+
// 报价查询
|
|
223
|
+
// ============================================================================
|
|
224
|
+
/**
|
|
225
|
+
* 获取 DAMM v1 Swap 报价
|
|
226
|
+
* @param poolAddress 池地址
|
|
227
|
+
* @param inputMint 输入 Mint
|
|
228
|
+
* @param amountIn 输入数量
|
|
229
|
+
* @param slippageBps 滑点 (bps)
|
|
230
|
+
* @param connection 可选连接
|
|
231
|
+
*/
|
|
232
|
+
export async function getDammV1SwapQuote(poolAddress, inputMint, amountIn, slippageBps = 100, connection) {
|
|
233
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
234
|
+
const quote = pool.getSwapQuote(new PublicKey(inputMint), amountIn, slippageBps);
|
|
235
|
+
return {
|
|
236
|
+
swapInAmount: quote.swapInAmount.toString(),
|
|
237
|
+
swapOutAmount: quote.swapOutAmount.toString(),
|
|
238
|
+
minSwapOutAmount: quote.minSwapOutAmount.toString(),
|
|
239
|
+
priceImpact: quote.priceImpact?.toString() || '0',
|
|
240
|
+
fee: quote.fee?.toString() || '0',
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* 获取 DAMM v1 存款报价
|
|
245
|
+
* @param poolAddress 池地址
|
|
246
|
+
* @param tokenAAmount Token A 数量
|
|
247
|
+
* @param tokenBAmount Token B 数量
|
|
248
|
+
* @param slippageBps 滑点 (bps)
|
|
249
|
+
* @param connection 可选连接
|
|
250
|
+
*/
|
|
251
|
+
export async function getDammV1DepositQuote(poolAddress, tokenAAmount, tokenBAmount, slippageBps = 100, connection) {
|
|
252
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
253
|
+
const quote = pool.getDepositQuote(tokenAAmount, tokenBAmount, true, slippageBps);
|
|
254
|
+
return {
|
|
255
|
+
tokenAInAmount: quote.tokenAInAmount.toString(),
|
|
256
|
+
tokenBInAmount: quote.tokenBInAmount.toString(),
|
|
257
|
+
poolTokenAmountOut: quote.poolTokenAmountOut.toString(),
|
|
258
|
+
minPoolTokenAmountOut: quote.minPoolTokenAmountOut.toString(),
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* 获取 DAMM v1 提款报价
|
|
263
|
+
* @param poolAddress 池地址
|
|
264
|
+
* @param lpAmount LP 数量
|
|
265
|
+
* @param slippageBps 滑点 (bps)
|
|
266
|
+
* @param connection 可选连接
|
|
267
|
+
*/
|
|
268
|
+
export async function getDammV1WithdrawQuote(poolAddress, lpAmount, slippageBps = 100, connection) {
|
|
269
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
270
|
+
const quote = pool.getWithdrawQuote(lpAmount, slippageBps);
|
|
271
|
+
return {
|
|
272
|
+
tokenAOutAmount: quote.tokenAOutAmount.toString(),
|
|
273
|
+
tokenBOutAmount: quote.tokenBOutAmount.toString(),
|
|
274
|
+
minTokenAOutAmount: quote.minTokenAOutAmount.toString(),
|
|
275
|
+
minTokenBOutAmount: quote.minTokenBOutAmount.toString(),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
// ============================================================================
|
|
279
|
+
// 用户信息
|
|
280
|
+
// ============================================================================
|
|
281
|
+
/**
|
|
282
|
+
* 获取用户的 LP 余额
|
|
283
|
+
* @param poolAddress 池地址
|
|
284
|
+
* @param userAddress 用户地址
|
|
285
|
+
* @param connection 可选连接
|
|
286
|
+
*/
|
|
287
|
+
export async function getDammV1UserLpBalance(poolAddress, userAddress, connection) {
|
|
288
|
+
const conn = getConnection(connection);
|
|
289
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
290
|
+
const lpMint = await pool.getPoolTokenMint();
|
|
291
|
+
const { getAssociatedTokenAddressSync } = await import('@solana/spl-token');
|
|
292
|
+
try {
|
|
293
|
+
const lpAta = getAssociatedTokenAddressSync(lpMint, new PublicKey(userAddress));
|
|
294
|
+
const lpAccount = await conn.getTokenAccountBalance(lpAta);
|
|
295
|
+
return {
|
|
296
|
+
balance: lpAccount.value.amount,
|
|
297
|
+
lockedBalance: '0', // 需要查询锁定账户
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
return {
|
|
302
|
+
balance: '0',
|
|
303
|
+
lockedBalance: '0',
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* 获取池的虚拟价格
|
|
309
|
+
* @param poolAddress 池地址
|
|
310
|
+
* @param connection 可选连接
|
|
311
|
+
*/
|
|
312
|
+
export async function getDammV1VirtualPrice(poolAddress, connection) {
|
|
313
|
+
const pool = await getDammV1Pool(poolAddress, connection);
|
|
314
|
+
return pool.poolInfo.virtualPrice;
|
|
315
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meteora DAMM v2 (CP-AMM) Bundle 批量交易
|
|
3
|
+
*
|
|
4
|
+
* 支持 Jito Bundle 的批量买卖
|
|
5
|
+
*/
|
|
6
|
+
import { Connection, Keypair } from '@solana/web3.js';
|
|
7
|
+
import BN from 'bn.js';
|
|
8
|
+
import type { MeteoraBundleSignedResult } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* DAMM v2 Bundle Swap 参数
|
|
11
|
+
*/
|
|
12
|
+
export interface DammV2BundleSwapParams {
|
|
13
|
+
/** 池地址 */
|
|
14
|
+
poolAddress: string;
|
|
15
|
+
/** 输入代币地址 */
|
|
16
|
+
inputMint: string;
|
|
17
|
+
/** 输出代币地址 */
|
|
18
|
+
outputMint: string;
|
|
19
|
+
/** Token A 精度 */
|
|
20
|
+
tokenADecimal?: number;
|
|
21
|
+
/** Token B 精度 */
|
|
22
|
+
tokenBDecimal?: number;
|
|
23
|
+
/** 交易列表 */
|
|
24
|
+
trades: {
|
|
25
|
+
wallet: Keypair;
|
|
26
|
+
amountIn: BN;
|
|
27
|
+
minAmountOut?: BN;
|
|
28
|
+
}[];
|
|
29
|
+
/** 滑点百分比 (例如 0.5 表示 0.5%) */
|
|
30
|
+
slippagePercent?: number;
|
|
31
|
+
/** Jito 小费 */
|
|
32
|
+
jitoTipLamports?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 签名 DAMM v2 Bundle 批量买入交易
|
|
36
|
+
*
|
|
37
|
+
* @param params Bundle 参数
|
|
38
|
+
* @param connection 可选连接
|
|
39
|
+
*/
|
|
40
|
+
export declare function signDammV2BundleBuy(params: DammV2BundleSwapParams, connection?: Connection): Promise<MeteoraBundleSignedResult>;
|
|
41
|
+
/**
|
|
42
|
+
* 签名 DAMM v2 Bundle 批量卖出交易
|
|
43
|
+
*
|
|
44
|
+
* @param params Bundle 参数
|
|
45
|
+
* @param connection 可选连接
|
|
46
|
+
*/
|
|
47
|
+
export declare function signDammV2BundleSell(params: DammV2BundleSwapParams, connection?: Connection): Promise<MeteoraBundleSignedResult>;
|
|
48
|
+
/**
|
|
49
|
+
* 签名 DAMM v2 Bundle 通用 Swap 交易
|
|
50
|
+
*
|
|
51
|
+
* @param params Bundle 参数
|
|
52
|
+
* @param isBuy 是否买入 (true = 买入, false = 卖出)
|
|
53
|
+
* @param connection 可选连接
|
|
54
|
+
*/
|
|
55
|
+
export declare function signDammV2BundleSwap(params: DammV2BundleSwapParams, isBuy: boolean, connection?: Connection): Promise<MeteoraBundleSignedResult>;
|
|
56
|
+
/**
|
|
57
|
+
* 将 Bundle 结果转换为后端 API 请求格式
|
|
58
|
+
*/
|
|
59
|
+
export declare function toDammV2BundleApiRequest(result: MeteoraBundleSignedResult): {
|
|
60
|
+
transactions: string[];
|
|
61
|
+
type: string;
|
|
62
|
+
poolAddress: string;
|
|
63
|
+
tradeCount: number;
|
|
64
|
+
jitoTipLamports: number;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* 批量获取 DAMM v2 Swap 报价
|
|
68
|
+
*
|
|
69
|
+
* @param poolAddress 池地址
|
|
70
|
+
* @param inputMint 输入代币地址
|
|
71
|
+
* @param amounts 输入金额列表
|
|
72
|
+
* @param tokenADecimal Token A 精度
|
|
73
|
+
* @param tokenBDecimal Token B 精度
|
|
74
|
+
* @param slippagePercent 滑点百分比
|
|
75
|
+
* @param connection 可选连接
|
|
76
|
+
*/
|
|
77
|
+
export declare function getDammV2BundleQuotes(poolAddress: string, inputMint: string, amounts: BN[], tokenADecimal?: number, tokenBDecimal?: number, slippagePercent?: number, connection?: Connection): Promise<{
|
|
78
|
+
swapOutAmount: string;
|
|
79
|
+
minSwapOutAmount: string;
|
|
80
|
+
totalFee: string;
|
|
81
|
+
priceImpact: number;
|
|
82
|
+
}[]>;
|