@elmntl/jlpd-sdk 0.1.11 → 0.13.4

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.
Files changed (115) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +185 -404
  3. package/dist/common/ata.d.ts +26 -0
  4. package/dist/common/ata.js +48 -0
  5. package/dist/common/buffer.d.ts +15 -0
  6. package/dist/common/buffer.js +118 -0
  7. package/dist/common/connection.d.ts +13 -0
  8. package/dist/common/connection.js +2 -0
  9. package/dist/common/constants.d.ts +14 -0
  10. package/dist/common/constants.js +31 -0
  11. package/dist/common/index.d.ts +6 -0
  12. package/dist/common/index.js +28 -0
  13. package/dist/common/strategy-interface.d.ts +59 -0
  14. package/dist/common/strategy-interface.js +42 -0
  15. package/dist/elemental-lend/accounts.d.ts +103 -0
  16. package/dist/elemental-lend/accounts.js +354 -0
  17. package/dist/elemental-lend/constants.d.ts +25 -0
  18. package/dist/elemental-lend/constants.js +48 -0
  19. package/dist/elemental-lend/index.d.ts +8 -0
  20. package/dist/elemental-lend/index.js +24 -0
  21. package/dist/elemental-lend/instructions.d.ts +104 -0
  22. package/dist/elemental-lend/instructions.js +266 -0
  23. package/dist/elemental-lend/jupiter-lend.d.ts +91 -0
  24. package/dist/elemental-lend/jupiter-lend.js +189 -0
  25. package/dist/elemental-lend/kamino-vault.d.ts +173 -0
  26. package/dist/elemental-lend/kamino-vault.js +483 -0
  27. package/dist/elemental-lend/pda.d.ts +12 -0
  28. package/dist/elemental-lend/pda.js +24 -0
  29. package/dist/elemental-lend/protocol-actions.d.ts +56 -0
  30. package/dist/elemental-lend/protocol-actions.js +244 -0
  31. package/dist/elemental-lend/types.d.ts +113 -0
  32. package/dist/elemental-lend/types.js +2 -0
  33. package/dist/elemental-lend-v2/accounts.d.ts +14 -0
  34. package/dist/elemental-lend-v2/accounts.js +136 -0
  35. package/dist/elemental-lend-v2/adapters.d.ts +22 -0
  36. package/dist/elemental-lend-v2/adapters.js +50 -0
  37. package/dist/elemental-lend-v2/constants.d.ts +48 -0
  38. package/dist/elemental-lend-v2/constants.js +104 -0
  39. package/dist/elemental-lend-v2/index.d.ts +8 -0
  40. package/dist/elemental-lend-v2/index.js +24 -0
  41. package/dist/elemental-lend-v2/instructions.d.ts +96 -0
  42. package/dist/elemental-lend-v2/instructions.js +190 -0
  43. package/dist/elemental-lend-v2/lut.d.ts +20 -0
  44. package/dist/elemental-lend-v2/lut.js +65 -0
  45. package/dist/elemental-lend-v2/pda.d.ts +9 -0
  46. package/dist/elemental-lend-v2/pda.js +27 -0
  47. package/dist/elemental-lend-v2/types.d.ts +105 -0
  48. package/dist/elemental-lend-v2/types.js +2 -0
  49. package/dist/elemental-lend-v2/update-aum.d.ts +29 -0
  50. package/dist/elemental-lend-v2/update-aum.js +82 -0
  51. package/dist/index.d.ts +5 -3552
  52. package/dist/index.js +37 -4454
  53. package/dist/jlpd-strategy/accounts.d.ts +83 -0
  54. package/dist/jlpd-strategy/accounts.js +216 -0
  55. package/dist/jlpd-strategy/adapter.d.ts +81 -0
  56. package/dist/jlpd-strategy/adapter.js +118 -0
  57. package/dist/jlpd-strategy/base-to-base-swap.d.ts +74 -0
  58. package/dist/jlpd-strategy/base-to-base-swap.js +205 -0
  59. package/dist/jlpd-strategy/constants.d.ts +127 -0
  60. package/dist/jlpd-strategy/constants.js +174 -0
  61. package/dist/jlpd-strategy/fluid-view.d.ts +199 -0
  62. package/dist/jlpd-strategy/fluid-view.js +799 -0
  63. package/dist/jlpd-strategy/hedge-derived.d.ts +135 -0
  64. package/dist/jlpd-strategy/hedge-derived.js +231 -0
  65. package/dist/jlpd-strategy/hedge-instructions.d.ts +210 -0
  66. package/dist/jlpd-strategy/hedge-instructions.js +300 -0
  67. package/dist/jlpd-strategy/hedge-state.d.ts +88 -0
  68. package/dist/jlpd-strategy/hedge-state.js +110 -0
  69. package/dist/jlpd-strategy/index.d.ts +17 -0
  70. package/dist/jlpd-strategy/index.js +33 -0
  71. package/dist/jlpd-strategy/instructions.d.ts +159 -0
  72. package/dist/jlpd-strategy/instructions.js +234 -0
  73. package/dist/jlpd-strategy/jlp-borrow.d.ts +63 -0
  74. package/dist/jlpd-strategy/jlp-borrow.js +87 -0
  75. package/dist/jlpd-strategy/jlp-data.d.ts +166 -0
  76. package/dist/jlpd-strategy/jlp-data.js +611 -0
  77. package/dist/jlpd-strategy/jupusd-earn.d.ts +90 -0
  78. package/dist/jlpd-strategy/jupusd-earn.js +166 -0
  79. package/dist/jlpd-strategy/live-jlp-price.d.ts +46 -0
  80. package/dist/jlpd-strategy/live-jlp-price.js +267 -0
  81. package/dist/jlpd-strategy/pda.d.ts +13 -0
  82. package/dist/jlpd-strategy/pda.js +28 -0
  83. package/dist/jlpd-strategy/settle-yield.d.ts +45 -0
  84. package/dist/jlpd-strategy/settle-yield.js +113 -0
  85. package/dist/jlpd-strategy/swap-jlp.d.ts +198 -0
  86. package/dist/jlpd-strategy/swap-jlp.js +586 -0
  87. package/dist/jlpd-strategy/types.d.ts +101 -0
  88. package/dist/jlpd-strategy/types.js +29 -0
  89. package/dist/p-stv-core/accounts.d.ts +152 -0
  90. package/dist/p-stv-core/accounts.js +407 -0
  91. package/dist/p-stv-core/constants.d.ts +138 -0
  92. package/dist/p-stv-core/constants.js +181 -0
  93. package/dist/p-stv-core/events.d.ts +7 -0
  94. package/dist/p-stv-core/events.js +246 -0
  95. package/dist/p-stv-core/index.d.ts +11 -0
  96. package/dist/p-stv-core/index.js +27 -0
  97. package/dist/p-stv-core/instructions.d.ts +637 -0
  98. package/dist/p-stv-core/instructions.js +670 -0
  99. package/dist/p-stv-core/lut.d.ts +41 -0
  100. package/dist/p-stv-core/lut.js +81 -0
  101. package/dist/p-stv-core/pda.d.ts +30 -0
  102. package/dist/p-stv-core/pda.js +65 -0
  103. package/dist/p-stv-core/prices.d.ts +20 -0
  104. package/dist/p-stv-core/prices.js +77 -0
  105. package/dist/p-stv-core/remaining-accounts.d.ts +107 -0
  106. package/dist/p-stv-core/remaining-accounts.js +326 -0
  107. package/dist/p-stv-core/send-tx.d.ts +72 -0
  108. package/dist/p-stv-core/send-tx.js +290 -0
  109. package/dist/p-stv-core/sol-wrap.d.ts +34 -0
  110. package/dist/p-stv-core/sol-wrap.js +74 -0
  111. package/dist/p-stv-core/types.d.ts +361 -0
  112. package/dist/p-stv-core/types.js +2 -0
  113. package/package.json +56 -15
  114. package/dist/index.d.mts +0 -3552
  115. package/dist/index.mjs +0 -4363
