hedge-web3 0.1.46 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. package/declarations/Constants.d.ts +2 -1
  2. package/declarations/idl/vault.d.ts +109 -47
  3. package/declarations/instructions/claimLiquidationPoolPosition.d.ts +1 -1
  4. package/declarations/instructions/claimStakingPoolPosition.d.ts +1 -1
  5. package/declarations/instructions/closeLiquidationPoolPosition.d.ts +1 -1
  6. package/declarations/instructions/createStakingPool.d.ts +1 -1
  7. package/declarations/instructions/createVault.d.ts +1 -1
  8. package/declarations/instructions/depositLiquidationPool.d.ts +1 -1
  9. package/declarations/instructions/depositStakingPool.d.ts +1 -1
  10. package/declarations/instructions/depositVault.d.ts +1 -1
  11. package/declarations/instructions/initHedgeFoundation.d.ts +1 -1
  12. package/declarations/instructions/liquidateVault.d.ts +1 -1
  13. package/declarations/instructions/loanVault.d.ts +1 -1
  14. package/declarations/instructions/redeemVault.d.ts +1 -1
  15. package/declarations/instructions/refreshOraclePrice.d.ts +3 -3
  16. package/declarations/instructions/repayVault.d.ts +1 -1
  17. package/declarations/instructions/setHalted.d.ts +1 -1
  18. package/declarations/instructions/updateVaultType.d.ts +4 -1
  19. package/declarations/instructions/withdrawStakingPool.d.ts +1 -1
  20. package/declarations/instructions/withdrawVault.d.ts +1 -1
  21. package/declarations/state/VaultAccount.d.ts +4 -3
  22. package/declarations/utils/getLinkedListAccounts.d.ts +1 -1
  23. package/lib/Constants.js +3 -2
  24. package/lib/idl/vault.js +109 -47
  25. package/lib/instructions/claimLiquidationPoolPosition.js +5 -1
  26. package/lib/instructions/claimStakingPoolPosition.js +5 -1
  27. package/lib/instructions/closeLiquidationPoolPosition.js +5 -1
  28. package/lib/instructions/createStakingPool.js +5 -2
  29. package/lib/instructions/createVault.js +5 -1
  30. package/lib/instructions/depositLiquidationPool.js +5 -1
  31. package/lib/instructions/depositStakingPool.js +5 -1
  32. package/lib/instructions/depositVault.js +5 -1
  33. package/lib/instructions/initHedgeFoundation.js +5 -1
  34. package/lib/instructions/initHedgeFoundationTokens.js +5 -1
  35. package/lib/instructions/liquidateVault.js +5 -1
  36. package/lib/instructions/loanVault.js +5 -3
  37. package/lib/instructions/redeemVault.js +5 -1
  38. package/lib/instructions/refreshOraclePrice.js +6 -1
  39. package/lib/instructions/repayVault.js +5 -1
  40. package/lib/instructions/setHalted.js +5 -1
  41. package/lib/instructions/updateVaultType.js +9 -2
  42. package/lib/instructions/withdrawStakingPool.js +5 -1
  43. package/lib/instructions/withdrawVault.js +5 -1
  44. package/lib/state/VaultAccount.js +11 -9
  45. package/lib/utils/getLinkedListAccounts.js +48 -48
  46. package/package.json +1 -1
  47. package/src/Constants.ts +2 -1
  48. package/src/idl/vault.ts +218 -94
  49. package/src/instructions/claimLiquidationPoolPosition.ts +3 -2
  50. package/src/instructions/claimStakingPoolPosition.ts +3 -2
  51. package/src/instructions/closeLiquidationPoolPosition.ts +3 -2
  52. package/src/instructions/createStakingPool.ts +3 -3
  53. package/src/instructions/createVault.ts +3 -2
  54. package/src/instructions/depositLiquidationPool.ts +3 -2
  55. package/src/instructions/depositStakingPool.ts +3 -2
  56. package/src/instructions/depositVault.ts +3 -3
  57. package/src/instructions/initHedgeFoundation.ts +3 -2
  58. package/src/instructions/initHedgeFoundationTokens.ts +2 -1
  59. package/src/instructions/liquidateVault.ts +5 -3
  60. package/src/instructions/loanVault.ts +3 -4
  61. package/src/instructions/redeemVault.ts +3 -2
  62. package/src/instructions/refreshOraclePrice.ts +7 -4
  63. package/src/instructions/repayVault.ts +3 -2
  64. package/src/instructions/setHalted.ts +3 -2
  65. package/src/instructions/updateVaultType.ts +10 -2
  66. package/src/instructions/withdrawStakingPool.ts +3 -2
  67. package/src/instructions/withdrawVault.ts +3 -2
  68. package/src/state/VaultAccount.ts +17 -12
  69. package/src/state/VaultType.ts +62 -0
  70. package/src/utils/getLinkedListAccounts.ts +54 -49
  71. 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 = "HDG4FDos8fyrB79qMCe98gaFjNEy5kpxGNjMc5V8M6TJ";
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": [
@@ -1769,7 +1774,7 @@ export declare type Vault = {
1769
1774
  "type": {
1770
1775
  "array": [
1771
1776
  "u128",
1772
- 32
1777
+ 128
1773
1778
  ];
1774
1779
  };
1775
1780
  },
