hedge-web3 0.1.21 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
- package/declarations/Constants.d.ts +3 -3
- package/declarations/idl/vault.d.ts +43 -43
- package/declarations/index.d.ts +1 -0
- package/declarations/instructions/claimStakingPoolPosition.d.ts +4 -0
- package/declarations/instructions/closeLiquidationPoolPosition.d.ts +1 -1
- package/declarations/instructions/createVault.d.ts +1 -1
- package/declarations/instructions/depositLiquidationPool.d.ts +1 -1
- package/declarations/instructions/depositVault.d.ts +1 -1
- package/declarations/instructions/liquidateVault.d.ts +1 -1
- package/declarations/instructions/loanVault.d.ts +1 -1
- package/declarations/instructions/redeemVault.d.ts +1 -1
- package/declarations/instructions/repayVault.d.ts +1 -1
- package/declarations/instructions/withdrawVault.d.ts +1 -1
- package/declarations/state/LiquidationPosition.d.ts +2 -2
- package/declarations/state/StakingPool.d.ts +2 -2
- package/declarations/state/StakingPoolPosition.d.ts +2 -2
- package/declarations/state/VaultAccount.d.ts +3 -3
- package/declarations/state/VaultHistoryEvent.d.ts +4 -4
- package/lib/Constants.js +8 -8
- package/lib/idl/idl.js +30 -30
- package/lib/idl/vault.js +43 -43
- package/lib/index.js +1 -0
- package/lib/instructions/claimStakingPoolPosition.js +55 -0
- package/lib/instructions/closeLiquidationPoolPosition.js +10 -10
- package/lib/instructions/createStakingPool.js +5 -5
- package/lib/instructions/createVault.js +12 -12
- package/lib/instructions/depositLiquidationPool.js +10 -10
- package/lib/instructions/depositStakingPool.js +1 -1
- package/lib/instructions/depositVault.js +8 -8
- package/lib/instructions/initHedgeFoundation.js +4 -4
- package/lib/instructions/liquidateVault.js +9 -9
- package/lib/instructions/loanVault.js +9 -9
- package/lib/instructions/redeemVault.js +10 -10
- package/lib/instructions/refreshOraclePrice.js +1 -1
- package/lib/instructions/repayVault.js +10 -10
- package/lib/instructions/withdrawStakingPool.js +7 -7
- package/lib/instructions/withdrawVault.js +8 -8
- package/lib/state/LiquidationPosition.js +2 -2
- package/lib/state/StakingPool.js +2 -2
- package/lib/state/StakingPoolPosition.js +3 -3
- package/lib/state/VaultAccount.js +2 -2
- package/lib/state/VaultHistoryEvent.js +4 -4
- package/package.json +9 -9
- package/src/Constants.ts +5 -5
- package/src/idl/idl.ts +30 -30
- package/src/idl/vault.ts +86 -86
- package/src/index.ts +1 -0
- package/src/instructions/claimStakingPoolPosition.ts +76 -0
- package/src/instructions/closeLiquidationPoolPosition.ts +11 -11
- package/src/instructions/createStakingPool.ts +6 -6
- package/src/instructions/createVault.ts +19 -18
- package/src/instructions/depositLiquidationPool.ts +11 -11
- package/src/instructions/depositStakingPool.ts +1 -1
- package/src/instructions/depositVault.ts +12 -12
- package/src/instructions/initHedgeFoundation.ts +5 -5
- package/src/instructions/initHedgeFoundationTokens.ts +1 -1
- package/src/instructions/liquidateVault.ts +10 -10
- package/src/instructions/loanVault.ts +11 -11
- package/src/instructions/redeemVault.ts +12 -12
- package/src/instructions/refreshOraclePrice.ts +1 -1
- package/src/instructions/repayVault.ts +12 -12
- package/src/instructions/setHalted.ts +1 -1
- package/src/instructions/withdrawStakingPool.ts +8 -8
- package/src/instructions/withdrawVault.ts +12 -12
- package/src/state/LiquidationPosition.ts +3 -3
- package/src/state/StakingPool.ts +4 -4
- package/src/state/StakingPoolPosition.ts +4 -4
- package/src/state/VaultAccount.ts +3 -3
- package/src/state/VaultHistoryEvent.ts +8 -8
@@ -1,11 +1,11 @@
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
2
|
-
export declare const HEDGE_PROGRAM_ID = "
|
2
|
+
export declare const HEDGE_PROGRAM_ID = "HDG1wzAC1G1XEHRBoQZGJBW4rVmxLZrPbk5ZHRxPWbXi";
|
3
3
|
export declare const HEDGE_PROGRAM_PUBLICKEY: PublicKey;
|
4
4
|
export declare const CHAINLINK_SOL_USD_ID = "FmAmfoyPXiA8Vhhe6MZTr3U6rZfEZ1ctEHay1ysqCqcf";
|
5
5
|
export declare const CHAINLINK_SOL_USD_PUBLICKEY: PublicKey;
|
6
6
|
export declare function getLiquidationPoolStatePublicKey(): Promise<PublicKey>;
|
7
|
-
export declare function
|
8
|
-
export declare function
|
7
|
+
export declare function getLiquidationPoolUshAccountPublicKey(): Promise<PublicKey>;
|
8
|
+
export declare function getUshMintPublicKey(): Promise<PublicKey>;
|
9
9
|
export declare function getVaultSystemStatePublicKey(): Promise<PublicKey>;
|
10
10
|
export declare function getHedgeMintPublicKey(): Promise<PublicKey>;
|
11
11
|
export declare function getPoolPublicKeyForMint(mintPublicKey: PublicKey): Promise<[PublicKey, number, string]>;
|
@@ -21,7 +21,7 @@ export declare type Vault = {
|
|
21
21
|
"isSigner": true;
|
22
22
|
},
|
23
23
|
{
|
24
|
-
"name": "
|
24
|
+
"name": "poolUshAccount";
|
25
25
|
"isMut": true;
|
26
26
|
"isSigner": false;
|
27
27
|
},
|
@@ -31,7 +31,7 @@ export declare type Vault = {
|
|
31
31
|
"isSigner": true;
|
32
32
|
},
|
33
33
|
{
|
34
|
-
"name": "
|
34
|
+
"name": "ushMint";
|
35
35
|
"isMut": true;
|
36
36
|
"isSigner": false;
|
37
37
|
},
|
@@ -166,7 +166,7 @@ export declare type Vault = {
|
|
166
166
|
"args": [];
|
167
167
|
},
|
168
168
|
{
|
169
|
-
"name": "
|
169
|
+
"name": "setUshTokenMetadata";
|
170
170
|
"accounts": [
|
171
171
|
{
|
172
172
|
"name": "metadataAccount";
|
@@ -212,7 +212,7 @@ export declare type Vault = {
|
|
212
212
|
"args": [];
|
213
213
|
},
|
214
214
|
{
|
215
|
-
"name": "
|
215
|
+
"name": "updateUshTokenMetadata";
|
216
216
|
"accounts": [
|
217
217
|
{
|
218
218
|
"name": "metadataAccount";
|
@@ -281,7 +281,7 @@ export declare type Vault = {
|
|
281
281
|
"isSigner": false;
|
282
282
|
},
|
283
283
|
{
|
284
|
-
"name": "
|
284
|
+
"name": "ushMint";
|
285
285
|
"isMut": false;
|
286
286
|
"isSigner": false;
|
287
287
|
},
|
@@ -291,7 +291,7 @@ export declare type Vault = {
|
|
291
291
|
"isSigner": false;
|
292
292
|
},
|
293
293
|
{
|
294
|
-
"name": "
|
294
|
+
"name": "poolAssociatedUshTokenAccount";
|
295
295
|
"isMut": true;
|
296
296
|
"isSigner": false;
|
297
297
|
},
|
@@ -419,7 +419,7 @@ export declare type Vault = {
|
|
419
419
|
"isSigner": false;
|
420
420
|
},
|
421
421
|
{
|
422
|
-
"name": "
|
422
|
+
"name": "ushMint";
|
423
423
|
"isMut": false;
|
424
424
|
"isSigner": false;
|
425
425
|
},
|
@@ -434,7 +434,7 @@ export declare type Vault = {
|
|
434
434
|
"isSigner": false;
|
435
435
|
},
|
436
436
|
{
|
437
|
-
"name": "
|
437
|
+
"name": "payerAssociatedUshAccount";
|
438
438
|
"isMut": true;
|
439
439
|
"isSigner": false;
|
440
440
|
},
|
@@ -444,7 +444,7 @@ export declare type Vault = {
|
|
444
444
|
"isSigner": false;
|
445
445
|
},
|
446
446
|
{
|
447
|
-
"name": "
|
447
|
+
"name": "poolAssociatedUshTokenAccount";
|
448
448
|
"isMut": true;
|
449
449
|
"isSigner": false;
|
450
450
|
},
|
@@ -500,12 +500,12 @@ export declare type Vault = {
|
|
500
500
|
"isSigner": false;
|
501
501
|
},
|
502
502
|
{
|
503
|
-
"name": "
|
503
|
+
"name": "feePoolAssociatedUshTokenAccount";
|
504
504
|
"isMut": true;
|
505
505
|
"isSigner": false;
|
506
506
|
},
|
507
507
|
{
|
508
|
-
"name": "
|
508
|
+
"name": "ushMint";
|
509
509
|
"isMut": true;
|
510
510
|
"isSigner": false;
|
511
511
|
},
|
@@ -599,12 +599,12 @@ export declare type Vault = {
|
|
599
599
|
"isSigner": false;
|
600
600
|
},
|
601
601
|
{
|
602
|
-
"name": "
|
602
|
+
"name": "feePoolAssociatedUshTokenAccount";
|
603
603
|
"isMut": true;
|
604
604
|
"isSigner": false;
|
605
605
|
},
|
606
606
|
{
|
607
|
-
"name": "
|
607
|
+
"name": "ushMint";
|
608
608
|
"isMut": true;
|
609
609
|
"isSigner": false;
|
610
610
|
},
|
@@ -684,7 +684,7 @@ export declare type Vault = {
|
|
684
684
|
"isSigner": false;
|
685
685
|
},
|
686
686
|
{
|
687
|
-
"name": "
|
687
|
+
"name": "feePoolAssociatedUshTokenAccount";
|
688
688
|
"isMut": true;
|
689
689
|
"isSigner": false;
|
690
690
|
},
|
@@ -704,7 +704,7 @@ export declare type Vault = {
|
|
704
704
|
"isSigner": false;
|
705
705
|
},
|
706
706
|
{
|
707
|
-
"name": "
|
707
|
+
"name": "ushMint";
|
708
708
|
"isMut": true;
|
709
709
|
"isSigner": false;
|
710
710
|
},
|
@@ -769,12 +769,12 @@ export declare type Vault = {
|
|
769
769
|
"isSigner": false;
|
770
770
|
},
|
771
771
|
{
|
772
|
-
"name": "
|
772
|
+
"name": "feePoolAssociatedUshTokenAccount";
|
773
773
|
"isMut": true;
|
774
774
|
"isSigner": false;
|
775
775
|
},
|
776
776
|
{
|
777
|
-
"name": "
|
777
|
+
"name": "ushMint";
|
778
778
|
"isMut": true;
|
779
779
|
"isSigner": false;
|
780
780
|
},
|
@@ -784,7 +784,7 @@ export declare type Vault = {
|
|
784
784
|
"isSigner": true;
|
785
785
|
},
|
786
786
|
{
|
787
|
-
"name": "
|
787
|
+
"name": "ownerUshAccount";
|
788
788
|
"isMut": true;
|
789
789
|
"isSigner": false;
|
790
790
|
},
|
@@ -844,7 +844,7 @@ export declare type Vault = {
|
|
844
844
|
"isSigner": false;
|
845
845
|
},
|
846
846
|
{
|
847
|
-
"name": "
|
847
|
+
"name": "feePoolAssociatedUshTokenAccount";
|
848
848
|
"isMut": true;
|
849
849
|
"isSigner": false;
|
850
850
|
},
|
@@ -854,7 +854,7 @@ export declare type Vault = {
|
|
854
854
|
"isSigner": true;
|
855
855
|
},
|
856
856
|
{
|
857
|
-
"name": "
|
857
|
+
"name": "ushMint";
|
858
858
|
"isMut": true;
|
859
859
|
"isSigner": false;
|
860
860
|
},
|
@@ -864,7 +864,7 @@ export declare type Vault = {
|
|
864
864
|
"isSigner": true;
|
865
865
|
},
|
866
866
|
{
|
867
|
-
"name": "
|
867
|
+
"name": "ownerUshAccount";
|
868
868
|
"isMut": true;
|
869
869
|
"isSigner": false;
|
870
870
|
},
|
@@ -924,7 +924,7 @@ export declare type Vault = {
|
|
924
924
|
"isSigner": true;
|
925
925
|
},
|
926
926
|
{
|
927
|
-
"name": "
|
927
|
+
"name": "ushMint";
|
928
928
|
"isMut": true;
|
929
929
|
"isSigner": false;
|
930
930
|
},
|
@@ -934,7 +934,7 @@ export declare type Vault = {
|
|
934
934
|
"isSigner": false;
|
935
935
|
},
|
936
936
|
{
|
937
|
-
"name": "
|
937
|
+
"name": "feePoolAssociatedUshTokenAccount";
|
938
938
|
"isMut": true;
|
939
939
|
"isSigner": false;
|
940
940
|
},
|
@@ -944,7 +944,7 @@ export declare type Vault = {
|
|
944
944
|
"isSigner": true;
|
945
945
|
},
|
946
946
|
{
|
947
|
-
"name": "
|
947
|
+
"name": "payerUshAccount";
|
948
948
|
"isMut": true;
|
949
949
|
"isSigner": false;
|
950
950
|
},
|
@@ -966,7 +966,7 @@ export declare type Vault = {
|
|
966
966
|
];
|
967
967
|
"args": [
|
968
968
|
{
|
969
|
-
"name": "
|
969
|
+
"name": "redeemPayUsh";
|
970
970
|
"type": "u64";
|
971
971
|
},
|
972
972
|
{
|
@@ -984,7 +984,7 @@ export declare type Vault = {
|
|
984
984
|
"isSigner": false;
|
985
985
|
},
|
986
986
|
{
|
987
|
-
"name": "
|
987
|
+
"name": "poolUshAccount";
|
988
988
|
"isMut": true;
|
989
989
|
"isSigner": false;
|
990
990
|
},
|
@@ -999,7 +999,7 @@ export declare type Vault = {
|
|
999
999
|
"isSigner": true;
|
1000
1000
|
},
|
1001
1001
|
{
|
1002
|
-
"name": "
|
1002
|
+
"name": "ushMint";
|
1003
1003
|
"isMut": true;
|
1004
1004
|
"isSigner": false;
|
1005
1005
|
},
|
@@ -1009,7 +1009,7 @@ export declare type Vault = {
|
|
1009
1009
|
"isSigner": true;
|
1010
1010
|
},
|
1011
1011
|
{
|
1012
|
-
"name": "
|
1012
|
+
"name": "ownerUshAccount";
|
1013
1013
|
"isMut": true;
|
1014
1014
|
"isSigner": false;
|
1015
1015
|
},
|
@@ -1089,17 +1089,17 @@ export declare type Vault = {
|
|
1089
1089
|
"isSigner": false;
|
1090
1090
|
},
|
1091
1091
|
{
|
1092
|
-
"name": "
|
1092
|
+
"name": "feePoolAssociatedUshTokenAccount";
|
1093
1093
|
"isMut": true;
|
1094
1094
|
"isSigner": false;
|
1095
1095
|
},
|
1096
1096
|
{
|
1097
|
-
"name": "
|
1097
|
+
"name": "liquidationPoolUshAccount";
|
1098
1098
|
"isMut": true;
|
1099
1099
|
"isSigner": false;
|
1100
1100
|
},
|
1101
1101
|
{
|
1102
|
-
"name": "
|
1102
|
+
"name": "ushMint";
|
1103
1103
|
"isMut": true;
|
1104
1104
|
"isSigner": false;
|
1105
1105
|
},
|
@@ -1205,17 +1205,17 @@ export declare type Vault = {
|
|
1205
1205
|
"isSigner": false;
|
1206
1206
|
},
|
1207
1207
|
{
|
1208
|
-
"name": "
|
1208
|
+
"name": "feePoolAssociatedUshTokenAccount";
|
1209
1209
|
"isMut": true;
|
1210
1210
|
"isSigner": false;
|
1211
1211
|
},
|
1212
1212
|
{
|
1213
|
-
"name": "
|
1213
|
+
"name": "liquidationPoolUshAccount";
|
1214
1214
|
"isMut": true;
|
1215
1215
|
"isSigner": false;
|
1216
1216
|
},
|
1217
1217
|
{
|
1218
|
-
"name": "
|
1218
|
+
"name": "ushMint";
|
1219
1219
|
"isMut": true;
|
1220
1220
|
"isSigner": false;
|
1221
1221
|
},
|
@@ -1296,7 +1296,7 @@ export declare type Vault = {
|
|
1296
1296
|
"isSigner": false;
|
1297
1297
|
},
|
1298
1298
|
{
|
1299
|
-
"name": "
|
1299
|
+
"name": "poolUshAccount";
|
1300
1300
|
"isMut": true;
|
1301
1301
|
"isSigner": false;
|
1302
1302
|
},
|
@@ -1306,7 +1306,7 @@ export declare type Vault = {
|
|
1306
1306
|
"isSigner": true;
|
1307
1307
|
},
|
1308
1308
|
{
|
1309
|
-
"name": "
|
1309
|
+
"name": "ownerUshAccount";
|
1310
1310
|
"isMut": true;
|
1311
1311
|
"isSigner": false;
|
1312
1312
|
},
|
@@ -1559,7 +1559,7 @@ export declare type Vault = {
|
|
1559
1559
|
"type": "u128";
|
1560
1560
|
},
|
1561
1561
|
{
|
1562
|
-
"name": "
|
1562
|
+
"name": "ushFeeAccumulator";
|
1563
1563
|
"type": "u128";
|
1564
1564
|
},
|
1565
1565
|
{
|
@@ -1617,7 +1617,7 @@ export declare type Vault = {
|
|
1617
1617
|
"type": "u128";
|
1618
1618
|
},
|
1619
1619
|
{
|
1620
|
-
"name": "
|
1620
|
+
"name": "startUshFeeAccumulator";
|
1621
1621
|
"type": "u128";
|
1622
1622
|
},
|
1623
1623
|
{
|
@@ -1653,7 +1653,7 @@ export declare type Vault = {
|
|
1653
1653
|
"type": "i64";
|
1654
1654
|
},
|
1655
1655
|
{
|
1656
|
-
"name": "
|
1656
|
+
"name": "totalUshSupply";
|
1657
1657
|
"type": "u64";
|
1658
1658
|
},
|
1659
1659
|
{
|
@@ -1757,11 +1757,11 @@ export declare type Vault = {
|
|
1757
1757
|
"type": "u128";
|
1758
1758
|
},
|
1759
1759
|
{
|
1760
|
-
"name": "
|
1760
|
+
"name": "ushDebtBefore";
|
1761
1761
|
"type": "u64";
|
1762
1762
|
},
|
1763
1763
|
{
|
1764
|
-
"name": "
|
1764
|
+
"name": "ushDebtAfter";
|
1765
1765
|
"type": "u64";
|
1766
1766
|
},
|
1767
1767
|
{
|
@@ -1900,7 +1900,7 @@ export declare type Vault = {
|
|
1900
1900
|
"type": "u64";
|
1901
1901
|
},
|
1902
1902
|
{
|
1903
|
-
"name": "
|
1903
|
+
"name": "closedUsh";
|
1904
1904
|
"type": "u64";
|
1905
1905
|
},
|
1906
1906
|
{
|
@@ -2150,7 +2150,7 @@ export declare type Vault = {
|
|
2150
2150
|
"name": "Solana";
|
2151
2151
|
},
|
2152
2152
|
{
|
2153
|
-
"name": "
|
2153
|
+
"name": "Ush";
|
2154
2154
|
}
|
2155
2155
|
];
|
2156
2156
|
};
|
package/declarations/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
export * from './instructions/createStakingPool';
|
2
2
|
export * from './instructions/depositStakingPool';
|
3
3
|
export * from './instructions/withdrawStakingPool';
|
4
|
+
export * from './instructions/claimStakingPoolPosition';
|
4
5
|
export * from './instructions/depositLiquidationPool';
|
5
6
|
export * from './instructions/closeLiquidationPoolPosition';
|
6
7
|
export * from './instructions/claimLiquidationPoolPosition';
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { Program, Provider } from '@project-serum/anchor';
|
2
|
+
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
+
export declare function claimStakingPoolPosition(program: Program, provider: Provider, poolPosition: PublicKey, payer: Signer, collateralType: string): Promise<PublicKey>;
|
4
|
+
export declare function claimStakingPoolPositionInstruction(program: Program, feePool: PublicKey, feePoolAssociatedTokenAccount: PublicKey, stakedTokenMint: PublicKey, vaultTypeAccount: PublicKey, collateralMint: PublicKey, poolPosition: PublicKey, payer: PublicKey, payerAssociatedTokenAccount: PublicKey): Promise<TransactionInstruction>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
export declare function closeLiquidationPoolPosition(program: Program, provider: Provider, poolPosition: PublicKey, payer: Signer, overrideStartTime?: number): Promise<PublicKey>;
|
4
|
-
export declare function closeLiquidationPoolPositionInstruction(program: Program, poolEra: PublicKey, poolPosition: PublicKey, payerPublicKey: PublicKey,
|
4
|
+
export declare function closeLiquidationPoolPositionInstruction(program: Program, poolEra: PublicKey, poolPosition: PublicKey, payerPublicKey: PublicKey, payerUshAccount: PublicKey, payerAssociatedHedgeAccount: PublicKey, communityAssociatedHedgeTokenAccount: PublicKey, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -2,4 +2,4 @@ import { Program, Provider } from "@project-serum/anchor";
|
|
2
2
|
import { PublicKey, Signer, Transaction, TransactionInstruction } from "@solana/web3.js";
|
3
3
|
export declare function createVault(program: Program, provider: Provider, payer: Signer, collateralType: string, depositAmount: number, overrideTime?: number): Promise<PublicKey>;
|
4
4
|
export declare function buildCreateVaultTransaction(program: Program, collateralType: string, depositAmount: number, overrideTime?: number): Promise<[Transaction, Signer[], PublicKey]>;
|
5
|
-
export declare function createVaultInstruction(program: Program, salt: string, payerPublicKey: PublicKey, payerTokenAccountPublicKey: PublicKey, vaultPublicKey: PublicKey, vaultAssociatedTokenAccount: PublicKey, feePool: PublicKey,
|
5
|
+
export declare function createVaultInstruction(program: Program, salt: string, payerPublicKey: PublicKey, payerTokenAccountPublicKey: PublicKey, vaultPublicKey: PublicKey, vaultAssociatedTokenAccount: PublicKey, feePool: PublicKey, feePoolAssociatedUshTokenAccount: PublicKey, vaultTypeAccount: PublicKey, collateralMint: PublicKey, historyPublicKey: PublicKey, ushMintPublickey: PublicKey, depositAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
export declare function depositLiquidationPool(program: Program, provider: Provider, payer: Signer, depositAmount: number, overrideStartTime?: number): Promise<PublicKey>;
|
4
|
-
export declare function depositLiquidationPoolInstruction(program: Program, payerPublicKey: PublicKey,
|
4
|
+
export declare function depositLiquidationPoolInstruction(program: Program, payerPublicKey: PublicKey, payerUshAccount: PublicKey, poolPositionPublicKey: PublicKey, depositAmount: number, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
export declare function depositVault(program: Program, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, depositAmount: number, overrideTime?: number): Promise<PublicKey>;
|
4
|
-
export declare function depositVaultInstruction(program: Program, vaultSystemStatePublicKey: PublicKey, vaultOwner: PublicKey, vaultOwnerTokenAccount: PublicKey, vaultPublicKey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccountPublicKey: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, hedgeStakingPoolPublicKey: PublicKey,
|
4
|
+
export declare function depositVaultInstruction(program: Program, vaultSystemStatePublicKey: PublicKey, vaultOwner: PublicKey, vaultOwnerTokenAccount: PublicKey, vaultPublicKey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccountPublicKey: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, hedgeStakingPoolPublicKey: PublicKey, hedgeStakingPoolAssociatedUshTokenAccount: PublicKey, collateralMint: PublicKey, ushMintPublickey: PublicKey, depositAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
export declare function liquidateVault(program: Program, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, overrideTime?: number): Promise<PublicKey>;
|
4
|
-
export declare function liquidateVaultInstruction(program: Program, payerPublicKey: PublicKey, payerAssociatedTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, poolState: PublicKey, poolEra: PublicKey, poolAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, newEraPublicKey: PublicKey, feePool: PublicKey, feePoolAssociatedTokenAccount: PublicKey,
|
4
|
+
export declare function liquidateVaultInstruction(program: Program, payerPublicKey: PublicKey, payerAssociatedTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, poolState: PublicKey, poolEra: PublicKey, poolAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, newEraPublicKey: PublicKey, feePool: PublicKey, feePoolAssociatedTokenAccount: PublicKey, hedgeStakingPoolAssociatedUshTokenAccount: PublicKey, collateralMint: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, collateralType: string, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
export declare function loanVault(program: Program, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, loanAmount: number, overrideTime?: number): Promise<PublicKey>;
|
4
|
-
export declare function loanVaultInstruction(program: Program, payerPublicKey: PublicKey,
|
4
|
+
export declare function loanVaultInstruction(program: Program, payerPublicKey: PublicKey, ownerUshAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, loanAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
export declare function redeemVault(program: Program, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, redeemAmount: number, transactionOverrideTime?: number): Promise<PublicKey>;
|
4
|
-
export declare function redeemVaultInstruction(program: Program, payerPublicKey: PublicKey,
|
4
|
+
export declare function redeemVaultInstruction(program: Program, payerPublicKey: PublicKey, payerUshAccount: PublicKey, destinationTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, redeemAmount: number, transactionOverrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
export declare function repayVault(program: Program, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, repayAmount: number, overrideTime?: number): Promise<PublicKey>;
|
4
|
-
export declare function repayVaultInstruction(program: Program, payerPublicKey: PublicKey,
|
4
|
+
export declare function repayVaultInstruction(program: Program, payerPublicKey: PublicKey, ownerUshAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, repayAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
export declare function withdrawVault(program: Program, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, withdrawAmount: number, overrideTime?: number): Promise<PublicKey>;
|
4
|
-
export declare function withdrawVaultInstruction(program: Program, vaultSystemStatePublicKey: PublicKey, payerPublicKey: PublicKey, destinationTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedCollateralPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, hedgeStakingPoolPublicKey: PublicKey,
|
4
|
+
export declare function withdrawVaultInstruction(program: Program, vaultSystemStatePublicKey: PublicKey, payerPublicKey: PublicKey, destinationTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedCollateralPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, hedgeStakingPoolPublicKey: PublicKey, hedgeStakingPoolAssociatedUshTokenAccount: PublicKey, ushMint: PublicKey, historyPublicKey: PublicKey, withdrawAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -8,7 +8,7 @@ export declare class LiquidationPosition {
|
|
8
8
|
liquidationPoolState?: LiquidationPoolState;
|
9
9
|
ownerAccount: PublicKey;
|
10
10
|
deposit: number;
|
11
|
-
|
11
|
+
closedUsh: number;
|
12
12
|
timestampOpened: Date;
|
13
13
|
timestampClosed: Date;
|
14
14
|
productSnapshotEntry: Decimal;
|
@@ -18,6 +18,6 @@ export declare class LiquidationPosition {
|
|
18
18
|
hedgeRewardsSnapshot: Decimal;
|
19
19
|
open: boolean;
|
20
20
|
constructor(poolPositionInfo: any, key: PublicKey);
|
21
|
-
|
21
|
+
getUshAvailable(era: LiquidationPoolEra): Decimal;
|
22
22
|
getTokensAvailable(era: LiquidationPoolEra, index: number): Decimal;
|
23
23
|
}
|
@@ -9,7 +9,7 @@ export declare class StakingPool {
|
|
9
9
|
halfLifeInDays: number;
|
10
10
|
totalHedgeReward: number;
|
11
11
|
hedgeRewardAccumulator: Decimal;
|
12
|
-
|
13
|
-
|
12
|
+
ushFeeAccumulator: Decimal;
|
13
|
+
collateralFeeAccumulator: [Decimal];
|
14
14
|
constructor(poolInfo: any, publicKey: PublicKey);
|
15
15
|
}
|
@@ -11,9 +11,9 @@ export declare class StakingPoolPosition {
|
|
11
11
|
timestampClosed: number;
|
12
12
|
closedRewardedTokens: number;
|
13
13
|
startHedgeRewardAccumulator: Decimal;
|
14
|
-
|
14
|
+
startUshFeeAccumulator: Decimal;
|
15
15
|
startSolFeeAccumulator: Decimal;
|
16
16
|
open: boolean;
|
17
17
|
constructor(poolPositionInfo: any, key: PublicKey, stakingPool: StakingPool);
|
18
|
-
|
18
|
+
getCurrentUshFeeReward(): Decimal;
|
19
19
|
}
|
@@ -12,7 +12,7 @@ export declare class VaultAccount {
|
|
12
12
|
pdaSalt: string;
|
13
13
|
/** The deposited collateral of the vault (in SOL Lamports). */
|
14
14
|
deposited: number;
|
15
|
-
/** The outstanding debt of the vault (in
|
15
|
+
/** The outstanding debt of the vault (in USH Lamports). Denormalized to time 0. */
|
16
16
|
denormalizedDebt: number;
|
17
17
|
debtProductSnapshotBytes: Decimal;
|
18
18
|
collateralAccumulatorSnapshotBytes: Decimal;
|
@@ -34,9 +34,9 @@ export declare class VaultAccount {
|
|
34
34
|
*/
|
35
35
|
inSol(): number;
|
36
36
|
/**
|
37
|
-
* Get the debt value in
|
37
|
+
* Get the debt value in USH
|
38
38
|
*
|
39
|
-
* @returns debt value in
|
39
|
+
* @returns debt value in USH
|
40
40
|
*/
|
41
41
|
inUsd(): number;
|
42
42
|
/**
|
@@ -5,10 +5,10 @@ export declare class VaultHistoryEvent {
|
|
5
5
|
publicKey: PublicKey;
|
6
6
|
actorAccount: PublicKey;
|
7
7
|
usdSolPrice: Decimal;
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
ushDebtBefore: number;
|
9
|
+
ushDebtAfter: number;
|
10
|
+
collateralBalanceBefore: number;
|
11
|
+
collateralBalanceAfter: number;
|
12
12
|
minCollateralRatioBefore: Decimal;
|
13
13
|
minCollateralRatioAfter: Decimal;
|
14
14
|
vaultStateBefore: PublicKey;
|
package/lib/Constants.js
CHANGED
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.findAssociatedTokenAddress = exports.findVaultAddress = exports.getVaultTypeOracleAccountPublicKey = exports.getVaultTypeAccountPublicKey = exports.getPoolPublicKeyForMint = exports.getHedgeMintPublicKey = exports.getVaultSystemStatePublicKey = exports.
|
12
|
+
exports.findAssociatedTokenAddress = exports.findVaultAddress = exports.getVaultTypeOracleAccountPublicKey = exports.getVaultTypeAccountPublicKey = exports.getPoolPublicKeyForMint = exports.getHedgeMintPublicKey = exports.getVaultSystemStatePublicKey = exports.getUshMintPublicKey = exports.getLiquidationPoolUshAccountPublicKey = exports.getLiquidationPoolStatePublicKey = exports.CHAINLINK_SOL_USD_PUBLICKEY = exports.CHAINLINK_SOL_USD_ID = exports.HEDGE_PROGRAM_PUBLICKEY = exports.HEDGE_PROGRAM_ID = void 0;
|
13
13
|
const spl_token_1 = require("@solana/spl-token");
|
14
14
|
const web3_js_1 = require("@solana/web3.js");
|
15
|
-
exports.HEDGE_PROGRAM_ID = '
|
15
|
+
exports.HEDGE_PROGRAM_ID = 'HDG1wzAC1G1XEHRBoQZGJBW4rVmxLZrPbk5ZHRxPWbXi';
|
16
16
|
exports.HEDGE_PROGRAM_PUBLICKEY = new web3_js_1.PublicKey(exports.HEDGE_PROGRAM_ID);
|
17
17
|
exports.CHAINLINK_SOL_USD_ID = 'FmAmfoyPXiA8Vhhe6MZTr3U6rZfEZ1ctEHay1ysqCqcf';
|
18
18
|
exports.CHAINLINK_SOL_USD_PUBLICKEY = new web3_js_1.PublicKey(exports.CHAINLINK_SOL_USD_ID);
|
@@ -24,20 +24,20 @@ function getLiquidationPoolStatePublicKey() {
|
|
24
24
|
});
|
25
25
|
}
|
26
26
|
exports.getLiquidationPoolStatePublicKey = getLiquidationPoolStatePublicKey;
|
27
|
-
function
|
27
|
+
function getLiquidationPoolUshAccountPublicKey() {
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
29
|
-
const [poolPublicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('
|
29
|
+
const [poolPublicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('LiquidationPoolUSHAccountV1')], exports.HEDGE_PROGRAM_PUBLICKEY);
|
30
30
|
return poolPublicKey;
|
31
31
|
});
|
32
32
|
}
|
33
|
-
exports.
|
34
|
-
function
|
33
|
+
exports.getLiquidationPoolUshAccountPublicKey = getLiquidationPoolUshAccountPublicKey;
|
34
|
+
function getUshMintPublicKey() {
|
35
35
|
return __awaiter(this, void 0, void 0, function* () {
|
36
|
-
const [findMintPublicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('
|
36
|
+
const [findMintPublicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('UshMintV1')], exports.HEDGE_PROGRAM_PUBLICKEY);
|
37
37
|
return findMintPublicKey;
|
38
38
|
});
|
39
39
|
}
|
40
|
-
exports.
|
40
|
+
exports.getUshMintPublicKey = getUshMintPublicKey;
|
41
41
|
function getVaultSystemStatePublicKey() {
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
43
43
|
const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('VaultSystemStateV1')], exports.HEDGE_PROGRAM_PUBLICKEY);
|