hedge-web3 0.1.21 → 0.1.26

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 (69) hide show
  1. package/declarations/Constants.d.ts +3 -3
  2. package/declarations/idl/vault.d.ts +43 -43
  3. package/declarations/index.d.ts +1 -0
  4. package/declarations/instructions/claimStakingPoolPosition.d.ts +4 -0
  5. package/declarations/instructions/closeLiquidationPoolPosition.d.ts +1 -1
  6. package/declarations/instructions/createVault.d.ts +1 -1
  7. package/declarations/instructions/depositLiquidationPool.d.ts +1 -1
  8. package/declarations/instructions/depositVault.d.ts +1 -1
  9. package/declarations/instructions/liquidateVault.d.ts +1 -1
  10. package/declarations/instructions/loanVault.d.ts +1 -1
  11. package/declarations/instructions/redeemVault.d.ts +1 -1
  12. package/declarations/instructions/repayVault.d.ts +1 -1
  13. package/declarations/instructions/withdrawVault.d.ts +1 -1
  14. package/declarations/state/LiquidationPosition.d.ts +2 -2
  15. package/declarations/state/StakingPool.d.ts +2 -2
  16. package/declarations/state/StakingPoolPosition.d.ts +2 -2
  17. package/declarations/state/VaultAccount.d.ts +3 -3
  18. package/declarations/state/VaultHistoryEvent.d.ts +4 -4
  19. package/lib/Constants.js +8 -8
  20. package/lib/idl/idl.js +30 -30
  21. package/lib/idl/vault.js +43 -43
  22. package/lib/index.js +1 -0
  23. package/lib/instructions/claimStakingPoolPosition.js +55 -0
  24. package/lib/instructions/closeLiquidationPoolPosition.js +10 -10
  25. package/lib/instructions/createStakingPool.js +5 -5
  26. package/lib/instructions/createVault.js +12 -12
  27. package/lib/instructions/depositLiquidationPool.js +10 -10
  28. package/lib/instructions/depositStakingPool.js +1 -1
  29. package/lib/instructions/depositVault.js +8 -8
  30. package/lib/instructions/initHedgeFoundation.js +4 -4
  31. package/lib/instructions/liquidateVault.js +9 -9
  32. package/lib/instructions/loanVault.js +9 -9
  33. package/lib/instructions/redeemVault.js +10 -10
  34. package/lib/instructions/refreshOraclePrice.js +1 -1
  35. package/lib/instructions/repayVault.js +10 -10
  36. package/lib/instructions/withdrawStakingPool.js +7 -7
  37. package/lib/instructions/withdrawVault.js +8 -8
  38. package/lib/state/LiquidationPosition.js +2 -2
  39. package/lib/state/StakingPool.js +2 -2
  40. package/lib/state/StakingPoolPosition.js +3 -3
  41. package/lib/state/VaultAccount.js +2 -2
  42. package/lib/state/VaultHistoryEvent.js +4 -4
  43. package/package.json +9 -9
  44. package/src/Constants.ts +5 -5
  45. package/src/idl/idl.ts +30 -30
  46. package/src/idl/vault.ts +86 -86
  47. package/src/index.ts +1 -0
  48. package/src/instructions/claimStakingPoolPosition.ts +76 -0
  49. package/src/instructions/closeLiquidationPoolPosition.ts +11 -11
  50. package/src/instructions/createStakingPool.ts +6 -6
  51. package/src/instructions/createVault.ts +19 -18
  52. package/src/instructions/depositLiquidationPool.ts +11 -11
  53. package/src/instructions/depositStakingPool.ts +1 -1
  54. package/src/instructions/depositVault.ts +12 -12
  55. package/src/instructions/initHedgeFoundation.ts +5 -5
  56. package/src/instructions/initHedgeFoundationTokens.ts +1 -1
  57. package/src/instructions/liquidateVault.ts +10 -10
  58. package/src/instructions/loanVault.ts +11 -11
  59. package/src/instructions/redeemVault.ts +12 -12
  60. package/src/instructions/refreshOraclePrice.ts +1 -1
  61. package/src/instructions/repayVault.ts +12 -12
  62. package/src/instructions/setHalted.ts +1 -1
  63. package/src/instructions/withdrawStakingPool.ts +8 -8
  64. package/src/instructions/withdrawVault.ts +12 -12
  65. package/src/state/LiquidationPosition.ts +3 -3
  66. package/src/state/StakingPool.ts +4 -4
  67. package/src/state/StakingPoolPosition.ts +4 -4
  68. package/src/state/VaultAccount.ts +3 -3
  69. package/src/state/VaultHistoryEvent.ts +8 -8
