hedge-web3 0.1.50 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/Constants.d.ts +2 -1
- package/declarations/idl/vault.d.ts +192 -41
- package/declarations/index.d.ts +1 -0
- package/declarations/instructions/claimLiquidationPoolPosition.d.ts +1 -1
- package/declarations/instructions/claimStakingPoolPosition.d.ts +1 -1
- package/declarations/instructions/closeClaimedLiquidationPoolPosition.d.ts +5 -0
- package/declarations/instructions/closeLiquidationPoolPosition.d.ts +1 -1
- package/declarations/instructions/createStakingPool.d.ts +1 -1
- package/declarations/instructions/createVault.d.ts +1 -1
- package/declarations/instructions/depositLiquidationPool.d.ts +1 -1
- package/declarations/instructions/depositStakingPool.d.ts +1 -1
- package/declarations/instructions/depositVault.d.ts +1 -1
- package/declarations/instructions/initHedgeFoundation.d.ts +1 -1
- package/declarations/instructions/liquidateVault.d.ts +2 -2
- package/declarations/instructions/loanVault.d.ts +1 -1
- package/declarations/instructions/redeemVault.d.ts +1 -1
- package/declarations/instructions/refreshOraclePrice.d.ts +3 -3
- package/declarations/instructions/repayVault.d.ts +1 -1
- package/declarations/instructions/setHalted.d.ts +1 -1
- package/declarations/instructions/updateVaultType.d.ts +4 -1
- package/declarations/instructions/withdrawStakingPool.d.ts +1 -1
- package/declarations/instructions/withdrawVault.d.ts +1 -1
- package/declarations/state/VaultAccount.d.ts +9 -6
- package/declarations/utils/getLinkedListAccounts.d.ts +1 -1
- package/lib/Constants.js +3 -2
- package/lib/idl/vault.js +192 -41
- package/lib/index.js +1 -0
- package/lib/instructions/claimLiquidationPoolPosition.js +5 -1
- package/lib/instructions/claimStakingPoolPosition.js +5 -1
- package/lib/instructions/closeClaimedLiquidationPoolPosition.js +38 -0
- package/lib/instructions/closeLiquidationPoolPosition.js +5 -1
- package/lib/instructions/createStakingPool.js +5 -1
- package/lib/instructions/createVault.js +5 -1
- package/lib/instructions/depositLiquidationPool.js +5 -1
- package/lib/instructions/depositStakingPool.js +5 -1
- package/lib/instructions/depositVault.js +12 -8
- package/lib/instructions/initHedgeFoundation.js +5 -1
- package/lib/instructions/initHedgeFoundationTokens.js +5 -1
- package/lib/instructions/liquidateVault.js +10 -8
- package/lib/instructions/loanVault.js +9 -6
- package/lib/instructions/redeemVault.js +9 -6
- package/lib/instructions/refreshOraclePrice.js +8 -3
- package/lib/instructions/repayVault.js +9 -6
- package/lib/instructions/setHalted.js +5 -1
- package/lib/instructions/updateVaultType.js +9 -2
- package/lib/instructions/withdrawStakingPool.js +5 -1
- package/lib/instructions/withdrawVault.js +9 -6
- package/lib/state/VaultAccount.js +28 -32
- package/lib/utils/getLinkedListAccounts.js +54 -57
- package/package.json +1 -1
- package/src/Constants.ts +2 -1
- package/src/idl/vault.ts +384 -82
- package/src/index.ts +1 -0
- package/src/instructions/claimLiquidationPoolPosition.ts +3 -2
- package/src/instructions/claimStakingPoolPosition.ts +3 -2
- package/src/instructions/closeClaimedLiquidationPoolPosition.ts +31 -0
- package/src/instructions/closeLiquidationPoolPosition.ts +3 -2
- package/src/instructions/createStakingPool.ts +3 -2
- package/src/instructions/createVault.ts +3 -2
- package/src/instructions/depositLiquidationPool.ts +3 -2
- package/src/instructions/depositStakingPool.ts +3 -2
- package/src/instructions/depositVault.ts +11 -11
- package/src/instructions/initHedgeFoundation.ts +3 -2
- package/src/instructions/initHedgeFoundationTokens.ts +2 -1
- package/src/instructions/liquidateVault.ts +11 -10
- package/src/instructions/loanVault.ts +11 -9
- package/src/instructions/redeemVault.ts +7 -7
- package/src/instructions/refreshOraclePrice.ts +9 -6
- package/src/instructions/repayVault.ts +7 -7
- package/src/instructions/setHalted.ts +3 -2
- package/src/instructions/updateVaultType.ts +10 -2
- package/src/instructions/withdrawStakingPool.ts +5 -3
- package/src/instructions/withdrawVault.ts +7 -7
- package/src/state/VaultAccount.ts +37 -32
- package/src/state/VaultType.ts +62 -0
- package/src/utils/getLinkedListAccounts.ts +61 -60
- package/src/utils/sendAndConfirmWithDebug.ts +27 -0
@@ -1,8 +1,9 @@
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
2
|
-
export declare const HEDGE_PROGRAM_ID = "
|
2
|
+
export declare const HEDGE_PROGRAM_ID = "HedgeEohwU6RqokrvPU4Hb6XKPub8NuKbnPmY7FoMMtN";
|
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
|
+
export declare const CHAINLINK_PROGRAM_ID = "HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny";
|
6
7
|
export declare function getLiquidationPoolStatePublicKey(): Promise<PublicKey>;
|
7
8
|
export declare function getLiquidationPoolUshAccountPublicKey(): Promise<PublicKey>;
|
8
9
|
export declare function getUshMintPublicKey(): Promise<PublicKey>;
|
@@ -1177,6 +1177,11 @@ export declare type Vault = {
|
|
1177
1177
|
"name": "systemProgram";
|
1178
1178
|
"isMut": false;
|
1179
1179
|
"isSigner": false;
|
1180
|
+
},
|
1181
|
+
{
|
1182
|
+
"name": "chainlinkProgram";
|
1183
|
+
"isMut": false;
|
1184
|
+
"isSigner": false;
|
1180
1185
|
}
|
1181
1186
|
];
|
1182
1187
|
"args": [
|
@@ -1649,6 +1654,74 @@ export declare type Vault = {
|
|
1649
1654
|
};
|
1650
1655
|
}
|
1651
1656
|
];
|
1657
|
+
},
|
1658
|
+
{
|
1659
|
+
"name": "adminMigrateVault";
|
1660
|
+
"accounts": [
|
1661
|
+
{
|
1662
|
+
"name": "payer";
|
1663
|
+
"isMut": true;
|
1664
|
+
"isSigner": true;
|
1665
|
+
},
|
1666
|
+
{
|
1667
|
+
"name": "vaultSystemState";
|
1668
|
+
"isMut": true;
|
1669
|
+
"isSigner": false;
|
1670
|
+
},
|
1671
|
+
{
|
1672
|
+
"name": "vaultAccount";
|
1673
|
+
"isMut": true;
|
1674
|
+
"isSigner": false;
|
1675
|
+
},
|
1676
|
+
{
|
1677
|
+
"name": "vaultTypeAccount";
|
1678
|
+
"isMut": true;
|
1679
|
+
"isSigner": false;
|
1680
|
+
}
|
1681
|
+
];
|
1682
|
+
"args": [];
|
1683
|
+
},
|
1684
|
+
{
|
1685
|
+
"name": "adminMigrateOracle";
|
1686
|
+
"accounts": [
|
1687
|
+
{
|
1688
|
+
"name": "payer";
|
1689
|
+
"isMut": true;
|
1690
|
+
"isSigner": true;
|
1691
|
+
},
|
1692
|
+
{
|
1693
|
+
"name": "vaultSystemState";
|
1694
|
+
"isMut": true;
|
1695
|
+
"isSigner": false;
|
1696
|
+
},
|
1697
|
+
{
|
1698
|
+
"name": "oracleInfoAccount";
|
1699
|
+
"isMut": true;
|
1700
|
+
"isSigner": false;
|
1701
|
+
},
|
1702
|
+
{
|
1703
|
+
"name": "vaultTypeAccount";
|
1704
|
+
"isMut": true;
|
1705
|
+
"isSigner": false;
|
1706
|
+
}
|
1707
|
+
];
|
1708
|
+
"args": [];
|
1709
|
+
},
|
1710
|
+
{
|
1711
|
+
"name": "closeClaimedLiquidationPool";
|
1712
|
+
"accounts": [
|
1713
|
+
{
|
1714
|
+
"name": "payer";
|
1715
|
+
"isMut": true;
|
1716
|
+
"isSigner": true;
|
1717
|
+
},
|
1718
|
+
{
|
1719
|
+
"name": "poolPosition";
|
1720
|
+
"isMut": true;
|
1721
|
+
"isSigner": false;
|
1722
|
+
}
|
1723
|
+
];
|
1724
|
+
"args": [];
|
1652
1725
|
}
|
1653
1726
|
];
|
1654
1727
|
"accounts": [
|
@@ -1717,7 +1790,7 @@ export declare type Vault = {
|
|
1717
1790
|
"type": {
|
1718
1791
|
"array": [
|
1719
1792
|
"u128",
|
1720
|
-
|
1793
|
+
128
|
1721
1794
|
];
|
1722
1795
|
};
|
1723
1796
|
},
|
@@ -1777,10 +1850,6 @@ export declare type Vault = {
|
|
1777
1850
|
"type": {
|
1778
1851
|
"kind": "struct";
|
1779
1852
|
"fields": [
|
1780
|
-
{
|
1781
|
-
"name": "state";
|
1782
|
-
"type": "u64";
|
1783
|
-
},
|
1784
1853
|
{
|
1785
1854
|
"name": "era";
|
1786
1855
|
"type": "publicKey";
|
@@ -1789,14 +1858,6 @@ export declare type Vault = {
|
|
1789
1858
|
"name": "ownerAccount";
|
1790
1859
|
"type": "publicKey";
|
1791
1860
|
},
|
1792
|
-
{
|
1793
|
-
"name": "deposit";
|
1794
|
-
"type": "u64";
|
1795
|
-
},
|
1796
|
-
{
|
1797
|
-
"name": "closedUsh";
|
1798
|
-
"type": "u64";
|
1799
|
-
},
|
1800
1861
|
{
|
1801
1862
|
"name": "productSnapshotEntry";
|
1802
1863
|
"type": "u128";
|
@@ -1810,7 +1871,7 @@ export declare type Vault = {
|
|
1810
1871
|
"type": {
|
1811
1872
|
"array": [
|
1812
1873
|
"u128",
|
1813
|
-
|
1874
|
+
128
|
1814
1875
|
];
|
1815
1876
|
};
|
1816
1877
|
},
|
@@ -1819,7 +1880,7 @@ export declare type Vault = {
|
|
1819
1880
|
"type": {
|
1820
1881
|
"array": [
|
1821
1882
|
"u128",
|
1822
|
-
|
1883
|
+
128
|
1823
1884
|
];
|
1824
1885
|
};
|
1825
1886
|
},
|
@@ -1827,6 +1888,14 @@ export declare type Vault = {
|
|
1827
1888
|
"name": "hedgeRewardsSnapshotAccum";
|
1828
1889
|
"type": "u128";
|
1829
1890
|
},
|
1891
|
+
{
|
1892
|
+
"name": "deposit";
|
1893
|
+
"type": "u64";
|
1894
|
+
},
|
1895
|
+
{
|
1896
|
+
"name": "closedUsh";
|
1897
|
+
"type": "u64";
|
1898
|
+
},
|
1830
1899
|
{
|
1831
1900
|
"name": "timestampOpened";
|
1832
1901
|
"type": "u64";
|
@@ -1834,6 +1903,12 @@ export declare type Vault = {
|
|
1834
1903
|
{
|
1835
1904
|
"name": "timestampClosed";
|
1836
1905
|
"type": "u64";
|
1906
|
+
},
|
1907
|
+
{
|
1908
|
+
"name": "state";
|
1909
|
+
"type": {
|
1910
|
+
"defined": "PositionState";
|
1911
|
+
};
|
1837
1912
|
}
|
1838
1913
|
];
|
1839
1914
|
};
|
@@ -1844,8 +1919,8 @@ export declare type Vault = {
|
|
1844
1919
|
"kind": "struct";
|
1845
1920
|
"fields": [
|
1846
1921
|
{
|
1847
|
-
"name": "
|
1848
|
-
"type": "
|
1922
|
+
"name": "vaultType";
|
1923
|
+
"type": "publicKey";
|
1849
1924
|
},
|
1850
1925
|
{
|
1851
1926
|
"name": "oraclePyth";
|
@@ -1858,6 +1933,22 @@ export declare type Vault = {
|
|
1858
1933
|
{
|
1859
1934
|
"name": "oracleSwitchboard";
|
1860
1935
|
"type": "publicKey";
|
1936
|
+
},
|
1937
|
+
{
|
1938
|
+
"name": "priorityPyth";
|
1939
|
+
"type": "i8";
|
1940
|
+
},
|
1941
|
+
{
|
1942
|
+
"name": "priorityChainlink";
|
1943
|
+
"type": "i8";
|
1944
|
+
},
|
1945
|
+
{
|
1946
|
+
"name": "prioritySwitchboard";
|
1947
|
+
"type": "i8";
|
1948
|
+
},
|
1949
|
+
{
|
1950
|
+
"name": "vaultTypeName";
|
1951
|
+
"type": "string";
|
1861
1952
|
}
|
1862
1953
|
];
|
1863
1954
|
};
|
@@ -1880,7 +1971,7 @@ export declare type Vault = {
|
|
1880
1971
|
"type": {
|
1881
1972
|
"array": [
|
1882
1973
|
"u128",
|
1883
|
-
|
1974
|
+
128
|
1884
1975
|
];
|
1885
1976
|
};
|
1886
1977
|
},
|
@@ -1889,7 +1980,7 @@ export declare type Vault = {
|
|
1889
1980
|
"type": {
|
1890
1981
|
"array": [
|
1891
1982
|
"u128",
|
1892
|
-
|
1983
|
+
128
|
1893
1984
|
];
|
1894
1985
|
};
|
1895
1986
|
},
|
@@ -1977,7 +2068,7 @@ export declare type Vault = {
|
|
1977
2068
|
"type": {
|
1978
2069
|
"array": [
|
1979
2070
|
"u128",
|
1980
|
-
|
2071
|
+
128
|
1981
2072
|
];
|
1982
2073
|
};
|
1983
2074
|
},
|
@@ -2061,7 +2152,7 @@ export declare type Vault = {
|
|
2061
2152
|
},
|
2062
2153
|
{
|
2063
2154
|
"name": "totalUshSupply";
|
2064
|
-
"type": "
|
2155
|
+
"type": "u128";
|
2065
2156
|
},
|
2066
2157
|
{
|
2067
2158
|
"name": "totalVaults";
|
@@ -2101,10 +2192,6 @@ export declare type Vault = {
|
|
2101
2192
|
"type": {
|
2102
2193
|
"kind": "struct";
|
2103
2194
|
"fields": [
|
2104
|
-
{
|
2105
|
-
"name": "collateralType";
|
2106
|
-
"type": "string";
|
2107
|
-
},
|
2108
2195
|
{
|
2109
2196
|
"name": "collateralMint";
|
2110
2197
|
"type": "publicKey";
|
@@ -2177,15 +2264,27 @@ export declare type Vault = {
|
|
2177
2264
|
"name": "interestRatePerSecond";
|
2178
2265
|
"type": "u128";
|
2179
2266
|
},
|
2267
|
+
{
|
2268
|
+
"name": "deprecated";
|
2269
|
+
"type": "bool";
|
2270
|
+
},
|
2271
|
+
{
|
2272
|
+
"name": "totalFeesAccumulatedUsh";
|
2273
|
+
"type": "u128";
|
2274
|
+
},
|
2275
|
+
{
|
2276
|
+
"name": "totalFeesAccumulatedCollateral";
|
2277
|
+
"type": "u128";
|
2278
|
+
},
|
2279
|
+
{
|
2280
|
+
"name": "vaultTypeName";
|
2281
|
+
"type": "string";
|
2282
|
+
},
|
2180
2283
|
{
|
2181
2284
|
"name": "firstVaultToRedeem";
|
2182
2285
|
"type": {
|
2183
2286
|
"option": "publicKey";
|
2184
2287
|
};
|
2185
|
-
},
|
2186
|
-
{
|
2187
|
-
"name": "deprecated";
|
2188
|
-
"type": "bool";
|
2189
2288
|
}
|
2190
2289
|
];
|
2191
2290
|
};
|
@@ -2212,12 +2311,14 @@ export declare type Vault = {
|
|
2212
2311
|
"type": "u64";
|
2213
2312
|
},
|
2214
2313
|
{
|
2215
|
-
"name": "
|
2216
|
-
"type":
|
2314
|
+
"name": "vaultStatus";
|
2315
|
+
"type": {
|
2316
|
+
"defined": "VaultStatus";
|
2317
|
+
};
|
2217
2318
|
},
|
2218
2319
|
{
|
2219
|
-
"name": "
|
2220
|
-
"type": "
|
2320
|
+
"name": "vaultType";
|
2321
|
+
"type": "publicKey";
|
2221
2322
|
},
|
2222
2323
|
{
|
2223
2324
|
"name": "bump";
|
@@ -2241,12 +2342,6 @@ export declare type Vault = {
|
|
2241
2342
|
"defined": "CurrencyType";
|
2242
2343
|
};
|
2243
2344
|
},
|
2244
|
-
{
|
2245
|
-
"name": "vaultStatus";
|
2246
|
-
"type": {
|
2247
|
-
"defined": "VaultStatus";
|
2248
|
-
};
|
2249
|
-
},
|
2250
2345
|
{
|
2251
2346
|
"name": "timeCreated";
|
2252
2347
|
"type": "u64";
|
@@ -2255,6 +2350,14 @@ export declare type Vault = {
|
|
2255
2350
|
"name": "timeLastInteraction";
|
2256
2351
|
"type": "u64";
|
2257
2352
|
},
|
2353
|
+
{
|
2354
|
+
"name": "vaultTypeName";
|
2355
|
+
"type": "string";
|
2356
|
+
},
|
2357
|
+
{
|
2358
|
+
"name": "pdaSalt";
|
2359
|
+
"type": "string";
|
2360
|
+
},
|
2258
2361
|
{
|
2259
2362
|
"name": "nextVaultToRedeem";
|
2260
2363
|
"type": {
|
@@ -2349,6 +2452,24 @@ export declare type Vault = {
|
|
2349
2452
|
"option": "publicKey";
|
2350
2453
|
};
|
2351
2454
|
},
|
2455
|
+
{
|
2456
|
+
"name": "priorityChainlink";
|
2457
|
+
"type": {
|
2458
|
+
"option": "i8";
|
2459
|
+
};
|
2460
|
+
},
|
2461
|
+
{
|
2462
|
+
"name": "priorityPyth";
|
2463
|
+
"type": {
|
2464
|
+
"option": "i8";
|
2465
|
+
};
|
2466
|
+
},
|
2467
|
+
{
|
2468
|
+
"name": "prioritySwitchboard";
|
2469
|
+
"type": {
|
2470
|
+
"option": "i8";
|
2471
|
+
};
|
2472
|
+
},
|
2352
2473
|
{
|
2353
2474
|
"name": "deprecated";
|
2354
2475
|
"type": {
|
@@ -2673,8 +2794,8 @@ export declare type Vault = {
|
|
2673
2794
|
},
|
2674
2795
|
{
|
2675
2796
|
"code": 6020;
|
2676
|
-
"name": "
|
2677
|
-
"msg": "Can only redeem
|
2797
|
+
"name": "NotRedeemingLowestCollateralRatioVault";
|
2798
|
+
"msg": "Can only redeem lowest collateral ratio vault in system.";
|
2678
2799
|
},
|
2679
2800
|
{
|
2680
2801
|
"code": 6021;
|
@@ -2688,8 +2809,38 @@ export declare type Vault = {
|
|
2688
2809
|
},
|
2689
2810
|
{
|
2690
2811
|
"code": 6023;
|
2812
|
+
"name": "InvalidSaltLength";
|
2813
|
+
"msg": "Salt for new vaults must be of length 8";
|
2814
|
+
},
|
2815
|
+
{
|
2816
|
+
"code": 6024;
|
2817
|
+
"name": "InvalidNameLength";
|
2818
|
+
"msg": "Name for new vault type must be length 16";
|
2819
|
+
},
|
2820
|
+
{
|
2821
|
+
"code": 6025;
|
2691
2822
|
"name": "UpdateVaultTypeBadMaxDebtExtended";
|
2692
2823
|
"msg": "New Max debt extended value is less than the current debt!";
|
2824
|
+
},
|
2825
|
+
{
|
2826
|
+
"code": 6026;
|
2827
|
+
"name": "UpdateVaultTypeNoEnabledOracles";
|
2828
|
+
"msg": "No Enabled Oracles!";
|
2829
|
+
},
|
2830
|
+
{
|
2831
|
+
"code": 6027;
|
2832
|
+
"name": "UpdateVaultTypeDuplicateOraclePriorities";
|
2833
|
+
"msg": "Duplicate Oracle Priorities";
|
2834
|
+
},
|
2835
|
+
{
|
2836
|
+
"code": 6028;
|
2837
|
+
"name": "UpdateVaultTypeInvalidOraclePriority";
|
2838
|
+
"msg": "Invalid Oracle Priority";
|
2839
|
+
},
|
2840
|
+
{
|
2841
|
+
"code": 6029;
|
2842
|
+
"name": "OracleUpdateFailed";
|
2843
|
+
"msg": "OracleUpdateFailed";
|
2693
2844
|
}
|
2694
2845
|
];
|
2695
2846
|
};
|
package/declarations/index.d.ts
CHANGED
@@ -5,6 +5,7 @@ export * from './instructions/claimStakingPoolPosition';
|
|
5
5
|
export * from './instructions/depositLiquidationPool';
|
6
6
|
export * from './instructions/closeLiquidationPoolPosition';
|
7
7
|
export * from './instructions/claimLiquidationPoolPosition';
|
8
|
+
export * from './instructions/closeClaimedLiquidationPoolPosition';
|
8
9
|
export * from './instructions/createVault';
|
9
10
|
export * from './instructions/depositVault';
|
10
11
|
export * from './instructions/withdrawVault';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function claimLiquidationPoolPosition(program: Program<Vault>, provider: Provider, poolPosition: PublicKey, payer: Signer, collateralType: string, overrideStartTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function claimLiquidationPoolPositionInstruction(program: Program<Vault>, vaultTypeAccount: PublicKey, collateralMint: PublicKey, poolPosition: PublicKey, payer: PublicKey, payerAssociatedTokenAccount: PublicKey, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function claimStakingPoolPosition(program: Program<Vault>, provider: Provider, poolPosition: PublicKey, payer: Signer, collateralType: string): Promise<PublicKey>;
|
5
5
|
export declare function claimStakingPoolPositionInstruction(program: Program<Vault>, feePool: PublicKey, feePoolAssociatedTokenAccount: PublicKey, stakedTokenMint: PublicKey, vaultTypeAccount: PublicKey, collateralMint: PublicKey, poolPosition: PublicKey, payer: PublicKey, payerAssociatedTokenAccount: PublicKey): Promise<TransactionInstruction>;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { Program, Provider } from '@project-serum/anchor';
|
2
|
+
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
|
+
export declare function closeClaimedLiquidationPoolPosition(program: Program<Vault>, provider: Provider, poolPosition: PublicKey, payer: Signer): Promise<PublicKey>;
|
5
|
+
export declare function closeClaimedLiquidationPoolPositionInstruction(program: Program<Vault>, poolPosition: PublicKey, payer: PublicKey): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function closeLiquidationPoolPosition(program: Program<Vault>, provider: Provider, poolPosition: PublicKey, payer: Signer, overrideStartTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function closeLiquidationPoolPositionInstruction(program: Program<Vault>, poolEra: PublicKey, poolPosition: PublicKey, payerPublicKey: PublicKey, payerUshAccount: PublicKey, payerAssociatedHedgeAccount: PublicKey, communityAssociatedHedgeTokenAccount: PublicKey, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function createStakingPool(program: Program<Vault>, provider: Provider, payer: Signer, mintPublicKey: PublicKey, hedgeTokensToBeMinted: number, overrideStartTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function createStakingPoolInstruction(program: Program<Vault>, payerPublicKey: PublicKey, mintPublicKey: PublicKey, hedgeTokensToBeMinted: number, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, Transaction, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function createVault(program: Program<Vault>, provider: Provider, payer: Signer, collateralType: string, depositAmount: number, overrideTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function buildCreateVaultTransaction(program: Program<Vault>, payerPublicKey: PublicKey, collateralType: string, depositAmount: number, overrideTime?: number): Promise<[Transaction, Signer[], PublicKey]>;
|
6
6
|
export declare function createVaultInstruction(program: Program<Vault>, 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,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function depositLiquidationPool(program: Program<Vault>, provider: Provider, payer: Signer, depositAmount: number, overrideStartTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function depositLiquidationPoolInstruction(program: Program<Vault>, payerPublicKey: PublicKey, payerUshAccount: PublicKey, poolPositionPublicKey: PublicKey, depositAmount: number, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function depositStakingPool(program: Program<Vault>, provider: Provider, payer: Signer, mintPublicKey: PublicKey, depositAmount: number, overrideStartTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function depositStakingPoolInstruction(program: Program<Vault>, payerPublicKey: PublicKey, poolPositionPublicKey: PublicKey, stakedTokenMintPublicKey: PublicKey, depositAmount: number, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function depositVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, depositAmount: number, overrideTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function depositVaultInstruction(program: Program<Vault>, vaultSystemStatePublicKey: PublicKey, vaultOwner: PublicKey, vaultOwnerTokenAccount: PublicKey, vaultPublicKey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccountPublicKey: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, hedgeStakingPoolPublicKey: PublicKey, hedgeStakingPoolAssociatedUshTokenAccount: PublicKey, collateralMint: PublicKey, ushMintPublickey: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, depositAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function initHedgeFoundation(program: Program<Vault>, provider: Provider, payer: Signer): Promise<PublicKey>;
|
5
5
|
export declare function initHedgeFoundationInstruction(program: Program<Vault>, poolEraPublicKey: PublicKey, payerPublicKey: PublicKey): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function liquidateVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, overrideTime?: number): Promise<PublicKey>;
|
5
|
-
export declare function liquidateVaultInstruction(program: Program<Vault>, 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, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey,
|
5
|
+
export declare function liquidateVaultInstruction(program: Program<Vault>, 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, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, vaultTypeAccount: PublicKey, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function loanVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, loanAmount: number, overrideTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function loanVaultInstruction(program: Program<Vault>, payerPublicKey: PublicKey, ownerUshAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, loanAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function redeemVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, redeemAmount: number, transactionOverrideTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function redeemVaultInstruction(program: Program<Vault>, payerPublicKey: PublicKey, payerUshAccount: PublicKey, destinationTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, redeemAmount: number, transactionOverrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
|
-
import { Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
4
|
-
export declare function refreshOraclePrice(program: Program<Vault>, provider: Provider, payer: Signer, collateralType: string, network: Cluster, overridePrice?: number, overrideTime?: number): Promise<
|
2
|
+
import { Signer, TransactionInstruction, TransactionSignature } from '@solana/web3.js';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
|
+
export declare function refreshOraclePrice(program: Program<Vault>, provider: Provider, payer: Signer, collateralType: string, network: Cluster, overridePrice?: number, overrideTime?: number): Promise<TransactionSignature | void>;
|
5
5
|
export declare function refreshOraclePriceInstruction(program: Program<Vault>, collateralType: string, network: Cluster, overridePrice?: number, overrideTime?: number): Promise<TransactionInstruction>;
|
6
6
|
export declare enum Cluster {
|
7
7
|
Testing = "Testing",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function repayVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, repayAmount: number, overrideTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function repayVaultInstruction(program: Program<Vault>, payerPublicKey: PublicKey, ownerUshAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, repayAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function setHalted(program: Program<Vault>, provider: Provider, payer: Signer, halted: boolean): Promise<PublicKey>;
|
5
5
|
export declare function setHaltedInstruction(program: Program<Vault>, vaultSystemStatePublicKey: PublicKey, payerPublicKey: PublicKey, halted: boolean): Promise<TransactionInstruction>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="bn.js" />
|
2
2
|
import { BN, Program, Provider } from '@project-serum/anchor';
|
3
3
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
4
|
-
import { Vault } from 'idl/vault';
|
4
|
+
import { Vault } from '../idl/vault';
|
5
5
|
export interface VaultTypeConfig {
|
6
6
|
maxDebtExtended?: BN;
|
7
7
|
minDebtPerVault?: BN;
|
@@ -9,6 +9,9 @@ export interface VaultTypeConfig {
|
|
9
9
|
oracleChainlink?: PublicKey;
|
10
10
|
oraclePyth?: PublicKey;
|
11
11
|
oracleSwitchboard?: PublicKey;
|
12
|
+
priorityPyth?: number;
|
13
|
+
priorityChainlink?: number;
|
14
|
+
prioritySwitchboard?: number;
|
12
15
|
deprecated?: boolean;
|
13
16
|
}
|
14
17
|
export declare function updateVaultType(program: Program<Vault>, provider: Provider, payer: Signer, vaultTypeAccount: PublicKey, oracleInfoAccount: PublicKey, config: VaultTypeConfig): Promise<PublicKey>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function withdrawStakingPool(program: Program<Vault>, provider: Provider, payer: Signer, poolPositionPublicKey: PublicKey, stakedTokenMintPublicKey: PublicKey, overrideStartTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function withdrawStakingPoolInstruction(program: Program<Vault>, payerPublicKey: PublicKey, poolPositionPublicKey: PublicKey, stakedTokenMintPublicKey: PublicKey, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
-
import { Vault } from 'idl/vault';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
4
|
export declare function withdrawVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, withdrawAmount: number, overrideTime?: number): Promise<PublicKey>;
|
5
5
|
export declare function withdrawVaultInstruction(program: Program<Vault>, vaultSystemStatePublicKey: PublicKey, payerPublicKey: PublicKey, destinationTokenAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedCollateralPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, hedgeStakingPoolPublicKey: PublicKey, hedgeStakingPoolAssociatedUshTokenAccount: PublicKey, ushMint: PublicKey, historyPublicKey: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, withdrawAmount: number, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { PublicKey } from '@solana/web3.js';
|
3
3
|
import Decimal from 'decimal.js';
|
4
|
+
import VaultType from './VaultType';
|
4
5
|
/**
|
5
6
|
* A class that represents an on-chian vault.
|
6
7
|
*/
|
@@ -12,21 +13,23 @@ export declare class VaultAccount {
|
|
12
13
|
/** The public key of the vault owner. */
|
13
14
|
pdaSalt: string;
|
14
15
|
/** The deposited collateral of the vault (in SOL Lamports). */
|
15
|
-
deposited:
|
16
|
+
deposited: number;
|
16
17
|
/** The outstanding debt of the vault (in USH Lamports). Denormalized to time 0. */
|
17
|
-
denormalizedDebt:
|
18
|
+
denormalizedDebt: number;
|
18
19
|
/** The ordered number of when this vault was created. */
|
19
20
|
vaultNumber: number;
|
20
21
|
/** Debt redistribution snapshot */
|
21
22
|
debtProductSnapshotBytes: Decimal;
|
22
23
|
/** Collateral redistribution snapshot' */
|
23
24
|
collateralAccumulatorSnapshotBytes: Decimal;
|
24
|
-
/** The vault type eg 'SOL-150' */
|
25
|
-
|
25
|
+
/** The vault type eg '2-SOL-150-0-----' */
|
26
|
+
vaultTypeName: string;
|
26
27
|
/** Current State of the vault ("Open", "Closed", "Liquidated") */
|
27
28
|
vaultStatus: string;
|
28
29
|
/** The public key of the next vault to redeem. */
|
29
30
|
nextVaultToRedeem: PublicKey;
|
31
|
+
/** The public key of the vault type. */
|
32
|
+
vaultType: PublicKey;
|
30
33
|
constructor(vault: any, publicKey: PublicKey);
|
31
34
|
/**
|
32
35
|
* Check if some `PublicKey` is the owner
|
@@ -53,11 +56,11 @@ export declare class VaultAccount {
|
|
53
56
|
* @returns example: `1b6ca...azy71s`
|
54
57
|
*/
|
55
58
|
toDisplayString(): string;
|
56
|
-
addDebt(
|
59
|
+
addDebt(additionalDebt: Decimal, vaultTypeAccount: VaultType): void;
|
57
60
|
addDeposit(depositAmount: number): void;
|
58
61
|
redeem(): void;
|
59
62
|
liquidate(): void;
|
60
|
-
updateDebtAndCollateral(
|
63
|
+
updateDebtAndCollateral(vaultTypeAccountData: VaultType): void;
|
61
64
|
toString(highlight: PublicKey): string;
|
62
65
|
/**
|
63
66
|
* Creates a VaultAccount from a slice of data
|