hedge-web3 0.1.1 → 0.1.6

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.
Files changed (88) hide show
  1. package/README.md +44 -0
  2. package/lib/index.js +2102 -0
  3. package/lib/index.js.map +1 -0
  4. package/lib/types/src/Constants.d.ts +13 -0
  5. package/lib/types/src/Constants.d.ts.map +1 -0
  6. package/lib/types/src/HedgeDecimal.d.ts +15 -0
  7. package/lib/types/src/HedgeDecimal.d.ts.map +1 -0
  8. package/lib/types/src/StakingPools.d.ts +4 -0
  9. package/lib/types/src/StakingPools.d.ts.map +1 -0
  10. package/lib/types/src/Vaults.d.ts +9 -0
  11. package/lib/types/src/Vaults.d.ts.map +1 -0
  12. package/lib/types/src/idl/idl.d.ts +3 -0
  13. package/lib/types/src/idl/idl.d.ts.map +1 -0
  14. package/lib/types/src/index.d.ts +20 -0
  15. package/lib/types/src/index.d.ts.map +1 -0
  16. package/lib/types/src/instructions/createStakingPool.d.ts +5 -0
  17. package/lib/types/src/instructions/createStakingPool.d.ts.map +1 -0
  18. package/lib/types/src/instructions/createVault.d.ts +5 -0
  19. package/lib/types/src/instructions/createVault.d.ts.map +1 -0
  20. package/lib/types/src/instructions/depositStakingPool.d.ts +5 -0
  21. package/lib/types/src/instructions/depositStakingPool.d.ts.map +1 -0
  22. package/lib/types/src/instructions/depositVault.d.ts +5 -0
  23. package/lib/types/src/instructions/depositVault.d.ts.map +1 -0
  24. package/lib/types/src/instructions/liquidateVault.d.ts +5 -0
  25. package/lib/types/src/instructions/liquidateVault.d.ts.map +1 -0
  26. package/lib/types/src/instructions/loanVault.d.ts +5 -0
  27. package/lib/types/src/instructions/loanVault.d.ts.map +1 -0
  28. package/lib/types/src/instructions/redeemVault.d.ts +5 -0
  29. package/lib/types/src/instructions/redeemVault.d.ts.map +1 -0
  30. package/lib/types/src/instructions/repayVault.d.ts +5 -0
  31. package/lib/types/src/instructions/repayVault.d.ts.map +1 -0
  32. package/lib/types/src/instructions/withdrawStakingPool.d.ts +5 -0
  33. package/lib/types/src/instructions/withdrawStakingPool.d.ts.map +1 -0
  34. package/lib/types/src/instructions/withdrawVault.d.ts +5 -0
  35. package/lib/types/src/instructions/withdrawVault.d.ts.map +1 -0
  36. package/lib/types/src/state/LiquidationPoolEra.d.ts +15 -0
  37. package/lib/types/src/state/LiquidationPoolEra.d.ts.map +1 -0
  38. package/lib/types/src/state/LiquidationPoolState.d.ts +7 -0
  39. package/lib/types/src/state/LiquidationPoolState.d.ts.map +1 -0
  40. package/lib/types/src/state/LiquidationPosition.d.ts +25 -0
  41. package/lib/types/src/state/LiquidationPosition.d.ts.map +1 -0
  42. package/lib/types/src/state/StakingPool.d.ts +16 -0
  43. package/lib/types/src/state/StakingPool.d.ts.map +1 -0
  44. package/lib/types/src/state/StakingPoolPosition.d.ts +20 -0
  45. package/lib/types/src/state/StakingPoolPosition.d.ts.map +1 -0
  46. package/lib/types/src/state/VaultAccount.d.ts +48 -0
  47. package/lib/types/src/state/VaultAccount.d.ts.map +1 -0
  48. package/lib/types/src/state/VaultHistoryEvent.d.ts +40 -0
  49. package/lib/types/src/state/VaultHistoryEvent.d.ts.map +1 -0
  50. package/lib/types/src/utils/Errors.d.ts +2 -0
  51. package/lib/types/src/utils/Errors.d.ts.map +1 -0
  52. package/lib/types/tsconfig.base.tsbuildinfo +1 -0
  53. package/package.json +6 -5
  54. package/rollup.config.js +14 -8
  55. package/src/Constants.ts +56 -0
  56. package/src/HedgeDecimal.ts +15 -7
  57. package/src/StakingPools.ts +3 -0
  58. package/src/Vaults.ts +8 -0
  59. package/src/idl/idl.ts +1474 -0
  60. package/src/index.ts +19 -4
  61. package/src/instructions/createStakingPool.ts +64 -0
  62. package/src/instructions/createVault.ts +65 -0
  63. package/src/instructions/depositStakingPool.ts +60 -0
  64. package/src/instructions/depositVault.ts +60 -0
  65. package/src/instructions/liquidateVault.ts +66 -0
  66. package/src/instructions/loanVault.ts +78 -0
  67. package/src/instructions/redeemVault.ts +82 -0
  68. package/src/instructions/repayVault.ts +73 -0
  69. package/src/instructions/withdrawStakingPool.ts +69 -0
  70. package/src/instructions/withdrawVault.ts +65 -0
  71. package/src/state/LiquidationPoolEra.ts +29 -0
  72. package/src/state/LiquidationPoolState.ts +10 -0
  73. package/src/state/LiquidationPosition.ts +77 -0
  74. package/src/state/StakingPool.ts +38 -0
  75. package/src/state/StakingPoolPosition.ts +39 -0
  76. package/src/{accounts → state}/VaultAccount.ts +5 -6
  77. package/src/state/VaultHistoryEvent.ts +61 -0
  78. package/src/types/buffer-layout/index.d.ts +88 -0
  79. package/src/utils/Errors.ts +11 -0
  80. package/tsconfig.base.json +3 -3
  81. package/tsconfig.d.json +3 -1
  82. package/tsconfig.json +1 -1
  83. package/src/accounts/LiquidationPoolEra.ts +0 -16
  84. package/src/accounts/LiquidationPoolState.ts +0 -22
  85. package/src/accounts/LiquidationPosition.ts +0 -72
  86. package/src/accounts/StakingPool.ts +0 -31
  87. package/src/accounts/StakingPoolPosition.ts +0 -29
  88. package/src/accounts/VaultHistoryEvent.ts +0 -27