package/lib/idl/idl.js CHANGED
@@ -24,7 +24,7 @@ exports.vaultIdl = {
24
24
  isSigner: true
25
25
  },
26
26
  {
27
- name: 'poolUsdhAccount',
27
+ name: 'poolUshAccount',
28
28
  isMut: true,
29
29
  isSigner: false
30
30
  },
@@ -34,7 +34,7 @@ exports.vaultIdl = {
34
34
  isSigner: true
35
35
  },
36
36
  {
37
- name: 'usdhMint',
37
+ name: 'ushMint',
38
38
  isMut: true,
39
39
  isSigner: false
40
40
  },
@@ -119,7 +119,7 @@ exports.vaultIdl = {
119
119
  isSigner: false
120
120
  },
121
121
  {
122
- name: 'usdhMint',
122
+ name: 'ushMint',
123
123
  isMut: false,
124
124
  isSigner: false
125
125
  },
@@ -129,7 +129,7 @@ exports.vaultIdl = {
129
129
  isSigner: false
130
130
  },
131
131
  {
132
- name: 'poolAssociatedUsdhTokenAccount',
132
+ name: 'poolAssociatedUshTokenAccount',
133
133
  isMut: true,
134
134
  isSigner: false
135
135
  },
@@ -257,7 +257,7 @@ exports.vaultIdl = {
257
257
  isSigner: false
258
258
  },
259
259
  {
260
- name: 'usdhMint',
260
+ name: 'ushMint',
261
261
  isMut: false,
262
262
  isSigner: false
263
263
  },
@@ -272,7 +272,7 @@ exports.vaultIdl = {
272
272
  isSigner: false
273
273
  },
274
274
  {
275
- name: 'payerAssociatedUsdhAccount',
275
+ name: 'payerAssociatedUshAccount',
276
276
  isMut: true,
277
277
  isSigner: false
278
278
  },
@@ -282,7 +282,7 @@ exports.vaultIdl = {
282
282
  isSigner: false
283
283
  },
284
284
  {
285
- name: 'poolAssociatedUsdhTokenAccount',
285
+ name: 'poolAssociatedUshTokenAccount',
286
286
  isMut: true,
287
287
  isSigner: false
288
288
  },
@@ -449,12 +449,12 @@ exports.vaultIdl = {
449
449
  isSigner: false
450
450
  },
451
451
  {
452
- name: 'feePoolAssociatedUsdhTokenAccount',
452
+ name: 'feePoolAssociatedUshTokenAccount',
453
453
  isMut: true,
454
454
  isSigner: false
455
455
  },
456
456
  {
457
- name: 'usdhMint',
457
+ name: 'ushMint',
458
458
  isMut: true,
459
459
  isSigner: false
460
460
  },
@@ -464,7 +464,7 @@ exports.vaultIdl = {
464
464
  isSigner: true
465
465
  },
466
466
  {
467
- name: 'ownerUsdhAccount',
467
+ name: 'ownerUshAccount',
468
468
  isMut: true,
469
469
  isSigner: false
470
470
  },
@@ -514,7 +514,7 @@ exports.vaultIdl = {
514
514
  isSigner: true
515
515
  },
516
516
  {
517
- name: 'usdhMint',
517
+ name: 'ushMint',
518
518
  isMut: true,
519
519
  isSigner: false
520
520
  },
@@ -524,7 +524,7 @@ exports.vaultIdl = {
524
524
  isSigner: true
525
525
  },
526
526
  {
527
- name: 'ownerUsdhAccount',
527
+ name: 'ownerUshAccount',
528
528
  isMut: true,
529
529
  isSigner: false
530
530
  },
@@ -565,7 +565,7 @@ exports.vaultIdl = {
565
565
  isSigner: true
566
566
  },
567
567
  {
568
- name: 'usdhMint',
568
+ name: 'ushMint',
569
569
  isMut: true,
570
570
  isSigner: false
571
571
  },
@@ -575,7 +575,7 @@ exports.vaultIdl = {
575
575
  isSigner: false
576
576
  },
