hedge-web3 0.2.31 → 0.3.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 +0 -12
- package/declarations/HedgeConstants.d.ts +76 -0
- package/declarations/idl/pyth.d.ts +1 -1
- package/declarations/idl/switchboard.d.ts +1 -1
- package/declarations/idl/vault.d.ts +60 -744
- package/declarations/index.d.ts +1 -10
- package/declarations/instructions/claimLiquidationPoolPosition.d.ts +1 -1
- package/declarations/instructions/claimStakingPoolPosition.d.ts +1 -1
- package/declarations/instructions/closeClaimedLiquidationPoolPosition.d.ts +1 -1
- package/declarations/instructions/closeLiquidationPoolPosition.d.ts +1 -1
- package/declarations/instructions/createReferralAccount.d.ts +3 -3
- package/declarations/instructions/createStakingPool.d.ts +1 -1
- package/declarations/instructions/createUserReferralAccount.d.ts +1 -1
- package/declarations/instructions/createVault.d.ts +1 -2
- package/declarations/instructions/depositLiquidationPool.d.ts +1 -2
- package/declarations/instructions/depositStakingPool.d.ts +1 -2
- package/declarations/instructions/depositVault.d.ts +1 -2
- package/declarations/instructions/initHedgeFoundation.d.ts +1 -1
- package/declarations/instructions/initHedgeFoundationTokens.d.ts +1 -1
- package/declarations/instructions/liquidateVault.d.ts +1 -1
- package/declarations/instructions/loanVault.d.ts +1 -2
- package/declarations/instructions/psmEditAccount.d.ts +1 -2
- package/declarations/instructions/psmMintUsh.d.ts +1 -2
- package/declarations/instructions/psmRedeemUsh.d.ts +1 -2
- package/declarations/instructions/redeemVault.d.ts +1 -2
- package/declarations/instructions/referralClaimFees.d.ts +3 -3
- package/declarations/instructions/refreshOraclePrice.d.ts +1 -1
- package/declarations/instructions/repayVault.d.ts +1 -2
- package/declarations/instructions/setHalted.d.ts +1 -1
- package/declarations/instructions/transferVault.d.ts +1 -1
- package/declarations/instructions/updateReferralAccount.d.ts +1 -2
- package/declarations/instructions/updateReferralState.d.ts +1 -2
- package/declarations/instructions/updateVaultType.d.ts +1 -2
- package/declarations/instructions/withdrawStakingPool.d.ts +1 -1
- package/declarations/instructions/withdrawVault.d.ts +1 -2
- package/declarations/state/VaultAccount.d.ts +2 -3
- package/declarations/utils/getLinkedListAccounts.d.ts +1 -2
- package/lib/Constants.js +27 -54
- package/lib/HedgeConstants.js +170 -0
- package/lib/HedgeDecimal.js +1 -2
- package/lib/StakingPools.js +5 -1
- package/lib/Vaults.js +5 -1
- package/lib/idl/vault.js +60 -744
- package/lib/index.js +6 -11
- package/lib/instructions/claimLiquidationPoolPosition.js +7 -8
- package/lib/instructions/claimStakingPoolPosition.js +7 -8
- package/lib/instructions/closeClaimedLiquidationPoolPosition.js +2 -3
- package/lib/instructions/closeLiquidationPoolPosition.js +16 -17
- package/lib/instructions/createReferralAccount.js +13 -17
- package/lib/instructions/createStakingPool.js +10 -11
- package/lib/instructions/createUserReferralAccount.js +9 -10
- package/lib/instructions/createVault.js +20 -21
- package/lib/instructions/depositLiquidationPool.js +12 -13
- package/lib/instructions/depositStakingPool.js +8 -9
- package/lib/instructions/depositVault.js +10 -11
- package/lib/instructions/initHedgeFoundation.js +10 -11
- package/lib/instructions/initHedgeFoundationTokens.js +7 -8
- package/lib/instructions/liquidateVault.js +12 -19
- package/lib/instructions/loanVault.js +16 -23
- package/lib/instructions/psmEditAccount.js +11 -11
- package/lib/instructions/psmMintUsh.js +18 -19
- package/lib/instructions/psmRedeemUsh.js +18 -19
- package/lib/instructions/redeemVault.js +10 -11
- package/lib/instructions/referralClaimFees.js +12 -16
- package/lib/instructions/refreshOraclePrice.js +9 -9
- package/lib/instructions/repayVault.js +12 -13
- package/lib/instructions/setHalted.js +4 -5
- package/lib/instructions/transferVault.js +2 -3
- package/lib/instructions/updateReferralAccount.js +6 -7
- package/lib/instructions/updateReferralState.js +6 -7
- package/lib/instructions/updateVaultType.js +5 -6
- package/lib/instructions/withdrawStakingPool.js +14 -15
- package/lib/instructions/withdrawVault.js +8 -9
- package/lib/state/VaultAccount.js +22 -8
- package/lib/state/VaultHistoryEvent.js +2 -2
- package/lib/utils/Errors.js +2 -3
- package/lib/utils/getLinkedListAccounts.js +2 -3
- package/lib/utils/sendAndConfirmWithDebug.js +1 -1
- package/package.json +9 -8
- package/src/{Constants.ts → HedgeConstants.ts} +13 -43
- package/src/idl/vault.ts +2382 -3750
- package/src/index.ts +3 -10
- package/src/instructions/claimLiquidationPoolPosition.ts +2 -2
- package/src/instructions/claimStakingPoolPosition.ts +2 -2
- package/src/instructions/closeClaimedLiquidationPoolPosition.ts +1 -1
- package/src/instructions/closeLiquidationPoolPosition.ts +2 -2
- package/src/instructions/createReferralAccount.ts +11 -15
- package/src/instructions/createStakingPool.ts +11 -4
- package/src/instructions/createUserReferralAccount.ts +2 -2
- package/src/instructions/createVault.ts +2 -2
- package/src/instructions/depositLiquidationPool.ts +2 -2
- package/src/instructions/depositStakingPool.ts +2 -2
- package/src/instructions/depositVault.ts +2 -2
- package/src/instructions/initHedgeFoundation.ts +2 -2
- package/src/instructions/initHedgeFoundationTokens.ts +2 -2
- package/src/instructions/liquidateVault.ts +29 -39
- package/src/instructions/loanVault.ts +23 -36
- package/src/instructions/psmEditAccount.ts +3 -3
- package/src/instructions/psmMintUsh.ts +3 -3
- package/src/instructions/psmRedeemUsh.ts +3 -3
- package/src/instructions/redeemVault.ts +2 -2
- package/src/instructions/referralClaimFees.ts +12 -18
- package/src/instructions/refreshOraclePrice.ts +4 -4
- package/src/instructions/repayVault.ts +2 -2
- package/src/instructions/setHalted.ts +2 -2
- package/src/instructions/transferVault.ts +1 -1
- package/src/instructions/updateReferralAccount.ts +2 -2
- package/src/instructions/updateReferralState.ts +2 -2
- package/src/instructions/updateVaultType.ts +2 -2
- package/src/instructions/withdrawStakingPool.ts +2 -2
- package/src/instructions/withdrawVault.ts +2 -2
- package/src/utils/Errors.ts +1 -1
- package/src/utils/getLinkedListAccounts.ts +1 -1
- package/declarations/instructions/adminWithdrawCol.d.ts +0 -5
- package/declarations/instructions/adminWithdrawUsh.d.ts +0 -5
- package/declarations/instructions/createCompoundStakingPool.d.ts +0 -5
- package/declarations/instructions/createCompoundStakingPoolPosition.d.ts +0 -6
- package/declarations/instructions/depositCompoundStakingPoolPosition.d.ts +0 -6
- package/declarations/instructions/depositRewardsToCompoundPool.d.ts +0 -6
- package/declarations/instructions/setCompoundPoolActive.d.ts +0 -5
- package/declarations/instructions/setDelegateWallet.d.ts +0 -5
- package/declarations/instructions/setVaultTypeStatus.d.ts +0 -4
- package/declarations/instructions/withdrawCompoundStakingPoolPosition.d.ts +0 -6
- package/declarations/utils/Sender.d.ts +0 -2
- package/lib/instructions/adminWithdrawCol.js +0 -60
- package/lib/instructions/adminWithdrawUsh.js +0 -57
- package/lib/instructions/createCompoundStakingPool.js +0 -58
- package/lib/instructions/createCompoundStakingPoolPosition.js +0 -56
- package/lib/instructions/depositCompoundStakingPoolPosition.js +0 -55
- package/lib/instructions/depositRewardsToCompoundPool.js +0 -64
- package/lib/instructions/setCompoundPoolActive.js +0 -43
- package/lib/instructions/setDelegateWallet.js +0 -43
- package/lib/instructions/setVaultTypeStatus.js +0 -38
- package/lib/instructions/withdrawCompoundStakingPoolPosition.js +0 -64
- package/lib/utils/Sender.js +0 -32
- package/src/instructions/adminWithdrawCol.ts +0 -87
- package/src/instructions/adminWithdrawUsh.ts +0 -78
- package/src/instructions/createCompoundStakingPool.ts +0 -63
- package/src/instructions/createCompoundStakingPoolPosition.ts +0 -85
- package/src/instructions/depositCompoundStakingPoolPosition.ts +0 -78
- package/src/instructions/depositRewardsToCompoundPool.ts +0 -110
- package/src/instructions/setCompoundPoolActive.ts +0 -51
- package/src/instructions/setDelegateWallet.ts +0 -51
- package/src/instructions/withdrawCompoundStakingPoolPosition.ts +0 -100
@@ -36,11 +36,6 @@ export declare function getReferralAccountPublicKey(hedgeProgramId: PublicKey, o
|
|
36
36
|
* @returns The user referral account public key based off the user's public key
|
37
37
|
*/
|
38
38
|
export declare function getUserReferralAccountPublicKey(hedgeProgramId: PublicKey, ownerPublicKey: PublicKey): Promise<PublicKey>;
|
39
|
-
/**
|
40
|
-
*
|
41
|
-
* @returns The compound pool position address for the given user
|
42
|
-
*/
|
43
|
-
export declare function getCompoundPoolPositionAddress(hedgeProgramId: PublicKey, poolPublicKey: PublicKey, ownerPublicKey: PublicKey): Promise<PublicKey>;
|
44
39
|
/**
|
45
40
|
*
|
46
41
|
* @returns The HDG mint public key
|
@@ -53,13 +48,6 @@ export declare function getHedgeMintPublicKey(hedgeProgramId: PublicKey): Promis
|
|
53
48
|
* @returns the public key for that staking pool
|
54
49
|
*/
|
55
50
|
export declare function getPoolPublicKeyForMint(hedgeProgramId: PublicKey, mintPublicKey: PublicKey): Promise<[PublicKey, number, string]>;
|
56
|
-
/**
|
57
|
-
* Get the public key for any compound staking pool
|
58
|
-
*
|
59
|
-
* @param mintPublicKey Staked collateral mint public key
|
60
|
-
* @returns the public key for that compound staking pool
|
61
|
-
*/
|
62
|
-
export declare function getCompoundPoolPublicKeyForMint(hedgeProgramId: PublicKey, mintPublicKey: PublicKey): Promise<[PublicKey, number]>;
|
63
51
|
/**
|
64
52
|
*
|
65
53
|
* @param collateralType String name of the collateral type (must be 16 chars)
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
2
|
+
export declare const CHAINLINK_SOL_USD_ID = "FmAmfoyPXiA8Vhhe6MZTr3U6rZfEZ1ctEHay1ysqCqcf";
|
3
|
+
export declare const CHAINLINK_SOL_USD_PUBLICKEY: PublicKey;
|
4
|
+
export declare const CHAINLINK_PROGRAM_ID = "HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny";
|
5
|
+
/**
|
6
|
+
* @returns The Liquidation pool public key
|
7
|
+
*/
|
8
|
+
export declare function getLiquidationPoolStatePublicKey(hedgeProgramId: PublicKey): Promise<PublicKey>;
|
9
|
+
/**
|
10
|
+
*
|
11
|
+
* @returns The liquidation pool ush account public key
|
12
|
+
*/
|
13
|
+
export declare function getLiquidationPoolUshAccountPublicKey(hedgeProgramId: PublicKey): Promise<PublicKey>;
|
14
|
+
/**
|
15
|
+
*
|
16
|
+
* @returns The USH mint public key
|
17
|
+
*/
|
18
|
+
export declare function getUshMintPublicKey(hedgeProgramId: PublicKey): Promise<PublicKey>;
|
19
|
+
/**
|
20
|
+
*
|
21
|
+
* @returns The Vault System State public key
|
22
|
+
*/
|
23
|
+
export declare function getVaultSystemStatePublicKey(hedgeProgramId: PublicKey): Promise<PublicKey>;
|
24
|
+
/**
|
25
|
+
*
|
26
|
+
* @returns The Referral State public key
|
27
|
+
*/
|
28
|
+
export declare function getReferralStatePublicKey(hedgeProgramId: PublicKey): Promise<PublicKey>;
|
29
|
+
/**
|
30
|
+
*
|
31
|
+
* @returns The Referral State public key based off the owner's public key
|
32
|
+
*/
|
33
|
+
export declare function getReferralAccountPublicKey(hedgeProgramId: PublicKey, ownerPublicKey: PublicKey): Promise<PublicKey>;
|
34
|
+
/**
|
35
|
+
*
|
36
|
+
* @returns The user referral account public key based off the user's public key
|
37
|
+
*/
|
38
|
+
export declare function getUserReferralAccountPublicKey(hedgeProgramId: PublicKey, ownerPublicKey: PublicKey): Promise<PublicKey>;
|
39
|
+
/**
|
40
|
+
*
|
41
|
+
* @returns The HDG mint public key
|
42
|
+
*/
|
43
|
+
export declare function getHedgeMintPublicKey(hedgeProgramId: PublicKey): Promise<PublicKey>;
|
44
|
+
/**
|
45
|
+
* Get the public key for any staking pool
|
46
|
+
*
|
47
|
+
* @param mintPublicKey Staked collateral mint public key
|
48
|
+
* @returns the public key for that staking pool
|
49
|
+
*/
|
50
|
+
export declare function getPoolPublicKeyForMint(hedgeProgramId: PublicKey, mintPublicKey: PublicKey): Promise<[PublicKey, number, string]>;
|
51
|
+
/**
|
52
|
+
*
|
53
|
+
* @param collateralType String name of the collateral type (must be 16 chars)
|
54
|
+
* @returns The public key for that Vault Type account
|
55
|
+
*/
|
56
|
+
export declare function getVaultTypeAccountPublicKey(hedgeProgramId: PublicKey, collateralType: string): Promise<PublicKey>;
|
57
|
+
/**
|
58
|
+
*
|
59
|
+
* @param collateralType String name of the collateral type (must be 16 chars)
|
60
|
+
* @returns The public key for that Vault Type oracle info
|
61
|
+
*/
|
62
|
+
export declare function getVaultTypeOracleAccountPublicKey(hedgeProgramId: PublicKey, collateralType: string): Promise<PublicKey>;
|
63
|
+
/**
|
64
|
+
* Vaults are stored in PDA accounts. Use this to get the address from a salt
|
65
|
+
*
|
66
|
+
* @param vaultSalt String salt for the vault (must be 8 chars)
|
67
|
+
* @returns The public key for that Vault Type oracle info
|
68
|
+
*/
|
69
|
+
export declare function findVaultAddress(hedgeProgramId: PublicKey, vaultSalt: string): Promise<PublicKey>;
|
70
|
+
/**
|
71
|
+
*
|
72
|
+
* @param walletAddress Owner public key
|
73
|
+
* @param tokenMintAddress Token mint
|
74
|
+
* @returns The associated token account public key
|
75
|
+
*/
|
76
|
+
export declare function findAssociatedTokenAddress(hedgeProgramId: PublicKey, walletAddress: PublicKey, tokenMintAddress: PublicKey): Promise<PublicKey>;
|