four-flap-meme-sdk 1.4.90 → 1.4.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flap/portal-bundle-merkle/create-to-dex.d.ts +1 -1
- package/dist/flap/portal-bundle-merkle/create-to-dex.js +51 -13
- package/dist/index.d.ts +3 -0
- package/dist/index.js +24 -0
- package/dist/sol/constants.d.ts +126 -0
- package/dist/sol/constants.js +145 -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 +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 +900 -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/dist/xlayer/aa-account.d.ts +240 -0
- package/dist/xlayer/aa-account.js +510 -0
- package/dist/xlayer/bundle.d.ts +93 -0
- package/dist/xlayer/bundle.js +472 -0
- package/dist/xlayer/bundler.d.ts +111 -0
- package/dist/xlayer/bundler.js +162 -0
- package/dist/xlayer/constants.d.ts +75 -0
- package/dist/xlayer/constants.js +145 -0
- package/dist/xlayer/dex.d.ts +132 -0
- package/dist/xlayer/dex.js +335 -0
- package/dist/xlayer/examples/bundle-buy-sell.d.ts +11 -0
- package/dist/xlayer/examples/bundle-buy-sell.js +194 -0
- package/dist/xlayer/index.d.ts +75 -0
- package/dist/xlayer/index.js +130 -0
- package/dist/xlayer/portal-ops.d.ts +152 -0
- package/dist/xlayer/portal-ops.js +239 -0
- package/dist/xlayer/types.d.ts +298 -0
- package/dist/xlayer/types.js +6 -0
- package/dist/xlayer/volume.d.ts +65 -0
- package/dist/xlayer/volume.js +235 -0
- package/package.json +38 -3
- 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,640 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jupiter Lend API (Jupiter Earn)
|
|
3
|
+
* @module sol/dex/jup/lend
|
|
4
|
+
*
|
|
5
|
+
* Lend API 提供存款赚息功能
|
|
6
|
+
* 用户可以存入代币获取 APY 收益
|
|
7
|
+
*/
|
|
8
|
+
import type { JupiterConfig } from './types.js';
|
|
9
|
+
/** 存款请求参数 */
|
|
10
|
+
export interface LendDepositParams {
|
|
11
|
+
/** 代币 Mint 地址 */
|
|
12
|
+
asset: string;
|
|
13
|
+
/** 签名者/用户公钥 */
|
|
14
|
+
signer: string;
|
|
15
|
+
/** 存款数量 (UI 数量,如 "5" 表示 5 USDC) */
|
|
16
|
+
amount: string;
|
|
17
|
+
}
|
|
18
|
+
/** 取款请求参数 */
|
|
19
|
+
export interface LendWithdrawParams {
|
|
20
|
+
/** 代币 Mint 地址 */
|
|
21
|
+
asset: string;
|
|
22
|
+
/** 签名者/用户公钥 */
|
|
23
|
+
signer: string;
|
|
24
|
+
/** 取款数量 (UI 数量) */
|
|
25
|
+
amount: string;
|
|
26
|
+
}
|
|
27
|
+
/** Mint 请求参数 (按份额存款) */
|
|
28
|
+
export interface LendMintParams {
|
|
29
|
+
/** 代币 Mint 地址 */
|
|
30
|
+
asset: string;
|
|
31
|
+
/** 签名者/用户公钥 */
|
|
32
|
+
signer: string;
|
|
33
|
+
/** 份额数量 (最小单位) */
|
|
34
|
+
shares: string;
|
|
35
|
+
}
|
|
36
|
+
/** Burn 请求参数 (按份额取款) */
|
|
37
|
+
export interface LendBurnParams {
|
|
38
|
+
/** 代币 Mint 地址 */
|
|
39
|
+
asset: string;
|
|
40
|
+
/** 签名者/用户公钥 */
|
|
41
|
+
signer: string;
|
|
42
|
+
/** 份额数量 (最小单位) */
|
|
43
|
+
shares: string;
|
|
44
|
+
}
|
|
45
|
+
/** Redeem 请求参数 (按份额赎回) */
|
|
46
|
+
export interface LendRedeemParams {
|
|
47
|
+
/** 代币 Mint 地址 */
|
|
48
|
+
asset: string;
|
|
49
|
+
/** 签名者/用户公钥 */
|
|
50
|
+
signer: string;
|
|
51
|
+
/** 份额数量 (最小单位) */
|
|
52
|
+
shares: string;
|
|
53
|
+
}
|
|
54
|
+
/** 交易响应 */
|
|
55
|
+
export interface LendTransactionResponse {
|
|
56
|
+
/** Base64 编码的未签名交易 */
|
|
57
|
+
transaction: string;
|
|
58
|
+
}
|
|
59
|
+
/** 账户信息 */
|
|
60
|
+
export interface LendInstructionAccount {
|
|
61
|
+
/** 账户公钥 */
|
|
62
|
+
pubkey: string;
|
|
63
|
+
/** 是否是签名者 */
|
|
64
|
+
isSigner: boolean;
|
|
65
|
+
/** 是否可写 */
|
|
66
|
+
isWritable: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** 指令响应 */
|
|
69
|
+
export interface LendInstructionResponse {
|
|
70
|
+
/** Program ID */
|
|
71
|
+
programId: string;
|
|
72
|
+
/** 账户列表 */
|
|
73
|
+
accounts: LendInstructionAccount[];
|
|
74
|
+
/** 指令数据 (Base64) */
|
|
75
|
+
data: string;
|
|
76
|
+
}
|
|
77
|
+
/** 底层资产信息 */
|
|
78
|
+
export interface LendUnderlyingAsset {
|
|
79
|
+
/** 资产地址 */
|
|
80
|
+
address: string;
|
|
81
|
+
/** 链 ID */
|
|
82
|
+
chainId: string;
|
|
83
|
+
/** 名称 */
|
|
84
|
+
name: string;
|
|
85
|
+
/** 符号 */
|
|
86
|
+
symbol: string;
|
|
87
|
+
/** 精度 */
|
|
88
|
+
decimals: number;
|
|
89
|
+
/** Logo URL */
|
|
90
|
+
logoUrl: string;
|
|
91
|
+
/** 价格 (USD) */
|
|
92
|
+
price: string;
|
|
93
|
+
/** CoinGecko ID */
|
|
94
|
+
coingeckoId: string;
|
|
95
|
+
}
|
|
96
|
+
/** 流动性供应数据 */
|
|
97
|
+
export interface LendLiquiditySupplyData {
|
|
98
|
+
/** 带利息模式 */
|
|
99
|
+
modeWithInterest: boolean;
|
|
100
|
+
/** 总供应量 */
|
|
101
|
+
supply: string;
|
|
102
|
+
/** 提款限额 */
|
|
103
|
+
withdrawalLimit: string;
|
|
104
|
+
/** 最后更新时间戳 */
|
|
105
|
+
lastUpdateTimestamp: string;
|
|
106
|
+
/** 扩展百分比 */
|
|
107
|
+
expandPercent: number;
|
|
108
|
+
/** 扩展持续时间 */
|
|
109
|
+
expandDuration: string;
|
|
110
|
+
/** 基础提款限额 */
|
|
111
|
+
baseWithdrawalLimit: string;
|
|
112
|
+
/** 距离限额可提款金额 */
|
|
113
|
+
withdrawableUntilLimit: string;
|
|
114
|
+
/** 可提款金额 */
|
|
115
|
+
withdrawable: string;
|
|
116
|
+
}
|
|
117
|
+
/** Earn 代币信息 */
|
|
118
|
+
export interface LendTokenInfo {
|
|
119
|
+
/** ID */
|
|
120
|
+
id: number;
|
|
121
|
+
/** jl 代币地址 (如 jlUSDC) */
|
|
122
|
+
address: string;
|
|
123
|
+
/** 名称 (如 "jupiter lend USDC") */
|
|
124
|
+
name: string;
|
|
125
|
+
/** 符号 (如 "jlUSDC") */
|
|
126
|
+
symbol: string;
|
|
127
|
+
/** 精度 */
|
|
128
|
+
decimals: number;
|
|
129
|
+
/** 底层资产地址 */
|
|
130
|
+
assetAddress: string;
|
|
131
|
+
/** 底层资产信息 */
|
|
132
|
+
asset: LendUnderlyingAsset;
|
|
133
|
+
/** 总资产 (最小单位) */
|
|
134
|
+
totalAssets: string;
|
|
135
|
+
/** 总供应量 (最小单位) */
|
|
136
|
+
totalSupply: string;
|
|
137
|
+
/** 资产转份额比率 */
|
|
138
|
+
convertToShares: string;
|
|
139
|
+
/** 份额转资产比率 */
|
|
140
|
+
convertToAssets: string;
|
|
141
|
+
/** 奖励率 (基点) */
|
|
142
|
+
rewardsRate: string;
|
|
143
|
+
/** 供应率 (基点) */
|
|
144
|
+
supplyRate: string;
|
|
145
|
+
/** 总收益率 (基点) = rewardsRate + supplyRate */
|
|
146
|
+
totalRate: string;
|
|
147
|
+
/** 再平衡差异 */
|
|
148
|
+
rebalanceDifference: string;
|
|
149
|
+
/** 流动性供应数据 */
|
|
150
|
+
liquiditySupplyData: LendLiquiditySupplyData;
|
|
151
|
+
/** 奖励列表 */
|
|
152
|
+
rewards: unknown[];
|
|
153
|
+
}
|
|
154
|
+
/** 用户存款仓位 */
|
|
155
|
+
export interface LendPosition {
|
|
156
|
+
/** 代币信息 */
|
|
157
|
+
token: LendTokenInfo;
|
|
158
|
+
/** 持有者地址 */
|
|
159
|
+
ownerAddress: string;
|
|
160
|
+
/** 份额数量 (最小单位) */
|
|
161
|
+
shares: string;
|
|
162
|
+
/** 底层资产数量 (最小单位) */
|
|
163
|
+
underlyingAssets: string;
|
|
164
|
+
/** 底层资产余额 (最小单位) */
|
|
165
|
+
underlyingBalance: string;
|
|
166
|
+
/** 授权额度 */
|
|
167
|
+
allowance: string;
|
|
168
|
+
}
|
|
169
|
+
/** 用户收益信息 */
|
|
170
|
+
export interface LendEarnings {
|
|
171
|
+
/** jl 代币地址 */
|
|
172
|
+
address: string;
|
|
173
|
+
/** 用户地址 */
|
|
174
|
+
ownerAddress: string;
|
|
175
|
+
/** 总存款 */
|
|
176
|
+
totalDeposits: string;
|
|
177
|
+
/** 总取款 */
|
|
178
|
+
totalWithdraws: string;
|
|
179
|
+
/** 总余额 */
|
|
180
|
+
totalBalance: string;
|
|
181
|
+
/** 总资产 */
|
|
182
|
+
totalAssets: string;
|
|
183
|
+
/** 收益 (利息) */
|
|
184
|
+
earnings: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 构建存款交易
|
|
188
|
+
*
|
|
189
|
+
* 将代币存入 Jupiter Earn 赚取利息。
|
|
190
|
+
*
|
|
191
|
+
* @param params 存款参数
|
|
192
|
+
* @param config Jupiter 配置
|
|
193
|
+
* @returns 未签名交易
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* import { Sol } from 'four-flap-meme-sdk'
|
|
198
|
+
*
|
|
199
|
+
* Sol.setJupiterConfig({ apiKey: 'your-api-key' })
|
|
200
|
+
*
|
|
201
|
+
* // 存入 5 USDC
|
|
202
|
+
* const result = await Sol.buildLendDeposit({
|
|
203
|
+
* asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
|
|
204
|
+
* signer: wallet.publicKey.toBase58(),
|
|
205
|
+
* amount: '5', // 5 USDC
|
|
206
|
+
* })
|
|
207
|
+
*
|
|
208
|
+
* // 签名并发送
|
|
209
|
+
* const tx = VersionedTransaction.deserialize(
|
|
210
|
+
* Buffer.from(result.transaction, 'base64')
|
|
211
|
+
* )
|
|
212
|
+
* tx.sign([wallet])
|
|
213
|
+
* const signature = await connection.sendTransaction(tx)
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
export declare function buildLendDeposit(params: LendDepositParams, config?: JupiterConfig): Promise<LendTransactionResponse>;
|
|
217
|
+
/**
|
|
218
|
+
* 构建取款交易
|
|
219
|
+
*
|
|
220
|
+
* 从 Jupiter Earn 取出存款和收益。
|
|
221
|
+
*
|
|
222
|
+
* @param params 取款参数
|
|
223
|
+
* @param config Jupiter 配置
|
|
224
|
+
* @returns 未签名交易
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* // 取出 5 USDC
|
|
229
|
+
* const result = await Sol.buildLendWithdraw({
|
|
230
|
+
* asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
231
|
+
* signer: wallet.publicKey.toBase58(),
|
|
232
|
+
* amount: '5',
|
|
233
|
+
* })
|
|
234
|
+
*
|
|
235
|
+
* // 签名并发送
|
|
236
|
+
* const tx = VersionedTransaction.deserialize(
|
|
237
|
+
* Buffer.from(result.transaction, 'base64')
|
|
238
|
+
* )
|
|
239
|
+
* tx.sign([wallet])
|
|
240
|
+
* await connection.sendTransaction(tx)
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export declare function buildLendWithdraw(params: LendWithdrawParams, config?: JupiterConfig): Promise<LendTransactionResponse>;
|
|
244
|
+
/**
|
|
245
|
+
* 构建 Mint 交易 (按份额存款)
|
|
246
|
+
*
|
|
247
|
+
* 使用份额 (shares) 而非代币数量来存款。
|
|
248
|
+
* 这是更底层的接口,适合精确控制份额的场景。
|
|
249
|
+
*
|
|
250
|
+
* @param params Mint 参数
|
|
251
|
+
* @param config Jupiter 配置
|
|
252
|
+
* @returns 未签名交易
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* const result = await Sol.buildLendMint({
|
|
257
|
+
* asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
258
|
+
* signer: wallet.publicKey.toBase58(),
|
|
259
|
+
* shares: '1000000', // 份额数量
|
|
260
|
+
* })
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
export declare function buildLendMint(params: LendMintParams, config?: JupiterConfig): Promise<LendTransactionResponse>;
|
|
264
|
+
/**
|
|
265
|
+
* 构建 Burn 交易 (按份额取款)
|
|
266
|
+
*
|
|
267
|
+
* 使用份额 (shares) 而非代币数量来取款。
|
|
268
|
+
* 这是更底层的接口,适合精确控制份额的场景。
|
|
269
|
+
*
|
|
270
|
+
* @param params Burn 参数
|
|
271
|
+
* @param config Jupiter 配置
|
|
272
|
+
* @returns 未签名交易
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```typescript
|
|
276
|
+
* const result = await Sol.buildLendBurn({
|
|
277
|
+
* asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
278
|
+
* signer: wallet.publicKey.toBase58(),
|
|
279
|
+
* shares: '1000000', // 份额数量
|
|
280
|
+
* })
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
export declare function buildLendBurn(params: LendBurnParams, config?: JupiterConfig): Promise<LendTransactionResponse>;
|
|
284
|
+
/**
|
|
285
|
+
* 构建 Redeem 交易 (按份额赎回)
|
|
286
|
+
*
|
|
287
|
+
* 与 Burn 类似,使用份额来赎回代币。
|
|
288
|
+
*
|
|
289
|
+
* @param params Redeem 参数
|
|
290
|
+
* @param config Jupiter 配置
|
|
291
|
+
* @returns 未签名交易
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```typescript
|
|
295
|
+
* const result = await Sol.buildLendRedeem({
|
|
296
|
+
* asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
297
|
+
* signer: wallet.publicKey.toBase58(),
|
|
298
|
+
* shares: '1000000',
|
|
299
|
+
* })
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
export declare function buildLendRedeem(params: LendRedeemParams, config?: JupiterConfig): Promise<LendTransactionResponse>;
|
|
303
|
+
/**
|
|
304
|
+
* 获取存款指令
|
|
305
|
+
*
|
|
306
|
+
* 返回单个指令而非完整交易,适合自定义组装交易。
|
|
307
|
+
*
|
|
308
|
+
* @param params 存款参数
|
|
309
|
+
* @param config Jupiter 配置
|
|
310
|
+
* @returns 指令
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* const instruction = await Sol.getLendDepositInstruction({
|
|
315
|
+
* asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
316
|
+
* signer: wallet.publicKey.toBase58(),
|
|
317
|
+
* amount: '5',
|
|
318
|
+
* })
|
|
319
|
+
*
|
|
320
|
+
* // 反序列化为 TransactionInstruction
|
|
321
|
+
* const ix = new TransactionInstruction({
|
|
322
|
+
* programId: new PublicKey(instruction.programId),
|
|
323
|
+
* keys: instruction.accounts.map(acc => ({
|
|
324
|
+
* pubkey: new PublicKey(acc.pubkey),
|
|
325
|
+
* isSigner: acc.isSigner,
|
|
326
|
+
* isWritable: acc.isWritable,
|
|
327
|
+
* })),
|
|
328
|
+
* data: Buffer.from(instruction.data, 'base64'),
|
|
329
|
+
* })
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
export declare function getLendDepositInstruction(params: LendDepositParams, config?: JupiterConfig): Promise<LendInstructionResponse>;
|
|
333
|
+
/**
|
|
334
|
+
* 获取取款指令
|
|
335
|
+
*
|
|
336
|
+
* @param params 取款参数
|
|
337
|
+
* @param config Jupiter 配置
|
|
338
|
+
* @returns 指令
|
|
339
|
+
*/
|
|
340
|
+
export declare function getLendWithdrawInstruction(params: LendWithdrawParams, config?: JupiterConfig): Promise<LendInstructionResponse>;
|
|
341
|
+
/**
|
|
342
|
+
* 获取 Mint 指令
|
|
343
|
+
*
|
|
344
|
+
* @param params Mint 参数
|
|
345
|
+
* @param config Jupiter 配置
|
|
346
|
+
* @returns 指令
|
|
347
|
+
*/
|
|
348
|
+
export declare function getLendMintInstruction(params: LendMintParams, config?: JupiterConfig): Promise<LendInstructionResponse>;
|
|
349
|
+
/**
|
|
350
|
+
* 获取 Burn 指令
|
|
351
|
+
*
|
|
352
|
+
* @param params Burn 参数
|
|
353
|
+
* @param config Jupiter 配置
|
|
354
|
+
* @returns 指令
|
|
355
|
+
*/
|
|
356
|
+
export declare function getLendBurnInstruction(params: LendBurnParams, config?: JupiterConfig): Promise<LendInstructionResponse>;
|
|
357
|
+
/**
|
|
358
|
+
* 获取 Redeem 指令
|
|
359
|
+
*
|
|
360
|
+
* @param params Redeem 参数
|
|
361
|
+
* @param config Jupiter 配置
|
|
362
|
+
* @returns 指令
|
|
363
|
+
*/
|
|
364
|
+
export declare function getLendRedeemInstruction(params: LendRedeemParams, config?: JupiterConfig): Promise<LendInstructionResponse>;
|
|
365
|
+
/**
|
|
366
|
+
* 获取所有 Earn 支持的代币
|
|
367
|
+
*
|
|
368
|
+
* 返回详细的代币信息,包括:
|
|
369
|
+
* - jl 代币地址和底层资产地址
|
|
370
|
+
* - 当前收益率 (APY)
|
|
371
|
+
* - 总存款量和总供应量
|
|
372
|
+
* - 份额转换比率
|
|
373
|
+
* - 流动性数据
|
|
374
|
+
*
|
|
375
|
+
* @param config Jupiter 配置
|
|
376
|
+
* @returns 代币信息数组
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```typescript
|
|
380
|
+
* const tokens = await Sol.getEarnTokens()
|
|
381
|
+
*
|
|
382
|
+
* tokens.forEach(token => {
|
|
383
|
+
* // 计算 APY (基点转百分比)
|
|
384
|
+
* const apy = Number(token.totalRate) / 100
|
|
385
|
+
*
|
|
386
|
+
* console.log(`${token.symbol}:`)
|
|
387
|
+
* console.log(` APY: ${apy.toFixed(2)}%`)
|
|
388
|
+
* console.log(` 底层资产: ${token.asset.symbol}`)
|
|
389
|
+
* console.log(` 价格: $${token.asset.price}`)
|
|
390
|
+
* console.log(` jl代币地址: ${token.address}`)
|
|
391
|
+
* console.log(` 资产地址: ${token.assetAddress}`)
|
|
392
|
+
* })
|
|
393
|
+
*
|
|
394
|
+
* // 示例输出:
|
|
395
|
+
* // jlUSDC:
|
|
396
|
+
* // APY: 5.46%
|
|
397
|
+
* // 底层资产: USDC
|
|
398
|
+
* // 价格: $0.999730840125
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
export declare function getEarnTokens(config?: JupiterConfig): Promise<LendTokenInfo[]>;
|
|
402
|
+
/**
|
|
403
|
+
* 获取单个代币的 Earn 信息
|
|
404
|
+
*
|
|
405
|
+
* @param assetMint 底层资产 Mint 地址
|
|
406
|
+
* @param config Jupiter 配置
|
|
407
|
+
* @returns 代币信息或 null
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* const usdcInfo = await Sol.getEarnTokenByAsset(
|
|
412
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
|
|
413
|
+
* )
|
|
414
|
+
*
|
|
415
|
+
* if (usdcInfo) {
|
|
416
|
+
* console.log('USDC APY:', Number(usdcInfo.totalRate) / 100, '%')
|
|
417
|
+
* }
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
export declare function getEarnTokenByAsset(assetMint: string, config?: JupiterConfig): Promise<LendTokenInfo | null>;
|
|
421
|
+
/**
|
|
422
|
+
* 获取所有 Earn APY 信息
|
|
423
|
+
*
|
|
424
|
+
* @param config Jupiter 配置
|
|
425
|
+
* @returns APY 映射 { assetMint: { symbol, apy, supplyRate, rewardsRate } }
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* ```typescript
|
|
429
|
+
* const apys = await Sol.getEarnApys()
|
|
430
|
+
*
|
|
431
|
+
* // { 'EPj...': { symbol: 'USDC', apy: 5.46, ... }, ... }
|
|
432
|
+
* console.log('USDC APY:', apys['EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'].apy)
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
export declare function getEarnApys(config?: JupiterConfig): Promise<Record<string, {
|
|
436
|
+
symbol: string;
|
|
437
|
+
jlSymbol: string;
|
|
438
|
+
apy: number;
|
|
439
|
+
supplyRate: number;
|
|
440
|
+
rewardsRate: number;
|
|
441
|
+
price: number;
|
|
442
|
+
}>>;
|
|
443
|
+
/**
|
|
444
|
+
* 计算份额对应的资产数量
|
|
445
|
+
*
|
|
446
|
+
* @param shares 份额数量 (最小单位)
|
|
447
|
+
* @param tokenInfo 代币信息
|
|
448
|
+
* @returns 资产数量 (最小单位)
|
|
449
|
+
*/
|
|
450
|
+
export declare function sharesToAssets(shares: string | bigint, tokenInfo: LendTokenInfo): bigint;
|
|
451
|
+
/**
|
|
452
|
+
* 计算资产数量对应的份额
|
|
453
|
+
*
|
|
454
|
+
* @param assets 资产数量 (最小单位)
|
|
455
|
+
* @param tokenInfo 代币信息
|
|
456
|
+
* @returns 份额数量 (最小单位)
|
|
457
|
+
*/
|
|
458
|
+
export declare function assetsToShares(assets: string | bigint, tokenInfo: LendTokenInfo): bigint;
|
|
459
|
+
/**
|
|
460
|
+
* 获取用户的 Earn 仓位
|
|
461
|
+
*
|
|
462
|
+
* 返回用户在所有 Earn 代币的存款仓位。
|
|
463
|
+
*
|
|
464
|
+
* @param users 用户地址(支持单个或多个,逗号分隔)
|
|
465
|
+
* @param config Jupiter 配置
|
|
466
|
+
* @returns 仓位数组
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```typescript
|
|
470
|
+
* const positions = await Sol.getEarnPositions(
|
|
471
|
+
* '9yFqMjJgsEcZ8GnEtFqxw1oFbPPVpypMVgYzQWgECFNy'
|
|
472
|
+
* )
|
|
473
|
+
*
|
|
474
|
+
* positions.forEach(pos => {
|
|
475
|
+
* if (BigInt(pos.shares) > 0n) {
|
|
476
|
+
* console.log(`${pos.token.asset.symbol}:`)
|
|
477
|
+
* console.log(` 份额: ${pos.shares}`)
|
|
478
|
+
* console.log(` 底层资产: ${pos.underlyingAssets}`)
|
|
479
|
+
* console.log(` APY: ${Number(pos.token.totalRate) / 100}%`)
|
|
480
|
+
* }
|
|
481
|
+
* })
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
export declare function getEarnPositions(users: string | string[], config?: JupiterConfig): Promise<LendPosition[]>;
|
|
485
|
+
/**
|
|
486
|
+
* 获取用户在指定代币的 Earn 仓位
|
|
487
|
+
*
|
|
488
|
+
* @param user 用户地址
|
|
489
|
+
* @param assetMint 底层资产 Mint 地址
|
|
490
|
+
* @param config Jupiter 配置
|
|
491
|
+
* @returns 仓位或 null
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```typescript
|
|
495
|
+
* const usdcPosition = await Sol.getEarnPositionByAsset(
|
|
496
|
+
* '9yFqMjJgsEcZ8GnEtFqxw1oFbPPVpypMVgYzQWgECFNy',
|
|
497
|
+
* 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
|
|
498
|
+
* )
|
|
499
|
+
*
|
|
500
|
+
* if (usdcPosition && BigInt(usdcPosition.shares) > 0n) {
|
|
501
|
+
* console.log('USDC 存款:', usdcPosition.underlyingAssets)
|
|
502
|
+
* }
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
export declare function getEarnPositionByAsset(user: string, assetMint: string, config?: JupiterConfig): Promise<LendPosition | null>;
|
|
506
|
+
/**
|
|
507
|
+
* 获取用户的非零 Earn 仓位
|
|
508
|
+
*
|
|
509
|
+
* @param user 用户地址
|
|
510
|
+
* @param config Jupiter 配置
|
|
511
|
+
* @returns 非零仓位数组
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```typescript
|
|
515
|
+
* const activePositions = await Sol.getActiveEarnPositions(
|
|
516
|
+
* '9yFqMjJgsEcZ8GnEtFqxw1oFbPPVpypMVgYzQWgECFNy'
|
|
517
|
+
* )
|
|
518
|
+
*
|
|
519
|
+
* activePositions.forEach(pos => {
|
|
520
|
+
* console.log(`${pos.token.asset.symbol}: ${pos.underlyingAssets}`)
|
|
521
|
+
* })
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
export declare function getActiveEarnPositions(user: string, config?: JupiterConfig): Promise<LendPosition[]>;
|
|
525
|
+
/**
|
|
526
|
+
* 获取用户的 Earn 资产总值 (USD)
|
|
527
|
+
*
|
|
528
|
+
* @param user 用户地址
|
|
529
|
+
* @param config Jupiter 配置
|
|
530
|
+
* @returns 总值 USD
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```typescript
|
|
534
|
+
* const totalValue = await Sol.getEarnTotalValue(
|
|
535
|
+
* '9yFqMjJgsEcZ8GnEtFqxw1oFbPPVpypMVgYzQWgECFNy'
|
|
536
|
+
* )
|
|
537
|
+
* console.log('Earn 总值: $' + totalValue.toFixed(2))
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
export declare function getEarnTotalValue(user: string, config?: JupiterConfig): Promise<number>;
|
|
541
|
+
/**
|
|
542
|
+
* 获取用户的收益统计
|
|
543
|
+
*
|
|
544
|
+
* 返回用户的存款、取款和收益汇总。
|
|
545
|
+
*
|
|
546
|
+
* @param user 用户地址(可选,不传则获取所有)
|
|
547
|
+
* @param config Jupiter 配置
|
|
548
|
+
* @returns 收益信息数组
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```typescript
|
|
552
|
+
* const earnings = await Sol.getEarnEarnings(
|
|
553
|
+
* '9yFqMjJgsEcZ8GnEtFqxw1oFbPPVpypMVgYzQWgECFNy'
|
|
554
|
+
* )
|
|
555
|
+
*
|
|
556
|
+
* earnings.forEach(e => {
|
|
557
|
+
* console.log(`代币: ${e.address}`)
|
|
558
|
+
* console.log(` 总存款: ${e.totalDeposits}`)
|
|
559
|
+
* console.log(` 总取款: ${e.totalWithdraws}`)
|
|
560
|
+
* console.log(` 当前余额: ${e.totalBalance}`)
|
|
561
|
+
* console.log(` 收益: ${e.earnings}`)
|
|
562
|
+
* })
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
export declare function getEarnEarnings(user?: string, config?: JupiterConfig): Promise<LendEarnings[]>;
|
|
566
|
+
/**
|
|
567
|
+
* 获取用户在指定代币的收益
|
|
568
|
+
*
|
|
569
|
+
* @param user 用户地址
|
|
570
|
+
* @param jlTokenAddress jl 代币地址(如 jlUSDC 地址)
|
|
571
|
+
* @param config Jupiter 配置
|
|
572
|
+
* @returns 收益信息或 null
|
|
573
|
+
*/
|
|
574
|
+
export declare function getEarnEarningsByToken(user: string, jlTokenAddress: string, config?: JupiterConfig): Promise<LendEarnings | null>;
|
|
575
|
+
/**
|
|
576
|
+
* 获取用户的总收益汇总
|
|
577
|
+
*
|
|
578
|
+
* @param user 用户地址
|
|
579
|
+
* @param config Jupiter 配置
|
|
580
|
+
* @returns 汇总信息
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```typescript
|
|
584
|
+
* const summary = await Sol.getEarnEarningsSummary(user)
|
|
585
|
+
* console.log('总存款:', summary.totalDeposits)
|
|
586
|
+
* console.log('总取款:', summary.totalWithdraws)
|
|
587
|
+
* console.log('总收益:', summary.totalEarnings)
|
|
588
|
+
* ```
|
|
589
|
+
*/
|
|
590
|
+
export declare function getEarnEarningsSummary(user: string, config?: JupiterConfig): Promise<{
|
|
591
|
+
totalDeposits: bigint;
|
|
592
|
+
totalWithdraws: bigint;
|
|
593
|
+
totalBalance: bigint;
|
|
594
|
+
totalEarnings: bigint;
|
|
595
|
+
}>;
|
|
596
|
+
/** 常见的 Earn 支持代币 */
|
|
597
|
+
export declare const LEND_SUPPORTED_ASSETS: {
|
|
598
|
+
/** USDC */
|
|
599
|
+
readonly USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
600
|
+
/** USDT */
|
|
601
|
+
readonly USDT: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
|
|
602
|
+
/** SOL */
|
|
603
|
+
readonly SOL: "So11111111111111111111111111111111111111112";
|
|
604
|
+
};
|
|
605
|
+
/**
|
|
606
|
+
* 存入 USDC
|
|
607
|
+
*
|
|
608
|
+
* @param signer 签名者公钥
|
|
609
|
+
* @param amount 数量 (UI 数量,如 "100" 表示 100 USDC)
|
|
610
|
+
* @param config Jupiter 配置
|
|
611
|
+
* @returns 未签名交易
|
|
612
|
+
*/
|
|
613
|
+
export declare function depositUsdc(signer: string, amount: string, config?: JupiterConfig): Promise<LendTransactionResponse>;
|
|
614
|
+
/**
|
|
615
|
+
* 取出 USDC
|
|
616
|
+
*
|
|
617
|
+
* @param signer 签名者公钥
|
|
618
|
+
* @param amount 数量
|
|
619
|
+
* @param config Jupiter 配置
|
|
620
|
+
* @returns 未签名交易
|
|
621
|
+
*/
|
|
622
|
+
export declare function withdrawUsdc(signer: string, amount: string, config?: JupiterConfig): Promise<LendTransactionResponse>;
|
|
623
|
+
/**
|
|
624
|
+
* 存入 SOL
|
|
625
|
+
*
|
|
626
|
+
* @param signer 签名者公钥
|
|
627
|
+
* @param amount 数量 (UI 数量,如 "1" 表示 1 SOL)
|
|
628
|
+
* @param config Jupiter 配置
|
|
629
|
+
* @returns 未签名交易
|
|
630
|
+
*/
|
|
631
|
+
export declare function depositSol(signer: string, amount: string, config?: JupiterConfig): Promise<LendTransactionResponse>;
|
|
632
|
+
/**
|
|
633
|
+
* 取出 SOL
|
|
634
|
+
*
|
|
635
|
+
* @param signer 签名者公钥
|
|
636
|
+
* @param amount 数量
|
|
637
|
+
* @param config Jupiter 配置
|
|
638
|
+
* @returns 未签名交易
|
|
639
|
+
*/
|
|
640
|
+
export declare function withdrawSol(signer: string, amount: string, config?: JupiterConfig): Promise<LendTransactionResponse>;
|