four-flap-meme-sdk 1.5.55 → 1.5.56
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/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/sol/constants.d.ts +150 -0
- package/dist/sol/constants.js +188 -0
- package/dist/sol/dex/blockrazor/client.d.ts +51 -0
- package/dist/sol/dex/blockrazor/client.js +96 -0
- package/dist/sol/dex/blockrazor/constants.d.ts +34 -0
- package/dist/sol/dex/blockrazor/constants.js +55 -0
- package/dist/sol/dex/blockrazor/geyser.d.ts +128 -0
- package/dist/sol/dex/blockrazor/geyser.js +530 -0
- package/dist/sol/dex/blockrazor/index.d.ts +18 -0
- package/dist/sol/dex/blockrazor/index.js +23 -0
- package/dist/sol/dex/blockrazor/send.d.ts +135 -0
- package/dist/sol/dex/blockrazor/send.js +254 -0
- package/dist/sol/dex/blockrazor/types.d.ts +191 -0
- package/dist/sol/dex/blockrazor/types.js +5 -0
- package/dist/sol/dex/index.d.ts +10 -0
- package/dist/sol/dex/index.js +16 -0
- package/dist/sol/dex/jup/client.d.ts +33 -0
- package/dist/sol/dex/jup/client.js +110 -0
- package/dist/sol/dex/jup/index.d.ts +16 -0
- package/dist/sol/dex/jup/index.js +148 -0
- package/dist/sol/dex/jup/legacy.d.ts +623 -0
- package/dist/sol/dex/jup/legacy.js +416 -0
- package/dist/sol/dex/jup/lend.d.ts +640 -0
- package/dist/sol/dex/jup/lend.js +603 -0
- package/dist/sol/dex/jup/portfolio.d.ts +362 -0
- package/dist/sol/dex/jup/portfolio.js +367 -0
- package/dist/sol/dex/jup/price.d.ts +173 -0
- package/dist/sol/dex/jup/price.js +220 -0
- package/dist/sol/dex/jup/recurring.d.ts +437 -0
- package/dist/sol/dex/jup/recurring.js +320 -0
- package/dist/sol/dex/jup/send.d.ts +282 -0
- package/dist/sol/dex/jup/send.js +295 -0
- package/dist/sol/dex/jup/studio.d.ts +457 -0
- package/dist/sol/dex/jup/studio.js +488 -0
- package/dist/sol/dex/jup/tokens.d.ts +767 -0
- package/dist/sol/dex/jup/tokens.js +697 -0
- package/dist/sol/dex/jup/trigger.d.ts +511 -0
- package/dist/sol/dex/jup/trigger.js +397 -0
- package/dist/sol/dex/jup/types.d.ts +433 -0
- package/dist/sol/dex/jup/types.js +5 -0
- package/dist/sol/dex/jup/ultra.d.ts +646 -0
- package/dist/sol/dex/jup/ultra.js +853 -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 +157 -0
- package/dist/sol/dex/meteora/dlmm.js +671 -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 +11 -0
- package/dist/sol/index.js +18 -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/nozomi/client.d.ts +63 -0
- package/dist/sol/nozomi/client.js +222 -0
- package/dist/sol/nozomi/index.d.ts +8 -0
- package/dist/sol/nozomi/index.js +8 -0
- package/dist/sol/nozomi/tip.d.ts +50 -0
- package/dist/sol/nozomi/tip.js +80 -0
- package/dist/sol/nozomi/types.d.ts +96 -0
- package/dist/sol/nozomi/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 +75 -0
- package/dist/sol/utils/lp-inspect.js +235 -0
- package/dist/sol/utils/transfer.d.ts +196 -0
- package/dist/sol/utils/transfer.js +307 -0
- package/dist/sol/utils/wallet.d.ts +107 -0
- package/dist/sol/utils/wallet.js +210 -0
- package/package.json +44 -5
- package/README.zh-CN.pdf +0 -0
- package/dist/flap/portal-bundle-merkle/encryption.d.ts +0 -16
- package/dist/flap/portal-bundle-merkle/encryption.js +0 -146
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jupiter Ultra API
|
|
3
|
+
* @module sol/dex/jup/ultra
|
|
4
|
+
*
|
|
5
|
+
* Ultra API 提供最优化的交易路由和执行
|
|
6
|
+
* 文档: https://docs.jup.ag/docs/apis/ultra-api
|
|
7
|
+
*/
|
|
8
|
+
import type { JupiterConfig, JupiterOrderParams, JupiterOrderResponse, JupiterExecuteParams, JupiterExecuteResponse, JupiterRouter, JupiterHoldingsResponse, JupiterNativeHoldingsResponse, JupiterShieldResponse, JupiterShieldWarning, JupiterSearchResponse, JupiterTokenInfo, JupiterRoutersResponse, JupiterBalancesResponse, JupiterBalanceInfo } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* 获取 Swap 报价和未签名交易
|
|
11
|
+
*
|
|
12
|
+
* @param params 请求参数
|
|
13
|
+
* @param config Jupiter 配置
|
|
14
|
+
* @returns Order 响应(包含报价和未签名交易)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { Sol } from 'four-flap-meme-sdk'
|
|
19
|
+
*
|
|
20
|
+
* // 设置 API Key
|
|
21
|
+
* Sol.setJupiterConfig({ apiKey: 'your-api-key' })
|
|
22
|
+
*
|
|
23
|
+
* // 获取报价
|
|
24
|
+
* const order = await Sol.getJupiterOrder({
|
|
25
|
+
* inputMint: 'So11111111111111111111111111111111111111112', // SOL
|
|
26
|
+
* outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
|
|
27
|
+
* amount: '10000000', // 0.01 SOL
|
|
28
|
+
* taker: 'BQ72nSv9f3PRyRKCBnHLVrerrv37CYTHm5h3s9VSGQDV',
|
|
29
|
+
* })
|
|
30
|
+
*
|
|
31
|
+
* console.log('输出数量:', order.outAmount)
|
|
32
|
+
* console.log('价格影响:', order.priceImpact)
|
|
33
|
+
* console.log('路由:', order.router)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function getJupiterOrder(params: JupiterOrderParams, config?: JupiterConfig): Promise<JupiterOrderResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* 获取 Swap 报价(不包含交易,仅报价)
|
|
39
|
+
*
|
|
40
|
+
* @param inputMint 输入代币 Mint
|
|
41
|
+
* @param outputMint 输出代币 Mint
|
|
42
|
+
* @param amount 输入数量
|
|
43
|
+
* @param config Jupiter 配置
|
|
44
|
+
* @returns Order 响应(transaction 为 null)
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const quote = await Sol.getJupiterQuote(
|
|
49
|
+
* 'So11111111111111111111111111111111111111112', // SOL
|
|
50
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
|
|
51
|
+
* '10000000', // 0.01 SOL
|
|
52
|
+
* )
|
|
53
|
+
* console.log('预期输出:', quote.outAmount)
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function getJupiterQuote(inputMint: string, outputMint: string, amount: string, config?: JupiterConfig): Promise<JupiterOrderResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* 获取带交易的 Swap 报价
|
|
59
|
+
*
|
|
60
|
+
* @param inputMint 输入代币 Mint
|
|
61
|
+
* @param outputMint 输出代币 Mint
|
|
62
|
+
* @param amount 输入数量
|
|
63
|
+
* @param taker 交易者地址
|
|
64
|
+
* @param options 可选参数
|
|
65
|
+
* @param config Jupiter 配置
|
|
66
|
+
* @returns Order 响应(包含未签名交易)
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const order = await Sol.getJupiterSwapTransaction(
|
|
71
|
+
* 'So11111111111111111111111111111111111111112',
|
|
72
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
73
|
+
* '10000000',
|
|
74
|
+
* wallet.publicKey.toBase58(),
|
|
75
|
+
* )
|
|
76
|
+
*
|
|
77
|
+
* if (order.transaction) {
|
|
78
|
+
* // 签名并执行交易
|
|
79
|
+
* const tx = Transaction.from(Buffer.from(order.transaction, 'base64'))
|
|
80
|
+
* tx.sign(wallet)
|
|
81
|
+
* await Sol.executeJupiterOrder({
|
|
82
|
+
* signedTransaction: tx.serialize().toString('base64'),
|
|
83
|
+
* requestId: order.requestId,
|
|
84
|
+
* })
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function getJupiterSwapTransaction(inputMint: string, outputMint: string, amount: string, taker: string, options?: {
|
|
89
|
+
receiver?: string;
|
|
90
|
+
payer?: string;
|
|
91
|
+
closeAuthority?: string;
|
|
92
|
+
referralAccount?: string;
|
|
93
|
+
referralFee?: number;
|
|
94
|
+
excludeRouters?: JupiterRouter | JupiterRouter[];
|
|
95
|
+
excludeDexes?: string;
|
|
96
|
+
}, config?: JupiterConfig): Promise<JupiterOrderResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* 执行已签名的 Swap 交易
|
|
99
|
+
*
|
|
100
|
+
* @param params 执行参数
|
|
101
|
+
* @param config Jupiter 配置
|
|
102
|
+
* @returns 执行结果
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const result = await Sol.executeJupiterOrder({
|
|
107
|
+
* signedTransaction: signedTxBase64,
|
|
108
|
+
* requestId: order.requestId,
|
|
109
|
+
* })
|
|
110
|
+
*
|
|
111
|
+
* if (result.status === 'Success') {
|
|
112
|
+
* console.log('交易成功:', result.signature)
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function executeJupiterOrder(params: JupiterExecuteParams, config?: JupiterConfig): Promise<JupiterExecuteResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* 计算 Swap 输出数量
|
|
119
|
+
*
|
|
120
|
+
* @param inputMint 输入代币
|
|
121
|
+
* @param outputMint 输出代币
|
|
122
|
+
* @param amount 输入数量
|
|
123
|
+
* @param config Jupiter 配置
|
|
124
|
+
* @returns 输出数量和相关信息
|
|
125
|
+
*/
|
|
126
|
+
export declare function calculateSwapOutput(inputMint: string, outputMint: string, amount: string, config?: JupiterConfig): Promise<{
|
|
127
|
+
inAmount: string;
|
|
128
|
+
outAmount: string;
|
|
129
|
+
priceImpact: number;
|
|
130
|
+
slippageBps: number;
|
|
131
|
+
feeBps: number;
|
|
132
|
+
routeLabel: string;
|
|
133
|
+
}>;
|
|
134
|
+
/**
|
|
135
|
+
* 获取代币价格 (以 USDC 计)
|
|
136
|
+
*
|
|
137
|
+
* @param mint 代币 Mint
|
|
138
|
+
* @param amount 数量 (最小单位)
|
|
139
|
+
* @param config Jupiter 配置
|
|
140
|
+
* @returns USD 价格
|
|
141
|
+
*/
|
|
142
|
+
export declare function getTokenUsdPrice(mint: string, amount?: string, // 默认 1 token (假设 9 位精度)
|
|
143
|
+
config?: JupiterConfig): Promise<number | null>;
|
|
144
|
+
/**
|
|
145
|
+
* 获取账户完整持仓信息
|
|
146
|
+
*
|
|
147
|
+
* 返回账户的原生 SOL 余额和所有代币持仓,包括每个代币账户的详细信息。
|
|
148
|
+
*
|
|
149
|
+
* @param address 钱包地址
|
|
150
|
+
* @param config Jupiter 配置
|
|
151
|
+
* @returns Holdings 响应
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* import { Sol } from 'four-flap-meme-sdk'
|
|
156
|
+
*
|
|
157
|
+
* Sol.setJupiterConfig({ apiKey: 'your-api-key' })
|
|
158
|
+
*
|
|
159
|
+
* const holdings = await Sol.getJupiterHoldings(
|
|
160
|
+
* '3X2LFoTQecbpqCR7G5tL1kczqBKurjKPHhKSZrJ4wgWc'
|
|
161
|
+
* )
|
|
162
|
+
*
|
|
163
|
+
* // 原生 SOL 余额
|
|
164
|
+
* console.log('SOL 余额:', holdings.uiAmount, 'SOL')
|
|
165
|
+
*
|
|
166
|
+
* // 遍历代币持仓
|
|
167
|
+
* for (const [mint, accounts] of Object.entries(holdings.tokens)) {
|
|
168
|
+
* for (const account of accounts) {
|
|
169
|
+
* console.log(`${mint}: ${account.uiAmountString}`)
|
|
170
|
+
* console.log(` 账户: ${account.account}`)
|
|
171
|
+
* console.log(` ATA: ${account.isAssociatedTokenAccount}`)
|
|
172
|
+
* console.log(` 冻结: ${account.isFrozen}`)
|
|
173
|
+
* }
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @note 对于持有超过数千种代币的钱包,响应可能较慢。
|
|
178
|
+
* 如果只需要 SOL 余额,请使用 getJupiterNativeHoldings()
|
|
179
|
+
*/
|
|
180
|
+
export declare function getJupiterHoldings(address: string, config?: JupiterConfig): Promise<JupiterHoldingsResponse>;
|
|
181
|
+
/**
|
|
182
|
+
* 获取账户原生 SOL 余额
|
|
183
|
+
*
|
|
184
|
+
* 仅获取 SOL 余额,比 getJupiterHoldings() 更快。
|
|
185
|
+
*
|
|
186
|
+
* @param address 钱包地址
|
|
187
|
+
* @param config Jupiter 配置
|
|
188
|
+
* @returns Native Holdings 响应
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const native = await Sol.getJupiterNativeHoldings(
|
|
193
|
+
* '3X2LFoTQecbpqCR7G5tL1kczqBKurjKPHhKSZrJ4wgWc'
|
|
194
|
+
* )
|
|
195
|
+
*
|
|
196
|
+
* console.log('SOL 余额:', native.uiAmount, 'SOL')
|
|
197
|
+
* console.log('Lamports:', native.amount)
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
export declare function getJupiterNativeHoldings(address: string, config?: JupiterConfig): Promise<JupiterNativeHoldingsResponse>;
|
|
201
|
+
/**
|
|
202
|
+
* 获取指定代币的持仓
|
|
203
|
+
*
|
|
204
|
+
* @param address 钱包地址
|
|
205
|
+
* @param mint 代币 Mint 地址
|
|
206
|
+
* @param config Jupiter 配置
|
|
207
|
+
* @returns 代币账户信息数组,如果没有持仓则返回空数组
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const jupSolHoldings = await Sol.getJupiterTokenHolding(
|
|
212
|
+
* '3X2LFoTQecbpqCR7G5tL1kczqBKurjKPHhKSZrJ4wgWc',
|
|
213
|
+
* 'jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v', // jupSOL
|
|
214
|
+
* )
|
|
215
|
+
*
|
|
216
|
+
* if (jupSolHoldings.length > 0) {
|
|
217
|
+
* console.log('jupSOL 余额:', jupSolHoldings[0].uiAmountString)
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
export declare function getJupiterTokenHolding(address: string, mint: string, config?: JupiterConfig): Promise<JupiterHoldingsResponse['tokens'][string]>;
|
|
222
|
+
/**
|
|
223
|
+
* 获取账户所有代币余额汇总
|
|
224
|
+
*
|
|
225
|
+
* @param address 钱包地址
|
|
226
|
+
* @param config Jupiter 配置
|
|
227
|
+
* @returns 代币余额映射 { mint: uiAmount }
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* const balances = await Sol.getJupiterTokenBalances(
|
|
232
|
+
* '3X2LFoTQecbpqCR7G5tL1kczqBKurjKPHhKSZrJ4wgWc'
|
|
233
|
+
* )
|
|
234
|
+
*
|
|
235
|
+
* for (const [mint, balance] of Object.entries(balances)) {
|
|
236
|
+
* console.log(`${mint}: ${balance}`)
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
export declare function getJupiterTokenBalances(address: string, config?: JupiterConfig): Promise<Record<string, number>>;
|
|
241
|
+
/**
|
|
242
|
+
* 检测代币风险警告
|
|
243
|
+
*
|
|
244
|
+
* Shield API 用于获取代币的安全信息和风险警告。
|
|
245
|
+
* 如果代币有潜在风险,会在 warnings 对象中返回警告信息。
|
|
246
|
+
*
|
|
247
|
+
* @param mints 代币 mint 地址数组
|
|
248
|
+
* @param config Jupiter 配置
|
|
249
|
+
* @returns Shield 响应
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* import { Sol } from 'four-flap-meme-sdk'
|
|
254
|
+
*
|
|
255
|
+
* Sol.setJupiterConfig({ apiKey: 'your-api-key' })
|
|
256
|
+
*
|
|
257
|
+
* // 检查多个代币
|
|
258
|
+
* const shield = await Sol.getJupiterShield([
|
|
259
|
+
* 'So11111111111111111111111111111111111111112', // SOL
|
|
260
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
|
|
261
|
+
* ])
|
|
262
|
+
*
|
|
263
|
+
* // 检查警告
|
|
264
|
+
* for (const [mint, warnings] of Object.entries(shield.warnings)) {
|
|
265
|
+
* console.log(`代币 ${mint} 有风险:`)
|
|
266
|
+
* warnings.forEach(w => console.log(` - ${w}`))
|
|
267
|
+
* }
|
|
268
|
+
*
|
|
269
|
+
* // 如果 warnings 为空对象,说明代币安全
|
|
270
|
+
* if (Object.keys(shield.warnings).length === 0) {
|
|
271
|
+
* console.log('所有代币安全')
|
|
272
|
+
* }
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
export declare function getJupiterShield(mints: string[], config?: JupiterConfig): Promise<JupiterShieldResponse>;
|
|
276
|
+
/**
|
|
277
|
+
* 检查单个代币是否有风险
|
|
278
|
+
*
|
|
279
|
+
* @param mint 代币 mint 地址
|
|
280
|
+
* @param config Jupiter 配置
|
|
281
|
+
* @returns 警告信息数组,如果为空则代币安全
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* const warnings = await Sol.checkTokenSafety(
|
|
286
|
+
* 'SomeSuspiciousTokenMintAddress...'
|
|
287
|
+
* )
|
|
288
|
+
*
|
|
289
|
+
* if (warnings.length > 0) {
|
|
290
|
+
* warnings.forEach(w => {
|
|
291
|
+
* console.log(`⚠️ [${w.severity}] ${w.type}: ${w.message}`)
|
|
292
|
+
* if (w.source) console.log(` 来源: ${w.source}`)
|
|
293
|
+
* })
|
|
294
|
+
* } else {
|
|
295
|
+
* console.log('✓ 代币安全')
|
|
296
|
+
* }
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
299
|
+
export declare function checkTokenSafety(mint: string, config?: JupiterConfig): Promise<JupiterShieldWarning[]>;
|
|
300
|
+
/**
|
|
301
|
+
* 批量检查代币安全性
|
|
302
|
+
*
|
|
303
|
+
* @param mints 代币 mint 地址数组
|
|
304
|
+
* @param config Jupiter 配置
|
|
305
|
+
* @returns 安全性检查结果
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* const results = await Sol.batchCheckTokenSafety([
|
|
310
|
+
* 'Token1...',
|
|
311
|
+
* 'Token2...',
|
|
312
|
+
* 'Token3...',
|
|
313
|
+
* ])
|
|
314
|
+
*
|
|
315
|
+
* for (const [mint, result] of Object.entries(results)) {
|
|
316
|
+
* if (result.safe) {
|
|
317
|
+
* console.log(`✓ ${mint}: 安全`)
|
|
318
|
+
* } else {
|
|
319
|
+
* const criticals = result.warnings.filter(w => w.severity === 'critical')
|
|
320
|
+
* console.log(`⚠️ ${mint}: ${criticals.length} 个严重警告`)
|
|
321
|
+
* }
|
|
322
|
+
* }
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
export declare function batchCheckTokenSafety(mints: string[], config?: JupiterConfig): Promise<Record<string, {
|
|
326
|
+
safe: boolean;
|
|
327
|
+
warnings: JupiterShieldWarning[];
|
|
328
|
+
/** 是否有严重警告 */
|
|
329
|
+
hasCritical: boolean;
|
|
330
|
+
/** 严重程度最高级别 */
|
|
331
|
+
maxSeverity: 'info' | 'warning' | 'critical' | null;
|
|
332
|
+
}>>;
|
|
333
|
+
/**
|
|
334
|
+
* 检查代币是否有严重风险
|
|
335
|
+
*
|
|
336
|
+
* @param mint 代币 mint 地址
|
|
337
|
+
* @param config Jupiter 配置
|
|
338
|
+
* @returns 是否有严重 (critical) 风险
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```typescript
|
|
342
|
+
* const isCritical = await Sol.hasTokenCriticalRisk('TokenMint...')
|
|
343
|
+
* if (isCritical) {
|
|
344
|
+
* console.log('⛔ 代币有严重风险,不建议交易')
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
export declare function hasTokenCriticalRisk(mint: string, config?: JupiterConfig): Promise<boolean>;
|
|
349
|
+
/**
|
|
350
|
+
* 搜索代币信息
|
|
351
|
+
*
|
|
352
|
+
* 可通过代币符号、名称或 mint 地址搜索代币。
|
|
353
|
+
* 支持逗号分隔搜索多个代币(最多100个 mint 地址)。
|
|
354
|
+
*
|
|
355
|
+
* @param query 搜索查询(symbol、name 或 mint 地址,逗号分隔可搜索多个)
|
|
356
|
+
* @param config Jupiter 配置
|
|
357
|
+
* @returns 代币信息数组
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```typescript
|
|
361
|
+
* import { Sol } from 'four-flap-meme-sdk'
|
|
362
|
+
*
|
|
363
|
+
* Sol.setJupiterConfig({ apiKey: 'your-api-key' })
|
|
364
|
+
*
|
|
365
|
+
* // 通过符号搜索
|
|
366
|
+
* const tokens = await Sol.searchJupiterTokens('USDC')
|
|
367
|
+
*
|
|
368
|
+
* // 通过 mint 地址搜索
|
|
369
|
+
* const usdc = await Sol.searchJupiterTokens(
|
|
370
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
|
|
371
|
+
* )
|
|
372
|
+
*
|
|
373
|
+
* // 搜索多个代币
|
|
374
|
+
* const multiple = await Sol.searchJupiterTokens(
|
|
375
|
+
* 'So11111111111111111111111111111111111111112,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
|
|
376
|
+
* )
|
|
377
|
+
*
|
|
378
|
+
* // 查看代币信息
|
|
379
|
+
* tokens.forEach(token => {
|
|
380
|
+
* console.log(`${token.symbol}: $${token.usdPrice}`)
|
|
381
|
+
* console.log(` 市值: $${token.mcap}`)
|
|
382
|
+
* console.log(` 流动性: $${token.liquidity}`)
|
|
383
|
+
* console.log(` 24h 价格变化: ${token.stats24h?.priceChange}%`)
|
|
384
|
+
* console.log(` 有机评分: ${token.organicScoreLabel}`)
|
|
385
|
+
* })
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export declare function searchJupiterTokens(query: string, config?: JupiterConfig): Promise<JupiterSearchResponse>;
|
|
389
|
+
/**
|
|
390
|
+
* 批量搜索代币(通过 mint 地址数组)
|
|
391
|
+
*
|
|
392
|
+
* @param mints 代币 mint 地址数组(最多100个)
|
|
393
|
+
* @param config Jupiter 配置
|
|
394
|
+
* @returns 代币信息数组
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```typescript
|
|
398
|
+
* const tokens = await Sol.batchSearchTokens([
|
|
399
|
+
* 'So11111111111111111111111111111111111111112', // SOL
|
|
400
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
|
|
401
|
+
* 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', // USDT
|
|
402
|
+
* ])
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
export declare function batchSearchTokens(mints: string[], config?: JupiterConfig): Promise<JupiterSearchResponse>;
|
|
406
|
+
/**
|
|
407
|
+
* 获取单个代币详细信息
|
|
408
|
+
*
|
|
409
|
+
* @param mint 代币 mint 地址
|
|
410
|
+
* @param config Jupiter 配置
|
|
411
|
+
* @returns 代币信息,如果未找到则返回 null
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```typescript
|
|
415
|
+
* const usdc = await Sol.getJupiterTokenInfo(
|
|
416
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
|
|
417
|
+
* )
|
|
418
|
+
*
|
|
419
|
+
* if (usdc) {
|
|
420
|
+
* console.log(`${usdc.name} (${usdc.symbol})`)
|
|
421
|
+
* console.log(`价格: $${usdc.usdPrice}`)
|
|
422
|
+
* console.log(`市值: $${usdc.mcap}`)
|
|
423
|
+
* console.log(`FDV: $${usdc.fdv}`)
|
|
424
|
+
* console.log(`流动性: $${usdc.liquidity}`)
|
|
425
|
+
* console.log(`持有者: ${usdc.holderCount}`)
|
|
426
|
+
* console.log(`已验证: ${usdc.isVerified}`)
|
|
427
|
+
*
|
|
428
|
+
* // 审计信息
|
|
429
|
+
* if (usdc.audit) {
|
|
430
|
+
* console.log(`Mint 权限禁用: ${usdc.audit.mintAuthorityDisabled}`)
|
|
431
|
+
* console.log(`冻结权限禁用: ${usdc.audit.freezeAuthorityDisabled}`)
|
|
432
|
+
* }
|
|
433
|
+
* }
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
export declare function getJupiterTokenInfo(mint: string, config?: JupiterConfig): Promise<JupiterTokenInfo | null>;
|
|
437
|
+
/**
|
|
438
|
+
* 获取代币价格和市值信息
|
|
439
|
+
*
|
|
440
|
+
* @param mint 代币 mint 地址
|
|
441
|
+
* @param config Jupiter 配置
|
|
442
|
+
* @returns 价格和市值信息
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```typescript
|
|
446
|
+
* const priceInfo = await Sol.getJupiterTokenPriceInfo(
|
|
447
|
+
* 'So11111111111111111111111111111111111111112'
|
|
448
|
+
* )
|
|
449
|
+
*
|
|
450
|
+
* console.log(`价格: $${priceInfo.price}`)
|
|
451
|
+
* console.log(`24h 变化: ${priceInfo.priceChange24h}%`)
|
|
452
|
+
* console.log(`市值: $${priceInfo.mcap}`)
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
export declare function getJupiterTokenPriceInfo(mint: string, config?: JupiterConfig): Promise<{
|
|
456
|
+
price: number | null;
|
|
457
|
+
priceChange5m: number | null;
|
|
458
|
+
priceChange1h: number | null;
|
|
459
|
+
priceChange6h: number | null;
|
|
460
|
+
priceChange24h: number | null;
|
|
461
|
+
mcap: number | null;
|
|
462
|
+
fdv: number | null;
|
|
463
|
+
liquidity: number | null;
|
|
464
|
+
volume24h: number | null;
|
|
465
|
+
}>;
|
|
466
|
+
/**
|
|
467
|
+
* 检查代币是否可信
|
|
468
|
+
*
|
|
469
|
+
* 基于审计信息和有机评分判断代币可信度
|
|
470
|
+
*
|
|
471
|
+
* @param mint 代币 mint 地址
|
|
472
|
+
* @param config Jupiter 配置
|
|
473
|
+
* @returns 可信度检查结果
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* const trust = await Sol.checkTokenTrust('TokenMint...')
|
|
478
|
+
*
|
|
479
|
+
* if (trust.isTrusted) {
|
|
480
|
+
* console.log('✓ 代币可信')
|
|
481
|
+
* } else {
|
|
482
|
+
* console.log('⚠️ 代币风险:', trust.warnings)
|
|
483
|
+
* }
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
export declare function checkTokenTrust(mint: string, config?: JupiterConfig): Promise<{
|
|
487
|
+
isTrusted: boolean;
|
|
488
|
+
isVerified: boolean;
|
|
489
|
+
organicScore: number | null;
|
|
490
|
+
organicScoreLabel: string | null;
|
|
491
|
+
hasMintAuthority: boolean;
|
|
492
|
+
hasFreezeAuthority: boolean;
|
|
493
|
+
isSuspicious: boolean;
|
|
494
|
+
warnings: string[];
|
|
495
|
+
}>;
|
|
496
|
+
/**
|
|
497
|
+
* 获取可用路由器列表
|
|
498
|
+
*
|
|
499
|
+
* 返回 Jupiter Ultra API 支持的所有路由器信息。
|
|
500
|
+
*
|
|
501
|
+
* @param config Jupiter 配置
|
|
502
|
+
* @returns 路由器信息数组
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* import { Sol } from 'four-flap-meme-sdk'
|
|
507
|
+
*
|
|
508
|
+
* Sol.setJupiterConfig({ apiKey: 'your-api-key' })
|
|
509
|
+
*
|
|
510
|
+
* const routers = await Sol.getJupiterRouters()
|
|
511
|
+
*
|
|
512
|
+
* routers.forEach(router => {
|
|
513
|
+
* console.log(`${router.name} (${router.id})`)
|
|
514
|
+
* console.log(` 图标: ${router.icon}`)
|
|
515
|
+
* })
|
|
516
|
+
*
|
|
517
|
+
* // 输出:
|
|
518
|
+
* // Iris (iris)
|
|
519
|
+
* // JupiterZ (jupiterz)
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
export declare function getJupiterRouters(config?: JupiterConfig): Promise<JupiterRoutersResponse>;
|
|
523
|
+
/**
|
|
524
|
+
* 获取路由器 ID 列表
|
|
525
|
+
*
|
|
526
|
+
* @param config Jupiter 配置
|
|
527
|
+
* @returns 路由器 ID 数组
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```typescript
|
|
531
|
+
* const routerIds = await Sol.getJupiterRouterIds()
|
|
532
|
+
* // ['iris', 'jupiterz']
|
|
533
|
+
* ```
|
|
534
|
+
*/
|
|
535
|
+
export declare function getJupiterRouterIds(config?: JupiterConfig): Promise<string[]>;
|
|
536
|
+
/**
|
|
537
|
+
* 获取账户所有代币余额(轻量版)
|
|
538
|
+
*
|
|
539
|
+
* 比 getJupiterHoldings() 更轻量,返回格式更简洁。
|
|
540
|
+
* 键为代币符号 (SOL) 或 mint 地址。
|
|
541
|
+
*
|
|
542
|
+
* @param address 钱包地址
|
|
543
|
+
* @param config Jupiter 配置
|
|
544
|
+
* @returns 代币余额映射
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```typescript
|
|
548
|
+
* import { Sol } from 'four-flap-meme-sdk'
|
|
549
|
+
*
|
|
550
|
+
* Sol.setJupiterConfig({ apiKey: 'your-api-key' })
|
|
551
|
+
*
|
|
552
|
+
* const balances = await Sol.getJupiterBalances(
|
|
553
|
+
* 'GqUEBPPxiq3YjDxTe7TPhoSzSEGNPpSy4ciScxpd1hJz'
|
|
554
|
+
* )
|
|
555
|
+
*
|
|
556
|
+
* // 原生 SOL 余额
|
|
557
|
+
* console.log('SOL:', balances['SOL'].uiAmount)
|
|
558
|
+
*
|
|
559
|
+
* // 代币余额 (通过 mint 地址)
|
|
560
|
+
* const usdcMint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
|
|
561
|
+
* if (balances[usdcMint]) {
|
|
562
|
+
* console.log('USDC:', balances[usdcMint].uiAmount)
|
|
563
|
+
* }
|
|
564
|
+
*
|
|
565
|
+
* // 遍历所有余额
|
|
566
|
+
* for (const [key, info] of Object.entries(balances)) {
|
|
567
|
+
* console.log(`${key}: ${info.uiAmount} (frozen: ${info.isFrozen})`)
|
|
568
|
+
* }
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
export declare function getJupiterBalances(address: string, config?: JupiterConfig): Promise<JupiterBalancesResponse>;
|
|
572
|
+
/**
|
|
573
|
+
* 获取账户 SOL 余额
|
|
574
|
+
*
|
|
575
|
+
* @param address 钱包地址
|
|
576
|
+
* @param config Jupiter 配置
|
|
577
|
+
* @returns SOL 余额信息,如果账户不存在返回 null
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* ```typescript
|
|
581
|
+
* const sol = await Sol.getJupiterSolBalance('wallet...')
|
|
582
|
+
* if (sol) {
|
|
583
|
+
* console.log('SOL 余额:', sol.uiAmount)
|
|
584
|
+
* }
|
|
585
|
+
* ```
|
|
586
|
+
*/
|
|
587
|
+
export declare function getJupiterSolBalance(address: string, config?: JupiterConfig): Promise<JupiterBalanceInfo | null>;
|
|
588
|
+
/**
|
|
589
|
+
* 获取账户指定代币余额
|
|
590
|
+
*
|
|
591
|
+
* @param address 钱包地址
|
|
592
|
+
* @param mint 代币 mint 地址
|
|
593
|
+
* @param config Jupiter 配置
|
|
594
|
+
* @returns 代币余额信息,如果没有该代币返回 null
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```typescript
|
|
598
|
+
* const usdc = await Sol.getJupiterTokenBalance(
|
|
599
|
+
* 'wallet...',
|
|
600
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
|
|
601
|
+
* )
|
|
602
|
+
* if (usdc) {
|
|
603
|
+
* console.log('USDC 余额:', usdc.uiAmount)
|
|
604
|
+
* }
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
export declare function getJupiterTokenBalance(address: string, mint: string, config?: JupiterConfig): Promise<JupiterBalanceInfo | null>;
|
|
608
|
+
/**
|
|
609
|
+
* 获取账户所有非零余额的代币 mint 列表
|
|
610
|
+
*
|
|
611
|
+
* @param address 钱包地址
|
|
612
|
+
* @param config Jupiter 配置
|
|
613
|
+
* @returns 代币 mint 地址数组(不包含 SOL)
|
|
614
|
+
*
|
|
615
|
+
* @example
|
|
616
|
+
* ```typescript
|
|
617
|
+
* const mints = await Sol.getJupiterTokenMints('wallet...')
|
|
618
|
+
* console.log('持有的代币:', mints)
|
|
619
|
+
* ```
|
|
620
|
+
*/
|
|
621
|
+
export declare function getJupiterTokenMints(address: string, config?: JupiterConfig): Promise<string[]>;
|
|
622
|
+
/**
|
|
623
|
+
* 获取账户余额摘要
|
|
624
|
+
*
|
|
625
|
+
* @param address 钱包地址
|
|
626
|
+
* @param config Jupiter 配置
|
|
627
|
+
* @returns 余额摘要
|
|
628
|
+
*
|
|
629
|
+
* @example
|
|
630
|
+
* ```typescript
|
|
631
|
+
* const summary = await Sol.getJupiterBalanceSummary('wallet...')
|
|
632
|
+
* console.log('SOL:', summary.solBalance)
|
|
633
|
+
* console.log('代币数量:', summary.tokenCount)
|
|
634
|
+
* console.log('冻结代币:', summary.frozenCount)
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
export declare function getJupiterBalanceSummary(address: string, config?: JupiterConfig): Promise<{
|
|
638
|
+
solBalance: number;
|
|
639
|
+
tokenCount: number;
|
|
640
|
+
frozenCount: number;
|
|
641
|
+
tokens: {
|
|
642
|
+
mint: string;
|
|
643
|
+
balance: number;
|
|
644
|
+
isFrozen: boolean;
|
|
645
|
+
}[];
|
|
646
|
+
}>;
|