hedge-web3 0.1.46 → 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 +109 -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 +109 -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 +218 -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
package/src/idl/vault.ts
CHANGED
@@ -1177,6 +1177,11 @@ export 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 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 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 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 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 type Vault = {
|
|
1896
1903
|
"kind": "struct",
|
1897
1904
|
"fields": [
|
1898
1905
|
{
|
1899
|
-
"name": "
|
1900
|
-
"type": "
|
1906
|
+
"name": "vaultType",
|
1907
|
+
"type": "publicKey"
|
1901
1908
|
},
|
1902
1909
|
{
|
1903
1910
|
"name": "oraclePyth",
|
@@ -1912,8 +1919,20 @@ export type Vault = {
|
|
1912
1919
|
"type": "publicKey"
|
1913
1920
|
},
|
1914
1921
|
{
|
1915
|
-
"name": "
|
1916
|
-
"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"
|
1917
1936
|
}
|
1918
1937
|
]
|
1919
1938
|
}
|
@@ -2117,7 +2136,7 @@ export type Vault = {
|
|
2117
2136
|
},
|
2118
2137
|
{
|
2119
2138
|
"name": "totalUshSupply",
|
2120
|
-
"type": "
|
2139
|
+
"type": "u128"
|
2121
2140
|
},
|
2122
2141
|
{
|
2123
2142
|
"name": "totalVaults",
|
@@ -2157,10 +2176,6 @@ export 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 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 type Vault = {
|
|
2276
2307
|
"type": "u64"
|
2277
2308
|
},
|
2278
2309
|
{
|
2279
|
-
"name": "
|
2280
|
-
"type":
|
2310
|
+
"name": "vaultStatus",
|
2311
|
+
"type": {
|
2312
|
+
"defined": "VaultStatus"
|
2313
|
+
}
|
2281
2314
|
},
|
2282
2315
|
{
|
2283
|
-
"name": "
|
2284
|
-
"type": "
|
2316
|
+
"name": "vaultType",
|
2317
|
+
"type": "publicKey"
|
2285
2318
|
},
|
2286
2319
|
{
|
2287
2320
|
"name": "bump",
|
@@ -2305,12 +2338,6 @@ export 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 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 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 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
|
};
|
@@ -3946,6 +4020,11 @@ export const IDL: Vault = {
|
|
3946
4020
|
"name": "systemProgram",
|
3947
4021
|
"isMut": false,
|
3948
4022
|
"isSigner": false
|
4023
|
+
},
|
4024
|
+
{
|
4025
|
+
"name": "chainlinkProgram",
|
4026
|
+
"isMut": false,
|
4027
|
+
"isSigner": false
|
3949
4028
|
}
|
3950
4029
|
],
|
3951
4030
|
"args": [
|
@@ -4598,10 +4677,6 @@ export const IDL: Vault = {
|
|
4598
4677
|
"type": {
|
4599
4678
|
"kind": "struct",
|
4600
4679
|
"fields": [
|
4601
|
-
{
|
4602
|
-
"name": "state",
|
4603
|
-
"type": "u64"
|
4604
|
-
},
|
4605
4680
|
{
|
4606
4681
|
"name": "era",
|
4607
4682
|
"type": "publicKey"
|
@@ -4610,14 +4685,6 @@ export const IDL: Vault = {
|
|
4610
4685
|
"name": "ownerAccount",
|
4611
4686
|
"type": "publicKey"
|
4612
4687
|
},
|
4613
|
-
{
|
4614
|
-
"name": "deposit",
|
4615
|
-
"type": "u64"
|
4616
|
-
},
|
4617
|
-
{
|
4618
|
-
"name": "closedUsh",
|
4619
|
-
"type": "u64"
|
4620
|
-
},
|
4621
4688
|
{
|
4622
4689
|
"name": "productSnapshotEntry",
|
4623
4690
|
"type": "u128"
|
@@ -4648,6 +4715,14 @@ export const IDL: Vault = {
|
|
4648
4715
|
"name": "hedgeRewardsSnapshotAccum",
|
4649
4716
|
"type": "u128"
|
4650
4717
|
},
|
4718
|
+
{
|
4719
|
+
"name": "deposit",
|
4720
|
+
"type": "u64"
|
4721
|
+
},
|
4722
|
+
{
|
4723
|
+
"name": "closedUsh",
|
4724
|
+
"type": "u64"
|
4725
|
+
},
|
4651
4726
|
{
|
4652
4727
|
"name": "timestampOpened",
|
4653
4728
|
"type": "u64"
|
@@ -4655,6 +4730,12 @@ export const IDL: Vault = {
|
|
4655
4730
|
{
|
4656
4731
|
"name": "timestampClosed",
|
4657
4732
|
"type": "u64"
|
4733
|
+
},
|
4734
|
+
{
|
4735
|
+
"name": "state",
|
4736
|
+
"type": {
|
4737
|
+
"defined": "PositionState"
|
4738
|
+
}
|
4658
4739
|
}
|
4659
4740
|
]
|
4660
4741
|
}
|
@@ -4665,8 +4746,8 @@ export const IDL: Vault = {
|
|
4665
4746
|
"kind": "struct",
|
4666
4747
|
"fields": [
|
4667
4748
|
{
|
4668
|
-
"name": "
|
4669
|
-
"type": "
|
4749
|
+
"name": "vaultType",
|
4750
|
+
"type": "publicKey"
|
4670
4751
|
},
|
4671
4752
|
{
|
4672
4753
|
"name": "oraclePyth",
|
@@ -4681,8 +4762,20 @@ export const IDL: Vault = {
|
|
4681
4762
|
"type": "publicKey"
|
4682
4763
|
},
|
4683
4764
|
{
|
4684
|
-
"name": "
|
4685
|
-
"type": "
|
4765
|
+
"name": "priorityPyth",
|
4766
|
+
"type": "i8"
|
4767
|
+
},
|
4768
|
+
{
|
4769
|
+
"name": "priorityChainlink",
|
4770
|
+
"type": "i8"
|
4771
|
+
},
|
4772
|
+
{
|
4773
|
+
"name": "prioritySwitchboard",
|
4774
|
+
"type": "i8"
|
4775
|
+
},
|
4776
|
+
{
|
4777
|
+
"name": "vaultTypeName",
|
4778
|
+
"type": "string"
|
4686
4779
|
}
|
4687
4780
|
]
|
4688
4781
|
}
|
@@ -4886,7 +4979,7 @@ export const IDL: Vault = {
|
|
4886
4979
|
},
|
4887
4980
|
{
|
4888
4981
|
"name": "totalUshSupply",
|
4889
|
-
"type": "
|
4982
|
+
"type": "u128"
|
4890
4983
|
},
|
4891
4984
|
{
|
4892
4985
|
"name": "totalVaults",
|
@@ -4926,10 +5019,6 @@ export const IDL: Vault = {
|
|
4926
5019
|
"type": {
|
4927
5020
|
"kind": "struct",
|
4928
5021
|
"fields": [
|
4929
|
-
{
|
4930
|
-
"name": "vaultTypeName",
|
4931
|
-
"type": "string"
|
4932
|
-
},
|
4933
5022
|
{
|
4934
5023
|
"name": "collateralMint",
|
4935
5024
|
"type": "publicKey"
|
@@ -5002,6 +5091,22 @@ export const IDL: Vault = {
|
|
5002
5091
|
"name": "interestRatePerSecond",
|
5003
5092
|
"type": "u128"
|
5004
5093
|
},
|
5094
|
+
{
|
5095
|
+
"name": "deprecated",
|
5096
|
+
"type": "bool"
|
5097
|
+
},
|
5098
|
+
{
|
5099
|
+
"name": "totalFeesAccumulatedUsh",
|
5100
|
+
"type": "u128"
|
5101
|
+
},
|
5102
|
+
{
|
5103
|
+
"name": "totalFeesAccumulatedCollateral",
|
5104
|
+
"type": "u128"
|
5105
|
+
},
|
5106
|
+
{
|
5107
|
+
"name": "vaultTypeName",
|
5108
|
+
"type": "string"
|
5109
|
+
},
|
5005
5110
|
{
|
5006
5111
|
"name": "firstVaultToRedeem",
|
5007
5112
|
"type": {
|
@@ -5045,12 +5150,14 @@ export const IDL: Vault = {
|
|
5045
5150
|
"type": "u64"
|
5046
5151
|
},
|
5047
5152
|
{
|
5048
|
-
"name": "
|
5049
|
-
"type":
|
5153
|
+
"name": "vaultStatus",
|
5154
|
+
"type": {
|
5155
|
+
"defined": "VaultStatus"
|
5156
|
+
}
|
5050
5157
|
},
|
5051
5158
|
{
|
5052
|
-
"name": "
|
5053
|
-
"type": "
|
5159
|
+
"name": "vaultType",
|
5160
|
+
"type": "publicKey"
|
5054
5161
|
},
|
5055
5162
|
{
|
5056
5163
|
"name": "bump",
|
@@ -5074,12 +5181,6 @@ export const IDL: Vault = {
|
|
5074
5181
|
"defined": "CurrencyType"
|
5075
5182
|
}
|
5076
5183
|
},
|
5077
|
-
{
|
5078
|
-
"name": "vaultStatus",
|
5079
|
-
"type": {
|
5080
|
-
"defined": "VaultStatus"
|
5081
|
-
}
|
5082
|
-
},
|
5083
5184
|
{
|
5084
5185
|
"name": "timeCreated",
|
5085
5186
|
"type": "u64"
|
@@ -5088,15 +5189,19 @@ export const IDL: Vault = {
|
|
5088
5189
|
"name": "timeLastInteraction",
|
5089
5190
|
"type": "u64"
|
5090
5191
|
},
|
5192
|
+
{
|
5193
|
+
"name": "vaultTypeName",
|
5194
|
+
"type": "string"
|
5195
|
+
},
|
5196
|
+
{
|
5197
|
+
"name": "pdaSalt",
|
5198
|
+
"type": "string"
|
5199
|
+
},
|
5091
5200
|
{
|
5092
5201
|
"name": "nextVaultToRedeem",
|
5093
5202
|
"type": {
|
5094
5203
|
"option": "publicKey"
|
5095
5204
|
}
|
5096
|
-
},
|
5097
|
-
{
|
5098
|
-
"name": "vaultType",
|
5099
|
-
"type": "publicKey"
|
5100
5205
|
}
|
5101
5206
|
]
|
5102
5207
|
}
|
@@ -5186,6 +5291,24 @@ export const IDL: Vault = {
|
|
5186
5291
|
"option": "publicKey"
|
5187
5292
|
}
|
5188
5293
|
},
|
5294
|
+
{
|
5295
|
+
"name": "priorityChainlink",
|
5296
|
+
"type": {
|
5297
|
+
"option": "i8"
|
5298
|
+
}
|
5299
|
+
},
|
5300
|
+
{
|
5301
|
+
"name": "priorityPyth",
|
5302
|
+
"type": {
|
5303
|
+
"option": "i8"
|
5304
|
+
}
|
5305
|
+
},
|
5306
|
+
{
|
5307
|
+
"name": "prioritySwitchboard",
|
5308
|
+
"type": {
|
5309
|
+
"option": "i8"
|
5310
|
+
}
|
5311
|
+
},
|
5189
5312
|
{
|
5190
5313
|
"name": "deprecated",
|
5191
5314
|
"type": {
|
@@ -5530,8 +5653,33 @@ export const IDL: Vault = {
|
|
5530
5653
|
},
|
5531
5654
|
{
|
5532
5655
|
"code": 6024,
|
5656
|
+
"name": "InvalidNameLength",
|
5657
|
+
"msg": "Name for new vault type must be length 16"
|
5658
|
+
},
|
5659
|
+
{
|
5660
|
+
"code": 6025,
|
5533
5661
|
"name": "UpdateVaultTypeBadMaxDebtExtended",
|
5534
5662
|
"msg": "New Max debt extended value is less than the current debt!"
|
5663
|
+
},
|
5664
|
+
{
|
5665
|
+
"code": 6025,
|
5666
|
+
"name": "UpdateVaultTypeNoEnabledOracles",
|
5667
|
+
"msg": "No Enabled Oracles!"
|
5668
|
+
},
|
5669
|
+
{
|
5670
|
+
"code": 6026,
|
5671
|
+
"name": "UpdateVaultTypeDuplicateOraclePriorities",
|
5672
|
+
"msg": "Duplicate Oracle Priorities"
|
5673
|
+
},
|
5674
|
+
{
|
5675
|
+
"code": 6027,
|
5676
|
+
"name": "UpdateVaultTypeInvalidOraclePriority",
|
5677
|
+
"msg": "Invalid Oracle Priority"
|
5678
|
+
},
|
5679
|
+
{
|
5680
|
+
"code": 6028,
|
5681
|
+
"name": "OracleUpdateFailed",
|
5682
|
+
"msg": "OracleUpdateFailed"
|
5535
5683
|
}
|
5536
5684
|
]
|
5537
5685
|
};
|
@@ -16,7 +16,8 @@ import {
|
|
16
16
|
getLiquidationPoolStatePublicKey,
|
17
17
|
getVaultSystemStatePublicKey,
|
18
18
|
} from '../Constants'
|
19
|
-
import
|
19
|
+
import sendAndConfirmWithDebug from '../utils/sendAndConfirmWithDebug'
|
20
|
+
import { Vault } from '../idl/vault'
|
20
21
|
|
21
22
|
export async function claimLiquidationPoolPosition(
|
22
23
|
program: Program<Vault>,
|
@@ -48,7 +49,7 @@ export async function claimLiquidationPoolPosition(
|
|
48
49
|
overrideStartTime
|
49
50
|
)
|
50
51
|
)
|
51
|
-
await
|
52
|
+
await sendAndConfirmWithDebug(provider.connection, transaction, [payer]).catch(parseAnchorErrors)
|
52
53
|
return payerAssociatedTokenAccount.address
|
53
54
|
}
|
54
55
|
|
@@ -17,7 +17,8 @@ import {
|
|
17
17
|
getPoolPublicKeyForMint,
|
18
18
|
getVaultSystemStatePublicKey,
|
19
19
|
} from '../Constants'
|
20
|
-
import
|
20
|
+
import sendAndConfirmWithDebug from '../utils/sendAndConfirmWithDebug'
|
21
|
+
import { Vault } from '../idl/vault'
|
21
22
|
|
22
23
|
export async function claimStakingPoolPosition(
|
23
24
|
program: Program<Vault>,
|
@@ -58,7 +59,7 @@ export async function claimStakingPoolPosition(
|
|
58
59
|
payerAssociatedTokenAccount.address
|
59
60
|
)
|
60
61
|
)
|
61
|
-
await
|
62
|
+
await sendAndConfirmWithDebug(provider.connection, transaction, [payer]).catch(parseAnchorErrors)
|
62
63
|
return payerAssociatedTokenAccount.address
|
63
64
|
}
|
64
65
|
|
@@ -17,7 +17,8 @@ import {
|
|
17
17
|
getUshMintPublicKey,
|
18
18
|
getVaultSystemStatePublicKey,
|
19
19
|
} from '../Constants'
|
20
|
-
import
|
20
|
+
import sendAndConfirmWithDebug from '../utils/sendAndConfirmWithDebug'
|
21
|
+
import { Vault } from '../idl/vault'
|
21
22
|
|
22
23
|
export async function closeLiquidationPoolPosition(
|
23
24
|
program: Program<Vault>,
|
@@ -64,7 +65,7 @@ export async function closeLiquidationPoolPosition(
|
|
64
65
|
overrideStartTime
|
65
66
|
)
|
66
67
|
)
|
67
|
-
await
|
68
|
+
await sendAndConfirmWithDebug(provider.connection, transaction, [payer]).catch(parseAnchorErrors)
|
68
69
|
return poolPosition
|
69
70
|
}
|
70
71
|
|
@@ -16,7 +16,8 @@ import {
|
|
16
16
|
getUshMintPublicKey,
|
17
17
|
getVaultSystemStatePublicKey,
|
18
18
|
} from '../Constants'
|
19
|
-
import
|
19
|
+
import sendAndConfirmWithDebug from '../utils/sendAndConfirmWithDebug'
|
20
|
+
import { Vault } from '../idl/vault'
|
20
21
|
|
21
22
|
export async function createStakingPool(
|
22
23
|
program: Program<Vault>,
|
@@ -29,7 +30,7 @@ export async function createStakingPool(
|
|
29
30
|
const transaction = new Transaction().add(
|
30
31
|
await createStakingPoolInstruction(program, payer.publicKey, mintPublicKey, hedgeTokensToBeMinted, overrideStartTime)
|
31
32
|
)
|
32
|
-
await
|
33
|
+
await sendAndConfirmWithDebug(provider.connection, transaction, [payer]).catch(parseAnchorErrors)
|
33
34
|
const [poolPublickey] = await getPoolPublicKeyForMint(mintPublicKey)
|
34
35
|
return poolPublickey
|
35
36
|
}
|
@@ -41,7 +42,6 @@ export async function createStakingPoolInstruction(
|
|
41
42
|
hedgeTokensToBeMinted: number,
|
42
43
|
overrideStartTime?: number
|
43
44
|
): Promise<TransactionInstruction> {
|
44
|
-
console.log("new createStakingPoolInstruction")
|
45
45
|
const vaultSystemStatePublicKey = await getVaultSystemStatePublicKey()
|
46
46
|
const ushMintPublickey = await getUshMintPublicKey()
|
47
47
|
const [poolPublickey, poolBump] = await getPoolPublicKeyForMint(mintPublicKey)
|
@@ -23,7 +23,8 @@ import {
|
|
23
23
|
|
24
24
|
import { v4 as uuidv4 } from 'uuid'
|
25
25
|
import { parseAnchorErrors } from '../utils/Errors'
|
26
|
-
import
|
26
|
+
import sendAndConfirmWithDebug from '../utils/sendAndConfirmWithDebug'
|
27
|
+
import { Vault } from '../idl/vault'
|
27
28
|
|
28
29
|
export async function createVault(
|
29
30
|
program: Program<Vault>,
|
@@ -106,7 +107,7 @@ export async function createVault(
|
|
106
107
|
)
|
107
108
|
}
|
108
109
|
|
109
|
-
await
|
110
|
+
await sendAndConfirmWithDebug(provider.connection, transaction, signers).catch(parseAnchorErrors)
|
110
111
|
return newVaultPublicKey
|
111
112
|
}
|
112
113
|
|
@@ -17,7 +17,8 @@ import {
|
|
17
17
|
getUshMintPublicKey,
|
18
18
|
getVaultSystemStatePublicKey,
|
19
19
|
} from '../Constants'
|
20
|
-
import
|
20
|
+
import sendAndConfirmWithDebug from '../utils/sendAndConfirmWithDebug'
|
21
|
+
import { Vault } from '../idl/vault'
|
21
22
|
|
22
23
|
export async function depositLiquidationPool(
|
23
24
|
program: Program<Vault>,
|
@@ -45,7 +46,7 @@ export async function depositLiquidationPool(
|
|
45
46
|
overrideStartTime
|
46
47
|
)
|
47
48
|
)
|
48
|
-
await
|
49
|
+
await sendAndConfirmWithDebug(provider.connection, transaction, [payer, poolPosition]).catch(parseAnchorErrors)
|
49
50
|
return poolPosition.publicKey
|
50
51
|
}
|
51
52
|
|
@@ -12,7 +12,8 @@ import {
|
|
12
12
|
} from '@solana/web3.js'
|
13
13
|
import { parseAnchorErrors } from '../utils/Errors'
|
14
14
|
import { findAssociatedTokenAddress, getPoolPublicKeyForMint, getVaultSystemStatePublicKey } from '../Constants'
|
15
|
-
import
|
15
|
+
import sendAndConfirmWithDebug from '../utils/sendAndConfirmWithDebug'
|
16
|
+
import { Vault } from '../idl/vault'
|
16
17
|
|
17
18
|
export async function depositStakingPool(
|
18
19
|
program: Program<Vault>,
|
@@ -33,7 +34,7 @@ export async function depositStakingPool(
|
|
33
34
|
overrideStartTime
|
34
35
|
)
|
35
36
|
)
|
36
|
-
await
|
37
|
+
await sendAndConfirmWithDebug(provider.connection, transaction, [payer, poolPosition]).catch(parseAnchorErrors)
|
37
38
|
return poolPosition.publicKey
|
38
39
|
}
|
39
40
|
|
@@ -19,7 +19,8 @@ import {
|
|
19
19
|
getPoolPublicKeyForMint,
|
20
20
|
getHedgeMintPublicKey,
|
21
21
|
} from '../Constants'
|
22
|
-
import
|
22
|
+
import sendAndConfirmWithDebug from '../utils/sendAndConfirmWithDebug'
|
23
|
+
import { Vault } from '../idl/vault'
|
23
24
|
import { WRAPPED_SOL_MINT } from '@project-serum/serum/lib/token-instructions'
|
24
25
|
|
25
26
|
export async function depositVault(
|
@@ -64,7 +65,6 @@ export async function depositVault(
|
|
64
65
|
|
65
66
|
const transaction = new Transaction()
|
66
67
|
const signers = [payer, history]
|
67
|
-
|
68
68
|
const [oldSmallerPublicKey, newSmallerPublicKey, newLargerPublicKey] = await getLinkedListAccounts(
|
69
69
|
program,
|
70
70
|
provider,
|
@@ -125,7 +125,7 @@ export async function depositVault(
|
|
125
125
|
)
|
126
126
|
}
|
127
127
|
|
128
|
-
await
|
128
|
+
await sendAndConfirmWithDebug(provider.connection, transaction, signers)
|
129
129
|
return vaultPublicKey
|
130
130
|
}
|
131
131
|
|