hedge-web3 0.1.46 → 0.2.0

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 -35
  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 -35
  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 -70
  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 = "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": [
@@ -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";
@@ -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
  };
@@ -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,6 +2248,22 @@ export declare type Vault = {
2233
2248
  "name": "interestRatePerSecond";
2234
2249
  "type": "u128";
2235
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
+ },
2236
2267
  {
2237
2268
  "name": "firstVaultToRedeem";
2238
2269
  "type": {
@@ -2276,12 +2307,14 @@ export declare type Vault = {
2276
2307
  "type": "u64";
2277
2308
  },
2278
2309
  {
2279
- "name": "vaultTypeName";
2280
- "type": "string";
2310
+ "name": "vaultStatus";
2311
+ "type": {
2312
+ "defined": "VaultStatus";
2313
+ };
2281
2314
  },
2282
2315
  {
2283
- "name": "pdaSalt";
2284
- "type": "string";
2316
+ "name": "vaultType";
2317
+ "type": "publicKey";
2285
2318
  },
2286
2319
  {
2287
2320
  "name": "bump";
@@ -2305,12 +2338,6 @@ export declare type Vault = {
2305
2338
  "defined": "CurrencyType";
2306
2339
  };
2307
2340
  },
2308
- {
2309
- "name": "vaultStatus";
2310
- "type": {
2311
- "defined": "VaultStatus";
2312
- };
2313
- },
2314
2341
  {
2315
2342
  "name": "timeCreated";
2316
2343
  "type": "u64";
@@ -2319,15 +2346,19 @@ export declare type Vault = {
2319
2346
  "name": "timeLastInteraction";
2320
2347
  "type": "u64";
2321
2348
  },
2349
+ {
2350
+ "name": "vaultTypeName";
2351
+ "type": "string";
2352
+ },
2353
+ {
2354
+ "name": "pdaSalt";
2355
+ "type": "string";
2356
+ },
2322
2357
  {
2323
2358
  "name": "nextVaultToRedeem";
2324
2359
  "type": {
2325
2360
  "option": "publicKey";
2326
2361
  };
2327
- },
2328
- {
2329
- "name": "vaultType";
2330
- "type": "publicKey";
2331
2362
  }
2332
2363
  ];
2333
2364
  };
@@ -2417,6 +2448,24 @@ export declare type Vault = {
2417
2448
  "option": "publicKey";
2418
2449
  };
2419
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
+ },
2420
2469
  {
2421
2470
  "name": "deprecated";
2422
2471
  "type": {
@@ -2761,8 +2810,33 @@ export declare type Vault = {
2761
2810
  },
2762
2811
  {
2763
2812
  "code": 6024;
2813
+ "name": "InvalidNameLength";
2814
+ "msg": "Name for new vault type must be length 16";
2815
+ },
2816
+ {
2817
+ "code": 6025;
2764
2818
  "name": "UpdateVaultTypeBadMaxDebtExtended";
2765
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";
2766
2840
  }
2767
2841
  ];
2768
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<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 = '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* () {