package/dist/index.d.ts CHANGED
@@ -1,3552 +1,5 @@
1
- import { PublicKey, AddressLookupTableAccount, Connection, VersionedTransaction, TransactionInstruction } from '@solana/web3.js';
2
- import { BN, Program } from '@coral-xyz/anchor';
3
-
4
- /**
5
- * Program IDL in camelCase format in order to be used in JS/TS.
6
- *
7
- * Note that this is only a type helper and is not the actual IDL. The original
8
- * IDL can be found at `target/idl/jlp_d_program.json`.
9
- */
10
- type JlpDProgram = {
11
- "address": "ELEM2bAobpZNuysfhyF28XGVjA1aTUwm6rPYyv1JX3oq";
12
- "metadata": {
13
- "name": "jlpDProgram";
14
- "version": "0.1.0";
15
- "spec": "0.1.0";
16
- "description": "Created with Anchor";
17
- };
18
- "instructions": [
19
- {
20
- "name": "claimFees";
21
- "discriminator": [
22
- 82,
23
- 251,
24
- 233,
25
- 156,
26
- 12,
27
- 52,
28
- 184,
29
- 202
30
- ];
31
- "accounts": [
32
- {
33
- "name": "manager";
34
- "docs": [
35
- "Manager claiming fees on behalf of fee_receiver"
36
- ];
37
- "signer": true;
38
- },
39
- {
40
- "name": "jlpVault";
41
- "docs": [
42
- "The JLP Vault PDA account",
43
- "Note: PDA verified in handler via get_pda() to avoid multiple loads"
44
- ];
45
- },
46
- {
47
- "name": "stv";
48
- "docs": [
49
- "The STV PDA account",
50
- "Note: PDA verified in handler via get_pda() to avoid multiple loads"
51
- ];
52
- "writable": true;
53
- },
54
- {
55
- "name": "baseMint";
56
- "docs": [
57
- "Base asset mint"
58
- ];
59
- },
60
- {
61
- "name": "jlMint";
62
- "docs": [
63
- "jlX mint (Jupiter Lend token) - for decimals in transfer_checked"
64
- ];
65
- },
66
- {
67
- "name": "jvMint";
68
- "docs": [
69
- "jvX mint (vault share token) - for supply reading in crystallization"
70
- ];
71
- },
72
- {
73
- "name": "stvBaseAta";
74
- "docs": [
75
- "STV's base ATA (for NAV calculation)"
76
- ];
77
- },
78
- {
79
- "name": "stvJlxAta";
80
- "docs": [
81
- "STV's jlX ATA (source for fee transfer)"
82
- ];
83
- "writable": true;
84
- },
85
- {
86
- "name": "feeReceiverJlxAta";
87
- "docs": [
88
- "Fee receiver's jlX ATA (destination for fees)"
89
- ];
90
- "writable": true;
91
- },
92
- {
93
- "name": "tokenProgram";
94
- "docs": [
95
- "Token program"
96
- ];
97
- }
98
- ];
99
- "args": [];
100
- },
101
- {
102
- "name": "closeStv";
103
- "docs": [
104
- "Close an STV account and return rent to admin",
105
- "Destructive operation - use only for cleanup/migration",
106
- "",
107
- "# Safety Checks",
108
- "- Validates jvX supply is 0 (no active shares)",
109
- "- Validates base_loaned is 0 (no outstanding loans)",
110
- "- Validates accrued_fees_jlx is 0 (no unclaimed fees)"
111
- ];
112
- "discriminator": [
113
- 173,
114
- 189,
115
- 151,
116
- 131,
117
- 240,
118
- 39,
119
- 199,
120
- 147
121
- ];
122
- "accounts": [
123
- {
124
- "name": "admin";
125
- "docs": [
126
- "Admin must sign - verified via vault.has_one = admin"
127
- ];
128
- "writable": true;
129
- "signer": true;
130
- "relations": [
131
- "jlpVault"
132
- ];
133
- },
134
- {
135
- "name": "jlpVault";
136
- "docs": [
137
- "JLP Vault for admin validation"
138
- ];
139
- "pda": {
140
- "seeds": [
141
- {
142
- "kind": "const";
143
- "value": [
144
- 106,
145
- 108,
146
- 112,
147
- 95,
148
- 118,
149
- 97,
150
- 117,
151
- 108,
152
- 116
153
- ];
154
- }
155
- ];
156
- };
157
- },
158
- {
159
- "name": "stv";
160
- "docs": [
161
- "STV to close"
162
- ];
163
- "writable": true;
164
- "pda": {
165
- "seeds": [
166
- {
167
- "kind": "const";
168
- "value": [
169
- 115,
170
- 116,
171
- 118
172
- ];
173
- },
174
- {
175
- "kind": "account";
176
- "path": "baseMint";
177
- }
178
- ];
179
- };
180
- },
181
- {
182
- "name": "jvMint";
183
- "docs": [
184
- "jvX mint for this STV - used to verify no active shares"
185
- ];
186
- },
187
- {
188
- "name": "baseMint";
189
- "docs": [
190
- "Base asset mint for this STV"
191
- ];
192
- },
193
- {
194
- "name": "systemProgram";
195
- "address": "11111111111111111111111111111111";
196
- }
197
- ];
198
- "args": [];
199
- },
200
- {
201
- "name": "deposit";
202
- "docs": [
203
- "Deposit base asset into the STV and receive jvX shares",
204
- "",
205
- "# Flow",
206
- "1. Crystallize fees inline (ensures fair PPS)",
207
- "2. Transfer base asset from user to STV's base ATA",
208
- "3. Mint jvX shares to user at post-fee PPS",
209
- "",
210
- "# Note",
211
- "For pools with Jupiter Earn support (SOL, USDC), manager can later convert",
212
- "base to jlX via jup_earn_deposit_withdraw instruction.",
213
- "For pools without Jupiter Earn (BTC, ETH), base stays in STV's base ATA.",
214
- "",
215
- "Remaining accounts (optional, for exchange rate):",
216
- "[0] = Jupiter Lend lending account",
217
- "[1] = Jupiter Lend rewards rate model"
218
- ];
219
- "discriminator": [
220
- 242,
221
- 35,
222
- 198,
223
- 137,
224
- 82,
225
- 225,
226
- 242,
227
- 182
228
- ];
229
- "accounts": [
230
- {
231
- "name": "user";
232
- "docs": [
233
- "User performing the deposit"
234
- ];
235
- "writable": true;
236
- "signer": true;
237
- },
238
- {
239
- "name": "jlpVault";
240
- "docs": [
241
- "The JLP Vault PDA account",
242
- "Note: bump verified in handler after load() to avoid multiple loads"
243
- ];
244
- },
245
- {
246
- "name": "stv";
247
- "docs": [
248
- "The STV PDA account",
249
- "Note: uses base_mint account for seeds; bump verified in handler"
250
- ];
251
- "writable": true;
252
- },
253
- {
254
- "name": "baseMint";
255
- "docs": [
256
- "Base asset mint (underlying token: SOL, BTC, ETH, USDC)"
257
- ];
258
- },
259
- {
260
- "name": "jlMint";
261
- "docs": [
262
- "jlX mint (Jupiter Lend token) - used for exchange rate reading"
263
- ];
264
- },
265
- {
266
- "name": "jvMint";
267
- "docs": [
268
- "jvX mint (vault share token) - STV is mint authority",
269
- "Verified against STV.jv_mint in handler"
270
- ];
271
- "writable": true;
272
- },
273
- {
274
- "name": "userBaseAta";
275
- "docs": [
276
- "User's base asset token account (source for deposit)"
277
- ];
278
- "writable": true;
279
- },
280
- {
281
- "name": "userJvxAta";
282
- "docs": [
283
- "User's jvX token account (destination for shares)"
284
- ];
285
- "writable": true;
286
- },
287
- {
288
- "name": "stvBaseAta";
289
- "docs": [
290
- "STV's base ATA (destination for user's base tokens)"
291
- ];
292
- "writable": true;
293
- },
294
- {
295
- "name": "stvJlxAta";
296
- "docs": [
297
- "STV's jlX ATA (used for NAV calculation)"
298
- ];
299
- },
300
- {
301
- "name": "tokenProgram";
302
- "docs": [
303
- "Token program"
304
- ];
305
- }
306
- ];
307
- "args": [
308
- {
309
- "name": "amount";
310
- "type": "u64";
311
- }
312
- ];
313
- },
314
- {
315
- "name": "initOrUpdateJlpVault";
316
- "docs": [
317
- "Initialize or update the global JLP Vault",
318
- "Init: Creates vault PDA with admin, jlp_mint, base_asset_mints (immutable after init)",
319
- "Update: Modifies manager, fee_receiver, and rebalance parameters",
320
- "Note: ATAs are created externally via script"
321
- ];
322
- "discriminator": [
323
- 234,
324
- 24,
325
- 218,
326
- 120,
327
- 213,
328
- 149,
329
- 245,
330
- 213
331
- ];
332
- "accounts": [
333
- {
334
- "name": "admin";
335
- "docs": [
336
- "Admin who controls the vault"
337
- ];
338
- "writable": true;
339
- "signer": true;
340
- },
341
- {
342
- "name": "jlpVault";
343
- "docs": [
344
- "The JLP Vault PDA account (zero-copy)",
345
- "Uses init_if_needed to support both init and update paths"
346
- ];
347
- "writable": true;
348
- "pda": {
349
- "seeds": [
350
- {
351
- "kind": "const";
352
- "value": [
353
- 106,
354
- 108,
355
- 112,
356
- 95,
357
- 118,
358
- 97,
359
- 117,
360
- 108,
361
- 116
362
- ];
363
- }
364
- ];
365
- };
366
- },
367
- {
368
- "name": "systemProgram";
369
- "docs": [
370
- "System program"
371
- ];
372
- "address": "11111111111111111111111111111111";
373
- }
374
- ];
375
- "args": [
376
- {
377
- "name": "params";
378
- "type": {
379
- "defined": {
380
- "name": "initOrUpdateJlpVaultParams";
381
- };
382
- };
383
- }
384
- ];
385
- },
386
- {
387
- "name": "initializeStv";
388
- "docs": [
389
- "Initialize a Single Token Vault (STV) for a specific asset",
390
- "Creates the STV PDA, jvX mint (with STV as authority), and jlX ATA"
391
- ];
392
- "discriminator": [
393
- 136,
394
- 8,
395
- 178,
396
- 176,
397
- 57,
398
- 33,
399
- 1,
400
- 106
401
- ];
402
- "accounts": [
403
- {
404
- "name": "admin";
405
- "docs": [
406
- "Admin of the JLP Vault"
407
- ];
408
- "writable": true;
409
- "signer": true;
410
- },
411
- {
412
- "name": "jlpVault";
413
- "docs": [
414
- "The JLP Vault PDA account",
415
- "Note: PDA and admin verified in handler via get_pda() to avoid multiple loads"
416
- ];
417
- },
418
- {
419
- "name": "stv";
420
- "docs": [
421
- "The STV PDA account (zero-copy)"
422
- ];
423
- "writable": true;
424
- "pda": {
425
- "seeds": [
426
- {
427
- "kind": "const";
428
- "value": [
429
- 115,
430
- 116,
431
- 118
432
- ];
433
- },
434
- {
435
- "kind": "account";
436
- "path": "baseMint";
437
- }
438
- ];
439
- };
440
- },
441
- {
442
- "name": "baseMint";
443
- "docs": [
444
- "Base asset mint (BTC, ETH, SOL, or USDC)"
445
- ];
446
- },
447
- {
448
- "name": "jlMint";
449
- "docs": [
450
- "Jupiter Lend token mint for this asset"
451
- ];
452
- },
453
- {
454
- "name": "jvMint";
455
- "docs": [
456
- "Vault share token mint (jvX) - STV is the mint authority",
457
- "Client generates keypair and passes it as signer"
458
- ];
459
- "writable": true;
460
- "signer": true;
461
- },
462
- {
463
- "name": "stvJlxAta";
464
- "docs": [
465
- "STV's jlX ATA (holds Jupiter Lend tokens)",
466
- "Uses init_if_needed in case ATA exists from a previous STV initialization"
467
- ];
468
- "writable": true;
469
- "pda": {
470
- "seeds": [
471
- {
472
- "kind": "account";
473
- "path": "stv";
474
- },
475
- {
476
- "kind": "const";
477
- "value": [
478
- 6,
479
- 221,
480
- 246,
481
- 225,
482
- 215,
483
- 101,
484
- 161,
485
- 147,
486
- 217,
487
- 203,
488
- 225,
489
- 70,
490
- 206,
491
- 235,
492
- 121,
493
- 172,
494
- 28,
495
- 180,
496
- 133,
497
- 237,
498
- 95,
499
- 91,
500
- 55,
501
- 145,
502
- 58,
503
- 140,
504
- 245,
505
- 133,
506
- 126,
507
- 255,
508
- 0,
509
- 169
510
- ];
511
- },
512
- {
513
- "kind": "account";
514
- "path": "jlMint";
515
- }
516
- ];
517
- "program": {
518
- "kind": "const";
519
- "value": [
520
- 140,
521
- 151,
522
- 37,
523
- 143,
524
- 78,
525
- 36,
526
- 137,
527
- 241,
528
- 187,
529
- 61,
530
- 16,
531
- 41,
532
- 20,
533
- 142,
534
- 13,
535
- 131,
536
- 11,
537
- 90,
538
- 19,
539
- 153,
540
- 218,
541
- 255,
542
- 16,
543
- 132,
544
- 4,
545
- 142,
546
- 123,
547
- 216,
548
- 219,
549
- 233,
550
- 248,
551
- 89
552
- ];
553
- };
554
- };
555
- },
556
- {
557
- "name": "systemProgram";
558
- "docs": [
559
- "System program"
560
- ];
561
- "address": "11111111111111111111111111111111";
562
- },
563
- {
564
- "name": "tokenProgram";
565
- "docs": [
566
- "Token program"
567
- ];
568
- },
569
- {
570
- "name": "associatedTokenProgram";
571
- "docs": [
572
- "Associated token program"
573
- ];
574
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
575
- },
576
- {
577
- "name": "rent";
578
- "docs": [
579
- "Rent sysvar"
580
- ];
581
- "address": "SysvarRent111111111111111111111111111111111";
582
- }
583
- ];
584
- "args": [
585
- {
586
- "name": "params";
587
- "type": {
588
- "defined": {
589
- "name": "initializeStvParams";
590
- };
591
- };
592
- }
593
- ];
594
- },
595
- {
596
- "name": "jupEarnDepositWithdraw";
597
- "docs": [
598
- "Deposit base to or withdraw from Jupiter Earn",
599
- "",
600
- "Manager-only operation to convert between base asset and jlX tokens",
601
- "via Jupiter Lend. This is used for pools that support Jupiter Earn",
602
- "(SOL, USDC) to earn yield on idle funds.",
603
- "",
604
- "# Directions",
605
- "- Deposit: Convert base asset -> jlX (earn Jupiter Earn yield)",
606
- "- Withdraw: Convert jlX -> base asset (provide withdrawal liquidity)",
607
- "",
608
- "# Use Cases",
609
- "- After user deposits, manager can deposit base to Jupiter Earn",
610
- "- Before user withdrawals, manager can withdraw from Jupiter Earn",
611
- "- BTC/ETH pools cannot use Jupiter Earn (not supported)",
612
- "",
613
- "# Remaining Accounts",
614
- "- Deposit: 17 Jupiter Lend accounts (see jup_lend::deposit_accounts)",
615
- "- Withdraw: 18 Jupiter Lend accounts (see jup_lend::withdraw_accounts)"
616
- ];
617
- "discriminator": [
618
- 124,
619
- 60,
620
- 71,
621
- 122,
622
- 162,
623
- 212,
624
- 164,
625
- 191
626
- ];
627
- "accounts": [
628
- {
629
- "name": "manager";
630
- "docs": [
631
- "Manager performing the operation"
632
- ];
633
- "signer": true;
634
- },
635
- {
636
- "name": "jlpVault";
637
- "docs": [
638
- "The JLP Vault PDA account",
639
- "Note: PDA and manager verified in handler"
640
- ];
641
- },
642
- {
643
- "name": "stv";
644
- "docs": [
645
- "The STV PDA account",
646
- "Note: PDA verified in handler"
647
- ];
648
- },
649
- {
650
- "name": "baseMint";
651
- "docs": [
652
- "Using UncheckedAccount to avoid borrow conflicts with Jupiter Lend CPI"
653
- ];
654
- },
655
- {
656
- "name": "jlMint";
657
- "docs": [
658
- "Using UncheckedAccount to avoid borrow conflicts with Jupiter Lend CPI"
659
- ];
660
- "writable": true;
661
- },
662
- {
663
- "name": "stvBaseAta";
664
- "docs": [
665
- "Using UncheckedAccount to avoid borrow conflicts with Jupiter Lend CPI"
666
- ];
667
- "writable": true;
668
- },
669
- {
670
- "name": "stvJlxAta";
671
- "docs": [
672
- "Using UncheckedAccount to avoid borrow conflicts with Jupiter Lend CPI"
673
- ];
674
- "writable": true;
675
- },
676
- {
677
- "name": "tokenProgram";
678
- "docs": [
679
- "Token program - used to validate ATA ownership"
680
- ];
681
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
682
- }
683
- ];
684
- "args": [
685
- {
686
- "name": "params";
687
- "type": {
688
- "defined": {
689
- "name": "jupEarnParams";
690
- };
691
- };
692
- }
693
- ];
694
- },
695
- {
696
- "name": "moveStvToFromVault";
697
- "docs": [
698
- "Move jlX tokens between STV and JLPVault staging ATA",
699
- "Direction::ToVault: STV jlX ATA -> Vault staging ATA (preparation for swap)",
700
- "Direction::FromVault: Vault staging ATA -> STV jlX ATA (return after swap/unwind)",
701
- "",
702
- "Remaining accounts (optional, for pools with Jupiter Earn):",
703
- "[0] = Jupiter Lend lending account (for exchange rate)",
704
- "[1] = Jupiter Lend rewards rate model (for exchange rate)",
705
- "",
706
- "For base-only pools (BTC, ETH where jl_mint == base_mint):",
707
- "No remaining accounts needed - uses 1.0 exchange rate"
708
- ];
709
- "discriminator": [
710
- 60,
711
- 104,
712
- 8,
713
- 126,
714
- 254,
715
- 244,
716
- 95,
717
- 221
718
- ];
719
- "accounts": [
720
- {
721
- "name": "manager";
722
- "docs": [
723
- "Manager performing the operation"
724
- ];
725
- "signer": true;
726
- },
727
- {
728
- "name": "jlpVault";
729
- "docs": [
730
- "The JLP Vault PDA account",
731
- "Note: PDA and manager verified in handler via get_pda() to avoid multiple loads"
732
- ];
733
- },
734
- {
735
- "name": "stv";
736
- "docs": [
737
- "The STV PDA account (mutable to update base_loaned)",
738
- "Note: PDA verified in handler via get_pda() to avoid multiple loads"
739
- ];
740
- "writable": true;
741
- },
742
- {
743
- "name": "baseMint";
744
- "docs": [
745
- "Base asset mint (for detection of base-only pools)"
746
- ];
747
- },
748
- {
749
- "name": "jlMint";
750
- "docs": [
751
- "jlX mint (for decimals in transfer_checked)",
752
- "For base-only pools (BTC, ETH), jl_mint == base_mint"
753
- ];
754
- },
755
- {
756
- "name": "stvJlxAta";
757
- "docs": [
758
- "STV's jlX ATA",
759
- "For base-only pools, this is the base ATA (jl_mint == base_mint)"
760
- ];
761
- "writable": true;
762
- },
763
- {
764
- "name": "vaultStagingAta";
765
- "docs": [
766
- "Vault's staging jlX ATA (for this specific jl_mint)",
767
- "For base-only pools, this is the staging base ATA"
768
- ];
769
- "writable": true;
770
- },
771
- {
772
- "name": "tokenProgram";
773
- "docs": [
774
- "Token program"
775
- ];
776
- }
777
- ];
778
- "args": [
779
- {
780
- "name": "params";
781
- "type": {
782
- "defined": {
783
- "name": "moveJlxParams";
784
- };
785
- };
786
- }
787
- ];
788
- },
789
- {
790
- "name": "settleYield";
791
- "docs": [
792
- "Settle yield/loss from JLP positions across all STVs",
793
- "Called periodically (~8 hours) to update all STV values based on JLP performance",
794
- "",
795
- "# USD-Based Settlement",
796
- "1. Values total vault holdings (JLP + staging jlX) in USD using oracles",
797
- "2. Values total base_loaned across all STVs in USD",
798
- "3. Distributes surplus (yield) or deficit (bad debt) proportionally",
799
- "",
800
- "# Security",
801
- "- BTC/ETH/SOL prices come from Doves oracles (manipulation-resistant)",
802
- "- JLP price computed directly from Jupiter Perps Pool account (aumUsd / jlp_supply)",
803
- "- Exchange rates come from Jupiter Earn (audited, TWAP-based)",
804
- "- Distribution is proportional to each STV's share of total loans",
805
- "",
806
- "# Accounts",
807
- "Requires all 5 STVs, 5 staging jlX ATAs, 3 Doves oracles (BTC/ETH/SOL),",
808
- "Jupiter Perps Pool account, JLP mint account",
809
- "",
810
- "# Remaining Accounts (15 accounts)",
811
- "For exchange rate calculation with time-accrued rewards:",
812
- "- [0-4]: Jupiter Lend lending accounts (BTC, ETH, SOL, USDC, JupUSD)",
813
- "- [5-9]: Jupiter Lend rewards rate model accounts (BTC, ETH, SOL, USDC, JupUSD)",
814
- "- [10-14]: jlX mint accounts (jlBTC, jlETH, jlSOL, jlUSDC, jlJupUSD)"
815
- ];
816
- "discriminator": [
817
- 64,
818
- 28,
819
- 44,
820
- 24,
821
- 43,
822
- 204,
823
- 58,
824
- 215
825
- ];
826
- "accounts": [
827
- {
828
- "name": "jlpVault";
829
- "writable": true;
830
- },
831
- {
832
- "name": "vaultJlpAta";
833
- "docs": [
834
- "JLP token account owned by vault"
835
- ];
836
- },
837
- {
838
- "name": "stv0";
839
- "writable": true;
840
- },
841
- {
842
- "name": "stv1";
843
- "writable": true;
844
- },
845
- {
846
- "name": "stv2";
847
- "writable": true;
848
- },
849
- {
850
- "name": "stv3";
851
- "writable": true;
852
- },
853
- {
854
- "name": "stv4";
855
- "writable": true;
856
- },
857
- {
858
- "name": "stagingJlx0";
859
- },
860
- {
861
- "name": "stagingJlx1";
862
- },
863
- {
864
- "name": "stagingJlx2";
865
- },
866
- {
867
- "name": "stagingJlx3";
868
- },
869
- {
870
- "name": "stagingJlx4";
871
- },
872
- {
873
- "name": "dovesBtcUsd";
874
- },
875
- {
876
- "name": "dovesEthUsd";
877
- },
878
- {
879
- "name": "dovesSolUsd";
880
- },
881
- {
882
- "name": "jlpPool";
883
- },
884
- {
885
- "name": "jlpMintAccount";
886
- },
887
- {
888
- "name": "manager";
889
- "docs": [
890
- "Manager who can perform rebalance operations (verified in handler)"
891
- ];
892
- "signer": true;
893
- }
894
- ];
895
- "args": [];
896
- },
897
- {
898
- "name": "swapJlxToFromJlp";
899
- "docs": [
900
- "Swap between different jlX types (e.g., jlSOL -> jlUSDC) via Jupiter",
901
- "Manager-only operation for rebalancing vault composition",
902
- "",
903
- "Remaining accounts: Jupiter swap accounts from API (varies based on route)",
904
- "Swap between jlX and JLP tokens via Jupiter",
905
- "JlxToJlp: Swap jlX -> JLP (increase vault JLP balance)",
906
- "JlpToJlx: Swap JLP -> jlX (decrease vault JLP balance)",
907
- "Manager-only operation for JLP position management",
908
- "",
909
- "Note: JLP positions are tracked via STV.base_loaned and settled",
910
- "using settle_yield with Doves oracle prices (USD-based settlement).",
911
- "",
912
- "Remaining accounts: Jupiter swap accounts from API (varies based on route)"
913
- ];
914
- "discriminator": [
915
- 229,
916
- 185,
917
- 136,
918
- 170,
919
- 210,
920
- 189,
921
- 172,
922
- 241
923
- ];
924
- "accounts": [
925
- {
926
- "name": "manager";
927
- "docs": [
928
- "Manager performing the swap"
929
- ];
930
- "signer": true;
931
- },
932
- {
933
- "name": "jlpVault";
934
- "docs": [
935
- "The JLP Vault PDA account",
936
- "Note: PDA and manager verified in handler via get_pda() to avoid multiple loads"
937
- ];
938
- },
939
- {
940
- "name": "vaultJlxAta";
941
- "docs": [
942
- "Vault's staging jlX ATA (source for JlxToJlp, dest for JlpToJlx)",
943
- "This is the jlX token that corresponds to stv_index"
944
- ];
945
- "writable": true;
946
- },
947
- {
948
- "name": "vaultJlpAta";
949
- "docs": [
950
- "Vault's JLP ATA (dest for JlxToJlp, source for JlpToJlx)"
951
- ];
952
- "writable": true;
953
- },
954
- {
955
- "name": "jlpMint";
956
- "docs": [
957
- "JLP mint"
958
- ];
959
- },
960
- {
961
- "name": "tokenProgram";
962
- "docs": [
963
- "Token program"
964
- ];
965
- },
966
- {
967
- "name": "jupiterProgram";
968
- "docs": [
969
- "Jupiter aggregator program"
970
- ];
971
- }
972
- ];
973
- "args": [
974
- {
975
- "name": "params";
976
- "type": {
977
- "defined": {
978
- "name": "swapJlxJlpParams";
979
- };
980
- };
981
- }
982
- ];
983
- },
984
- {
985
- "name": "updateStv";
986
- "docs": [
987
- "Update STV parameters including fees and flags",
988
- "Admin-only operation to modify STV configuration"
989
- ];
990
- "discriminator": [
991
- 72,
992
- 173,
993
- 200,
994
- 203,
995
- 74,
996
- 83,
997
- 242,
998
- 43
999
- ];
1000
- "accounts": [
1001
- {
1002
- "name": "admin";
1003
- "docs": [
1004
- "Admin of the JLP Vault"
1005
- ];
1006
- "writable": true;
1007
- "signer": true;
1008
- },
1009
- {
1010
- "name": "jlpVault";
1011
- "docs": [
1012
- "The JLP Vault PDA account",
1013
- "Note: PDA and admin verified in handler via get_pda() to avoid multiple loads"
1014
- ];
1015
- },
1016
- {
1017
- "name": "stv";
1018
- "docs": [
1019
- "The STV PDA account to update",
1020
- "Note: PDA verified in handler via get_pda() to avoid multiple loads"
1021
- ];
1022
- "writable": true;
1023
- }
1024
- ];
1025
- "args": [
1026
- {
1027
- "name": "params";
1028
- "type": {
1029
- "defined": {
1030
- "name": "updateStvParams";
1031
- };
1032
- };
1033
- }
1034
- ];
1035
- },
1036
- {
1037
- "name": "withdraw";
1038
- "docs": [
1039
- "Withdraw base asset by burning jvX shares",
1040
- "",
1041
- "# Flow",
1042
- "1. Crystallize fees inline (ensures fair PPS)",
1043
- "2. Calculate base amount from shares at post-fee PPS",
1044
- "3. Burn jvX shares from user",
1045
- "4. Transfer base from STV's base ATA to user",
1046
- "",
1047
- "# Note",
1048
- "Requires sufficient base balance in STV's base ATA.",
1049
- "Manager must ensure liquidity by converting jlX to base via",
1050
- "jup_earn_deposit_withdraw instruction before user withdrawals.",
1051
- "",
1052
- "Remaining accounts (optional, for exchange rate):",
1053
- "[0] = Jupiter Lend lending account",
1054
- "[1] = Jupiter Lend rewards rate model"
1055
- ];
1056
- "discriminator": [
1057
- 183,
1058
- 18,
1059
- 70,
1060
- 156,
1061
- 148,
1062
- 109,
1063
- 161,
1064
- 34
1065
- ];
1066
- "accounts": [
1067
- {
1068
- "name": "user";
1069
- "docs": [
1070
- "User performing the withdrawal"
1071
- ];
1072
- "writable": true;
1073
- "signer": true;
1074
- },
1075
- {
1076
- "name": "jlpVault";
1077
- "docs": [
1078
- "The JLP Vault PDA account",
1079
- "Note: PDA verified in handler via get_pda() to avoid multiple loads"
1080
- ];
1081
- },
1082
- {
1083
- "name": "stv";
1084
- "docs": [
1085
- "The STV PDA account",
1086
- "Note: PDA verified in handler via get_pda() to avoid multiple loads"
1087
- ];
1088
- "writable": true;
1089
- },
1090
- {
1091
- "name": "baseMint";
1092
- "docs": [
1093
- "Base asset mint (underlying token: SOL, BTC, ETH, USDC)"
1094
- ];
1095
- },
1096
- {
1097
- "name": "jlMint";
1098
- "docs": [
1099
- "jlX mint (Jupiter Lend token) - used for NAV calculation"
1100
- ];
1101
- },
1102
- {
1103
- "name": "jvMint";
1104
- "docs": [
1105
- "jvX mint (vault share token) - STV is mint authority",
1106
- "Verified against STV.jv_mint in handler"
1107
- ];
1108
- "writable": true;
1109
- },
1110
- {
1111
- "name": "userBaseAta";
1112
- "docs": [
1113
- "User's base asset token account (destination for withdrawal)"
1114
- ];
1115
- "writable": true;
1116
- },
1117
- {
1118
- "name": "userJvxAta";
1119
- "docs": [
1120
- "User's jvX token account (source - shares to burn)"
1121
- ];
1122
- "writable": true;
1123
- },
1124
- {
1125
- "name": "stvBaseAta";
1126
- "docs": [
1127
- "STV's base ATA (source for base tokens to user)"
1128
- ];
1129
- "writable": true;
1130
- },
1131
- {
1132
- "name": "stvJlxAta";
1133
- "docs": [
1134
- "STV's jlX ATA (used for NAV calculation)"
1135
- ];
1136
- },
1137
- {
1138
- "name": "tokenProgram";
1139
- "docs": [
1140
- "Token program"
1141
- ];
1142
- }
1143
- ];
1144
- "args": [
1145
- {
1146
- "name": "sharesToBurn";
1147
- "type": "u64";
1148
- }
1149
- ];
1150
- }
1151
- ];
1152
- "accounts": [
1153
- {
1154
- "name": "jlpVault";
1155
- "discriminator": [
1156
- 41,
1157
- 108,
1158
- 189,
1159
- 168,
1160
- 199,
1161
- 152,
1162
- 221,
1163
- 119
1164
- ];
1165
- },
1166
- {
1167
- "name": "stv";
1168
- "discriminator": [
1169
- 214,
1170
- 2,
1171
- 96,
1172
- 41,
1173
- 85,
1174
- 163,
1175
- 17,
1176
- 230
1177
- ];
1178
- }
1179
- ];
1180
- "events": [
1181
- {
1182
- "name": "deposited";
1183
- "discriminator": [
1184
- 111,
1185
- 141,
1186
- 26,
1187
- 45,
1188
- 161,
1189
- 35,
1190
- 100,
1191
- 57
1192
- ];
1193
- },
1194
- {
1195
- "name": "feesClaimSkipped";
1196
- "discriminator": [
1197
- 7,
1198
- 214,
1199
- 20,
1200
- 27,
1201
- 90,
1202
- 132,
1203
- 198,
1204
- 77
1205
- ];
1206
- },
1207
- {
1208
- "name": "feesClaimed";
1209
- "discriminator": [
1210
- 22,
1211
- 104,
1212
- 110,
1213
- 222,
1214
- 38,
1215
- 157,
1216
- 14,
1217
- 62
1218
- ];
1219
- },
1220
- {
1221
- "name": "jlpSwapped";
1222
- "discriminator": [
1223
- 253,
1224
- 47,
1225
- 169,
1226
- 18,
1227
- 222,
1228
- 203,
1229
- 169,
1230
- 15
1231
- ];
1232
- },
1233
- {
1234
- "name": "jlpVaultInitialized";
1235
- "discriminator": [
1236
- 52,
1237
- 94,
1238
- 202,
1239
- 211,
1240
- 2,
1241
- 98,
1242
- 77,
1243
- 229
1244
- ];
1245
- },
1246
- {
1247
- "name": "jlpVaultUpdated";
1248
- "discriminator": [
1249
- 20,
1250
- 204,
1251
- 5,
1252
- 243,
1253
- 122,
1254
- 9,
1255
- 109,
1256
- 130
1257
- ];
1258
- },
1259
- {
1260
- "name": "jlxMoved";
1261
- "discriminator": [
1262
- 251,
1263
- 80,
1264
- 253,
1265
- 180,
1266
- 106,
1267
- 69,
1268
- 129,
1269
- 70
1270
- ];
1271
- },
1272
- {
1273
- "name": "jlxSwapped";
1274
- "discriminator": [
1275
- 200,
1276
- 218,
1277
- 196,
1278
- 94,
1279
- 186,
1280
- 141,
1281
- 86,
1282
- 223
1283
- ];
1284
- },
1285
- {
1286
- "name": "jupEarnEvent";
1287
- "discriminator": [
1288
- 138,
1289
- 10,
1290
- 64,
1291
- 209,
1292
- 244,
1293
- 49,
1294
- 1,
1295
- 188
1296
- ];
1297
- },
1298
- {
1299
- "name": "settleYieldEvent";
1300
- "discriminator": [
1301
- 208,
1302
- 142,
1303
- 20,
1304
- 32,
1305
- 204,
1306
- 216,
1307
- 242,
1308
- 189
1309
- ];
1310
- },
1311
- {
1312
- "name": "settleYieldSkipped";
1313
- "discriminator": [
1314
- 189,
1315
- 221,
1316
- 140,
1317
- 115,
1318
- 37,
1319
- 102,
1320
- 42,
1321
- 195
1322
- ];
1323
- },
1324
- {
1325
- "name": "settleYieldStvEvent";
1326
- "discriminator": [
1327
- 12,
1328
- 42,
1329
- 226,
1330
- 95,
1331
- 60,
1332
- 95,
1333
- 192,
1334
- 238
1335
- ];
1336
- },
1337
- {
1338
- "name": "stvInitialized";
1339
- "discriminator": [
1340
- 41,
1341
- 106,
1342
- 196,
1343
- 230,
1344
- 138,
1345
- 22,
1346
- 195,
1347
- 188
1348
- ];
1349
- },
1350
- {
1351
- "name": "stvUpdated";
1352
- "discriminator": [
1353
- 108,
1354
- 129,
1355
- 139,
1356
- 80,
1357
- 212,
1358
- 111,
1359
- 83,
1360
- 199
1361
- ];
1362
- },
1363
- {
1364
- "name": "withdrawn";
1365
- "discriminator": [
1366
- 20,
1367
- 89,
1368
- 223,
1369
- 198,
1370
- 194,
1371
- 124,
1372
- 219,
1373
- 13
1374
- ];
1375
- }
1376
- ];
1377
- "errors": [
1378
- {
1379
- "code": 6000;
1380
- "name": "unauthorized";
1381
- "msg": "Unauthorized: not admin";
1382
- },
1383
- {
1384
- "code": 6001;
1385
- "name": "notManager";
1386
- "msg": "Unauthorized: not manager";
1387
- },
1388
- {
1389
- "code": 6002;
1390
- "name": "vaultPaused";
1391
- "msg": "Vault is paused";
1392
- },
1393
- {
1394
- "code": 6003;
1395
- "name": "depositsDisabled";
1396
- "msg": "Deposits disabled";
1397
- },
1398
- {
1399
- "code": 6004;
1400
- "name": "withdrawalsDisabled";
1401
- "msg": "Withdrawals disabled";
1402
- },
1403
- {
1404
- "code": 6005;
1405
- "name": "jlpDisabled";
1406
- "msg": "JLP operations disabled";
1407
- },
1408
- {
1409
- "code": 6006;
1410
- "name": "rebalanceDisabled";
1411
- "msg": "Rebalance operations disabled";
1412
- },
1413
- {
1414
- "code": 6007;
1415
- "name": "mathOverflow";
1416
- "msg": "Math overflow";
1417
- },
1418
- {
1419
- "code": 6008;
1420
- "name": "invalidTimestamp";
1421
- "msg": "Invalid timestamp";
1422
- },
1423
- {
1424
- "code": 6009;
1425
- "name": "divisionByZero";
1426
- "msg": "Division by zero";
1427
- },
1428
- {
1429
- "code": 6010;
1430
- "name": "stagingNotZero";
1431
- "msg": "Staging ATAs must be zero";
1432
- },
1433
- {
1434
- "code": 6011;
1435
- "name": "insufficientLiquidity";
1436
- "msg": "Insufficient liquidity for withdrawal";
1437
- },
1438
- {
1439
- "code": 6012;
1440
- "name": "insufficientBalance";
1441
- "msg": "Insufficient balance";
1442
- },
1443
- {
1444
- "code": 6013;
1445
- "name": "slippageExceeded";
1446
- "msg": "Slippage exceeded";
1447
- },
1448
- {
1449
- "code": 6014;
1450
- "name": "invalidJlpVaultBump";
1451
- "msg": "Invalid JLP vault PDA bump";
1452
- },
1453
- {
1454
- "code": 6015;
1455
- "name": "invalidStvBump";
1456
- "msg": "Invalid STV PDA bump";
1457
- },
1458
- {
1459
- "code": 6016;
1460
- "name": "invalidJlMint";
1461
- "msg": "Invalid jlX mint (Jupiter Lend token)";
1462
- },
1463
- {
1464
- "code": 6017;
1465
- "name": "invalidJvMint";
1466
- "msg": "Invalid jvX mint (vault share token)";
1467
- },
1468
- {
1469
- "code": 6018;
1470
- "name": "invalidBaseMint";
1471
- "msg": "Invalid base asset mint";
1472
- },
1473
- {
1474
- "code": 6019;
1475
- "name": "invalidJlpMint";
1476
- "msg": "Invalid JLP mint";
1477
- },
1478
- {
1479
- "code": 6020;
1480
- "name": "invalidOwner";
1481
- "msg": "Invalid account owner";
1482
- },
1483
- {
1484
- "code": 6021;
1485
- "name": "invalidStvIndex";
1486
- "msg": "Invalid STV index";
1487
- },
1488
- {
1489
- "code": 6022;
1490
- "name": "invalidFeeParams";
1491
- "msg": "Invalid fee parameters";
1492
- },
1493
- {
1494
- "code": 6023;
1495
- "name": "amountTooSmall";
1496
- "msg": "Amount too small";
1497
- },
1498
- {
1499
- "code": 6024;
1500
- "name": "zeroAmount";
1501
- "msg": "Zero amount not allowed";
1502
- },
1503
- {
1504
- "code": 6025;
1505
- "name": "feeCapExceeded";
1506
- "msg": "Fee cap exceeded";
1507
- },
1508
- {
1509
- "code": 6026;
1510
- "name": "mintMismatch";
1511
- "msg": "Mint mismatch";
1512
- },
1513
- {
1514
- "code": 6027;
1515
- "name": "insufficientAccounts";
1516
- "msg": "Insufficient accounts provided";
1517
- },
1518
- {
1519
- "code": 6028;
1520
- "name": "invalidProgram";
1521
- "msg": "Invalid program ID";
1522
- },
1523
- {
1524
- "code": 6029;
1525
- "name": "invalidSwapDiscriminator";
1526
- "msg": "Invalid swap discriminator";
1527
- },
1528
- {
1529
- "code": 6030;
1530
- "name": "maxDepositExceeded";
1531
- "msg": "Deposit exceeds maximum allowed";
1532
- },
1533
- {
1534
- "code": 6031;
1535
- "name": "invalidLendingAccount";
1536
- "msg": "Invalid Jupiter Lend lending account";
1537
- },
1538
- {
1539
- "code": 6032;
1540
- "name": "missingExchangeRateAccounts";
1541
- "msg": "Missing exchange rate accounts - lending and rewards_rate_model required for pools with Jupiter Earn";
1542
- },
1543
- {
1544
- "code": 6033;
1545
- "name": "jupiterLendCpiFailed";
1546
- "msg": "Jupiter Lend CPI failed";
1547
- },
1548
- {
1549
- "code": 6034;
1550
- "name": "jupiterSwapCpiFailed";
1551
- "msg": "Jupiter swap CPI failed";
1552
- },
1553
- {
1554
- "code": 6035;
1555
- "name": "oracleStale";
1556
- "msg": "Oracle price is stale - older than staleness threshold";
1557
- },
1558
- {
1559
- "code": 6036;
1560
- "name": "oraclePriceNegative";
1561
- "msg": "Oracle returned negative price";
1562
- },
1563
- {
1564
- "code": 6037;
1565
- "name": "invalidBaseAssetIndex";
1566
- "msg": "Invalid base asset index";
1567
- },
1568
- {
1569
- "code": 6038;
1570
- "name": "priceFeedMismatch";
1571
- "msg": "Price feed mismatch";
1572
- },
1573
- {
1574
- "code": 6039;
1575
- "name": "oracleAccountInvalid";
1576
- "msg": "Oracle account invalid";
1577
- },
1578
- {
1579
- "code": 6040;
1580
- "name": "invalidAccountData";
1581
- "msg": "Invalid account data - could not parse account";
1582
- },
1583
- {
1584
- "code": 6041;
1585
- "name": "invalidExchangeRate";
1586
- "msg": "Invalid exchange rate from Jupiter Lend";
1587
- },
1588
- {
1589
- "code": 6042;
1590
- "name": "invalidOracleAccount";
1591
- "msg": "Invalid oracle account - not owned by expected program";
1592
- },
1593
- {
1594
- "code": 6043;
1595
- "name": "jlpPriceOutOfRange";
1596
- "msg": "JLP price out of reasonable range ($0.50 - $50.00)";
1597
- },
1598
- {
1599
- "code": 6044;
1600
- "name": "testModeRequired";
1601
- "msg": "Test mode required: FLAG_TEST_MODE must be set for devnet/localnet builds";
1602
- },
1603
- {
1604
- "code": 6045;
1605
- "name": "notAdmin";
1606
- "msg": "Unauthorized: not admin";
1607
- }
1608
- ];
1609
- "types": [
1610
- {
1611
- "name": "deposited";
1612
- "type": {
1613
- "kind": "struct";
1614
- "fields": [
1615
- {
1616
- "name": "stv";
1617
- "type": "pubkey";
1618
- },
1619
- {
1620
- "name": "user";
1621
- "type": "pubkey";
1622
- },
1623
- {
1624
- "name": "amountBase";
1625
- "docs": [
1626
- "Amount of base asset deposited"
1627
- ];
1628
- "type": "u64";
1629
- },
1630
- {
1631
- "name": "sharesMinted";
1632
- "type": "u64";
1633
- },
1634
- {
1635
- "name": "pps";
1636
- "type": "u64";
1637
- }
1638
- ];
1639
- };
1640
- },
1641
- {
1642
- "name": "direction";
1643
- "docs": [
1644
- "Direction of jlX token movement between STV and Vault"
1645
- ];
1646
- "type": {
1647
- "kind": "enum";
1648
- "variants": [
1649
- {
1650
- "name": "toVault";
1651
- },
1652
- {
1653
- "name": "fromVault";
1654
- }
1655
- ];
1656
- };
1657
- },
1658
- {
1659
- "name": "feesClaimSkipped";
1660
- "docs": [
1661
- "Event emitted when claim_fees returns early (no fees to claim)"
1662
- ];
1663
- "type": {
1664
- "kind": "struct";
1665
- "fields": [
1666
- {
1667
- "name": "stv";
1668
- "docs": [
1669
- "The STV account"
1670
- ];
1671
- "type": "pubkey";
1672
- },
1673
- {
1674
- "name": "reason";
1675
- "docs": [
1676
- "Reason for skipping: \"NoFeesToClaim\""
1677
- ];
1678
- "type": "string";
1679
- }
1680
- ];
1681
- };
1682
- },
1683
- {
1684
- "name": "feesClaimed";
1685
- "docs": [
1686
- "Fee claim event - when manager claims accrued fees"
1687
- ];
1688
- "type": {
1689
- "kind": "struct";
1690
- "fields": [
1691
- {
1692
- "name": "stv";
1693
- "type": "pubkey";
1694
- },
1695
- {
1696
- "name": "amountJlx";
1697
- "docs": [
1698
- "Total jlX claimed by fee receiver"
1699
- ];
1700
- "type": "u64";
1701
- },
1702
- {
1703
- "name": "feeReceiver";
1704
- "docs": [
1705
- "Fee receiver who received the fees"
1706
- ];
1707
- "type": "pubkey";
1708
- }
1709
- ];
1710
- };
1711
- },
1712
- {
1713
- "name": "initOrUpdateJlpVaultParams";
1714
- "docs": [
1715
- "Parameters for initializing or updating the JLP Vault"
1716
- ];
1717
- "type": {
1718
- "kind": "struct";
1719
- "fields": [
1720
- {
1721
- "name": "jlpMint";
1722
- "docs": [
1723
- "JLP token mint - required for init, ignored on update"
1724
- ];
1725
- "type": {
1726
- "option": "pubkey";
1727
- };
1728
- },
1729
- {
1730
- "name": "baseAssetMints";
1731
- "docs": [
1732
- "Base asset token mints [BTC, ETH, SOL, USDC, JupUSD] - required for init, ignored on update"
1733
- ];
1734
- "type": {
1735
- "option": {
1736
- "array": [
1737
- "pubkey",
1738
- 5
1739
- ];
1740
- };
1741
- };
1742
- },
1743
- {
1744
- "name": "jlxAssetMints";
1745
- "docs": [
1746
- "jlX token mints [jlBTC, jlETH, jlSOL, jlUSDC, jlJupUSD] - required for init, ignored on update"
1747
- ];
1748
- "type": {
1749
- "option": {
1750
- "array": [
1751
- "pubkey",
1752
- 5
1753
- ];
1754
- };
1755
- };
1756
- },
1757
- {
1758
- "name": "newAdmin";
1759
- "docs": [
1760
- "New admin address - if Some, transfers admin ownership (only current admin can do this)"
1761
- ];
1762
- "type": {
1763
- "option": "pubkey";
1764
- };
1765
- },
1766
- {
1767
- "name": "manager";
1768
- "docs": [
1769
- "Manager address (can perform rebalance operations)"
1770
- ];
1771
- "type": "pubkey";
1772
- },
1773
- {
1774
- "name": "feeReceiver";
1775
- "docs": [
1776
- "Fee receiver address"
1777
- ];
1778
- "type": "pubkey";
1779
- },
1780
- {
1781
- "name": "flags";
1782
- "docs": [
1783
- "Vault flags (paused, deposits disabled, etc.)"
1784
- ];
1785
- "type": "u16";
1786
- },
1787
- {
1788
- "name": "jlpSlippageBps";
1789
- "docs": [
1790
- "JLP swap slippage tolerance in basis points (e.g., 100 = 1%)"
1791
- ];
1792
- "type": "u16";
1793
- },
1794
- {
1795
- "name": "oracleStalenessThreshold";
1796
- "docs": [
1797
- "Maximum age in seconds for Doves oracle prices to be considered valid.",
1798
- "On init: defaults to 60 seconds if None.",
1799
- "On update: if None, keeps existing value; if Some, updates to new value."
1800
- ];
1801
- "type": {
1802
- "option": "u64";
1803
- };
1804
- }
1805
- ];
1806
- };
1807
- },
1808
- {
1809
- "name": "initializeStvParams";
1810
- "docs": [
1811
- "Parameters for initializing an STV"
1812
- ];
1813
- "type": {
1814
- "kind": "struct";
1815
- "fields": [
1816
- {
1817
- "name": "mgmtFeeBps";
1818
- "docs": [
1819
- "Management fee in basis points (annual)"
1820
- ];
1821
- "type": "u16";
1822
- },
1823
- {
1824
- "name": "perfFeeBps";
1825
- "docs": [
1826
- "Performance fee in basis points"
1827
- ];
1828
- "type": "u16";
1829
- },
1830
- {
1831
- "name": "maxDeposit";
1832
- "docs": [
1833
- "Maximum deposit amount in base asset (0 = unlimited)"
1834
- ];
1835
- "type": "u64";
1836
- },
1837
- {
1838
- "name": "minDeposit";
1839
- "docs": [
1840
- "Minimum deposit amount in base asset (0 = no minimum)"
1841
- ];
1842
- "type": "u64";
1843
- }
1844
- ];
1845
- };
1846
- },
1847
- {
1848
- "name": "jlpVault";
1849
- "docs": [
1850
- "JLPVault - Global vault configuration account",
1851
- "Seeds: [\"jlp_vault\"]",
1852
- "Size: 8 (discriminator) + 464 (data) = 472 bytes",
1853
- "",
1854
- "## USD-Based Settlement Model",
1855
- "This vault uses USD-based settlement where JLP positions are tracked via",
1856
- "each STV's `base_loaned` field. Yield is settled by marking `base_loaned`",
1857
- "to market using Doves oracle prices."
1858
- ];
1859
- "serialization": "bytemuck";
1860
- "repr": {
1861
- "kind": "c";
1862
- };
1863
- "type": {
1864
- "kind": "struct";
1865
- "fields": [
1866
- {
1867
- "name": "admin";
1868
- "docs": [
1869
- "Admin who can update vault configuration"
1870
- ];
1871
- "type": "pubkey";
1872
- },
1873
- {
1874
- "name": "manager";
1875
- "docs": [
1876
- "Manager who can perform rebalance operations"
1877
- ];
1878
- "type": "pubkey";
1879
- },
1880
- {
1881
- "name": "feeReceiver";
1882
- "docs": [
1883
- "Account that receives fees"
1884
- ];
1885
- "type": "pubkey";
1886
- },
1887
- {
1888
- "name": "jlpMint";
1889
- "docs": [
1890
- "JLP token mint address"
1891
- ];
1892
- "type": "pubkey";
1893
- },
1894
- {
1895
- "name": "baseAssetMints";
1896
- "docs": [
1897
- "Base asset token mints [BTC, ETH, SOL, USDC, JupUSD]"
1898
- ];
1899
- "type": {
1900
- "array": [
1901
- "pubkey",
1902
- 5
1903
- ];
1904
- };
1905
- },
1906
- {
1907
- "name": "jlxAssetMints";
1908
- "docs": [
1909
- "jlX token mints [jlBTC, jlETH, jlSOL, jlUSDC, jlJupUSD]"
1910
- ];
1911
- "type": {
1912
- "array": [
1913
- "pubkey",
1914
- 5
1915
- ];
1916
- };
1917
- },
1918
- {
1919
- "name": "oracleStalenessThreshold";
1920
- "docs": [
1921
- "Maximum age in seconds for Doves oracle prices to be considered valid.",
1922
- "Used during yield settlement to ensure price freshness.",
1923
- "Default: 60 seconds. Setting to 0 disables staleness check (not recommended)."
1924
- ];
1925
- "type": "u64";
1926
- },
1927
- {
1928
- "name": "flags";
1929
- "docs": [
1930
- "Vault state flags"
1931
- ];
1932
- "type": "u16";
1933
- },
1934
- {
1935
- "name": "jlpSlippageBps";
1936
- "docs": [
1937
- "JLP swap slippage tolerance in basis points (e.g., 100 = 1%)"
1938
- ];
1939
- "type": "u16";
1940
- },
1941
- {
1942
- "name": "version";
1943
- "docs": [
1944
- "Account version for migrations"
1945
- ];
1946
- "type": "u8";
1947
- },
1948
- {
1949
- "name": "bump";
1950
- "docs": [
1951
- "PDA bump seed"
1952
- ];
1953
- "type": "u8";
1954
- },
1955
- {
1956
- "name": "reserved";
1957
- "docs": [
1958
- "Reserved for 8-byte alignment"
1959
- ];
1960
- "type": {
1961
- "array": [
1962
- "u8",
1963
- 2
1964
- ];
1965
- };
1966
- }
1967
- ];
1968
- };
1969
- },
1970
- {
1971
- "name": "jlpSwapped";
1972
- "type": {
1973
- "kind": "struct";
1974
- "fields": [
1975
- {
1976
- "name": "vault";
1977
- "type": "pubkey";
1978
- },
1979
- {
1980
- "name": "stvIndex";
1981
- "type": "u8";
1982
- },
1983
- {
1984
- "name": "amountIn";
1985
- "type": "u64";
1986
- },
1987
- {
1988
- "name": "amountOut";
1989
- "type": "u64";
1990
- },
1991
- {
1992
- "name": "direction";
1993
- "docs": [
1994
- "Direction: 0 = JlxToJlp, 1 = JlpToJlx"
1995
- ];
1996
- "type": "u8";
1997
- },
1998
- {
1999
- "name": "jlpBalanceBefore";
2000
- "type": "u64";
2001
- },
2002
- {
2003
- "name": "jlpBalanceAfter";
2004
- "type": "u64";
2005
- }
2006
- ];
2007
- };
2008
- },
2009
- {
2010
- "name": "jlpVaultInitialized";
2011
- "type": {
2012
- "kind": "struct";
2013
- "fields": [
2014
- {
2015
- "name": "vault";
2016
- "type": "pubkey";
2017
- },
2018
- {
2019
- "name": "admin";
2020
- "type": "pubkey";
2021
- },
2022
- {
2023
- "name": "manager";
2024
- "type": "pubkey";
2025
- },
2026
- {
2027
- "name": "feeReceiver";
2028
- "type": "pubkey";
2029
- },
2030
- {
2031
- "name": "jlpMint";
2032
- "type": "pubkey";
2033
- }
2034
- ];
2035
- };
2036
- },
2037
- {
2038
- "name": "jlpVaultUpdated";
2039
- "type": {
2040
- "kind": "struct";
2041
- "fields": [
2042
- {
2043
- "name": "vault";
2044
- "type": "pubkey";
2045
- },
2046
- {
2047
- "name": "oldManager";
2048
- "type": "pubkey";
2049
- },
2050
- {
2051
- "name": "newManager";
2052
- "type": "pubkey";
2053
- },
2054
- {
2055
- "name": "oldFeeReceiver";
2056
- "type": "pubkey";
2057
- },
2058
- {
2059
- "name": "newFeeReceiver";
2060
- "type": "pubkey";
2061
- },
2062
- {
2063
- "name": "oldFlags";
2064
- "type": "u16";
2065
- },
2066
- {
2067
- "name": "newFlags";
2068
- "type": "u16";
2069
- },
2070
- {
2071
- "name": "oldJlpSlippageBps";
2072
- "type": "u16";
2073
- },
2074
- {
2075
- "name": "newJlpSlippageBps";
2076
- "type": "u16";
2077
- },
2078
- {
2079
- "name": "oldOracleStalenessThreshold";
2080
- "type": "u64";
2081
- },
2082
- {
2083
- "name": "newOracleStalenessThreshold";
2084
- "type": "u64";
2085
- }
2086
- ];
2087
- };
2088
- },
2089
- {
2090
- "name": "jlxMoved";
2091
- "type": {
2092
- "kind": "struct";
2093
- "fields": [
2094
- {
2095
- "name": "stv";
2096
- "type": "pubkey";
2097
- },
2098
- {
2099
- "name": "vault";
2100
- "type": "pubkey";
2101
- },
2102
- {
2103
- "name": "amountJlx";
2104
- "type": "u64";
2105
- },
2106
- {
2107
- "name": "direction";
2108
- "docs": [
2109
- "Direction: 0 = ToVault (STV -> Vault), 1 = FromVault (Vault -> STV)"
2110
- ];
2111
- "type": "u8";
2112
- },
2113
- {
2114
- "name": "baseValue";
2115
- "docs": [
2116
- "Base asset value of the jlX moved (at current exchange rate)"
2117
- ];
2118
- "type": "u64";
2119
- },
2120
- {
2121
- "name": "exchangeRate";
2122
- "docs": [
2123
- "Jupiter Lend exchange rate used for calculation (12 decimals)"
2124
- ];
2125
- "type": "u64";
2126
- },
2127
- {
2128
- "name": "newBaseLoaned";
2129
- "docs": [
2130
- "New base_loaned after the move"
2131
- ];
2132
- "type": "u64";
2133
- }
2134
- ];
2135
- };
2136
- },
2137
- {
2138
- "name": "jlxSwapped";
2139
- "type": {
2140
- "kind": "struct";
2141
- "fields": [
2142
- {
2143
- "name": "vault";
2144
- "type": "pubkey";
2145
- },
2146
- {
2147
- "name": "fromIndex";
2148
- "type": "u8";
2149
- },
2150
- {
2151
- "name": "toIndex";
2152
- "type": "u8";
2153
- },
2154
- {
2155
- "name": "amountIn";
2156
- "type": "u64";
2157
- },
2158
- {
2159
- "name": "minOut";
2160
- "type": "u64";
2161
- },
2162
- {
2163
- "name": "amountOut";
2164
- "type": "u64";
2165
- }
2166
- ];
2167
- };
2168
- },
2169
- {
2170
- "name": "jupEarnDirection";
2171
- "docs": [
2172
- "Direction for Jupiter Earn operations"
2173
- ];
2174
- "type": {
2175
- "kind": "enum";
2176
- "variants": [
2177
- {
2178
- "name": "deposit";
2179
- },
2180
- {
2181
- "name": "withdraw";
2182
- }
2183
- ];
2184
- };
2185
- },
2186
- {
2187
- "name": "jupEarnEvent";
2188
- "docs": [
2189
- "Event emitted for Jupiter Earn deposit/withdraw operations"
2190
- ];
2191
- "type": {
2192
- "kind": "struct";
2193
- "fields": [
2194
- {
2195
- "name": "stv";
2196
- "docs": [
2197
- "The STV account"
2198
- ];
2199
- "type": "pubkey";
2200
- },
2201
- {
2202
- "name": "direction";
2203
- "docs": [
2204
- "Direction: 0 = Deposit (base -> jlX), 1 = Withdraw (jlX -> base)"
2205
- ];
2206
- "type": "u8";
2207
- },
2208
- {
2209
- "name": "baseAmount";
2210
- "docs": [
2211
- "Amount of base asset (deposited or received)"
2212
- ];
2213
- "type": "u64";
2214
- },
2215
- {
2216
- "name": "jlxAmount";
2217
- "docs": [
2218
- "Amount of jlX (received or burned)"
2219
- ];
2220
- "type": "u64";
2221
- }
2222
- ];
2223
- };
2224
- },
2225
- {
2226
- "name": "jupEarnParams";
2227
- "docs": [
2228
- "Parameters for Jupiter Earn deposit/withdraw"
2229
- ];
2230
- "type": {
2231
- "kind": "struct";
2232
- "fields": [
2233
- {
2234
- "name": "direction";
2235
- "docs": [
2236
- "Direction of the operation"
2237
- ];
2238
- "type": {
2239
- "defined": {
2240
- "name": "jupEarnDirection";
2241
- };
2242
- };
2243
- },
2244
- {
2245
- "name": "amount";
2246
- "docs": [
2247
- "Amount to deposit (base) or withdraw (jlX)"
2248
- ];
2249
- "type": "u64";
2250
- }
2251
- ];
2252
- };
2253
- },
2254
- {
2255
- "name": "moveJlxParams";
2256
- "docs": [
2257
- "Parameters for moving jlX tokens between STV and Vault"
2258
- ];
2259
- "type": {
2260
- "kind": "struct";
2261
- "fields": [
2262
- {
2263
- "name": "amountJlx";
2264
- "docs": [
2265
- "Amount of jlX tokens to move"
2266
- ];
2267
- "type": "u64";
2268
- },
2269
- {
2270
- "name": "direction";
2271
- "docs": [
2272
- "Direction of the transfer"
2273
- ];
2274
- "type": {
2275
- "defined": {
2276
- "name": "direction";
2277
- };
2278
- };
2279
- }
2280
- ];
2281
- };
2282
- },
2283
- {
2284
- "name": "stv";
2285
- "docs": [
2286
- "STV - Single Token Vault account",
2287
- "Seeds: [\"stv\", base_mint.key().as_ref()]",
2288
- "Size: 8 (discriminator) + 160 (data) = 168 bytes"
2289
- ];
2290
- "serialization": "bytemuck";
2291
- "repr": {
2292
- "kind": "c";
2293
- };
2294
- "type": {
2295
- "kind": "struct";
2296
- "fields": [
2297
- {
2298
- "name": "baseMint";
2299
- "docs": [
2300
- "Base asset mint (BTC, ETH, SOL, or USDC)"
2301
- ];
2302
- "type": "pubkey";
2303
- },
2304
- {
2305
- "name": "jlMint";
2306
- "docs": [
2307
- "Jupiter Lend token mint (jlBTC, jlETH, jlSOL, jlUSDC, jlJupUSD)"
2308
- ];
2309
- "type": "pubkey";
2310
- },
2311
- {
2312
- "name": "jvMint";
2313
- "docs": [
2314
- "Vault share token mint (jvBTC, jvETH, jvSOL, jvUSDC, jvJupUSD)"
2315
- ];
2316
- "type": "pubkey";
2317
- },
2318
- {
2319
- "name": "pps";
2320
- "docs": [
2321
- "Price per share in base asset terms (scaled by PPS_DECIMALS)"
2322
- ];
2323
- "type": "u64";
2324
- },
2325
- {
2326
- "name": "hwm";
2327
- "docs": [
2328
- "High water mark for performance fee (scaled by PPS_DECIMALS)"
2329
- ];
2330
- "type": "u64";
2331
- },
2332
- {
2333
- "name": "lastMgmtFeeTs";
2334
- "docs": [
2335
- "Timestamp of last management fee accrual"
2336
- ];
2337
- "type": "u64";
2338
- },
2339
- {
2340
- "name": "baseLoaned";
2341
- "docs": [
2342
- "Base asset value loaned to JLP Vault (illiquid assets)",
2343
- "Updated on: move_stv_to_from_vault (+/-), settle_yield (+/-)",
2344
- "Denominated in base asset (SOL, BTC, etc.), NOT jlX"
2345
- ];
2346
- "type": "u64";
2347
- },
2348
- {
2349
- "name": "accruedFeesJlx";
2350
- "docs": [
2351
- "Accrued fees in jlX terms (unclaimed, reduces effective NAV for PPS)",
2352
- "Updated on: crystallize_fees (+), claim_fees (reset to 0)"
2353
- ];
2354
- "type": "u64";
2355
- },
2356
- {
2357
- "name": "maxDeposit";
2358
- "docs": [
2359
- "Maximum deposit amount in base asset (0 = unlimited)"
2360
- ];
2361
- "type": "u64";
2362
- },
2363
- {
2364
- "name": "minDeposit";
2365
- "docs": [
2366
- "Minimum deposit amount in base asset (0 = no minimum)"
2367
- ];
2368
- "type": "u64";
2369
- },
2370
- {
2371
- "name": "mgmtFeeBps";
2372
- "docs": [
2373
- "Management fee in basis points (annual)"
2374
- ];
2375
- "type": "u16";
2376
- },
2377
- {
2378
- "name": "perfFeeBps";
2379
- "docs": [
2380
- "Performance fee in basis points"
2381
- ];
2382
- "type": "u16";
2383
- },
2384
- {
2385
- "name": "flags";
2386
- "docs": [
2387
- "STV state flags"
2388
- ];
2389
- "type": "u16";
2390
- },
2391
- {
2392
- "name": "version";
2393
- "docs": [
2394
- "Account version for migrations"
2395
- ];
2396
- "type": "u8";
2397
- },
2398
- {
2399
- "name": "bump";
2400
- "docs": [
2401
- "PDA bump seed"
2402
- ];
2403
- "type": "u8";
2404
- }
2405
- ];
2406
- };
2407
- },
2408
- {
2409
- "name": "settleYieldEvent";
2410
- "docs": [
2411
- "Aggregate yield settlement event - emitted once per settle_yield call"
2412
- ];
2413
- "type": {
2414
- "kind": "struct";
2415
- "fields": [
2416
- {
2417
- "name": "vault";
2418
- "docs": [
2419
- "The JLP vault"
2420
- ];
2421
- "type": "pubkey";
2422
- },
2423
- {
2424
- "name": "vaultUsd";
2425
- "docs": [
2426
- "Total vault USD value (JLP + staging jlX) with 6 decimals"
2427
- ];
2428
- "type": "u128";
2429
- },
2430
- {
2431
- "name": "totalLoanedUsd";
2432
- "docs": [
2433
- "Total base_loaned USD value across all STVs with 6 decimals"
2434
- ];
2435
- "type": "u128";
2436
- },
2437
- {
2438
- "name": "deltaUsd";
2439
- "docs": [
2440
- "Absolute delta between vault_usd and total_loaned_usd"
2441
- ];
2442
- "type": "u128";
2443
- },
2444
- {
2445
- "name": "isSurplus";
2446
- "docs": [
2447
- "True if vault_usd >= total_loaned_usd (yield), false if deficit (bad debt)"
2448
- ];
2449
- "type": "bool";
2450
- },
2451
- {
2452
- "name": "timestamp";
2453
- "docs": [
2454
- "Settlement timestamp"
2455
- ];
2456
- "type": "i64";
2457
- }
2458
- ];
2459
- };
2460
- },
2461
- {
2462
- "name": "settleYieldSkipped";
2463
- "docs": [
2464
- "Event emitted when settle_yield returns early (no loans outstanding)"
2465
- ];
2466
- "type": {
2467
- "kind": "struct";
2468
- "fields": [
2469
- {
2470
- "name": "vault";
2471
- "docs": [
2472
- "The JLP vault"
2473
- ];
2474
- "type": "pubkey";
2475
- },
2476
- {
2477
- "name": "reason";
2478
- "docs": [
2479
- "Reason for skipping: \"NoLoansOutstanding\""
2480
- ];
2481
- "type": "string";
2482
- }
2483
- ];
2484
- };
2485
- },
2486
- {
2487
- "name": "settleYieldStvEvent";
2488
- "docs": [
2489
- "Per-STV yield settlement event - emitted for each STV with non-zero base_loaned"
2490
- ];
2491
- "type": {
2492
- "kind": "struct";
2493
- "fields": [
2494
- {
2495
- "name": "stv";
2496
- "docs": [
2497
- "The STV account"
2498
- ];
2499
- "type": "pubkey";
2500
- },
2501
- {
2502
- "name": "oldBaseLoaned";
2503
- "docs": [
2504
- "base_loaned before settlement"
2505
- ];
2506
- "type": "u64";
2507
- },
2508
- {
2509
- "name": "newBaseLoaned";
2510
- "docs": [
2511
- "base_loaned after settlement"
2512
- ];
2513
- "type": "u64";
2514
- },
2515
- {
2516
- "name": "adjustmentBase";
2517
- "docs": [
2518
- "Adjustment amount in base asset terms"
2519
- ];
2520
- "type": "u64";
2521
- },
2522
- {
2523
- "name": "isSurplus";
2524
- "docs": [
2525
- "True if surplus (yield added), false if deficit (bad debt deducted)"
2526
- ];
2527
- "type": "bool";
2528
- }
2529
- ];
2530
- };
2531
- },
2532
- {
2533
- "name": "stvInitialized";
2534
- "type": {
2535
- "kind": "struct";
2536
- "fields": [
2537
- {
2538
- "name": "stv";
2539
- "type": "pubkey";
2540
- },
2541
- {
2542
- "name": "baseMint";
2543
- "type": "pubkey";
2544
- },
2545
- {
2546
- "name": "jlMint";
2547
- "type": "pubkey";
2548
- },
2549
- {
2550
- "name": "jvMint";
2551
- "type": "pubkey";
2552
- }
2553
- ];
2554
- };
2555
- },
2556
- {
2557
- "name": "stvUpdated";
2558
- "type": {
2559
- "kind": "struct";
2560
- "fields": [
2561
- {
2562
- "name": "stv";
2563
- "type": "pubkey";
2564
- },
2565
- {
2566
- "name": "baseMint";
2567
- "type": "pubkey";
2568
- },
2569
- {
2570
- "name": "oldMgmtFeeBps";
2571
- "type": "u16";
2572
- },
2573
- {
2574
- "name": "newMgmtFeeBps";
2575
- "type": "u16";
2576
- },
2577
- {
2578
- "name": "oldPerfFeeBps";
2579
- "type": "u16";
2580
- },
2581
- {
2582
- "name": "newPerfFeeBps";
2583
- "type": "u16";
2584
- },
2585
- {
2586
- "name": "oldFlags";
2587
- "type": "u16";
2588
- },
2589
- {
2590
- "name": "newFlags";
2591
- "type": "u16";
2592
- },
2593
- {
2594
- "name": "oldMaxDeposit";
2595
- "type": "u64";
2596
- },
2597
- {
2598
- "name": "newMaxDeposit";
2599
- "type": "u64";
2600
- },
2601
- {
2602
- "name": "oldMinDeposit";
2603
- "type": "u64";
2604
- },
2605
- {
2606
- "name": "newMinDeposit";
2607
- "type": "u64";
2608
- },
2609
- {
2610
- "name": "oldJlMint";
2611
- "type": "pubkey";
2612
- },
2613
- {
2614
- "name": "newJlMint";
2615
- "type": "pubkey";
2616
- }
2617
- ];
2618
- };
2619
- },
2620
- {
2621
- "name": "swapDirection";
2622
- "docs": [
2623
- "Direction of the swap operation"
2624
- ];
2625
- "type": {
2626
- "kind": "enum";
2627
- "variants": [
2628
- {
2629
- "name": "jlxToJlp";
2630
- },
2631
- {
2632
- "name": "jlpToJlx";
2633
- }
2634
- ];
2635
- };
2636
- },
2637
- {
2638
- "name": "swapJlxJlpParams";
2639
- "docs": [
2640
- "Parameters for the swap instruction"
2641
- ];
2642
- "type": {
2643
- "kind": "struct";
2644
- "fields": [
2645
- {
2646
- "name": "stvIndex";
2647
- "docs": [
2648
- "Which STV this JLP belongs to (0-4: BTC, ETH, SOL, USDC, JupUSD)"
2649
- ];
2650
- "type": "u8";
2651
- },
2652
- {
2653
- "name": "direction";
2654
- "docs": [
2655
- "Direction of the swap"
2656
- ];
2657
- "type": {
2658
- "defined": {
2659
- "name": "swapDirection";
2660
- };
2661
- };
2662
- },
2663
- {
2664
- "name": "amountIn";
2665
- "docs": [
2666
- "Amount of input token being swapped"
2667
- ];
2668
- "type": "u64";
2669
- },
2670
- {
2671
- "name": "expectedAmountOut";
2672
- "docs": [
2673
- "Expected output amount (used for devnet mock, verified on mainnet)"
2674
- ];
2675
- "type": "u64";
2676
- },
2677
- {
2678
- "name": "jupiterData";
2679
- "docs": [
2680
- "Jupiter swap instruction data (includes discriminator and route)",
2681
- "This is obtained from Jupiter API off-chain",
2682
- "On devnet (with `devnet` feature), this can be empty"
2683
- ];
2684
- "type": "bytes";
2685
- }
2686
- ];
2687
- };
2688
- },
2689
- {
2690
- "name": "updateStvParams";
2691
- "docs": [
2692
- "Parameters for updating an STV"
2693
- ];
2694
- "type": {
2695
- "kind": "struct";
2696
- "fields": [
2697
- {
2698
- "name": "mgmtFeeBps";
2699
- "docs": [
2700
- "Management fee in basis points (annual)"
2701
- ];
2702
- "type": "u16";
2703
- },
2704
- {
2705
- "name": "perfFeeBps";
2706
- "docs": [
2707
- "Performance fee in basis points"
2708
- ];
2709
- "type": "u16";
2710
- },
2711
- {
2712
- "name": "flags";
2713
- "docs": [
2714
- "STV state flags"
2715
- ];
2716
- "type": "u16";
2717
- },
2718
- {
2719
- "name": "maxDeposit";
2720
- "docs": [
2721
- "Maximum deposit amount in base asset (0 = unlimited)"
2722
- ];
2723
- "type": "u64";
2724
- },
2725
- {
2726
- "name": "minDeposit";
2727
- "docs": [
2728
- "Minimum deposit amount in base asset (0 = no minimum)"
2729
- ];
2730
- "type": "u64";
2731
- },
2732
- {
2733
- "name": "jlMint";
2734
- "docs": [
2735
- "Optional new jl_mint for migrating base-only pools to Jupiter Lend"
2736
- ];
2737
- "type": {
2738
- "option": "pubkey";
2739
- };
2740
- },
2741
- {
2742
- "name": "pps";
2743
- "docs": [
2744
- "Override price per share (9 decimals, e.g. 1_000_000_000 = 1.0)"
2745
- ];
2746
- "type": {
2747
- "option": "u64";
2748
- };
2749
- },
2750
- {
2751
- "name": "hwm";
2752
- "docs": [
2753
- "Override high water mark (9 decimals)"
2754
- ];
2755
- "type": {
2756
- "option": "u64";
2757
- };
2758
- },
2759
- {
2760
- "name": "baseLoaned";
2761
- "docs": [
2762
- "Override base_loaned accounting field"
2763
- ];
2764
- "type": {
2765
- "option": "u64";
2766
- };
2767
- }
2768
- ];
2769
- };
2770
- },
2771
- {
2772
- "name": "withdrawn";
2773
- "type": {
2774
- "kind": "struct";
2775
- "fields": [
2776
- {
2777
- "name": "stv";
2778
- "type": "pubkey";
2779
- },
2780
- {
2781
- "name": "user";
2782
- "type": "pubkey";
2783
- },
2784
- {
2785
- "name": "sharesBurned";
2786
- "type": "u64";
2787
- },
2788
- {
2789
- "name": "amountBase";
2790
- "docs": [
2791
- "Amount of base asset withdrawn"
2792
- ];
2793
- "type": "u64";
2794
- },
2795
- {
2796
- "name": "pps";
2797
- "type": "u64";
2798
- }
2799
- ];
2800
- };
2801
- }
2802
- ];
2803
- };
2804
-
2805
- type PoolName = "SOL" | "USDC" | "JupUSD" | "BTC" | "ETH";
2806
- type JupEarnDirection = "Deposit" | "Withdraw";
2807
- type MoveDirection = "ToVault" | "FromVault";
2808
- type SwapDirection = "JlxToJlp" | "JlpToJlx";
2809
- interface JLPVault {
2810
- admin: PublicKey;
2811
- manager: PublicKey;
2812
- feeReceiver: PublicKey;
2813
- jlpMint: PublicKey;
2814
- baseAssetMints: PublicKey[];
2815
- jlxAssetMints: PublicKey[];
2816
- oracleStalenessThreshold: BN;
2817
- flags: number;
2818
- jlpSlippageBps: number;
2819
- version: number;
2820
- bump: number;
2821
- }
2822
- interface STV {
2823
- baseMint: PublicKey;
2824
- jlMint: PublicKey;
2825
- jvMint: PublicKey;
2826
- pps: BN;
2827
- hwm: BN;
2828
- lastMgmtFeeTs: BN;
2829
- baseLoaned: BN;
2830
- accruedFeesJlx: BN;
2831
- maxDeposit: BN;
2832
- minDeposit: BN;
2833
- mgmtFeeBps: number;
2834
- perfFeeBps: number;
2835
- flags: number;
2836
- version: number;
2837
- bump: number;
2838
- }
2839
- interface ExchangeRateResult {
2840
- rate: number;
2841
- rawRate: bigint;
2842
- storedRate: number;
2843
- staleness: number;
2844
- isFresh: boolean;
2845
- }
2846
- interface JupiterLendPool {
2847
- mint: PublicKey;
2848
- name: PoolName;
2849
- lending: PublicKey;
2850
- fTokenMint: PublicKey;
2851
- tokenReservesLiquidity: PublicKey;
2852
- supplyPositionOnLiquidity: PublicKey;
2853
- rewardsRateModel: PublicKey;
2854
- vault: PublicKey;
2855
- rateModel: PublicKey;
2856
- claimAccount: PublicKey;
2857
- decimals: number;
2858
- stvIndex: number;
2859
- hasJupiterLend: boolean;
2860
- jupDirectSwap: boolean;
2861
- }
2862
- interface AccountMeta {
2863
- pubkey: PublicKey;
2864
- isSigner: boolean;
2865
- isWritable: boolean;
2866
- }
2867
- interface SwapQuote {
2868
- inputMint: PublicKey;
2869
- outputMint: PublicKey;
2870
- inAmount: BN;
2871
- outAmount: BN;
2872
- minOutAmount: BN;
2873
- priceImpactPct: number;
2874
- route: string[];
2875
- jupiterData: Buffer;
2876
- remainingAccounts: AccountMeta[];
2877
- addressLookupTables: AddressLookupTableAccount[];
2878
- computeUnitLimit: number;
2879
- }
2880
- interface LendingAccountData {
2881
- mint: PublicKey;
2882
- fTokenMint: PublicKey;
2883
- lendingId: number;
2884
- decimals: number;
2885
- rewardsRateModel: PublicKey;
2886
- liquidityExchangePrice: bigint;
2887
- tokenExchangePrice: bigint;
2888
- lastUpdateTimestamp: bigint;
2889
- tokenReservesLiquidity: PublicKey;
2890
- supplyPositionOnLiquidity: PublicKey;
2891
- bump: number;
2892
- }
2893
- interface RewardsRateModelData {
2894
- mint: PublicKey;
2895
- startTvl: bigint;
2896
- duration: bigint;
2897
- startTime: bigint;
2898
- yearlyReward: bigint;
2899
- nextDuration: bigint;
2900
- nextRewardAmount: bigint;
2901
- bump: number;
2902
- }
2903
- interface UpdateVaultParams {
2904
- jlpMint?: PublicKey | null;
2905
- baseAssetMints?: PublicKey[] | null;
2906
- jlxAssetMints?: PublicKey[] | null;
2907
- newAdmin?: PublicKey | null;
2908
- manager?: PublicKey;
2909
- feeReceiver?: PublicKey;
2910
- oracleStalenessThreshold?: BN | null;
2911
- jlpSlippageBps?: number;
2912
- flags?: number;
2913
- }
2914
- interface UpdateStvParams$1 {
2915
- mgmtFeeBps?: number;
2916
- perfFeeBps?: number;
2917
- maxDeposit?: BN;
2918
- minDeposit?: BN;
2919
- flags?: number;
2920
- jlMint?: PublicKey;
2921
- pps?: BN;
2922
- hwm?: BN;
2923
- baseLoaned?: BN;
2924
- }
2925
- interface InitializeStvParams$1 {
2926
- poolName: PoolName;
2927
- mgmtFeeBps: number;
2928
- perfFeeBps: number;
2929
- maxDeposit: BN;
2930
- minDeposit: BN;
2931
- }
2932
- interface JupiterQuoteResponse {
2933
- inputMint: string;
2934
- inAmount: string;
2935
- outputMint: string;
2936
- outAmount: string;
2937
- otherAmountThreshold: string;
2938
- swapMode: string;
2939
- slippageBps: number;
2940
- platformFee: {
2941
- amount: string;
2942
- feeBps: number;
2943
- } | null;
2944
- priceImpactPct: string;
2945
- routePlan: Array<{
2946
- swapInfo: {
2947
- ammKey: string;
2948
- label?: string;
2949
- inputMint: string;
2950
- outputMint: string;
2951
- inAmount: string;
2952
- outAmount: string;
2953
- feeAmount: string;
2954
- feeMint: string;
2955
- };
2956
- percent: number;
2957
- }>;
2958
- contextSlot?: number;
2959
- timeTaken?: number;
2960
- }
2961
- interface JupiterSwapInstructionsResponse {
2962
- tokenLedgerInstruction: SerializedInstruction | null;
2963
- computeBudgetInstructions: SerializedInstruction[];
2964
- setupInstructions: SerializedInstruction[];
2965
- swapInstruction: SerializedInstruction;
2966
- cleanupInstruction: SerializedInstruction | null;
2967
- addressLookupTableAddresses: string[];
2968
- computeUnitLimit?: number;
2969
- error?: string;
2970
- }
2971
- interface SerializedInstruction {
2972
- programId: string;
2973
- accounts: Array<{
2974
- pubkey: string;
2975
- isSigner: boolean;
2976
- isWritable: boolean;
2977
- }>;
2978
- data: string;
2979
- }
2980
-
2981
- declare class JlpdClientError extends Error {
2982
- constructor(message: string);
2983
- }
2984
- interface DepositParams {
2985
- user: PublicKey;
2986
- amount: BN;
2987
- }
2988
- interface WithdrawParams {
2989
- user: PublicKey;
2990
- shares: BN;
2991
- }
2992
- interface JupEarnParams$1 {
2993
- manager: PublicKey;
2994
- direction: JupEarnDirection;
2995
- amount: BN;
2996
- }
2997
- interface MoveJlxParams$1 {
2998
- manager: PublicKey;
2999
- direction: MoveDirection;
3000
- jlxAmount: BN;
3001
- }
3002
- interface ClaimFeesParams {
3003
- manager: PublicKey;
3004
- }
3005
- interface SwapJlxJlpParams$1 {
3006
- manager: PublicKey;
3007
- pool: PoolName;
3008
- direction: SwapDirection;
3009
- amountIn: BN;
3010
- expectedOut: BN;
3011
- quote: SwapQuote;
3012
- }
3013
- interface SettleYieldParams {
3014
- manager: PublicKey;
3015
- }
3016
- /**
3017
- * Main SDK client for JLP.D program
3018
- */
3019
- declare class JlpdClient {
3020
- readonly connection: Connection;
3021
- readonly programId: PublicKey;
3022
- readonly program: Program<JlpDProgram>;
3023
- readonly vaultPda: PublicKey;
3024
- readonly vaultBump: number;
3025
- readonly jupiterApiKey?: string;
3026
- private readonly poolContextCache;
3027
- constructor(connection: Connection, programId?: PublicKey, options?: {
3028
- jupiterApiKey?: string;
3029
- });
3030
- static mainnet(connection: Connection, options?: {
3031
- jupiterApiKey?: string;
3032
- }): JlpdClient;
3033
- static devnet(connection: Connection, options?: {
3034
- jupiterApiKey?: string;
3035
- }): JlpdClient;
3036
- fetchVault(): Promise<JLPVault | null>;
3037
- fetchStv(baseMint: PublicKey): Promise<STV | null>;
3038
- fetchExchangeRate(poolName: PoolName): Promise<ExchangeRateResult>;
3039
- /**
3040
- * Calculate APY based on PPS growth over time
3041
- *
3042
- * @param poolName Pool to calculate APY for
3043
- * @param startPps PPS at the start of the period (as BN with 9 decimals)
3044
- * @param startTime Unix timestamp (seconds) when startPps was recorded
3045
- * @returns APY as a decimal (e.g., 0.12 = 12% APY)
3046
- *
3047
- * @example
3048
- * ```typescript
3049
- * // Calculate APY from a week ago
3050
- * const startPps = new BN("1050000000"); // 1.05 (9 decimals)
3051
- * const startTime = Math.floor(Date.now() / 1000) - 7 * 24 * 60 * 60;
3052
- * const apy = await client.calculateApy("SOL", startPps, startTime);
3053
- * console.log(`APY: ${(apy * 100).toFixed(2)}%`);
3054
- * ```
3055
- */
3056
- calculateApy(poolName: PoolName, startPps: BN, startTime: number): Promise<number>;
3057
- /**
3058
- * Calculate simple APY (non-compounded) based on PPS growth
3059
- *
3060
- * @param poolName Pool to calculate APY for
3061
- * @param startPps PPS at the start of the period
3062
- * @param startTime Unix timestamp when startPps was recorded
3063
- * @returns Simple APY as a decimal
3064
- */
3065
- calculateSimpleApy(poolName: PoolName, startPps: BN, startTime: number): Promise<number>;
3066
- pool(poolNameOrMint: PoolName | PublicKey): PoolContext;
3067
- swap(): SwapContext;
3068
- admin(): AdminContext;
3069
- buildTransaction(payer: PublicKey, ixs: TransactionInstruction[], alts?: AddressLookupTableAccount[]): Promise<VersionedTransaction>;
3070
- }
3071
- /**
3072
- * Context for pool-specific operations
3073
- */
3074
- declare class PoolContext {
3075
- readonly client: JlpdClient;
3076
- readonly pool: JupiterLendPool;
3077
- readonly stvPda: PublicKey;
3078
- readonly stvBump: number;
3079
- readonly vaultStagingAta: PublicKey;
3080
- readonly vaultJlpAta: PublicKey;
3081
- readonly vaultBaseAta: PublicKey;
3082
- readonly stvBaseAta: PublicKey;
3083
- readonly stvJlxAta: PublicKey;
3084
- constructor(client: JlpdClient, pool: JupiterLendPool);
3085
- deposit(params: DepositParams): Promise<VersionedTransaction>;
3086
- withdraw(params: WithdrawParams): Promise<VersionedTransaction>;
3087
- jupEarn(params: JupEarnParams$1): Promise<VersionedTransaction>;
3088
- moveJlx(params: MoveJlxParams$1): Promise<VersionedTransaction>;
3089
- claimFees(params: ClaimFeesParams): Promise<VersionedTransaction>;
3090
- updateStv(params: {
3091
- admin: PublicKey;
3092
- } & UpdateStvParams$1): Promise<VersionedTransaction>;
3093
- }
3094
- /**
3095
- * Context for swap operations
3096
- */
3097
- declare class SwapContext {
3098
- readonly client: JlpdClient;
3099
- constructor(client: JlpdClient);
3100
- quoteJlxJlp(params: {
3101
- pool: PoolName;
3102
- direction: SwapDirection;
3103
- amountIn: BN;
3104
- slippageBps?: number;
3105
- }): Promise<SwapQuote>;
3106
- swapJlxJlp(params: SwapJlxJlpParams$1): Promise<VersionedTransaction>;
3107
- }
3108
- /**
3109
- * Context for admin operations
3110
- */
3111
- declare class AdminContext {
3112
- readonly client: JlpdClient;
3113
- constructor(client: JlpdClient);
3114
- initOrUpdateVault(params: {
3115
- admin: PublicKey;
3116
- } & UpdateVaultParams): Promise<VersionedTransaction>;
3117
- initializeStv(params: {
3118
- admin: PublicKey;
3119
- } & InitializeStvParams$1, jvMintKeypair: PublicKey): Promise<VersionedTransaction>;
3120
- settleYield(params: SettleYieldParams): Promise<VersionedTransaction>;
3121
- }
3122
-
3123
- /**
3124
- * Creates an Anchor Program instance for the JLP.D program
3125
- * @param connection - Solana connection instance
3126
- * @returns Typed Anchor Program instance
3127
- */
3128
- declare function createProgram(connection: Connection): Program<JlpDProgram>;
3129
-
3130
- declare const JLPD_PROGRAM_ID: PublicKey;
3131
- declare const JUPITER_LEND_PROGRAM_ID$1: PublicKey;
3132
- declare const JUPITER_SWAP_PROGRAM_ID: PublicKey;
3133
- declare const SEED_JLP_VAULT = "jlp_vault";
3134
- declare const SEED_STV = "stv";
3135
- declare const FLAG_PAUSED = 1;
3136
- declare const FLAG_DEPOSITS_DISABLED = 2;
3137
- declare const FLAG_WITHDRAWALS_DISABLED = 4;
3138
- declare const FLAG_JLP_DISABLED = 8;
3139
- declare const FLAG_REBALANCE_DISABLED = 16;
3140
- declare const PPS_DECIMALS = 1000000000;
3141
- declare const EXCHANGE_RATE_PRECISION = 1000000000000;
3142
- declare const MINTS: {
3143
- readonly JLP: PublicKey;
3144
- readonly WSOL: PublicKey;
3145
- readonly USDC: PublicKey;
3146
- readonly WBTC: PublicKey;
3147
- readonly WETH: PublicKey;
3148
- readonly JupUSD: PublicKey;
3149
- };
3150
- declare enum STV_INDEX {
3151
- BTC = 0,
3152
- ETH = 1,
3153
- SOL = 2,
3154
- USDC = 3,
3155
- JupUSD = 4
3156
- }
3157
- declare const ORACLES: {
3158
- readonly DOVES_BTC_USD: PublicKey;
3159
- readonly DOVES_ETH_USD: PublicKey;
3160
- readonly DOVES_SOL_USD: PublicKey;
3161
- };
3162
- declare const JLP_POOL_PUBKEY: PublicKey;
3163
- declare const JUPITER_PERPS_PROGRAM_ID: PublicKey;
3164
-
3165
- /**
3166
- * Derive the JLP Vault PDA address (cached)
3167
- * Seeds: ["jlp_vault"]
3168
- */
3169
- declare function deriveVaultPda(programId: PublicKey): [PublicKey, number];
3170
- /**
3171
- * Derive an STV (Single Token Vault) PDA address (cached)
3172
- * Seeds: ["stv", base_mint]
3173
- */
3174
- declare function deriveStvPda(baseMint: PublicKey, programId: PublicKey): [PublicKey, number];
3175
- /**
3176
- * Clear PDA cache (useful for testing)
3177
- */
3178
- declare function clearPdaCache(): void;
3179
-
3180
- /**
3181
- * JLPVault account layout (464 bytes data + 8 byte discriminator = 472 bytes total)
3182
- */
3183
- declare const JLP_VAULT_DATA_SIZE = 464;
3184
- declare const JLP_VAULT_ACCOUNT_SIZE: number;
3185
- declare const JLP_VAULT_DISCRIMINATOR: Buffer<ArrayBuffer>;
3186
- /**
3187
- * Parse a JLPVault account from raw account data
3188
- */
3189
- declare function parseVault(data: Buffer): JLPVault;
3190
-
3191
- /**
3192
- * STV (Single Token Vault) account layout (160 bytes data + 8 byte discriminator = 168 bytes total)
3193
- */
3194
- declare const STV_DATA_SIZE = 160;
3195
- declare const STV_ACCOUNT_SIZE: number;
3196
- declare const STV_DISCRIMINATOR: Buffer<ArrayBuffer>;
3197
- /**
3198
- * Parse an STV account from raw account data
3199
- */
3200
- declare function parseStv(data: Buffer): STV;
3201
-
3202
- /**
3203
- * Derive ATA address (cached)
3204
- */
3205
- declare function deriveAta(mint: PublicKey, owner: PublicKey, allowPda?: boolean): PublicKey;
3206
- /**
3207
- * Derive all ATAs for a user interacting with an STV (cached)
3208
- */
3209
- declare function deriveUserAtas(baseMint: PublicKey, jvMint: PublicKey, userWallet: PublicKey): {
3210
- baseAta: PublicKey;
3211
- jvxAta: PublicKey;
3212
- };
3213
- /**
3214
- * Derive all ATAs owned by an STV PDA (cached)
3215
- */
3216
- declare function deriveStvAtas(baseMint: PublicKey, jlxMint: PublicKey, stvPda: PublicKey): {
3217
- baseAta: PublicKey;
3218
- jlxAta: PublicKey;
3219
- };
3220
- /**
3221
- * Derive vault staging and JLP ATAs (owned by vault PDA, cached)
3222
- */
3223
- declare function deriveVaultAtas(jlxMint: PublicKey, jlpMint: PublicKey, vaultPda: PublicKey): {
3224
- stagingAta: PublicKey;
3225
- jlpAta: PublicKey;
3226
- };
3227
- /**
3228
- * Clear ATA cache (useful for testing)
3229
- */
3230
- declare function clearAtaCache(): void;
3231
-
3232
- /**
3233
- * Calculate NAV for an STV
3234
- * NAV = stv_base_ata.amount + (stv_jlx_ata.amount * exchange_rate / 1e12) + base_loaned
3235
- */
3236
- declare function calculateNav(stvBaseBalance: BN, stvJlxBalance: BN, exchangeRate: bigint, baseLoaned: BN): BN;
3237
- /**
3238
- * Calculate PPS from NAV and total jvX supply
3239
- * PPS = NAV * PPS_DECIMALS / total_jvx_supply
3240
- */
3241
- declare function calculatePps(nav: BN, jvSupply: BN): BN;
3242
- /**
3243
- * Convert shares to base amount
3244
- */
3245
- declare function sharesToBase(shares: BN, pps: BN): BN;
3246
- /**
3247
- * Convert base amount to shares
3248
- */
3249
- declare function baseToShares(base: BN, pps: BN): BN;
3250
- /**
3251
- * Convert jlX to base using exchange rate
3252
- */
3253
- declare function jlxToBase(jlxAmount: BN, exchangeRate: BN): BN;
3254
- /**
3255
- * Convert base to jlX using exchange rate
3256
- */
3257
- declare function baseToJlx(baseAmount: BN, exchangeRate: BN): BN;
3258
- /**
3259
- * Calculate full exchange rate including time-accrued rewards
3260
- */
3261
- declare function calculateExchangeRate(storedRate: bigint, rewardsRate: bigint, currentTimestamp: bigint, lastUpdateTimestamp: bigint, fTokenTotalSupply: bigint): bigint;
3262
-
3263
- declare const LENDING_ADMIN: PublicKey;
3264
- declare const LIQUIDITY_PROGRAM_ID: PublicKey;
3265
- declare const LIQUIDITY_SINGLETON: PublicKey;
3266
- declare const WSOL_POOL: JupiterLendPool;
3267
- declare const USDC_POOL: JupiterLendPool;
3268
- declare const JUPUSD_POOL: JupiterLendPool;
3269
- declare const WBTC_POOL: JupiterLendPool;
3270
- declare const WETH_POOL: JupiterLendPool;
3271
- declare const POOLS: Record<PoolName, JupiterLendPool>;
3272
- declare function getPoolByName(name: PoolName): JupiterLendPool | undefined;
3273
- declare function getPoolByMint(mint: PublicKey): JupiterLendPool | undefined;
3274
-
3275
- declare const JUPITER_LEND_PROGRAM_ID: PublicKey;
3276
- /**
3277
- * Build remaining accounts for deposit/withdraw exchange rate lookup
3278
- */
3279
- declare function buildExchangeRateAccounts(pool: JupiterLendPool): {
3280
- lending: PublicKey;
3281
- rewardsRateModel: PublicKey;
3282
- } | null;
3283
- /**
3284
- * Build remaining accounts for jup_earn_deposit instruction (17 accounts + program ID)
3285
- */
3286
- declare function buildJupEarnDepositAccounts(pool: JupiterLendPool, stvPda: PublicKey, stvBaseAta: PublicKey, stvJlxAta: PublicKey): AccountMeta[];
3287
- /**
3288
- * Build remaining accounts for jup_earn_withdraw instruction (18 accounts + program ID)
3289
- */
3290
- declare function buildJupEarnWithdrawAccounts(pool: JupiterLendPool, stvPda: PublicKey, stvJlxAta: PublicKey, stvBaseAta: PublicKey): AccountMeta[];
3291
- /**
3292
- * Parse Lending account data from buffer
3293
- */
3294
- declare function parseLendingAccount(data: Buffer): LendingAccountData;
3295
- /**
3296
- * Parse LendingRewardsRateModel account data from buffer
3297
- */
3298
- declare function parseRewardsRateModel(data: Buffer): RewardsRateModelData;
3299
-
3300
- /**
3301
- * Get a swap quote from Jupiter API
3302
- */
3303
- declare function getJupiterQuote(inputMint: PublicKey, outputMint: PublicKey, amount: bigint | number, slippageBps?: number, maxAccounts?: number, apiKey?: string): Promise<JupiterQuoteResponse>;
3304
- /**
3305
- * Get swap instructions from Jupiter API
3306
- */
3307
- declare function getJupiterSwapInstructions(quote: JupiterQuoteResponse, userPubkey: PublicKey, apiKey?: string): Promise<JupiterSwapInstructionsResponse>;
3308
- /**
3309
- * Parse swap instruction to extract remaining accounts
3310
- */
3311
- declare function parseSwapRemainingAccounts(swapInstruction: SerializedInstruction): AccountMeta[];
3312
- /**
3313
- * Fetch Address Lookup Tables from the chain
3314
- */
3315
- declare function fetchAddressLookupTables(connection: Connection, addresses: string[]): Promise<AddressLookupTableAccount[]>;
3316
- /**
3317
- * Build complete swap data for CPI including quote, instructions, and ALTs
3318
- */
3319
- declare function buildSwapData(connection: Connection, inputMint: PublicKey, outputMint: PublicKey, amount: bigint | number, userPubkey: PublicKey, slippageBps?: number, maxAccounts?: number, apiKey?: string): Promise<{
3320
- quote: JupiterQuoteResponse;
3321
- instructions: JupiterSwapInstructionsResponse;
3322
- remainingAccounts: AccountMeta[];
3323
- addressLookupTables: AddressLookupTableAccount[];
3324
- }>;
3325
-
3326
- /**
3327
- * Jupiter Price API V3 Integration
3328
- *
3329
- * Used to fetch token prices for settle_yield instruction.
3330
- * Manager must provide JLP rate which is validated against Pyth on-chain.
3331
- */
3332
-
3333
- /**
3334
- * Jupiter Price API V3 response for a single token
3335
- */
3336
- interface JupiterPriceData {
3337
- createdAt: string;
3338
- liquidity: number;
3339
- usdPrice: number;
3340
- blockId: number;
3341
- decimals: number;
3342
- priceChange24h: number;
3343
- }
3344
- /**
3345
- * Jupiter Price API V3 response
3346
- */
3347
- type JupiterPriceResponse = {
3348
- [mint: string]: JupiterPriceData;
3349
- };
3350
- /**
3351
- * Fetch token price from Jupiter Price API V3
3352
- *
3353
- * @param mint Token mint address
3354
- * @param apiKey Jupiter API key
3355
- * @returns Price in USD as a number, or null if unavailable
3356
- */
3357
- declare function fetchJupiterPriceUsd(mint: string, apiKey: string): Promise<number | null>;
3358
- /**
3359
- * Fetch JLP price and convert to 8 decimals for on-chain use
3360
- *
3361
- * This is the format required by the settle_yield instruction's jlp_rate parameter.
3362
- * The rate is validated against Pyth oracle on-chain (must be within 50 bps).
3363
- *
3364
- * @param jlpMint JLP token mint address
3365
- * @param fallbackPrice Fallback price in USD if API fails (default: $4.60)
3366
- * @param apiKey Jupiter API key
3367
- * @returns Price as BN with 8 decimals (e.g., $4.60 -> 460_000_000)
3368
- *
3369
- * @example
3370
- * ```typescript
3371
- * const jlpRate = await fetchJlpRate(MINTS.JLP);
3372
- * const tx = await adminContext.settleYield({
3373
- * manager: wallet.publicKey,
3374
- * jlpRate,
3375
- * oracles: { ... }
3376
- * });
3377
- * ```
3378
- */
3379
- declare function fetchJlpRate(jlpMint: string, fallbackPrice: number | undefined, apiKey: string): Promise<BN>;
3380
-
3381
- interface InitOrUpdateJlpVaultParams {
3382
- jlpMint: PublicKey | null;
3383
- baseAssetMints: PublicKey[] | null;
3384
- jlxAssetMints: PublicKey[] | null;
3385
- newAdmin: PublicKey | null;
3386
- manager: PublicKey;
3387
- feeReceiver: PublicKey;
3388
- flags: number;
3389
- jlpSlippageBps: number;
3390
- oracleStalenessThreshold: BN | null;
3391
- }
3392
- interface InitializeStvParams {
3393
- mgmtFeeBps: number;
3394
- perfFeeBps: number;
3395
- maxDeposit: BN;
3396
- minDeposit: BN;
3397
- }
3398
- interface UpdateStvParams {
3399
- mgmtFeeBps: number;
3400
- perfFeeBps: number;
3401
- flags: number;
3402
- maxDeposit: BN;
3403
- minDeposit: BN;
3404
- jlMint: PublicKey | null;
3405
- pps: BN | null;
3406
- hwm: BN | null;
3407
- baseLoaned: BN | null;
3408
- }
3409
- interface InitOrUpdateJlpVaultAccounts {
3410
- admin: PublicKey;
3411
- }
3412
- interface InitializeStvAccounts {
3413
- admin: PublicKey;
3414
- jlpVault: PublicKey;
3415
- baseMint: PublicKey;
3416
- jlMint: PublicKey;
3417
- jvMint: PublicKey;
3418
- tokenProgram: PublicKey;
3419
- }
3420
- interface UpdateStvAccounts {
3421
- admin: PublicKey;
3422
- jlpVault: PublicKey;
3423
- stv: PublicKey;
3424
- }
3425
- declare function createInitOrUpdateVaultInstruction(program: Program<JlpDProgram>, params: InitOrUpdateJlpVaultParams, accounts: InitOrUpdateJlpVaultAccounts): Promise<TransactionInstruction>;
3426
- declare function createInitializeStvInstruction(program: Program<JlpDProgram>, params: InitializeStvParams, accounts: InitializeStvAccounts): Promise<TransactionInstruction>;
3427
- declare function createUpdateStvInstruction(program: Program<JlpDProgram>, params: UpdateStvParams, accounts: UpdateStvAccounts): Promise<TransactionInstruction>;
3428
-
3429
- interface DepositAccounts {
3430
- user: PublicKey;
3431
- jlpVault: PublicKey;
3432
- stv: PublicKey;
3433
- baseMint: PublicKey;
3434
- jlMint: PublicKey;
3435
- jvMint: PublicKey;
3436
- userBaseAta: PublicKey;
3437
- userJvxAta: PublicKey;
3438
- stvBaseAta: PublicKey;
3439
- stvJlxAta: PublicKey;
3440
- tokenProgram: PublicKey;
3441
- }
3442
- interface WithdrawAccounts {
3443
- user: PublicKey;
3444
- jlpVault: PublicKey;
3445
- stv: PublicKey;
3446
- baseMint: PublicKey;
3447
- jlMint: PublicKey;
3448
- jvMint: PublicKey;
3449
- userBaseAta: PublicKey;
3450
- userJvxAta: PublicKey;
3451
- stvBaseAta: PublicKey;
3452
- stvJlxAta: PublicKey;
3453
- tokenProgram: PublicKey;
3454
- }
3455
- /**
3456
- * Create a deposit instruction
3457
- */
3458
- declare function createDepositInstruction(program: Program<JlpDProgram>, amount: BN, accounts: DepositAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3459
- /**
3460
- * Create a withdraw instruction
3461
- */
3462
- declare function createWithdrawInstruction(program: Program<JlpDProgram>, sharesToBurn: BN, accounts: WithdrawAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3463
-
3464
- interface JupEarnParams {
3465
- direction: JupEarnDirection;
3466
- amount: BN;
3467
- }
3468
- interface MoveJlxParams {
3469
- amountJlx: BN;
3470
- direction: MoveDirection;
3471
- }
3472
- interface SwapJlxJlpParams {
3473
- stvIndex: number;
3474
- direction: SwapDirection;
3475
- amountIn: BN;
3476
- expectedAmountOut: BN;
3477
- jupiterData: Buffer;
3478
- }
3479
- interface JupEarnAccounts {
3480
- manager: PublicKey;
3481
- jlpVault: PublicKey;
3482
- stv: PublicKey;
3483
- baseMint: PublicKey;
3484
- jlMint: PublicKey;
3485
- stvBaseAta: PublicKey;
3486
- stvJlxAta: PublicKey;
3487
- }
3488
- interface MoveStvAccounts {
3489
- manager: PublicKey;
3490
- jlpVault: PublicKey;
3491
- stv: PublicKey;
3492
- baseMint: PublicKey;
3493
- jlMint: PublicKey;
3494
- stvJlxAta: PublicKey;
3495
- vaultStagingAta: PublicKey;
3496
- tokenProgram: PublicKey;
3497
- }
3498
- interface SwapJlxJlpAccounts {
3499
- manager: PublicKey;
3500
- jlpVault: PublicKey;
3501
- vaultJlxAta: PublicKey;
3502
- vaultJlpAta: PublicKey;
3503
- jlpMint: PublicKey;
3504
- tokenProgram: PublicKey;
3505
- jupiterProgram: PublicKey;
3506
- }
3507
- interface SettleYieldAccounts {
3508
- manager: PublicKey;
3509
- jlpVault: PublicKey;
3510
- vaultJlpAta: PublicKey;
3511
- jlpMint: PublicKey;
3512
- stvBtc: PublicKey;
3513
- stvEth: PublicKey;
3514
- stvSol: PublicKey;
3515
- stvUsdc: PublicKey;
3516
- stvJupusd: PublicKey;
3517
- stagingBtc: PublicKey;
3518
- stagingEth: PublicKey;
3519
- stagingSol: PublicKey;
3520
- stagingUsdc: PublicKey;
3521
- stagingJupusd: PublicKey;
3522
- oracleBtc: PublicKey;
3523
- oracleEth: PublicKey;
3524
- oracleSol: PublicKey;
3525
- jlpPool: PublicKey;
3526
- jlpMintAccount: PublicKey;
3527
- }
3528
- interface SettleYieldInstructionParams {
3529
- }
3530
- declare function createJupEarnInstruction(program: Program<JlpDProgram>, params: JupEarnParams, accounts: JupEarnAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3531
- declare function createMoveJlxInstruction(program: Program<JlpDProgram>, params: MoveJlxParams, accounts: MoveStvAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3532
- declare function createSwapJlxJlpInstruction(program: Program<JlpDProgram>, params: SwapJlxJlpParams, accounts: SwapJlxJlpAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3533
- declare function createSettleYieldInstruction(program: Program<JlpDProgram>, params: SettleYieldInstructionParams, accounts: SettleYieldAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3534
-
3535
- interface ClaimFeesAccounts {
3536
- manager: PublicKey;
3537
- jlpVault: PublicKey;
3538
- stv: PublicKey;
3539
- baseMint: PublicKey;
3540
- jlMint: PublicKey;
3541
- jvMint: PublicKey;
3542
- stvBaseAta: PublicKey;
3543
- stvJlxAta: PublicKey;
3544
- feeReceiverJlxAta: PublicKey;
3545
- tokenProgram: PublicKey;
3546
- }
3547
- /**
3548
- * Create a claim_fees instruction using Anchor's program.methods
3549
- */
3550
- declare function createClaimFeesInstruction(program: Program<JlpDProgram>, accounts: ClaimFeesAccounts, remainingAccounts?: AccountMeta[]): Promise<TransactionInstruction>;
3551
-
3552
- export { type AccountMeta, AdminContext, type ClaimFeesAccounts, type ClaimFeesParams, type DepositAccounts, type DepositParams, EXCHANGE_RATE_PRECISION, type ExchangeRateResult, FLAG_DEPOSITS_DISABLED, FLAG_JLP_DISABLED, FLAG_PAUSED, FLAG_REBALANCE_DISABLED, FLAG_WITHDRAWALS_DISABLED, type InitOrUpdateJlpVaultAccounts, type InitOrUpdateJlpVaultParams, type InitializeStvAccounts, type InitializeStvParams$1 as InitializeStvParams, JLPD_PROGRAM_ID, type JLPVault, JLP_POOL_PUBKEY, JLP_VAULT_ACCOUNT_SIZE, JLP_VAULT_DATA_SIZE, JLP_VAULT_DISCRIMINATOR, JUPITER_LEND_PROGRAM_ID$1 as JUPITER_LEND_PROGRAM_ID, JUPITER_PERPS_PROGRAM_ID, JUPITER_SWAP_PROGRAM_ID, JUPUSD_POOL, JUPITER_LEND_PROGRAM_ID as JUP_LEND_PROGRAM_ID, type JlpDProgram, JlpdClient, JlpdClientError, type JupEarnAccounts, type JupEarnDirection, type JupEarnParams$1 as JupEarnParams, type JupiterLendPool, type JupiterPriceData, type JupiterPriceResponse, type JupiterQuoteResponse, type JupiterSwapInstructionsResponse, LENDING_ADMIN, LIQUIDITY_PROGRAM_ID, LIQUIDITY_SINGLETON, type LendingAccountData, MINTS, type MoveDirection, type MoveJlxParams$1 as MoveJlxParams, type MoveStvAccounts, ORACLES, POOLS, PPS_DECIMALS, PoolContext, type PoolName, type RewardsRateModelData, SEED_JLP_VAULT, SEED_STV, type STV, STV_ACCOUNT_SIZE, STV_DATA_SIZE, STV_DISCRIMINATOR, STV_INDEX, type SerializedInstruction, type SettleYieldAccounts, type SettleYieldInstructionParams, type SettleYieldParams, SwapContext, type SwapDirection, type SwapJlxJlpAccounts, type SwapJlxJlpParams$1 as SwapJlxJlpParams, type SwapQuote, USDC_POOL, type UpdateStvAccounts, type UpdateStvParams$1 as UpdateStvParams, type UpdateVaultParams, WBTC_POOL, WETH_POOL, WSOL_POOL, type WithdrawAccounts, type WithdrawParams, baseToJlx, baseToShares, buildExchangeRateAccounts, buildJupEarnDepositAccounts, buildJupEarnWithdrawAccounts, buildSwapData, calculateExchangeRate, calculateNav, calculatePps, clearAtaCache, clearPdaCache, createClaimFeesInstruction, createDepositInstruction, createInitOrUpdateVaultInstruction, createInitializeStvInstruction, createJupEarnInstruction, createMoveJlxInstruction, createProgram, createSettleYieldInstruction, createSwapJlxJlpInstruction, createUpdateStvInstruction, createWithdrawInstruction, deriveAta, deriveStvAtas, deriveStvPda, deriveUserAtas, deriveVaultAtas, deriveVaultPda, fetchAddressLookupTables, fetchJlpRate, fetchJupiterPriceUsd, getJupiterQuote, getJupiterSwapInstructions, getPoolByMint, getPoolByName, jlxToBase, parseLendingAccount, parseRewardsRateModel, parseStv, parseSwapRemainingAccounts, parseVault, sharesToBase };
1
+ export * as common from "./common";
2
+ export * as pStvCore from "./p-stv-core";
3
+ export * as elementalLend from "./elemental-lend";
4
+ export * as elementalLendV2 from "./elemental-lend-v2";
5
+ export * as jlpdStrategy from "./jlpd-strategy";