four-flap-meme-sdk 1.5.6 → 1.5.8
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/README.zh-CN.pdf +0 -0
- package/dist/abis/common.js +2 -0
- package/dist/contracts/tm-bundle-merkle/config.d.ts +0 -1
- package/dist/contracts/tm-bundle-merkle/config.js +0 -1
- package/dist/contracts/tm-bundle-merkle/core.js +13 -9
- package/dist/flap/portal-bundle-merkle/config.d.ts +0 -1
- package/dist/flap/portal-bundle-merkle/config.js +0 -1
- package/dist/flap/portal-bundle-merkle/create-to-dex.d.ts +8 -2
- package/dist/flap/portal-bundle-merkle/create-to-dex.js +170 -128
- 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 +1 -1
- package/package.json +5 -41
- package/dist/sol/constants.d.ts +0 -150
- package/dist/sol/constants.js +0 -188
- package/dist/sol/dex/blockrazor/client.d.ts +0 -51
- package/dist/sol/dex/blockrazor/client.js +0 -96
- package/dist/sol/dex/blockrazor/constants.d.ts +0 -34
- package/dist/sol/dex/blockrazor/constants.js +0 -55
- package/dist/sol/dex/blockrazor/geyser.d.ts +0 -128
- package/dist/sol/dex/blockrazor/geyser.js +0 -530
- package/dist/sol/dex/blockrazor/index.d.ts +0 -18
- package/dist/sol/dex/blockrazor/index.js +0 -23
- package/dist/sol/dex/blockrazor/send.d.ts +0 -135
- package/dist/sol/dex/blockrazor/send.js +0 -254
- package/dist/sol/dex/blockrazor/types.d.ts +0 -191
- package/dist/sol/dex/blockrazor/types.js +0 -5
- package/dist/sol/dex/index.d.ts +0 -10
- package/dist/sol/dex/index.js +0 -16
- package/dist/sol/dex/jup/client.d.ts +0 -33
- package/dist/sol/dex/jup/client.js +0 -110
- package/dist/sol/dex/jup/index.d.ts +0 -16
- package/dist/sol/dex/jup/index.js +0 -148
- package/dist/sol/dex/jup/legacy.d.ts +0 -623
- package/dist/sol/dex/jup/legacy.js +0 -416
- package/dist/sol/dex/jup/lend.d.ts +0 -640
- package/dist/sol/dex/jup/lend.js +0 -603
- package/dist/sol/dex/jup/portfolio.d.ts +0 -362
- package/dist/sol/dex/jup/portfolio.js +0 -367
- package/dist/sol/dex/jup/price.d.ts +0 -173
- package/dist/sol/dex/jup/price.js +0 -220
- package/dist/sol/dex/jup/recurring.d.ts +0 -437
- package/dist/sol/dex/jup/recurring.js +0 -320
- package/dist/sol/dex/jup/send.d.ts +0 -282
- package/dist/sol/dex/jup/send.js +0 -295
- package/dist/sol/dex/jup/studio.d.ts +0 -457
- package/dist/sol/dex/jup/studio.js +0 -488
- package/dist/sol/dex/jup/tokens.d.ts +0 -767
- package/dist/sol/dex/jup/tokens.js +0 -697
- package/dist/sol/dex/jup/trigger.d.ts +0 -511
- package/dist/sol/dex/jup/trigger.js +0 -397
- package/dist/sol/dex/jup/types.d.ts +0 -433
- package/dist/sol/dex/jup/types.js +0 -5
- package/dist/sol/dex/jup/ultra.d.ts +0 -646
- package/dist/sol/dex/jup/ultra.js +0 -853
- 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 -11
- package/dist/sol/index.js +0 -18
- 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/nozomi/client.d.ts +0 -63
- package/dist/sol/nozomi/client.js +0 -222
- package/dist/sol/nozomi/index.d.ts +0 -8
- package/dist/sol/nozomi/index.js +0 -8
- package/dist/sol/nozomi/tip.d.ts +0 -50
- package/dist/sol/nozomi/tip.js +0 -80
- package/dist/sol/nozomi/types.d.ts +0 -96
- package/dist/sol/nozomi/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 -196
- package/dist/sol/utils/transfer.js +0 -307
- package/dist/sol/utils/wallet.d.ts +0 -107
- package/dist/sol/utils/wallet.js +0 -210
|
@@ -1,623 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Jupiter Legacy Swap API
|
|
3
|
-
* @module sol/dex/jup/legacy
|
|
4
|
-
*
|
|
5
|
-
* Legacy Swap API 提供更多自定义选项的交易路由
|
|
6
|
-
* 文档: https://docs.jup.ag/docs/apis/swap-api
|
|
7
|
-
*/
|
|
8
|
-
import type { JupiterConfig } from './types.js';
|
|
9
|
-
/** Swap 模式 */
|
|
10
|
-
export type LegacySwapMode = 'ExactIn' | 'ExactOut';
|
|
11
|
-
/** 指令版本 */
|
|
12
|
-
export type LegacyInstructionVersion = 'V1' | 'V2';
|
|
13
|
-
/** 路由交换信息 */
|
|
14
|
-
export interface LegacySwapInfo {
|
|
15
|
-
/** AMM Key */
|
|
16
|
-
ammKey: string;
|
|
17
|
-
/** AMM 标签 (如 'Raydium CLMM', 'Orca') */
|
|
18
|
-
label?: string;
|
|
19
|
-
/** 输入代币 Mint */
|
|
20
|
-
inputMint: string;
|
|
21
|
-
/** 输出代币 Mint */
|
|
22
|
-
outputMint: string;
|
|
23
|
-
/** 输入数量 */
|
|
24
|
-
inAmount: string;
|
|
25
|
-
/** 输出数量 */
|
|
26
|
-
outAmount: string;
|
|
27
|
-
/** 手续费数量 (已弃用) */
|
|
28
|
-
feeAmount?: string;
|
|
29
|
-
/** 手续费代币 (已弃用) */
|
|
30
|
-
feeMint?: string;
|
|
31
|
-
}
|
|
32
|
-
/** 路由计划 */
|
|
33
|
-
export interface LegacyRoutePlan {
|
|
34
|
-
/** 交换信息 */
|
|
35
|
-
swapInfo: LegacySwapInfo;
|
|
36
|
-
/** 百分比 */
|
|
37
|
-
percent: number | null;
|
|
38
|
-
/** BPS */
|
|
39
|
-
bps?: number | null;
|
|
40
|
-
}
|
|
41
|
-
/** 平台手续费 */
|
|
42
|
-
export interface LegacyPlatformFee {
|
|
43
|
-
/** 手续费数量 */
|
|
44
|
-
amount: string;
|
|
45
|
-
/** 手续费 BPS */
|
|
46
|
-
feeBps: number;
|
|
47
|
-
}
|
|
48
|
-
/** Quote 请求参数 */
|
|
49
|
-
export interface LegacyQuoteParams {
|
|
50
|
-
/** 输入代币 Mint */
|
|
51
|
-
inputMint: string;
|
|
52
|
-
/** 输出代币 Mint */
|
|
53
|
-
outputMint: string;
|
|
54
|
-
/**
|
|
55
|
-
* 原始数量 (最小单位)
|
|
56
|
-
* - ExactIn: 输入数量
|
|
57
|
-
* - ExactOut: 输出数量
|
|
58
|
-
*/
|
|
59
|
-
amount: string | number;
|
|
60
|
-
/** 滑点 BPS (默认: 50) */
|
|
61
|
-
slippageBps?: number;
|
|
62
|
-
/**
|
|
63
|
-
* Swap 模式 (默认: ExactIn)
|
|
64
|
-
* - ExactIn: 精确输入
|
|
65
|
-
* - ExactOut: 精确输出 (仅部分 AMM 支持)
|
|
66
|
-
*/
|
|
67
|
-
swapMode?: LegacySwapMode;
|
|
68
|
-
/**
|
|
69
|
-
* 指定使用的 DEX 列表
|
|
70
|
-
* 例如: ['Raydium', 'Orca V2', 'Meteora DLMM']
|
|
71
|
-
*/
|
|
72
|
-
dexes?: string[];
|
|
73
|
-
/**
|
|
74
|
-
* 排除的 DEX 列表
|
|
75
|
-
* 例如: ['Raydium', 'Orca V2']
|
|
76
|
-
*/
|
|
77
|
-
excludeDexes?: string[];
|
|
78
|
-
/** 限制中间代币为稳定币 (默认: true) */
|
|
79
|
-
restrictIntermediateTokens?: boolean;
|
|
80
|
-
/** 仅使用直接路由/单跳 (默认: false) */
|
|
81
|
-
onlyDirectRoutes?: boolean;
|
|
82
|
-
/** 使用 Legacy 交易格式 (默认: false) */
|
|
83
|
-
asLegacyTransaction?: boolean;
|
|
84
|
-
/** 平台手续费 BPS */
|
|
85
|
-
platformFeeBps?: number;
|
|
86
|
-
/** 最大账户数量 (默认: 64) */
|
|
87
|
-
maxAccounts?: number;
|
|
88
|
-
/** 指令版本 (默认: V1) */
|
|
89
|
-
instructionVersion?: LegacyInstructionVersion;
|
|
90
|
-
/** 动态滑点 (默认: false) */
|
|
91
|
-
dynamicSlippage?: boolean;
|
|
92
|
-
}
|
|
93
|
-
/** Quote 响应 */
|
|
94
|
-
export interface LegacyQuoteResponse {
|
|
95
|
-
/** 输入代币 Mint */
|
|
96
|
-
inputMint: string;
|
|
97
|
-
/** 输入数量 */
|
|
98
|
-
inAmount: string;
|
|
99
|
-
/** 输出代币 Mint */
|
|
100
|
-
outputMint: string;
|
|
101
|
-
/**
|
|
102
|
-
* 输出数量
|
|
103
|
-
* 包含平台费和 DEX 费用,不包含滑点
|
|
104
|
-
*/
|
|
105
|
-
outAmount: string;
|
|
106
|
-
/**
|
|
107
|
-
* 最小输出阈值
|
|
108
|
-
* 考虑滑点后的最小输出
|
|
109
|
-
*/
|
|
110
|
-
otherAmountThreshold: string;
|
|
111
|
-
/** Swap 模式 */
|
|
112
|
-
swapMode: LegacySwapMode;
|
|
113
|
-
/** 滑点 BPS */
|
|
114
|
-
slippageBps: number;
|
|
115
|
-
/** 价格影响百分比 */
|
|
116
|
-
priceImpactPct: string;
|
|
117
|
-
/** 路由计划 */
|
|
118
|
-
routePlan: LegacyRoutePlan[];
|
|
119
|
-
/** 平台手续费 */
|
|
120
|
-
platformFee: LegacyPlatformFee | null;
|
|
121
|
-
/** Context Slot */
|
|
122
|
-
contextSlot?: number;
|
|
123
|
-
/** 耗时 (秒) */
|
|
124
|
-
timeTaken?: number;
|
|
125
|
-
/** Swap USD 价值 */
|
|
126
|
-
swapUsdValue?: string;
|
|
127
|
-
/** 是否使用了简化路由 */
|
|
128
|
-
simplerRouteUsed?: boolean;
|
|
129
|
-
/** 指令版本 */
|
|
130
|
-
instructionVersion?: LegacyInstructionVersion;
|
|
131
|
-
}
|
|
132
|
-
/** 优先级等级 */
|
|
133
|
-
export type PriorityLevel = 'medium' | 'high' | 'veryHigh';
|
|
134
|
-
/** 优先费配置 - priorityLevelWithMaxLamports */
|
|
135
|
-
export interface PriorityLevelWithMaxLamports {
|
|
136
|
-
priorityLevelWithMaxLamports: {
|
|
137
|
-
/** 优先级等级 */
|
|
138
|
-
priorityLevel: PriorityLevel;
|
|
139
|
-
/** 最大 lamports 上限 */
|
|
140
|
-
maxLamports: number;
|
|
141
|
-
/** 是否使用全局费率市场 (默认: false) */
|
|
142
|
-
global?: boolean;
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
/** 优先费配置 - jitoTipLamports */
|
|
146
|
-
export interface JitoTipLamports {
|
|
147
|
-
jitoTipLamports: number;
|
|
148
|
-
}
|
|
149
|
-
/** 优先费配置 - jitoTipLamportsWithPayer */
|
|
150
|
-
export interface JitoTipLamportsWithPayer {
|
|
151
|
-
jitoTipLamportsWithPayer: {
|
|
152
|
-
/** Jito tip 数量 */
|
|
153
|
-
lamports: number;
|
|
154
|
-
/** 支付者公钥 */
|
|
155
|
-
payer: string;
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
/** 优先费配置类型 */
|
|
159
|
-
export type PrioritizationFeeLamports = number | 'auto' | PriorityLevelWithMaxLamports | JitoTipLamports | JitoTipLamportsWithPayer;
|
|
160
|
-
/** Swap 请求参数 */
|
|
161
|
-
export interface LegacySwapParams {
|
|
162
|
-
/** 用户公钥 */
|
|
163
|
-
userPublicKey: string;
|
|
164
|
-
/** Quote 响应 */
|
|
165
|
-
quoteResponse: LegacyQuoteResponse;
|
|
166
|
-
/**
|
|
167
|
-
* 自定义支付者公钥
|
|
168
|
-
* 支付交易费用和代币账户租金
|
|
169
|
-
*/
|
|
170
|
-
payer?: string;
|
|
171
|
-
/**
|
|
172
|
-
* 是否自动包装/解包 SOL (默认: true)
|
|
173
|
-
* - true + 输入为 SOL: 将 SOL 包装为 WSOL
|
|
174
|
-
* - true + 输出为 SOL: 将 WSOL 解包为 SOL
|
|
175
|
-
* - false: 需要已存在的 WSOL 账户
|
|
176
|
-
*/
|
|
177
|
-
wrapAndUnwrapSol?: boolean;
|
|
178
|
-
/**
|
|
179
|
-
* 使用共享程序账户 (由路由引擎动态决定)
|
|
180
|
-
* 对于复杂路由需要多个中间代币账户
|
|
181
|
-
*/
|
|
182
|
-
useSharedAccounts?: boolean;
|
|
183
|
-
/**
|
|
184
|
-
* 手续费账户 (需要已初始化)
|
|
185
|
-
* 代币账户的 mint 必须是输入或输出代币
|
|
186
|
-
* 如果 /quote 传入了 platformFeeBps,则必须传入此参数
|
|
187
|
-
*/
|
|
188
|
-
feeAccount?: string;
|
|
189
|
-
/**
|
|
190
|
-
* 跟踪账户公钥
|
|
191
|
-
* 用于追踪交易,可通过 Solscan/Dune 等查询
|
|
192
|
-
*/
|
|
193
|
-
trackingAccount?: string;
|
|
194
|
-
/**
|
|
195
|
-
* 优先费配置
|
|
196
|
-
* - 数字: 固定 lamports
|
|
197
|
-
* - 'auto': 自动估算
|
|
198
|
-
* - priorityLevelWithMaxLamports: 按等级估算并设置上限
|
|
199
|
-
* - jitoTipLamports: Jito tip (需要连接 Jito RPC)
|
|
200
|
-
* - jitoTipLamportsWithPayer: Jito tip 并指定支付者
|
|
201
|
-
*/
|
|
202
|
-
prioritizationFeeLamports?: PrioritizationFeeLamports;
|
|
203
|
-
/** 使用 Legacy 交易格式 (默认: false) */
|
|
204
|
-
asLegacyTransaction?: boolean;
|
|
205
|
-
/**
|
|
206
|
-
* 目标代币账户
|
|
207
|
-
* 接收输出代币的账户,需要已初始化
|
|
208
|
-
* 与 nativeDestinationAccount 互斥
|
|
209
|
-
*/
|
|
210
|
-
destinationTokenAccount?: string;
|
|
211
|
-
/**
|
|
212
|
-
* 原生 SOL 目标账户
|
|
213
|
-
* 仅当输出为 SOL 时有效
|
|
214
|
-
* 与 destinationTokenAccount 互斥
|
|
215
|
-
*/
|
|
216
|
-
nativeDestinationAccount?: string;
|
|
217
|
-
/**
|
|
218
|
-
* 动态计算 CU 限制 (默认: false)
|
|
219
|
-
* 启用后会模拟交易获取实际 CU,但会多一次 RPC 调用
|
|
220
|
-
* 推荐启用以准确估算 CU 和降低优先费
|
|
221
|
-
*/
|
|
222
|
-
dynamicComputeUnitLimit?: boolean;
|
|
223
|
-
/**
|
|
224
|
-
* 跳过用户账户 RPC 调用 (默认: false)
|
|
225
|
-
* 启用后不检查必需账户是否存在
|
|
226
|
-
*/
|
|
227
|
-
skipUserAccountsRpcCalls?: boolean;
|
|
228
|
-
/**
|
|
229
|
-
* 动态滑点 (默认: false)
|
|
230
|
-
* 已不再维护,推荐使用 Ultra API 的 RTSE
|
|
231
|
-
*/
|
|
232
|
-
dynamicSlippage?: boolean;
|
|
233
|
-
/**
|
|
234
|
-
* 精确的 CU 价格 (微 lamports)
|
|
235
|
-
* computeUnitLimit (1400000) * computeUnitPriceMicroLamports
|
|
236
|
-
* 推荐使用 prioritizationFeeLamports + dynamicComputeUnitLimit
|
|
237
|
-
*/
|
|
238
|
-
computeUnitPriceMicroLamports?: number;
|
|
239
|
-
/**
|
|
240
|
-
* 交易有效期 slots 数量
|
|
241
|
-
* 例如: 10 slots ≈ 4 秒
|
|
242
|
-
*/
|
|
243
|
-
blockhashSlotsToExpiry?: number;
|
|
244
|
-
}
|
|
245
|
-
/** Swap 响应 */
|
|
246
|
-
export interface LegacySwapResponse {
|
|
247
|
-
/** Base64 编码的未签名交易 */
|
|
248
|
-
swapTransaction: string;
|
|
249
|
-
/** 区块高度有效期限 */
|
|
250
|
-
lastValidBlockHeight: number;
|
|
251
|
-
/** 优先费 lamports */
|
|
252
|
-
prioritizationFeeLamports?: number;
|
|
253
|
-
}
|
|
254
|
-
/** 账户信息 */
|
|
255
|
-
export interface InstructionAccount {
|
|
256
|
-
/** 账户公钥 */
|
|
257
|
-
pubkey: string;
|
|
258
|
-
/** 是否是签名者 */
|
|
259
|
-
isSigner: boolean;
|
|
260
|
-
/** 是否可写 */
|
|
261
|
-
isWritable: boolean;
|
|
262
|
-
}
|
|
263
|
-
/** 指令 */
|
|
264
|
-
export interface Instruction {
|
|
265
|
-
/** Program ID */
|
|
266
|
-
programId: string;
|
|
267
|
-
/** 账户列表 */
|
|
268
|
-
accounts: InstructionAccount[];
|
|
269
|
-
/** 指令数据 (Base64) */
|
|
270
|
-
data: string;
|
|
271
|
-
}
|
|
272
|
-
/** Swap Instructions 响应 */
|
|
273
|
-
export interface LegacySwapInstructionsResponse {
|
|
274
|
-
/**
|
|
275
|
-
* 其他指令
|
|
276
|
-
* 如果设置了 Jito tip,会包含 Jito tip 指令
|
|
277
|
-
*/
|
|
278
|
-
otherInstructions: Instruction[];
|
|
279
|
-
/**
|
|
280
|
-
* Compute Budget 指令
|
|
281
|
-
* 用于设置交易的计算预算
|
|
282
|
-
*/
|
|
283
|
-
computeBudgetInstructions: Instruction[];
|
|
284
|
-
/**
|
|
285
|
-
* Setup 指令
|
|
286
|
-
* 用于创建用户所需的代币账户
|
|
287
|
-
*/
|
|
288
|
-
setupInstructions: Instruction[];
|
|
289
|
-
/**
|
|
290
|
-
* Swap 指令
|
|
291
|
-
* 实际的交换指令
|
|
292
|
-
*/
|
|
293
|
-
swapInstruction: Instruction;
|
|
294
|
-
/**
|
|
295
|
-
* Address Lookup Table 地址
|
|
296
|
-
* 版本化交易使用
|
|
297
|
-
*/
|
|
298
|
-
addressLookupTableAddresses: string[];
|
|
299
|
-
/**
|
|
300
|
-
* Cleanup 指令
|
|
301
|
-
* 用于包装/解包 SOL
|
|
302
|
-
*/
|
|
303
|
-
cleanupInstruction?: Instruction;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* 获取 Legacy Swap 报价
|
|
307
|
-
*
|
|
308
|
-
* Legacy API 提供更多自定义选项,适合需要精细控制路由的场景。
|
|
309
|
-
*
|
|
310
|
-
* @param params 报价参数
|
|
311
|
-
* @param config Jupiter 配置
|
|
312
|
-
* @returns Quote 响应
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* ```typescript
|
|
316
|
-
* import { Sol } from 'four-flap-meme-sdk'
|
|
317
|
-
*
|
|
318
|
-
* Sol.setJupiterConfig({ apiKey: 'your-api-key' })
|
|
319
|
-
*
|
|
320
|
-
* // 基础报价
|
|
321
|
-
* const quote = await Sol.getLegacyQuote({
|
|
322
|
-
* inputMint: 'So11111111111111111111111111111111111111112',
|
|
323
|
-
* outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
324
|
-
* amount: '100000000', // 0.1 SOL
|
|
325
|
-
* })
|
|
326
|
-
*
|
|
327
|
-
* console.log('输出数量:', quote.outAmount)
|
|
328
|
-
* console.log('最小输出:', quote.otherAmountThreshold)
|
|
329
|
-
* console.log('价格影响:', quote.priceImpactPct)
|
|
330
|
-
* console.log('路由:', quote.routePlan.map(r => r.swapInfo.label).join(' -> '))
|
|
331
|
-
*
|
|
332
|
-
* // 高级选项
|
|
333
|
-
* const advancedQuote = await Sol.getLegacyQuote({
|
|
334
|
-
* inputMint: 'So11111111111111111111111111111111111111112',
|
|
335
|
-
* outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
336
|
-
* amount: '100000000',
|
|
337
|
-
* slippageBps: 100, // 1% 滑点
|
|
338
|
-
* dexes: ['Raydium', 'Orca V2'], // 只用这些 DEX
|
|
339
|
-
* onlyDirectRoutes: true, // 单跳
|
|
340
|
-
* })
|
|
341
|
-
* ```
|
|
342
|
-
*/
|
|
343
|
-
export declare function getLegacyQuote(params: LegacyQuoteParams, config?: JupiterConfig): Promise<LegacyQuoteResponse>;
|
|
344
|
-
/**
|
|
345
|
-
* 简化的 Legacy 报价获取
|
|
346
|
-
*
|
|
347
|
-
* @param inputMint 输入代币 Mint
|
|
348
|
-
* @param outputMint 输出代币 Mint
|
|
349
|
-
* @param amount 数量
|
|
350
|
-
* @param slippageBps 滑点 BPS (默认: 50)
|
|
351
|
-
* @param config Jupiter 配置
|
|
352
|
-
* @returns Quote 响应
|
|
353
|
-
*/
|
|
354
|
-
export declare function getLegacyQuoteSimple(inputMint: string, outputMint: string, amount: string | number, slippageBps?: number, config?: JupiterConfig): Promise<LegacyQuoteResponse>;
|
|
355
|
-
/**
|
|
356
|
-
* 构建 Legacy Swap 交易
|
|
357
|
-
*
|
|
358
|
-
* @param params Swap 参数
|
|
359
|
-
* @param config Jupiter 配置
|
|
360
|
-
* @returns Swap 响应(包含未签名交易)
|
|
361
|
-
*
|
|
362
|
-
* @example
|
|
363
|
-
* ```typescript
|
|
364
|
-
* // 1. 获取报价
|
|
365
|
-
* const quote = await Sol.getLegacyQuote({
|
|
366
|
-
* inputMint: 'So11111111111111111111111111111111111111112',
|
|
367
|
-
* outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
368
|
-
* amount: '100000000',
|
|
369
|
-
* })
|
|
370
|
-
*
|
|
371
|
-
* // 2. 构建交易
|
|
372
|
-
* const swap = await Sol.buildLegacySwap({
|
|
373
|
-
* quoteResponse: quote,
|
|
374
|
-
* userPublicKey: wallet.publicKey.toBase58(),
|
|
375
|
-
* })
|
|
376
|
-
*
|
|
377
|
-
* // 3. 签名并发送
|
|
378
|
-
* const tx = VersionedTransaction.deserialize(
|
|
379
|
-
* Buffer.from(swap.swapTransaction, 'base64')
|
|
380
|
-
* )
|
|
381
|
-
* tx.sign([wallet])
|
|
382
|
-
* const signature = await connection.sendTransaction(tx)
|
|
383
|
-
* ```
|
|
384
|
-
*/
|
|
385
|
-
export declare function buildLegacySwap(params: LegacySwapParams, config?: JupiterConfig): Promise<LegacySwapResponse>;
|
|
386
|
-
/**
|
|
387
|
-
* 获取 Swap 分解指令
|
|
388
|
-
*
|
|
389
|
-
* 返回分解的指令而非完整交易,允许自定义组装交易。
|
|
390
|
-
* 适用于需要同时添加优先费和 Jito tip 等高级场景。
|
|
391
|
-
*
|
|
392
|
-
* @param params Swap 参数 (与 buildLegacySwap 相同)
|
|
393
|
-
* @param config Jupiter 配置
|
|
394
|
-
* @returns 分解的指令
|
|
395
|
-
*
|
|
396
|
-
* @example
|
|
397
|
-
* ```typescript
|
|
398
|
-
* import {
|
|
399
|
-
* TransactionMessage,
|
|
400
|
-
* VersionedTransaction,
|
|
401
|
-
* AddressLookupTableAccount
|
|
402
|
-
* } from '@solana/web3.js'
|
|
403
|
-
*
|
|
404
|
-
* // 1. 获取报价
|
|
405
|
-
* const quote = await Sol.getLegacyQuote({
|
|
406
|
-
* inputMint: 'So11111111111111111111111111111111111111112',
|
|
407
|
-
* outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
408
|
-
* amount: '100000000',
|
|
409
|
-
* })
|
|
410
|
-
*
|
|
411
|
-
* // 2. 获取分解指令
|
|
412
|
-
* const instructions = await Sol.getLegacySwapInstructions({
|
|
413
|
-
* userPublicKey: wallet.publicKey.toBase58(),
|
|
414
|
-
* quoteResponse: quote,
|
|
415
|
-
* prioritizationFeeLamports: {
|
|
416
|
-
* jitoTipLamports: 10000, // 添加 Jito tip
|
|
417
|
-
* }
|
|
418
|
-
* })
|
|
419
|
-
*
|
|
420
|
-
* // 3. 获取 Address Lookup Tables
|
|
421
|
-
* const lookupTables = await Promise.all(
|
|
422
|
-
* instructions.addressLookupTableAddresses.map(addr =>
|
|
423
|
-
* connection.getAddressLookupTable(new PublicKey(addr))
|
|
424
|
-
* )
|
|
425
|
-
* )
|
|
426
|
-
*
|
|
427
|
-
* // 4. 反序列化指令
|
|
428
|
-
* const allInstructions = [
|
|
429
|
-
* ...instructions.computeBudgetInstructions,
|
|
430
|
-
* ...instructions.setupInstructions,
|
|
431
|
-
* instructions.swapInstruction,
|
|
432
|
-
* ...(instructions.cleanupInstruction ? [instructions.cleanupInstruction] : []),
|
|
433
|
-
* ...instructions.otherInstructions, // Jito tip 指令在这里
|
|
434
|
-
* ].map(ix => deserializeInstruction(ix))
|
|
435
|
-
*
|
|
436
|
-
* // 5. 构建版本化交易
|
|
437
|
-
* const messageV0 = new TransactionMessage({
|
|
438
|
-
* payerKey: wallet.publicKey,
|
|
439
|
-
* recentBlockhash: blockhash,
|
|
440
|
-
* instructions: allInstructions,
|
|
441
|
-
* }).compileToV0Message(lookupTables)
|
|
442
|
-
*
|
|
443
|
-
* const tx = new VersionedTransaction(messageV0)
|
|
444
|
-
* tx.sign([wallet])
|
|
445
|
-
* ```
|
|
446
|
-
*/
|
|
447
|
-
export declare function getLegacySwapInstructions(params: LegacySwapParams, config?: JupiterConfig): Promise<LegacySwapInstructionsResponse>;
|
|
448
|
-
/**
|
|
449
|
-
* 反序列化指令的辅助函数
|
|
450
|
-
*
|
|
451
|
-
* 将 API 返回的指令格式转换为 @solana/web3.js 可用格式
|
|
452
|
-
*
|
|
453
|
-
* @example
|
|
454
|
-
* ```typescript
|
|
455
|
-
* import { PublicKey, TransactionInstruction } from '@solana/web3.js'
|
|
456
|
-
*
|
|
457
|
-
* function deserializeInstruction(instruction: Instruction): TransactionInstruction {
|
|
458
|
-
* return new TransactionInstruction({
|
|
459
|
-
* programId: new PublicKey(instruction.programId),
|
|
460
|
-
* keys: instruction.accounts.map(acc => ({
|
|
461
|
-
* pubkey: new PublicKey(acc.pubkey),
|
|
462
|
-
* isSigner: acc.isSigner,
|
|
463
|
-
* isWritable: acc.isWritable,
|
|
464
|
-
* })),
|
|
465
|
-
* data: Buffer.from(instruction.data, 'base64'),
|
|
466
|
-
* })
|
|
467
|
-
* }
|
|
468
|
-
* ```
|
|
469
|
-
*/
|
|
470
|
-
/** Program ID 到标签的映射 */
|
|
471
|
-
export type ProgramIdToLabelMap = Record<string, string>;
|
|
472
|
-
/**
|
|
473
|
-
* 获取所有支持的 DEX 及其 Program ID
|
|
474
|
-
*
|
|
475
|
-
* 返回 Program ID 到 DEX 标签的映射。
|
|
476
|
-
* 可用于 /quote 的 dexes 和 excludeDexes 参数。
|
|
477
|
-
*
|
|
478
|
-
* @param config Jupiter 配置
|
|
479
|
-
* @returns Program ID 到标签的映射
|
|
480
|
-
*
|
|
481
|
-
* @example
|
|
482
|
-
* ```typescript
|
|
483
|
-
* const dexMap = await Sol.getProgramIdToLabel()
|
|
484
|
-
*
|
|
485
|
-
* // 查看所有 DEX
|
|
486
|
-
* Object.entries(dexMap).forEach(([programId, label]) => {
|
|
487
|
-
* console.log(`${label}: ${programId}`)
|
|
488
|
-
* })
|
|
489
|
-
*
|
|
490
|
-
* // 常见 DEX:
|
|
491
|
-
* // Raydium: 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8
|
|
492
|
-
* // Raydium CLMM: CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK
|
|
493
|
-
* // Orca V2: 9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP
|
|
494
|
-
* // Whirlpool: whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc
|
|
495
|
-
* // Meteora: Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB
|
|
496
|
-
* // Meteora DLMM: LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo
|
|
497
|
-
* // Pump.fun: 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P
|
|
498
|
-
* ```
|
|
499
|
-
*/
|
|
500
|
-
export declare function getProgramIdToLabel(config?: JupiterConfig): Promise<ProgramIdToLabelMap>;
|
|
501
|
-
/**
|
|
502
|
-
* 获取所有支持的 DEX 标签列表
|
|
503
|
-
*
|
|
504
|
-
* @param config Jupiter 配置
|
|
505
|
-
* @returns DEX 标签数组
|
|
506
|
-
*
|
|
507
|
-
* @example
|
|
508
|
-
* ```typescript
|
|
509
|
-
* const labels = await Sol.getAllDexLabels()
|
|
510
|
-
* // ['Raydium', 'Raydium CLMM', 'Orca V2', 'Whirlpool', ...]
|
|
511
|
-
* ```
|
|
512
|
-
*/
|
|
513
|
-
export declare function getAllDexLabels(config?: JupiterConfig): Promise<string[]>;
|
|
514
|
-
/**
|
|
515
|
-
* 通过标签获取 Program ID
|
|
516
|
-
*
|
|
517
|
-
* @param label DEX 标签
|
|
518
|
-
* @param config Jupiter 配置
|
|
519
|
-
* @returns Program ID 或 null
|
|
520
|
-
*
|
|
521
|
-
* @example
|
|
522
|
-
* ```typescript
|
|
523
|
-
* const raydiumId = await Sol.getProgramIdByLabel('Raydium')
|
|
524
|
-
* // '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'
|
|
525
|
-
* ```
|
|
526
|
-
*/
|
|
527
|
-
export declare function getProgramIdByLabel(label: string, config?: JupiterConfig): Promise<string | null>;
|
|
528
|
-
/**
|
|
529
|
-
* 通过 Program ID 获取 DEX 标签
|
|
530
|
-
*
|
|
531
|
-
* @param programId Program ID
|
|
532
|
-
* @param config Jupiter 配置
|
|
533
|
-
* @returns DEX 标签或 null
|
|
534
|
-
*
|
|
535
|
-
* @example
|
|
536
|
-
* ```typescript
|
|
537
|
-
* const label = await Sol.getLabelByProgramId(
|
|
538
|
-
* '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'
|
|
539
|
-
* )
|
|
540
|
-
* // 'Raydium'
|
|
541
|
-
* ```
|
|
542
|
-
*/
|
|
543
|
-
export declare function getLabelByProgramId(programId: string, config?: JupiterConfig): Promise<string | null>;
|
|
544
|
-
/**
|
|
545
|
-
* 搜索 DEX
|
|
546
|
-
*
|
|
547
|
-
* @param keyword 搜索关键词(不区分大小写)
|
|
548
|
-
* @param config Jupiter 配置
|
|
549
|
-
* @returns 匹配的 { programId, label } 数组
|
|
550
|
-
*
|
|
551
|
-
* @example
|
|
552
|
-
* ```typescript
|
|
553
|
-
* const results = await Sol.searchDex('raydium')
|
|
554
|
-
* // [
|
|
555
|
-
* // { programId: '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8', label: 'Raydium' },
|
|
556
|
-
* // { programId: 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK', label: 'Raydium CLMM' },
|
|
557
|
-
* // { programId: 'CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C', label: 'Raydium CP' },
|
|
558
|
-
* // ]
|
|
559
|
-
* ```
|
|
560
|
-
*/
|
|
561
|
-
export declare function searchDex(keyword: string, config?: JupiterConfig): Promise<{
|
|
562
|
-
programId: string;
|
|
563
|
-
label: string;
|
|
564
|
-
}[]>;
|
|
565
|
-
/**
|
|
566
|
-
* 获取路由标签
|
|
567
|
-
*
|
|
568
|
-
* @param quote Quote 响应
|
|
569
|
-
* @returns 路由标签数组
|
|
570
|
-
*/
|
|
571
|
-
export declare function getRouteLabels(quote: LegacyQuoteResponse): string[];
|
|
572
|
-
/**
|
|
573
|
-
* 计算路由跳数
|
|
574
|
-
*
|
|
575
|
-
* @param quote Quote 响应
|
|
576
|
-
* @returns 跳数
|
|
577
|
-
*/
|
|
578
|
-
export declare function getRouteHops(quote: LegacyQuoteResponse): number;
|
|
579
|
-
/**
|
|
580
|
-
* 获取报价摘要
|
|
581
|
-
*
|
|
582
|
-
* @param quote Quote 响应
|
|
583
|
-
* @returns 报价摘要
|
|
584
|
-
*/
|
|
585
|
-
export declare function getQuoteSummary(quote: LegacyQuoteResponse): {
|
|
586
|
-
inputMint: string;
|
|
587
|
-
outputMint: string;
|
|
588
|
-
inAmount: string;
|
|
589
|
-
outAmount: string;
|
|
590
|
-
minOutAmount: string;
|
|
591
|
-
priceImpact: number;
|
|
592
|
-
slippageBps: number;
|
|
593
|
-
route: string;
|
|
594
|
-
hops: number;
|
|
595
|
-
usdValue: number | null;
|
|
596
|
-
};
|
|
597
|
-
/**
|
|
598
|
-
* 比较多个报价
|
|
599
|
-
*
|
|
600
|
-
* @param quotes Quote 响应数组
|
|
601
|
-
* @returns 排序后的报价(输出最多的在前)
|
|
602
|
-
*/
|
|
603
|
-
export declare function compareQuotes(quotes: LegacyQuoteResponse[]): LegacyQuoteResponse[];
|
|
604
|
-
/**
|
|
605
|
-
* 获取最佳报价
|
|
606
|
-
*
|
|
607
|
-
* 比较不同 DEX 组合的报价,返回输出最多的
|
|
608
|
-
*
|
|
609
|
-
* @param inputMint 输入代币 Mint
|
|
610
|
-
* @param outputMint 输出代币 Mint
|
|
611
|
-
* @param amount 数量
|
|
612
|
-
* @param options 选项
|
|
613
|
-
* @param config Jupiter 配置
|
|
614
|
-
* @returns 最佳报价
|
|
615
|
-
*/
|
|
616
|
-
export declare function getBestLegacyQuote(inputMint: string, outputMint: string, amount: string | number, options?: {
|
|
617
|
-
slippageBps?: number;
|
|
618
|
-
compareDirectRoute?: boolean;
|
|
619
|
-
}, config?: JupiterConfig): Promise<{
|
|
620
|
-
best: LegacyQuoteResponse;
|
|
621
|
-
direct: LegacyQuoteResponse | null;
|
|
622
|
-
directSavings: string | null;
|
|
623
|
-
}>;
|