@@ -1829,10 +1834,6 @@ export declare type Vault = {
1829
1834
  "type": {
1830
1835
  "kind": "struct";
1831
1836
  "fields": [
1832
- {
1833
- "name": "state";
1834
- "type": "u64";
1835
- },
1836
1837
  {
1837
1838
  "name": "era";
1838
1839
  "type": "publicKey";
@@ -1841,14 +1842,6 @@ export declare type Vault = {
1841
1842
  "name": "ownerAccount";
1842
1843
  "type": "publicKey";
1843
1844
  },
1844
- {
1845
- "name": "deposit";
1846
- "type": "u64";
1847
- },
1848
- {
1849
- "name": "closedUsh";
1850
- "type": "u64";
1851
- },
1852
1845
  {
1853
1846
  "name": "productSnapshotEntry";
1854
1847
  "type": "u128";
@@ -1862,7 +1855,7 @@ export declare type Vault = {
1862
1855
  "type": {
1863
1856
  "array": [
1864
1857
  "u128",
1865
- 32
1858
+ 128
1866
1859
  ];
1867
1860
  };
1868
1861
  },
@@ -1871,7 +1864,7 @@ export declare type Vault = {
1871
1864
  "type": {
1872
1865
  "array": [
1873
1866
  "u128",
1874
- 32
1867
+ 128
1875
1868
  ];
1876
1869
  };
1877
1870
  },
@@ -1879,6 +1872,14 @@ export declare type Vault = {
1879
1872
  "name": "hedgeRewardsSnapshotAccum";
1880
1873
  "type": "u128";
1881
1874
  },
1875
+ {
1876
+ "name": "deposit";
1877
+ "type": "u64";
1878
+ },
1879
+ {
1880
+ "name": "closedUsh";
1881
+ "type": "u64";
1882
+ },
1882
1883
  {
1883
1884
  "name": "timestampOpened";
1884
1885
  "type": "u64";
@@ -1886,6 +1887,12 @@ export declare type Vault = {
1886
1887
  {
1887
1888
  "name": "timestampClosed";
1888
1889
  "type": "u64";
1890
+ },
1891
+ {
1892
+ "name": "state";
1893
+ "type": {
1894
+ "defined": "PositionState";
1895
+ };
1889
1896
  }
1890
1897
  ];
1891
1898
  };
@@ -1896,8 +1903,8 @@ export declare type Vault = {
1896
1903
  "kind": "struct";
1897
1904
  "fields": [
1898
1905
  {
1899
- "name": "vaultTypeName";
1900
- "type": "string";
1906
+ "name": "vaultType";
1907
+ "type": "publicKey";
1901
1908
  },
1902
1909
  {
1903
1910
  "name": "oraclePyth";
@@ -1912,8 +1919,20 @@ export declare type Vault = {
1912
1919
  "type": "publicKey";
1913
1920
  },
1914
1921
  {
1915
- "name": "vaultType";
1916
- "type": "publicKey";
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";
1917
1936
  }
1918
1937
  ];
1919
1938
  };
@@ -1936,7 +1955,7 @@ export declare type Vault = {
1936
1955
  "type": {
1937
1956
  "array": [
1938
1957
  "u128",
1939
- 32
1958
+ 128
1940
1959
  ];
1941
1960
  };
1942
1961
  },
@@ -1945,7 +1964,7 @@ export declare type Vault = {
1945
1964
  "type": {
1946
1965
  "array": [
1947
1966
  "u128",
1948
- 32
1967
+ 128
1949
1968
  ];
1950
1969
  };
1951
1970
  },
@@ -2033,7 +2052,7 @@ export declare type Vault = {
2033
2052
  "type": {
2034
2053
  "array": [
2035
2054
  "u128",
2036
- 32
2055
+ 128
2037
2056
  ];
2038
2057
  };
2039
2058
  },
@@ -2117,7 +2136,7 @@ export declare type Vault = {
2117
2136
  },
2118
2137
  {
2119
2138
  "name": "totalUshSupply";
2120
- "type": "u64";
2139
+ "type": "u128";
2121
2140
  },
2122
2141
  {
2123
2142
  "name": "totalVaults";
@@ -2157,10 +2176,6 @@ export declare type Vault = {
2157
2176
  "type": {
2158
2177
  "kind": "struct";
2159
2178
  "fields": [
2160
- {
2161
- "name": "vaultTypeName";
2162
- "type": "string";
2163
- },
2164
2179
  {
2165
2180
  "name": "collateralMint";
2166
2181
  "type": "publicKey";
@@ -2233,12 +2248,6 @@ export declare type Vault = {
2233
2248
  "name": "interestRatePerSecond";
2234
2249
  "type": "u128";
2235
2250
  },
2236
- {
2237
- "name": "firstVaultToRedeem";
2238
- "type": {
2239
- "option": "publicKey";
2240
- };
2241
- },
2242
2251
  {
2243
2252
  "name": "deprecated";
2244
2253
  "type": "bool";
@@ -2250,6 +2259,16 @@ export declare type Vault = {
2250
2259
  {
2251
2260
  "name": "totalFeesAccumulatedCollateral";
2252
2261
  "type": "u128";
2262
+ },
2263
+ {
2264
+ "name": "vaultTypeName";
2265
+ "type": "string";
2266
+ },
2267
+ {
2268
+ "name": "firstVaultToRedeem";
2269
+ "type": {
2270
+ "option": "publicKey";
2271
+ };
2253
2272
  }
2254
2273
  ];
2255
2274
  };
@@ -2276,12 +2295,14 @@ export declare type Vault = {
2276
2295
  "type": "u64";
2277
2296
  },
2278
2297
  {
2279
- "name": "vaultTypeName";
2280
- "type": "string";
2298
+ "name": "vaultStatus";
2299
+ "type": {
2300
+ "defined": "VaultStatus";
2301
+ };
2281
2302
  },
2282
2303
  {
2283
- "name": "pdaSalt";
2284
- "type": "string";
2304
+ "name": "vaultType";
2305
+ "type": "publicKey";
2285
2306
  },
2286
2307
  {
2287
2308
  "name": "bump";
@@ -2305,12 +2326,6 @@ export declare type Vault = {
2305
2326
  "defined": "CurrencyType";
2306
2327
  };
2307
2328
  },
2308
- {
2309
- "name": "vaultStatus";
2310
- "type": {
2311
- "defined": "VaultStatus";
2312
- };
2313
- },
2314
2329
  {
2315
2330
  "name": "timeCreated";
2316
2331
  "type": "u64";
@@ -2319,15 +2334,19 @@ export declare type Vault = {
2319
2334
  "name": "timeLastInteraction";
2320
2335
  "type": "u64";
2321
2336
  },
2337
+ {
2338
+ "name": "vaultTypeName";
2339
+ "type": "string";
2340
+ },
2341
+ {
2342
+ "name": "pdaSalt";
2343
+ "type": "string";
2344
+ },
2322
2345
  {
2323
2346
  "name": "nextVaultToRedeem";
2324
2347
  "type": {
2325
2348
  "option": "publicKey";
2326
2349
  };
2327
- },
2328
- {
2329
- "name": "vaultType";
2330
- "type": "publicKey";
2331
2350
  }
2332
2351
  ];
2333
2352
  };
@@ -2417,6 +2436,24 @@ export declare type Vault = {
2417
2436
  "option": "publicKey";
2418
2437
  };
2419
2438
  },
2439
+ {
2440
+ "name": "priorityChainlink";
2441
+ "type": {
2442
+ "option": "i8";
2443
+ };
2444
+ },
2445
+ {
2446
+ "name": "priorityPyth";
2447
+ "type": {
2448
+ "option": "i8";
2449
+ };
2450
+ },
2451
+ {
2452
+ "name": "prioritySwitchboard";
2453
+ "type": {
2454
+ "option": "i8";
2455
+ };
2456
+ },
2420
2457
  {
2421
2458
  "name": "deprecated";
2422
2459
  "type": {
@@ -2761,8 +2798,33 @@ export declare type Vault = {
2761
2798
  },
2762
2799
  {
2763
2800
  "code": 6024;
2801
+ "name": "InvalidNameLength";
2802
+ "msg": "Name for new vault type must be length 16";
2803
+ },
2804
+ {
2805
+ "code": 6025;
2764
2806
  "name": "UpdateVaultTypeBadMaxDebtExtended";
2765
2807
  "msg": "New Max debt extended value is less than the current debt!";
2808
+ },
2809
+ {
2810
+ "code": 6026;
2811
+ "name": "UpdateVaultTypeNoEnabledOracles";
2812
+ "msg": "No Enabled Oracles!";
2813
+ },
2814
+ {
2815
+ "code": 6027;
2816
+ "name": "UpdateVaultTypeDuplicateOraclePriorities";
2817
+ "msg": "Duplicate Oracle Priorities";
2818
+ },
2819
+ {
2820
+ "code": 6028;
2821
+ "name": "UpdateVaultTypeInvalidOraclePriority";
2822
+ "msg": "Invalid Oracle Priority";
2823
+ },
2824
+ {
2825
+ "code": 6029;
2826
+ "name": "OracleUpdateFailed";
2827
+ "msg": "OracleUpdateFailed";
2766
2828
  }
2767
2829
  ];
2768
2830
  };
@@ -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<string>;
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(newNormalizedDebt: Decimal, vaultTypeCompoundedInterest: Decimal): void;
59
+ addDebt(additionalDebt: Decimal, vaultTypeAccount: VaultType): void;
59
60
  addDeposit(depositAmount: number): void;
60
61
  redeem(): void;
61
62
  liquidate(): void;
62
- updateDebtAndCollateral(vaultTypeAccountData: any): void;
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 = 'HDG4FDos8fyrB79qMCe98gaFjNEy5kpxGNjMc5V8M6TJ';
15
+ exports.HEDGE_PROGRAM_ID = 'HedgeEohwU6RqokrvPU4Hb6XKPub8NuKbnPmY7FoMMtN';
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* () {