577
577
  {
578
- name: 'feePoolAssociatedUsdhTokenAccount',
578
+ name: 'feePoolAssociatedUshTokenAccount',
579
579
  isMut: true,
580
580
  isSigner: false
581
581
  },
@@ -585,7 +585,7 @@ exports.vaultIdl = {
585
585
  isSigner: true
586
586
  },
587
587
  {
588
- name: 'payerUsdhAccount',
588
+ name: 'payerUshAccount',
589
589
  isMut: true,
590
590
  isSigner: false
591
591
  },
@@ -607,7 +607,7 @@ exports.vaultIdl = {
607
607
  ],
608
608
  args: [
609
609
  {
610
- name: 'redeemPayUsdh',
610
+ name: 'redeemPayUsh',
611
611
  type: 'u64'
612
612
  },
613
613
  {
@@ -629,7 +629,7 @@ exports.vaultIdl = {
629
629
  isSigner: false
630
630
  },
631
631
  {
632
- name: 'poolUsdhAccount',
632
+ name: 'poolUshAccount',
633
633
  isMut: true,
634
634
  isSigner: false
635
635
  },
@@ -649,7 +649,7 @@ exports.vaultIdl = {
649
649
  isSigner: true
650
650
  },
651
651
  {
652
- name: 'ownerUsdhAccount',
652
+ name: 'ownerUshAccount',
653
653
  isMut: true,
654
654
  isSigner: false
655
655
  },
@@ -699,12 +699,12 @@ exports.vaultIdl = {
699
699
  isSigner: false
700
700
  },
701
701
  {
702
- name: 'poolUsdhAccount',
702
+ name: 'poolUshAccount',
703
703
  isMut: true,
704
704
  isSigner: false
705
705
  },
706
706
  {
707
- name: 'usdhMint',
707
+ name: 'ushMint',
708
708
  isMut: true,
709
709
  isSigner: false
710
710
  },
@@ -770,7 +770,7 @@ exports.vaultIdl = {
770
770
  isSigner: false
771
771
  },
772
772
  {
773
- name: 'poolUsdhAccount',
773
+ name: 'poolUshAccount',
774
774
  isMut: true,
775
775
  isSigner: false
776
776
  },
@@ -780,7 +780,7 @@ exports.vaultIdl = {
780
780
  isSigner: true
781
781
  },
782
782
  {
783
- name: 'ownerUsdhAccount',
783
+ name: 'ownerUshAccount',
784
784
  isMut: true,
785
785
  isSigner: false
786
786
  },
@@ -846,7 +846,7 @@ exports.vaultIdl = {
846
846
  type: 'u128'
847
847
  },
848
848
  {
849
- name: 'usdhFeeAccumulator',
849
+ name: 'ushFeeAccumulator',
850
850
  type: 'u128'
851
851
  },
852
852
  {
@@ -904,7 +904,7 @@ exports.vaultIdl = {
904
904
  type: 'u128'
905
905
  },
906
906
  {
907
- name: 'startUsdhFeeAccumulator',
907
+ name: 'startUshFeeAccumulator',
908
908
  type: 'u128'
909
909
  },
910
910
  {
@@ -944,7 +944,7 @@ exports.vaultIdl = {
944
944
  type: 'u64'
945
945
  },
946
946
  {
947
- name: 'totalUsdhSupply',
947
+ name: 'totalUshSupply',
948
948
  type: 'u64'
949
949
  },
950
950
  {
@@ -980,7 +980,7 @@ exports.vaultIdl = {
980
980
  type: 'u8'
981
981
  },
982
982
  {
983
- name: 'bumpUsdhPoolAccount',
983
+ name: 'bumpUshPoolAccount',
984
984
  type: 'u8'
985
985
  },
986
986
  {
@@ -1082,11 +1082,11 @@ exports.vaultIdl = {
1082
1082
  type: 'u128'
1083
1083
  },
1084
1084
  {
1085
- name: 'usdhDebtBefore',
1085
+ name: 'ushDebtBefore',
1086
1086
  type: 'u64'
1087
1087
  },
1088
1088
  {
1089
- name: 'usdhDebtAfter',
1089
+ name: 'ushDebtAfter',
1090
1090
  type: 'u64'
1091
1091
  },
1092
1092
  {
@@ -1230,7 +1230,7 @@ exports.vaultIdl = {
1230
1230
  type: 'u64'
1231
1231
  },
1232
1232
  {
1233
- name: 'closedUsdh',
1233
+ name: 'closedUsh',
1234
1234
  type: 'u64'
1235
1235
  },
1236
1236
  {
@@ -1370,7 +1370,7 @@ exports.vaultIdl = {
1370
1370
  name: 'Solana'
1371
1371
  },
1372
1372
  {
1373
- name: 'Usdh'
1373
+ name: 'Ush'
1374
1374
  }
1375
1375
  ]
1376
1376
  }
package/lib/idl/vault.js CHANGED
@@ -24,7 +24,7 @@ exports.IDL = {
24
24
  "isSigner": true
25
25
  },
26
26
  {
27
- "name": "poolUsdhAccount",
27
+ "name": "poolUshAccount",
28
28
  "isMut": true,
29
29
  "isSigner": false
30
30
  },
@@ -34,7 +34,7 @@ exports.IDL = {
34
34
  "isSigner": true
35
35
  },
36
36
  {
37
- "name": "usdhMint",
37
+ "name": "ushMint",
38
38
  "isMut": true,
39
39
  "isSigner": false
40
40
  },
@@ -169,7 +169,7 @@ exports.IDL = {
169
169
  "args": []
170
170
  },
171
171
  {
172
- "name": "setUsdhTokenMetadata",
172
+ "name": "setUshTokenMetadata",
173
173
  "accounts": [
174
174
  {
175
175
  "name": "metadataAccount",
@@ -215,7 +215,7 @@ exports.IDL = {
215
215
  "args": []
216
216
  },
217
217
  {
218
- "name": "updateUsdhTokenMetadata",
218
+ "name": "updateUshTokenMetadata",
219
219
  "accounts": [
220
220
  {
221
221
  "name": "metadataAccount",
@@ -284,7 +284,7 @@ exports.IDL = {
284
284
  "isSigner": false
285
285
  },
286
286
  {
287
- "name": "usdhMint",
287
+ "name": "ushMint",
288
288
  "isMut": false,
289
289
  "isSigner": false
290
290
  },
@@ -294,7 +294,7 @@ exports.IDL = {
294
294
  "isSigner": false
295
295
  },
296
296
  {
297
- "name": "poolAssociatedUsdhTokenAccount",
297
+ "name": "poolAssociatedUshTokenAccount",
298
298
  "isMut": true,
299
299
  "isSigner": false
300
300
  },
@@ -422,7 +422,7 @@ exports.IDL = {
422
422
  "isSigner": false
423
423
  },
424
424
  {
425
- "name": "usdhMint",
425
+ "name": "ushMint",
426
426
  "isMut": false,
427
427
  "isSigner": false
428
428
  },
@@ -437,7 +437,7 @@ exports.IDL = {
437
437
  "isSigner": false
438
438
  },
439
439
  {
440
- "name": "payerAssociatedUsdhAccount",
440
+ "name": "payerAssociatedUshAccount",
441
441
  "isMut": true,
442
442
  "isSigner": false
443
443
  },
@@ -447,7 +447,7 @@ exports.IDL = {
447
447
  "isSigner": false
448
448
  },
449
449
  {
450
- "name": "poolAssociatedUsdhTokenAccount",
450
+ "name": "poolAssociatedUshTokenAccount",
451
451
  "isMut": true,
452
452
  "isSigner": false
453
453
  },
@@ -503,12 +503,12 @@ exports.IDL = {
503
503
  "isSigner": false
504
504
  },
505
505
  {
506
- "name": "feePoolAssociatedUsdhTokenAccount",
506
+ "name": "feePoolAssociatedUshTokenAccount",
507
507
  "isMut": true,
508
508
  "isSigner": false
509
509
  },
510
510
  {
511
- "name": "usdhMint",
511
+ "name": "ushMint",
512
512
  "isMut": true,
513
513
  "isSigner": false
514
514
  },
@@ -602,12 +602,12 @@ exports.IDL = {
602
602
  "isSigner": false
603
603
  },
604
604
  {
605
- "name": "feePoolAssociatedUsdhTokenAccount",
605
+ "name": "feePoolAssociatedUshTokenAccount",
606
606
  "isMut": true,
607
607
  "isSigner": false
608
608
  },
609
609
  {
610
- "name": "usdhMint",
610
+ "name": "ushMint",
611
611
  "isMut": true,
612
612
  "isSigner": false
613
613
  },
@@ -687,7 +687,7 @@ exports.IDL = {
687
687
  "isSigner": false
688
688
  },
689
689
  {
690
- "name": "feePoolAssociatedUsdhTokenAccount",
690
+ "name": "feePoolAssociatedUshTokenAccount",
691
691
  "isMut": true,
692
692
  "isSigner": false
693
693
  },
@@ -707,7 +707,7 @@ exports.IDL = {
707
707
  "isSigner": false
708
708
  },
709
709
  {
710
- "name": "usdhMint",
710
+ "name": "ushMint",
711
711
  "isMut": true,
712
712
  "isSigner": false
713
713
  },
@@ -772,12 +772,12 @@ exports.IDL = {
772
772
  "isSigner": false
773
773
  },
774
774
  {
775
- "name": "feePoolAssociatedUsdhTokenAccount",
775
+ "name": "feePoolAssociatedUshTokenAccount",
776
776
  "isMut": true,
777
777
  "isSigner": false
778
778
  },
779
779
  {
780
- "name": "usdhMint",
780
+ "name": "ushMint",
781
781
  "isMut": true,
782
782
  "isSigner": false
783
783
  },
@@ -787,7 +787,7 @@ exports.IDL = {
787
787
  "isSigner": true
788
788
  },
789
789
  {
790
- "name": "ownerUsdhAccount",
790
+ "name": "ownerUshAccount",
791
791
  "isMut": true,
792
792
  "isSigner": false
793
793
  },
@@ -847,7 +847,7 @@ exports.IDL = {
847
847
  "isSigner": false
848
848
  },
849
849
  {
850
- "name": "feePoolAssociatedUsdhTokenAccount",
850
+ "name": "feePoolAssociatedUshTokenAccount",
851
851
  "isMut": true,
852
852
  "isSigner": false
853
853
  },
@@ -857,7 +857,7 @@ exports.IDL = {
857
857
  "isSigner": true
858
858
  },
859
859
  {
860
- "name": "usdhMint",
860
+ "name": "ushMint",
861
861
  "isMut": true,
862
862
  "isSigner": false
863
863
  },
@@ -867,7 +867,7 @@ exports.IDL = {
867
867
  "isSigner": true
868
868
  },
869
869
  {
870
- "name": "ownerUsdhAccount",
870
+ "name": "ownerUshAccount",
871
871
  "isMut": true,
872
872
  "isSigner": false
873
873
  },
@@ -927,7 +927,7 @@ exports.IDL = {
927
927
  "isSigner": true
928
928
  },
929
929
  {
930
- "name": "usdhMint",
930
+ "name": "ushMint",
931
931
  "isMut": true,
932
932
  "isSigner": false
933
933
  },
@@ -937,7 +937,7 @@ exports.IDL = {
937
937
  "isSigner": false
938
938
  },
939
939
  {
940
- "name": "feePoolAssociatedUsdhTokenAccount",
940
+ "name": "feePoolAssociatedUshTokenAccount",
941
941
  "isMut": true,
942
942
  "isSigner": false
943
943
  },
@@ -947,7 +947,7 @@ exports.IDL = {
947
947
  "isSigner": true
948
948
  },
949
949
  {
950
- "name": "payerUsdhAccount",
950
+ "name": "payerUshAccount",
951
951
  "isMut": true,
952
952
  "isSigner": false
953
953
  },
@@ -969,7 +969,7 @@ exports.IDL = {
969
969
  ],
970
970
  "args": [
971
971
  {
972
- "name": "redeemPayUsdh",
972
+ "name": "redeemPayUsh",
973
973
  "type": "u64"
974
974
  },
975
975
  {
@@ -987,7 +987,7 @@ exports.IDL = {
987
987
  "isSigner": false
988
988
  },
989
989
  {
990
- "name": "poolUsdhAccount",
990
+ "name": "poolUshAccount",
991
991
  "isMut": true,
992
992
  "isSigner": false
993
993
  },
@@ -1002,7 +1002,7 @@ exports.IDL = {
1002
1002
  "isSigner": true
1003
1003
  },
1004
1004
  {
1005
- "name": "usdhMint",
1005
+ "name": "ushMint",
1006
1006
  "isMut": true,
1007
1007
  "isSigner": false
1008
1008
  },
@@ -1012,7 +1012,7 @@ exports.IDL = {
1012
1012
  "isSigner": true
1013
1013
  },
1014
1014
  {
1015
- "name": "ownerUsdhAccount",
1015
+ "name": "ownerUshAccount",
1016
1016
  "isMut": true,
1017
1017
  "isSigner": false
1018
1018
  },
@@ -1092,17 +1092,17 @@ exports.IDL = {
1092
1092
  "isSigner": false
1093
1093
  },
1094
1094
  {
1095
- "name": "feePoolAssociatedUsdhTokenAccount",
1095
+ "name": "feePoolAssociatedUshTokenAccount",
1096
1096
  "isMut": true,
1097
1097
  "isSigner": false
1098
1098
  },
1099
1099
  {
1100
- "name": "liquidationPoolUsdhAccount",
1100
+ "name": "liquidationPoolUshAccount",
1101
1101
  "isMut": true,
1102
1102
  "isSigner": false
1103
1103
  },
1104
1104
  {
1105
- "name": "usdhMint",
1105
+ "name": "ushMint",
1106
1106
  "isMut": true,
1107
1107
  "isSigner": false
1108
1108
  },
@@ -1208,17 +1208,17 @@ exports.IDL = {
1208
1208
  "isSigner": false
1209
1209
  },
1210
1210
  {
1211
- "name": "feePoolAssociatedUsdhTokenAccount",
1211
+ "name": "feePoolAssociatedUshTokenAccount",
1212
1212
  "isMut": true,
1213
1213
  "isSigner": false
1214
1214
  },
1215
1215
  {
1216
- "name": "liquidationPoolUsdhAccount",
1216
+ "name": "liquidationPoolUshAccount",
1217
1217
  "isMut": true,
1218
1218
  "isSigner": false
1219
1219
  },
1220
1220
  {
1221
- "name": "usdhMint",
1221
+ "name": "ushMint",
1222
1222
  "isMut": true,
1223
1223
  "isSigner": false
1224
1224
  },
@@ -1299,7 +1299,7 @@ exports.IDL = {
1299
1299
  "isSigner": false
1300
1300
  },
1301
1301
  {
1302
- "name": "poolUsdhAccount",
1302
+ "name": "poolUshAccount",
1303
1303
  "isMut": true,
1304
1304
  "isSigner": false
1305
1305
  },
@@ -1309,7 +1309,7 @@ exports.IDL = {
1309
1309
  "isSigner": true
1310
1310
  },
1311
1311
  {
1312
- "name": "ownerUsdhAccount",
1312
+ "name": "ownerUshAccount",
1313
1313
  "isMut": true,
1314
1314
  "isSigner": false
1315
1315
  },
@@ -1562,7 +1562,7 @@ exports.IDL = {
1562
1562
  "type": "u128"
1563
1563
  },
1564
1564
  {
1565
- "name": "usdhFeeAccumulator",
1565
+ "name": "ushFeeAccumulator",
1566
1566
  "type": "u128"
1567
1567
  },
1568
1568
  {
@@ -1620,7 +1620,7 @@ exports.IDL = {
1620
1620
  "type": "u128"
1621
1621
  },
1622
1622
  {
1623
- "name": "startUsdhFeeAccumulator",
1623
+ "name": "startUshFeeAccumulator",
1624
1624
  "type": "u128"
1625
1625
  },
1626
1626
  {
@@ -1656,7 +1656,7 @@ exports.IDL = {
1656
1656
  "type": "i64"
1657
1657
  },
1658
1658
  {
1659
- "name": "totalUsdhSupply",
1659
+ "name": "totalUshSupply",
1660
1660
  "type": "u64"
1661
1661
  },
1662
1662
  {
@@ -1760,11 +1760,11 @@ exports.IDL = {
1760
1760
  "type": "u128"
1761
1761
  },
1762
1762
  {
1763
- "name": "usdhDebtBefore",
1763
+ "name": "ushDebtBefore",
1764
1764
  "type": "u64"
1765
1765
  },
1766
1766
  {
1767
- "name": "usdhDebtAfter",
1767
+ "name": "ushDebtAfter",
1768
1768
  "type": "u64"
1769
1769
  },
1770
1770
  {
@@ -1903,7 +1903,7 @@ exports.IDL = {
1903
1903
  "type": "u64"
1904
1904
  },
1905
1905
  {
1906
- "name": "closedUsdh",
1906
+ "name": "closedUsh",
1907
1907
  "type": "u64"
1908
1908
  },
1909
1909
  {
@@ -2153,7 +2153,7 @@ exports.IDL = {
2153
2153
  "name": "Solana"
2154
2154
  },
2155
2155
  {
2156
- "name": "Usdh"
2156
+ "name": "Ush"
2157
2157
  }
2158
2158
  ]
2159
2159
  }
package/lib/index.js CHANGED
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./instructions/createStakingPool"), exports);
14
14
  __exportStar(require("./instructions/depositStakingPool"), exports);
15
15
  __exportStar(require("./instructions/withdrawStakingPool"), exports);
16
+ __exportStar(require("./instructions/claimStakingPoolPosition"), exports);
16
17
  __exportStar(require("./instructions/depositLiquidationPool"), exports);
17
18
  __exportStar(require("./instructions/closeLiquidationPoolPosition"), exports);
18
19
  __exportStar(require("./instructions/claimLiquidationPoolPosition"), exports);
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.claimStakingPoolPositionInstruction = exports.claimStakingPoolPosition = void 0;
13
+ const spl_token_1 = require("@solana/spl-token");
14
+ const web3_js_1 = require("@solana/web3.js");
15
+ const Errors_1 = require("../utils/Errors");
16
+ const Constants_1 = require("../Constants");
17
+ function claimStakingPoolPosition(program, provider, poolPosition, payer, collateralType) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const vaultTypeAccount = yield (0, Constants_1.getVaultTypeAccountPublicKey)(collateralType);
20
+ const vaultTypeAccountInfo = yield program.account.vaultType.fetch(vaultTypeAccount);
21
+ const collateralMint = vaultTypeAccountInfo.collateralMint;
22
+ const stakedTokenMint = yield (0, Constants_1.getHedgeMintPublicKey)();
23
+ const [feePool] = yield (0, Constants_1.getPoolPublicKeyForMint)(stakedTokenMint);
24
+ const feePoolAssociatedTokenAccount = yield (0, spl_token_1.getOrCreateAssociatedTokenAccount)(provider.connection, payer, collateralMint, feePool, true);
25
+ const payerAssociatedTokenAccount = yield (0, spl_token_1.getOrCreateAssociatedTokenAccount)(provider.connection, payer, collateralMint, payer.publicKey);
26
+ const transaction = new web3_js_1.Transaction().add(yield claimStakingPoolPositionInstruction(program, feePool, feePoolAssociatedTokenAccount.address, stakedTokenMint, vaultTypeAccount, collateralMint, poolPosition, payer.publicKey, payerAssociatedTokenAccount.address));
27
+ yield (0, web3_js_1.sendAndConfirmTransaction)(provider.connection, transaction, [payer], provider.opts).catch(Errors_1.parseAnchorErrors);
28
+ return payerAssociatedTokenAccount.address;
29
+ });
30
+ }
31
+ exports.claimStakingPoolPosition = claimStakingPoolPosition;
32
+ function claimStakingPoolPositionInstruction(program, feePool, feePoolAssociatedTokenAccount, stakedTokenMint, vaultTypeAccount, collateralMint, poolPosition, payer, payerAssociatedTokenAccount) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const vaultSystemState = yield (0, Constants_1.getVaultSystemStatePublicKey)();
35
+ return program.instruction.claimStakingPoolPosition({
36
+ accounts: {
37
+ vaultSystemState: vaultSystemState,
38
+ feePool: feePool,
39
+ stakedTokenMint: stakedTokenMint,
40
+ feePoolAssociatedTokenAccount: feePoolAssociatedTokenAccount,
41
+ vaultTypeAccount: vaultTypeAccount,
42
+ collateralMint: collateralMint,
43
+ poolPosition: poolPosition,
44
+ payer: payer,
45
+ payerAssociatedTokenAccount: payerAssociatedTokenAccount,
46
+ associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
47
+ systemProgram: web3_js_1.SystemProgram.programId,
48
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
49
+ rent: web3_js_1.SYSVAR_RENT_PUBKEY
50
+ },
51
+ signers: []
52
+ });
53
+ });
54
+ }
55
+ exports.claimStakingPoolPositionInstruction = claimStakingPoolPositionInstruction;