@@ -1,29 +0,0 @@
1
- // import { LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js'
2
- // import Decimal from 'decimal.js'
3
-
4
- import { PublicKey } from '@solana/web3.js'
5
- import { StakingPool } from './StakingPool'
6
-
7
- // import { WAD } from './HedgeConstants'
8
-
9
- export class StakingPoolPosition {
10
- constructor (public poolPositionInfo: any, key: PublicKey, stakingPool: StakingPool) {
11
- // this.open = !!poolPositionInfo.state.open
12
- // this.publicKey = key
13
- // this.pool = stakingPool
14
- // this.owner = poolPositionInfo.owner
15
- // this.deposited = poolPositionInfo.deposited.toNumber()
16
- // this.timestampOpened = poolPositionInfo.timestampOpened.toNumber()
17
- // this.timestampClosed = poolPositionInfo.timestampClosed.toNumber()
18
- // this.closedRewardedTokens = poolPositionInfo.closedRewardedTokens.toNumber()
19
-
20
- // this.startHedgeRewardAccumulator = byteArrayToFloat64(poolPositionInfo.startHedgeRewardAccumulator)
21
- // this.startUsdhFeeAccumulator = byteArrayToFloat64(poolPositionInfo.startUsdhFeeAccumulator)
22
- // this.startSolFeeAccumulator = byteArrayToFloat64(poolPositionInfo.startSolFeeAccumulator)
23
- }
24
-
25
- // getCurrentUsdhFeeReward () {
26
- // const feesAccured = (this.pool.usdhFeeAccumulator - this.startUsdhFeeAccumulator) * this.deposited
27
- // return feesAccured
28
- // }
29
- }
@@ -1,27 +0,0 @@
1
- // import { LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js'
2
- // import Decimal from 'decimal.js'
3
-
4
- import { PublicKey } from '@solana/web3.js'
5
-
6
- // import { WAD } from './HedgeConstants'
7
-
8
- export class VaultHistoryEvent {
9
- constructor (public account: any, publicKey: PublicKey) {
10
- // this.publicKey = publicKey
11
- // this.actorAccount = account.actorAccount
12
-
13
- // this.usdSolPrice = (new Decimal(account.usdSolPrice.toString())).dividedBy(WAD)
14
-
15
- // this.usdhDebtBefore = account.usdhDebtBefore.toNumber()
16
- // this.usdhDebtAfter = account.usdhDebtAfter.toNumber()
17
- // this.solBalanceBefore = account.solBalanceBefore.toNumber()
18
- // this.solBalanceAfter = account.solBalanceAfter.toNumber()
19
- // this.minCollateralRatioBefore = account.minCollateralRatioBefore.toNumber()
20
- // this.minCollateralRatioAfter = account.minCollateralRatioAfter.toNumber()
21
- // this.vaultStateBefore = Object.keys(account.vaultStateBefore)[0]
22
- // this.vaultStateAfter = Object.keys(account.vaultStateAfter)[0]
23
-
24
- // this.timestamp = account.timestamp.toNumber()
25
- // this.action = Object.keys(account.action)[0]
26
- }
27
- }