hedge-web3 0.1.44 → 0.2.0
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 +161 -35
- package/declarations/instructions/claimLiquidationPoolPosition.d.ts +1 -1
- package/declarations/instructions/claimStakingPoolPosition.d.ts +1 -1
- 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 +1 -1
- 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 +4 -3
- package/declarations/utils/getLinkedListAccounts.d.ts +1 -1
- package/lib/Constants.js +3 -2
- package/lib/idl/vault.js +161 -35
- package/lib/instructions/claimLiquidationPoolPosition.js +5 -1
- package/lib/instructions/claimStakingPoolPosition.js +5 -1
- package/lib/instructions/closeLiquidationPoolPosition.js +5 -1
- package/lib/instructions/createStakingPool.js +5 -2
- 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 +5 -1
- package/lib/instructions/initHedgeFoundation.js +5 -1
- package/lib/instructions/initHedgeFoundationTokens.js +5 -1
- package/lib/instructions/liquidateVault.js +5 -1
- package/lib/instructions/loanVault.js +5 -3
- package/lib/instructions/redeemVault.js +5 -1
- package/lib/instructions/refreshOraclePrice.js +6 -1
- package/lib/instructions/repayVault.js +5 -1
- 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 +5 -1
- package/lib/state/VaultAccount.js +11 -9
- package/lib/utils/getLinkedListAccounts.js +48 -48
- package/package.json +1 -1
- package/src/Constants.ts +2 -1
- package/src/idl/vault.ts +322 -70
- package/src/instructions/claimLiquidationPoolPosition.ts +3 -2
- package/src/instructions/claimStakingPoolPosition.ts +3 -2
- package/src/instructions/closeLiquidationPoolPosition.ts +3 -2
- package/src/instructions/createStakingPool.ts +3 -3
- 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 +3 -3
- package/src/instructions/initHedgeFoundation.ts +3 -2
- package/src/instructions/initHedgeFoundationTokens.ts +2 -1
- package/src/instructions/liquidateVault.ts +5 -3
- package/src/instructions/loanVault.ts +3 -4
- package/src/instructions/redeemVault.ts +3 -2
- package/src/instructions/refreshOraclePrice.ts +7 -4
- package/src/instructions/repayVault.ts +3 -2
- package/src/instructions/setHalted.ts +3 -2
- package/src/instructions/updateVaultType.ts +10 -2
- package/src/instructions/withdrawStakingPool.ts +3 -2
- package/src/instructions/withdrawVault.ts +3 -2
- package/src/state/VaultAccount.ts +17 -12
- package/src/state/VaultType.ts +62 -0
- package/src/utils/getLinkedListAccounts.ts +54 -49
- 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 = "HedgeiSAoDWrgfyJ9z8XVsxhcCY2D9aHq1o3kTEbG1C1";
|
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,58 @@ 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": [];
|
1652
1709
|
}
|
1653
1710
|
];
|
1654
1711
|
"accounts": [
|
@@ -1777,10 +1834,6 @@ export declare type Vault = {
|
|
1777
1834
|
"type": {
|
1778
1835
|
"kind": "struct";
|
1779
1836
|
"fields": [
|
1780
|
-
{
|
1781
|
-
"name": "state";
|
1782
|
-
"type": "u64";
|
1783
|
-
},
|
1784
1837
|
{
|
1785
1838
|
"name": "era";
|
1786
1839
|
"type": "publicKey";
|
@@ -1789,14 +1842,6 @@ export declare type Vault = {
|
|
1789
1842
|
"name": "ownerAccount";
|
1790
1843
|
"type": "publicKey";
|
1791
1844
|
},
|
1792
|
-
{
|
1793
|
-
"name": "deposit";
|
1794
|
-
"type": "u64";
|
1795
|
-
},
|
1796
|
-
{
|
1797
|
-
"name": "closedUsh";
|
1798
|
-
"type": "u64";
|
1799
|
-
},
|
1800
1845
|
{
|
1801
1846
|
"name": "productSnapshotEntry";
|
1802
1847
|
"type": "u128";
|
@@ -1827,6 +1872,14 @@ export declare type Vault = {
|
|
1827
1872
|
"name": "hedgeRewardsSnapshotAccum";
|
1828
1873
|
"type": "u128";
|
1829
1874
|
},
|
1875
|
+
{
|
1876
|
+
"name": "deposit";
|
1877
|
+
"type": "u64";
|
1878
|
+
},
|
1879
|
+
{
|
1880
|
+
"name": "closedUsh";
|
1881
|
+
"type": "u64";
|
1882
|
+
},
|
1830
1883
|
{
|
1831
1884
|
"name": "timestampOpened";
|
1832
1885
|
"type": "u64";
|
@@ -1834,6 +1887,12 @@ export declare type Vault = {
|
|
1834
1887
|
{
|
1835
1888
|
"name": "timestampClosed";
|
1836
1889
|
"type": "u64";
|
1890
|
+
},
|
1891
|
+
{
|
1892
|
+
"name": "state";
|
1893
|
+
"type": {
|
1894
|
+
"defined": "PositionState";
|
1895
|
+
};
|
1837
1896
|
}
|
1838
1897
|
];
|
1839
1898
|
};
|
@@ -1844,8 +1903,8 @@ export declare type Vault = {
|
|
1844
1903
|
"kind": "struct";
|
1845
1904
|
"fields": [
|
1846
1905
|
{
|
1847
|
-
"name": "
|
1848
|
-
"type": "
|
1906
|
+
"name": "vaultType";
|
1907
|
+
"type": "publicKey";
|
1849
1908
|
},
|
1850
1909
|
{
|
1851
1910
|
"name": "oraclePyth";
|
@@ -1860,8 +1919,20 @@ export declare type Vault = {
|
|
1860
1919
|
"type": "publicKey";
|
1861
1920
|
},
|
1862
1921
|
{
|
1863
|
-
"name": "
|
1864
|
-
"type": "
|
1922
|
+
"name": "priorityPyth";
|
1923
|
+
"type": "i8";
|
1924
|
+
},
|
1925
|
+
{
|
1926
|
+
"name": "priorityChainlink";
|
1927
|
+
"type": "i8";
|
1928
|
+
},
|
1929
|
+
{
|
1930
|
+
"name": "prioritySwitchboard";
|
1931
|
+
"type": "i8";
|
1932
|
+
},
|
1933
|
+
{
|
1934
|
+
"name": "vaultTypeName";
|
1935
|
+
"type": "string";
|
1865
1936
|
}
|
1866
1937
|
];
|
1867
1938
|
};
|
@@ -2065,7 +2136,7 @@ export declare type Vault = {
|
|
2065
2136
|
},
|
2066
2137
|
{
|
2067
2138
|
"name": "totalUshSupply";
|
2068
|
-
"type": "
|
2139
|
+
"type": "u128";
|
2069
2140
|
},
|
2070
2141
|
{
|
2071
2142
|
"name": "totalVaults";
|
@@ -2105,10 +2176,6 @@ export declare type Vault = {
|
|
2105
2176
|
"type": {
|
2106
2177
|
"kind": "struct";
|
2107
2178
|
"fields": [
|
2108
|
-
{
|
2109
|
-
"name": "vaultTypeName";
|
2110
|
-
"type": "string";
|
2111
|
-
},
|
2112
2179
|
{
|
2113
2180
|
"name": "collateralMint";
|
2114
2181
|
"type": "publicKey";
|
@@ -2181,6 +2248,22 @@ export declare type Vault = {
|
|
2181
2248
|
"name": "interestRatePerSecond";
|
2182
2249
|
"type": "u128";
|
2183
2250
|
},
|
2251
|
+
{
|
2252
|
+
"name": "deprecated";
|
2253
|
+
"type": "bool";
|
2254
|
+
},
|
2255
|
+
{
|
2256
|
+
"name": "totalFeesAccumulatedUsh";
|
2257
|
+
"type": "u128";
|
2258
|
+
},
|
2259
|
+
{
|
2260
|
+
"name": "totalFeesAccumulatedCollateral";
|
2261
|
+
"type": "u128";
|
2262
|
+
},
|
2263
|
+
{
|
2264
|
+
"name": "vaultTypeName";
|
2265
|
+
"type": "string";
|
2266
|
+
},
|
2184
2267
|
{
|
2185
2268
|
"name": "firstVaultToRedeem";
|
2186
2269
|
"type": {
|
@@ -2224,12 +2307,14 @@ export declare type Vault = {
|
|
2224
2307
|
"type": "u64";
|
2225
2308
|
},
|
2226
2309
|
{
|
2227
|
-
"name": "
|
2228
|
-
"type":
|
2310
|
+
"name": "vaultStatus";
|
2311
|
+
"type": {
|
2312
|
+
"defined": "VaultStatus";
|
2313
|
+
};
|
2229
2314
|
},
|
2230
2315
|
{
|
2231
|
-
"name": "
|
2232
|
-
"type": "
|
2316
|
+
"name": "vaultType";
|
2317
|
+
"type": "publicKey";
|
2233
2318
|
},
|
2234
2319
|
{
|
2235
2320
|
"name": "bump";
|
@@ -2253,12 +2338,6 @@ export declare type Vault = {
|
|
2253
2338
|
"defined": "CurrencyType";
|
2254
2339
|
};
|
2255
2340
|
},
|
2256
|
-
{
|
2257
|
-
"name": "vaultStatus";
|
2258
|
-
"type": {
|
2259
|
-
"defined": "VaultStatus";
|
2260
|
-
};
|
2261
|
-
},
|
2262
2341
|
{
|
2263
2342
|
"name": "timeCreated";
|
2264
2343
|
"type": "u64";
|
@@ -2267,15 +2346,19 @@ export declare type Vault = {
|
|
2267
2346
|
"name": "timeLastInteraction";
|
2268
2347
|
"type": "u64";
|
2269
2348
|
},
|
2349
|
+
{
|
2350
|
+
"name": "vaultTypeName";
|
2351
|
+
"type": "string";
|
2352
|
+
},
|
2353
|
+
{
|
2354
|
+
"name": "pdaSalt";
|
2355
|
+
"type": "string";
|
2356
|
+
},
|
2270
2357
|
{
|
2271
2358
|
"name": "nextVaultToRedeem";
|
2272
2359
|
"type": {
|
2273
2360
|
"option": "publicKey";
|
2274
2361
|
};
|
2275
|
-
},
|
2276
|
-
{
|
2277
|
-
"name": "vaultType";
|
2278
|
-
"type": "publicKey";
|
2279
2362
|
}
|
2280
2363
|
];
|
2281
2364
|
};
|
@@ -2365,6 +2448,24 @@ export declare type Vault = {
|
|
2365
2448
|
"option": "publicKey";
|
2366
2449
|
};
|
2367
2450
|
},
|
2451
|
+
{
|
2452
|
+
"name": "priorityChainlink";
|
2453
|
+
"type": {
|
2454
|
+
"option": "i8";
|
2455
|
+
};
|
2456
|
+
},
|
2457
|
+
{
|
2458
|
+
"name": "priorityPyth";
|
2459
|
+
"type": {
|
2460
|
+
"option": "i8";
|
2461
|
+
};
|
2462
|
+
},
|
2463
|
+
{
|
2464
|
+
"name": "prioritySwitchboard";
|
2465
|
+
"type": {
|
2466
|
+
"option": "i8";
|
2467
|
+
};
|
2468
|
+
},
|
2368
2469
|
{
|
2369
2470
|
"name": "deprecated";
|
2370
2471
|
"type": {
|
@@ -2709,8 +2810,33 @@ export declare type Vault = {
|
|
2709
2810
|
},
|
2710
2811
|
{
|
2711
2812
|
"code": 6024;
|
2813
|
+
"name": "InvalidNameLength";
|
2814
|
+
"msg": "Name for new vault type must be length 16";
|
2815
|
+
},
|
2816
|
+
{
|
2817
|
+
"code": 6025;
|
2712
2818
|
"name": "UpdateVaultTypeBadMaxDebtExtended";
|
2713
2819
|
"msg": "New Max debt extended value is less than the current debt!";
|
2820
|
+
},
|
2821
|
+
{
|
2822
|
+
"code": 6025;
|
2823
|
+
"name": "UpdateVaultTypeNoEnabledOracles";
|
2824
|
+
"msg": "No Enabled Oracles!";
|
2825
|
+
},
|
2826
|
+
{
|
2827
|
+
"code": 6026;
|
2828
|
+
"name": "UpdateVaultTypeDuplicateOraclePriorities";
|
2829
|
+
"msg": "Duplicate Oracle Priorities";
|
2830
|
+
},
|
2831
|
+
{
|
2832
|
+
"code": 6027;
|
2833
|
+
"name": "UpdateVaultTypeInvalidOraclePriority";
|
2834
|
+
"msg": "Invalid Oracle Priority";
|
2835
|
+
},
|
2836
|
+
{
|
2837
|
+
"code": 6028;
|
2838
|
+
"name": "OracleUpdateFailed";
|
2839
|
+
"msg": "OracleUpdateFailed";
|
2714
2840
|
}
|
2715
2841
|
];
|
2716
2842
|
};
|
@@ -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>;
|
@@ -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
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
|
*/
|
@@ -21,7 +22,7 @@ export declare class VaultAccount {
|
|
21
22
|
debtProductSnapshotBytes: Decimal;
|
22
23
|
/** Collateral redistribution snapshot' */
|
23
24
|
collateralAccumulatorSnapshotBytes: Decimal;
|
24
|
-
/** The vault type eg '2-SOL-150-0' */
|
25
|
+
/** The vault type eg '2-SOL-150-0-----' */
|
25
26
|
vaultTypeName: string;
|
26
27
|
/** Current State of the vault ("Open", "Closed", "Liquidated") */
|
27
28
|
vaultStatus: string;
|
@@ -55,11 +56,11 @@ export declare class VaultAccount {
|
|
55
56
|
* @returns example: `1b6ca...azy71s`
|
56
57
|
*/
|
57
58
|
toDisplayString(): string;
|
58
|
-
addDebt(
|
59
|
+
addDebt(additionalDebt: Decimal, vaultTypeAccount: VaultType): void;
|
59
60
|
addDeposit(depositAmount: number): void;
|
60
61
|
redeem(): void;
|
61
62
|
liquidate(): void;
|
62
|
-
updateDebtAndCollateral(vaultTypeAccountData:
|
63
|
+
updateDebtAndCollateral(vaultTypeAccountData: VaultType): void;
|
63
64
|
toString(highlight: PublicKey): string;
|
64
65
|
/**
|
65
66
|
* Creates a VaultAccount from a slice of data
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey } from '@solana/web3.js';
|
3
3
|
import { VaultAccount } from '../state/VaultAccount';
|
4
|
-
import { Vault } from 'idl/vault';
|
4
|
+
import { Vault } from '../idl/vault';
|
5
5
|
export declare function getLinkedListAccounts(program: Program<Vault>, provider: Provider, vaultTypeAccountPublicKey: PublicKey, vaultPublicKey: PublicKey, depositAmount: number, loanAmount: number, redeem: boolean, liquidate: boolean, cachedVaults?: VaultAccount[]): Promise<[PublicKey, PublicKey, PublicKey, VaultAccount[]]>;
|
package/lib/Constants.js
CHANGED
@@ -9,13 +9,14 @@ 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.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;
|
12
|
+
exports.findAssociatedTokenAddress = exports.findVaultAddress = exports.getVaultTypeOracleAccountPublicKey = exports.getVaultTypeAccountPublicKey = exports.getPoolPublicKeyForMint = exports.getHedgeMintPublicKey = exports.getVaultSystemStatePublicKey = exports.getUshMintPublicKey = exports.getLiquidationPoolUshAccountPublicKey = exports.getLiquidationPoolStatePublicKey = exports.CHAINLINK_PROGRAM_ID = 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 = 'HedgeiSAoDWrgfyJ9z8XVsxhcCY2D9aHq1o3kTEbG1C1';
|
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);
|
19
|
+
exports.CHAINLINK_PROGRAM_ID = "HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny";
|
19
20
|
const enc = new TextEncoder();
|
20
21
|
function getLiquidationPoolStatePublicKey() {
|
21
22
|
return __awaiter(this, void 0, void 0, function* () {
|