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.
- package/README.md +44 -0
- package/lib/index.js +2102 -0
- package/lib/index.js.map +1 -0
- package/lib/types/src/Constants.d.ts +13 -0
- package/lib/types/src/Constants.d.ts.map +1 -0
- package/lib/types/src/HedgeDecimal.d.ts +15 -0
- package/lib/types/src/HedgeDecimal.d.ts.map +1 -0
- package/lib/types/src/StakingPools.d.ts +4 -0
- package/lib/types/src/StakingPools.d.ts.map +1 -0
- package/lib/types/src/Vaults.d.ts +9 -0
- package/lib/types/src/Vaults.d.ts.map +1 -0
- package/lib/types/src/idl/idl.d.ts +3 -0
- package/lib/types/src/idl/idl.d.ts.map +1 -0
- package/lib/types/src/index.d.ts +20 -0
- package/lib/types/src/index.d.ts.map +1 -0
- package/lib/types/src/instructions/createStakingPool.d.ts +5 -0
- package/lib/types/src/instructions/createStakingPool.d.ts.map +1 -0
- package/lib/types/src/instructions/createVault.d.ts +5 -0
- package/lib/types/src/instructions/createVault.d.ts.map +1 -0
- package/lib/types/src/instructions/depositStakingPool.d.ts +5 -0
- package/lib/types/src/instructions/depositStakingPool.d.ts.map +1 -0
- package/lib/types/src/instructions/depositVault.d.ts +5 -0
- package/lib/types/src/instructions/depositVault.d.ts.map +1 -0
- package/lib/types/src/instructions/liquidateVault.d.ts +5 -0
- package/lib/types/src/instructions/liquidateVault.d.ts.map +1 -0
- package/lib/types/src/instructions/loanVault.d.ts +5 -0
- package/lib/types/src/instructions/loanVault.d.ts.map +1 -0
- package/lib/types/src/instructions/redeemVault.d.ts +5 -0
- package/lib/types/src/instructions/redeemVault.d.ts.map +1 -0
- package/lib/types/src/instructions/repayVault.d.ts +5 -0
- package/lib/types/src/instructions/repayVault.d.ts.map +1 -0
- package/lib/types/src/instructions/withdrawStakingPool.d.ts +5 -0
- package/lib/types/src/instructions/withdrawStakingPool.d.ts.map +1 -0
- package/lib/types/src/instructions/withdrawVault.d.ts +5 -0
- package/lib/types/src/instructions/withdrawVault.d.ts.map +1 -0
- package/lib/types/src/state/LiquidationPoolEra.d.ts +15 -0
- package/lib/types/src/state/LiquidationPoolEra.d.ts.map +1 -0
- package/lib/types/src/state/LiquidationPoolState.d.ts +7 -0
- package/lib/types/src/state/LiquidationPoolState.d.ts.map +1 -0
- package/lib/types/src/state/LiquidationPosition.d.ts +25 -0
- package/lib/types/src/state/LiquidationPosition.d.ts.map +1 -0
- package/lib/types/src/state/StakingPool.d.ts +16 -0
- package/lib/types/src/state/StakingPool.d.ts.map +1 -0
- package/lib/types/src/state/StakingPoolPosition.d.ts +20 -0
- package/lib/types/src/state/StakingPoolPosition.d.ts.map +1 -0
- package/lib/types/src/state/VaultAccount.d.ts +48 -0
- package/lib/types/src/state/VaultAccount.d.ts.map +1 -0
- package/lib/types/src/state/VaultHistoryEvent.d.ts +40 -0
- package/lib/types/src/state/VaultHistoryEvent.d.ts.map +1 -0
- package/lib/types/src/utils/Errors.d.ts +2 -0
- package/lib/types/src/utils/Errors.d.ts.map +1 -0
- package/lib/types/tsconfig.base.tsbuildinfo +1 -0
- package/package.json +6 -5
- package/rollup.config.js +14 -8
- package/src/Constants.ts +56 -0
- package/src/HedgeDecimal.ts +15 -7
- package/src/StakingPools.ts +3 -0
- package/src/Vaults.ts +8 -0
- package/src/idl/idl.ts +1474 -0
- package/src/index.ts +19 -4
- package/src/instructions/createStakingPool.ts +64 -0
- package/src/instructions/createVault.ts +65 -0
- package/src/instructions/depositStakingPool.ts +60 -0
- package/src/instructions/depositVault.ts +60 -0
- package/src/instructions/liquidateVault.ts +66 -0
- package/src/instructions/loanVault.ts +78 -0
- package/src/instructions/redeemVault.ts +82 -0
- package/src/instructions/repayVault.ts +73 -0
- package/src/instructions/withdrawStakingPool.ts +69 -0
- package/src/instructions/withdrawVault.ts +65 -0
- package/src/state/LiquidationPoolEra.ts +29 -0
- package/src/state/LiquidationPoolState.ts +10 -0
- package/src/state/LiquidationPosition.ts +77 -0
- package/src/state/StakingPool.ts +38 -0
- package/src/state/StakingPoolPosition.ts +39 -0
- package/src/{accounts → state}/VaultAccount.ts +5 -6
- package/src/state/VaultHistoryEvent.ts +61 -0
- package/src/types/buffer-layout/index.d.ts +88 -0
- package/src/utils/Errors.ts +11 -0
- package/tsconfig.base.json +3 -3
- package/tsconfig.d.json +3 -1
- package/tsconfig.json +1 -1
- package/src/accounts/LiquidationPoolEra.ts +0 -16
- package/src/accounts/LiquidationPoolState.ts +0 -22
- package/src/accounts/LiquidationPosition.ts +0 -72
- package/src/accounts/StakingPool.ts +0 -31
- package/src/accounts/StakingPoolPosition.ts +0 -29
- package/src/accounts/VaultHistoryEvent.ts +0 -27
package/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Hedge Web3 API
|
2
|
+
|
3
|
+
Documentation for the Hedge Web3 TypeScript API.
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
## Documentation
|
8
|
+
|
9
|
+
Documentation can be found here: [https://web3-docs.hedge.so/](https://web3-docs.hedge.so/)
|
10
|
+
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
TypeDoc runs on Node.js and is available as a NPM package.
|
15
|
+
|
16
|
+
```sh
|
17
|
+
npm install hedge-web3 --save-dev
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
To create a vault, import the package.
|
23
|
+
|
24
|
+
```js
|
25
|
+
const HedgeWeb3 = require('hedge-web3')
|
26
|
+
```
|
27
|
+
|
28
|
+
To create a vault and deposit 3 SOL:
|
29
|
+
|
30
|
+
```js
|
31
|
+
const vaultPublickey = await HedgeWeb3.createVault(connection, ownerPublicKey, LAMPORTS_PER_SOL * 3, LAMPORTS_PER_SOL * 1.2)
|
32
|
+
```
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
This project is maintained by a community of developers. Contributions are welcome and appreciated.
|
37
|
+
You can find Hedge Labs on GitHub; feel free to open an issue or create a pull request:
|
38
|
+
https://github.com/Hedge-Finance/hedge-web3
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
Copyright (c) 2021 [Christopher Coudron](https://hedge.so)<br>
|
43
|
+
Copyright (c) 2021 [Hedge Labs Ltd.](https://hedge.so)<br>
|
44
|
+
Licensed under the Apache License 2.0.
|