@xitadel-fi/sdk 0.1.1

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.
@@ -0,0 +1,433 @@
1
+ import { Program, AnchorProvider, BN, IdlTypes } from '@coral-xyz/anchor';
2
+ import { Keypair, PublicKey, TransactionInstruction } from '@solana/web3.js';
3
+ import { Xitadel } from '../../target/types/xitadel';
4
+ export type LTTRegisterParams = IdlTypes<Xitadel>['lttRegistrationParams'];
5
+ export type LTTStatus = IdlTypes<Xitadel>['lttStatus'];
6
+ export type LTTConfiguration = Awaited<ReturnType<XitadelProgram['getLttConfig']>>;
7
+ export declare const SEEDS: {
8
+ LTT_CONFIG: Buffer<ArrayBuffer>;
9
+ LTT_MINT: Buffer<ArrayBuffer>;
10
+ ORACLE_PRICE_FEED: Buffer<ArrayBuffer>;
11
+ METADATA: Buffer<ArrayBuffer>;
12
+ FUNDING_RECORD: Buffer<ArrayBuffer>;
13
+ COLLATERAL_STATE: Buffer<ArrayBuffer>;
14
+ COLLATERAL_VAULT: Buffer<ArrayBuffer>;
15
+ };
16
+ export declare class XitadelProgram {
17
+ program: Program<Xitadel>;
18
+ constructor(provider: AnchorProvider, address?: string);
19
+ getProgramId(): PublicKey;
20
+ getConfigPda(): PublicKey;
21
+ getConfig(): Promise<any>;
22
+ /**
23
+ * Initialize the Xitadel program configuration
24
+ * @param manager The manager's public key (can be different from payer)
25
+ * @param payer Optional payer public key (defaults to manager if not provided)
26
+ * @returns Transaction instruction for initializing the program configuration
27
+ */
28
+ initConfig(manager: PublicKey, payer?: PublicKey): Promise<TransactionInstruction>;
29
+ /**
30
+ * Helper method to get LTT configuration PDA
31
+ * @param lttId The LTT ID (Pubkey)
32
+ * @returns LTT configuration PDA
33
+ */
34
+ getLTTConfigPda(lttId: PublicKey): PublicKey;
35
+ /**
36
+ * Get LTT configuration data
37
+ * @param lttId The LTT ID (Pubkey)
38
+ * @returns LTT configuration data
39
+ */
40
+ getLttConfig(lttId: PublicKey): Promise<{
41
+ bump: number;
42
+ lttId: PublicKey;
43
+ issuer: PublicKey;
44
+ collateralPriceFeed: PublicKey;
45
+ lttTokenMint: PublicKey;
46
+ fundingTokenMint: PublicKey;
47
+ collateralTokenMint: PublicKey;
48
+ lttSupply: BN;
49
+ fundedLttSupply: BN;
50
+ collateralAmount: BN;
51
+ stableInterestAmount: BN;
52
+ tokenInterestAmount: BN;
53
+ fundingStartTs: BN;
54
+ fundingEndTs: BN;
55
+ lttMaturityTs: BN;
56
+ registeredTs: BN;
57
+ lttDeactivateTs: BN;
58
+ liquidationStartTs: BN;
59
+ isLiquidationStarted: boolean;
60
+ status: ({
61
+ funding?: undefined;
62
+ active?: undefined;
63
+ cancelled?: undefined;
64
+ liquidated?: undefined;
65
+ matured?: undefined;
66
+ defaulted?: undefined;
67
+ deactivated?: undefined;
68
+ } & {
69
+ pending: Record<string, never>;
70
+ }) | ({
71
+ pending?: undefined;
72
+ active?: undefined;
73
+ cancelled?: undefined;
74
+ liquidated?: undefined;
75
+ matured?: undefined;
76
+ defaulted?: undefined;
77
+ deactivated?: undefined;
78
+ } & {
79
+ funding: Record<string, never>;
80
+ }) | ({
81
+ pending?: undefined;
82
+ funding?: undefined;
83
+ cancelled?: undefined;
84
+ liquidated?: undefined;
85
+ matured?: undefined;
86
+ defaulted?: undefined;
87
+ deactivated?: undefined;
88
+ } & {
89
+ active: Record<string, never>;
90
+ }) | ({
91
+ pending?: undefined;
92
+ funding?: undefined;
93
+ active?: undefined;
94
+ liquidated?: undefined;
95
+ matured?: undefined;
96
+ defaulted?: undefined;
97
+ deactivated?: undefined;
98
+ } & {
99
+ cancelled: Record<string, never>;
100
+ }) | ({
101
+ pending?: undefined;
102
+ funding?: undefined;
103
+ active?: undefined;
104
+ cancelled?: undefined;
105
+ matured?: undefined;
106
+ defaulted?: undefined;
107
+ deactivated?: undefined;
108
+ } & {
109
+ liquidated: Record<string, never>;
110
+ }) | ({
111
+ pending?: undefined;
112
+ funding?: undefined;
113
+ active?: undefined;
114
+ cancelled?: undefined;
115
+ liquidated?: undefined;
116
+ defaulted?: undefined;
117
+ deactivated?: undefined;
118
+ } & {
119
+ matured: Record<string, never>;
120
+ }) | ({
121
+ pending?: undefined;
122
+ funding?: undefined;
123
+ active?: undefined;
124
+ cancelled?: undefined;
125
+ liquidated?: undefined;
126
+ matured?: undefined;
127
+ deactivated?: undefined;
128
+ } & {
129
+ defaulted: Record<string, never>;
130
+ }) | ({
131
+ pending?: undefined;
132
+ funding?: undefined;
133
+ active?: undefined;
134
+ cancelled?: undefined;
135
+ liquidated?: undefined;
136
+ matured?: undefined;
137
+ defaulted?: undefined;
138
+ } & {
139
+ deactivated: Record<string, never>;
140
+ });
141
+ lpSupplyAmount: BN;
142
+ lpTokenVault: PublicKey;
143
+ maxAllowedLtvPct: BN;
144
+ useChainlink: boolean;
145
+ totalWithdrawnStableAmount: BN;
146
+ positionNftMint: PublicKey;
147
+ maxWithdrawLtvPct: BN;
148
+ chainlinkDataStreamDecimals: number;
149
+ chainlinkDataStreamVersion: number;
150
+ positionNftMintB: PublicKey;
151
+ }>;
152
+ /**
153
+ * Helper method to get LP authority PDA
154
+ * @returns LP authority PDA
155
+ */
156
+ getLpAuthority(): PublicKey;
157
+ /**
158
+ * Helper method to get metadata PDA
159
+ * @param lttMintPda The LTT mint PDA
160
+ * @returns Metadata PDA
161
+ */
162
+ getMetadataPda(lttMintPda: PublicKey): PublicKey;
163
+ /**
164
+ * Helper method to get funding record PDA
165
+ * @param lttId The LTT ID
166
+ * @param investor The investor's public key
167
+ * @returns Funding record PDA
168
+ */
169
+ getFundingRecordPda(lttConfig: PublicKey, investor: PublicKey): PublicKey;
170
+ /**
171
+ * Helper method to get collateral state PDA
172
+ * @param lttId The LTT ID
173
+ * @returns Collateral state PDA
174
+ */
175
+ getCollateralStatePda(lttId: PublicKey): PublicKey;
176
+ /**
177
+ * Register a new LTT
178
+ * @param manager The manager's public key
179
+ * @param params The LTT registration parameters
180
+ * @param fundingTokenMint The funding token mint account
181
+ * @param collateralTokenMint The collateral token mint account
182
+ * @returns Transaction instruction for registering the LTT
183
+ */
184
+ registerLTT(manager: PublicKey, fundingTokenMint: PublicKey, collateralTokenMint: PublicKey, params: LTTRegisterParams): Promise<TransactionInstruction>;
185
+ /**
186
+ * Fund an LTT
187
+ * @param lttId The LTT ID to fund
188
+ * @param investor The investor's public key
189
+ * @param amount The amount to fund
190
+ * @returns Transaction instruction for funding the LTT
191
+ */
192
+ fundLTT(lttId: PublicKey, investor: PublicKey, fundingAmount: BN): Promise<TransactionInstruction[]>;
193
+ /**
194
+ * Activate liquidation for an LTT
195
+ * @param lttId The LTT ID
196
+ * @param keeperBot The keeper bot's public key
197
+ * @returns Transaction instruction for activating liquidation
198
+ */
199
+ activateLiquidation(lttId: PublicKey, keeperBot: PublicKey, pricefeed: PublicKey, chainLinkProgram: PublicKey, signedReport: Buffer | Uint8Array, verifierAccounts: {
200
+ verifier: PublicKey;
201
+ accessController: PublicKey;
202
+ config: PublicKey;
203
+ }): Promise<TransactionInstruction>;
204
+ /**
205
+ * Execute liquidation for an LTT
206
+ * @param lttId The LTT ID
207
+ * @param keeperBot The keeper bot's public key
208
+ * @param priceFeed Switchboard price feed
209
+ * @returns Transaction instruction for executing liquidation
210
+ */
211
+ executeLiquidation(lttId: PublicKey, keeperBot: PublicKey, priceFeed: PublicKey, chainLinkProgram: PublicKey, signedReport: Buffer | Uint8Array, verifierAccounts: {
212
+ verifier: PublicKey;
213
+ accessController: PublicKey;
214
+ config: PublicKey;
215
+ }): Promise<TransactionInstruction>;
216
+ /**
217
+ * Withdraw collateral from an LTT
218
+ * @param lttId The LTT ID
219
+ * @param withdrawer The withdrawer's public key
220
+ * @param amount The amount to withdraw
221
+ * @returns Transaction instruction for withdrawing collateral
222
+ */
223
+ withdrawCollateral(lttId: PublicKey, withdrawer: PublicKey, amount: BN, chainLinkProgram: PublicKey, priceFeed: PublicKey, signedReport: Buffer | Uint8Array, verifierAccounts: {
224
+ verifier: PublicKey;
225
+ accessController: PublicKey;
226
+ config: PublicKey;
227
+ }): Promise<TransactionInstruction[]>;
228
+ /**
229
+ * Withdraw USDC from an LTT
230
+ * @param lttId The LTT ID
231
+ * @param withdrawer The withdrawer's public key
232
+ * @param amount The amount to withdraw
233
+ * @returns Transaction instruction for withdrawing USDC
234
+ */
235
+ withdrawUsdc(lttId: PublicKey, withdrawer: PublicKey, amount: BN): Promise<TransactionInstruction>;
236
+ /**
237
+ * Fetch LTT configuration
238
+ * @param lttId The LTT ID
239
+ * @returns LTT configuration
240
+ */
241
+ fetchLTTConfiguration(lttId: PublicKey): Promise<{
242
+ bump: number;
243
+ lttId: PublicKey;
244
+ issuer: PublicKey;
245
+ collateralPriceFeed: PublicKey;
246
+ lttTokenMint: PublicKey;
247
+ fundingTokenMint: PublicKey;
248
+ collateralTokenMint: PublicKey;
249
+ lttSupply: BN;
250
+ fundedLttSupply: BN;
251
+ collateralAmount: BN;
252
+ stableInterestAmount: BN;
253
+ tokenInterestAmount: BN;
254
+ fundingStartTs: BN;
255
+ fundingEndTs: BN;
256
+ lttMaturityTs: BN;
257
+ registeredTs: BN;
258
+ lttDeactivateTs: BN;
259
+ liquidationStartTs: BN;
260
+ isLiquidationStarted: boolean;
261
+ status: ({
262
+ funding?: undefined;
263
+ active?: undefined;
264
+ cancelled?: undefined;
265
+ liquidated?: undefined;
266
+ matured?: undefined;
267
+ defaulted?: undefined;
268
+ deactivated?: undefined;
269
+ } & {
270
+ pending: Record<string, never>;
271
+ }) | ({
272
+ pending?: undefined;
273
+ active?: undefined;
274
+ cancelled?: undefined;
275
+ liquidated?: undefined;
276
+ matured?: undefined;
277
+ defaulted?: undefined;
278
+ deactivated?: undefined;
279
+ } & {
280
+ funding: Record<string, never>;
281
+ }) | ({
282
+ pending?: undefined;
283
+ funding?: undefined;
284
+ cancelled?: undefined;
285
+ liquidated?: undefined;
286
+ matured?: undefined;
287
+ defaulted?: undefined;
288
+ deactivated?: undefined;
289
+ } & {
290
+ active: Record<string, never>;
291
+ }) | ({
292
+ pending?: undefined;
293
+ funding?: undefined;
294
+ active?: undefined;
295
+ liquidated?: undefined;
296
+ matured?: undefined;
297
+ defaulted?: undefined;
298
+ deactivated?: undefined;
299
+ } & {
300
+ cancelled: Record<string, never>;
301
+ }) | ({
302
+ pending?: undefined;
303
+ funding?: undefined;
304
+ active?: undefined;
305
+ cancelled?: undefined;
306
+ matured?: undefined;
307
+ defaulted?: undefined;
308
+ deactivated?: undefined;
309
+ } & {
310
+ liquidated: Record<string, never>;
311
+ }) | ({
312
+ pending?: undefined;
313
+ funding?: undefined;
314
+ active?: undefined;
315
+ cancelled?: undefined;
316
+ liquidated?: undefined;
317
+ defaulted?: undefined;
318
+ deactivated?: undefined;
319
+ } & {
320
+ matured: Record<string, never>;
321
+ }) | ({
322
+ pending?: undefined;
323
+ funding?: undefined;
324
+ active?: undefined;
325
+ cancelled?: undefined;
326
+ liquidated?: undefined;
327
+ matured?: undefined;
328
+ deactivated?: undefined;
329
+ } & {
330
+ defaulted: Record<string, never>;
331
+ }) | ({
332
+ pending?: undefined;
333
+ funding?: undefined;
334
+ active?: undefined;
335
+ cancelled?: undefined;
336
+ liquidated?: undefined;
337
+ matured?: undefined;
338
+ defaulted?: undefined;
339
+ } & {
340
+ deactivated: Record<string, never>;
341
+ });
342
+ lpSupplyAmount: BN;
343
+ lpTokenVault: PublicKey;
344
+ maxAllowedLtvPct: BN;
345
+ useChainlink: boolean;
346
+ totalWithdrawnStableAmount: BN;
347
+ positionNftMint: PublicKey;
348
+ maxWithdrawLtvPct: BN;
349
+ chainlinkDataStreamDecimals: number;
350
+ chainlinkDataStreamVersion: number;
351
+ positionNftMintB: PublicKey;
352
+ }>;
353
+ /**
354
+ * Redeem LTT tokens
355
+ * @param lttId The LTT ID
356
+ * @param investor The investor's public key
357
+ * @param amount The amount to redeem
358
+ * @returns Transaction instruction for redeeming LTT tokens
359
+ */
360
+ redeemLTT(lttId: PublicKey, investor: PublicKey, amount: BN): Promise<TransactionInstruction[]>;
361
+ /**
362
+ * Update LTT status
363
+ * @param lttId The LTT ID
364
+ * @returns Transaction instruction for updating LTT status
365
+ */
366
+ updateLTTStatus(lttId: PublicKey): Promise<TransactionInstruction>;
367
+ /**
368
+ * Deactivate an LTT
369
+ * @param signer
370
+ * @param lttId The LTT ID
371
+ * @param positionNftMint The position NFT mint
372
+ * @param cpAmmProgramId The CP AMM program ID
373
+ * @returns Transaction instructions for deactivating the LTT
374
+ */
375
+ deactivateLTT(signer: PublicKey, lttId: PublicKey, positionNftMint: PublicKey, cpAmmProgramId: PublicKey): Promise<TransactionInstruction[]>;
376
+ /**
377
+ * Activate an LTT
378
+ * @param signer The signer's public key
379
+ * @param positionNftMintKeypair
380
+ * @param ammConfig
381
+ * @param params The LP creation parameters
382
+ * @returns Transaction instructions for creating LP
383
+ */
384
+ activateLtt(signer: PublicKey, positionNftMintKeypair: Keypair, positionNftMintKeypairB: Keypair, ammConfig: PublicKey, ammConfigB: PublicKey, params: {
385
+ lttId: PublicKey;
386
+ stableCoinMint: PublicKey;
387
+ initialLiquidityAmount: BN;
388
+ stableCoinAmount: BN;
389
+ cpAmmProgramId: PublicKey;
390
+ collateralTokenMint: PublicKey;
391
+ }): Promise<TransactionInstruction[]>;
392
+ /**
393
+ * Maturate an LTT
394
+ * @param signer
395
+ * @param lttId The LTT ID
396
+ * @param positionNftMint The position NFT mint
397
+ * @param ammConfig The AMM config
398
+ * @param cpAmmProgramId The CP AMM program ID
399
+ * @param params The maturate parameters
400
+ * @returns Transaction instruction for maturing the LTT
401
+ */
402
+ maturateLtt(signer: PublicKey, lttId: PublicKey, positionNftMint: PublicKey, positionNftMintB: PublicKey, ammConfig: PublicKey, ammConfigB: PublicKey, cpAmmProgramId: PublicKey): Promise<TransactionInstruction>;
403
+ /**
404
+ * Stop liquidation
405
+ * @param lttId The LTT ID
406
+ * @param signer The signer's public key
407
+ * @returns Transaction instruction for stopping liquidation
408
+ */
409
+ stopLiquidation(lttId: PublicKey, signer: PublicKey, priceFeed: PublicKey, chainlinkProgram: PublicKey, signedReport: Buffer | Uint8Array, verifierAccounts: {
410
+ verifier: PublicKey;
411
+ accessController: PublicKey;
412
+ config: PublicKey;
413
+ }): Promise<TransactionInstruction>;
414
+ /**
415
+ * Harvest funds or NFTs from the LTT harvest vault.
416
+ * @param lttId The LTT ID
417
+ * @param manager The manager's keypair or public key
418
+ * @param positionNftMint The position NFT mint
419
+ * @returns A transaction instruction to perform the harvest
420
+ */
421
+ harvestLTT(lttId: PublicKey, manager: PublicKey, positionNftMint: PublicKey): Promise<TransactionInstruction[]>;
422
+ getHarvestVaultPda(lttId: PublicKey): PublicKey;
423
+ /**
424
+ * Claim LP fees for an active LTT
425
+ * @param signer The signer's public key
426
+ * @param lttId The LTT ID
427
+ * @param positionNftMint The position NFT mint
428
+ * @param ammConfig The AMM config
429
+ * @param cpAmmProgramId The CP AMM program ID
430
+ * @returns Transaction instruction for claiming fees
431
+ */
432
+ claimFees(signer: PublicKey, lttId: PublicKey, positionNftMint: PublicKey, ammConfig: PublicKey, cpAmmProgramId: PublicKey, receiver: PublicKey): Promise<TransactionInstruction>;
433
+ }