@kamino-finance/klend-sdk 5.0.4 → 5.0.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/dist/classes/fraction.d.ts.map +1 -1
- package/dist/classes/fraction.js.map +1 -1
- package/dist/classes/manager.d.ts +38 -4
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +112 -5
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +4 -0
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +17 -25
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/obligation.d.ts +3 -4
- package/dist/classes/obligation.d.ts.map +1 -1
- package/dist/classes/obligation.js +96 -27
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +2 -1
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +32 -29
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/utils.d.ts +3 -0
- package/dist/classes/utils.d.ts.map +1 -1
- package/dist/classes/utils.js +30 -0
- package/dist/classes/utils.js.map +1 -1
- package/dist/classes/vault.d.ts +12 -8
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +94 -66
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +15 -1
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl.json +27 -2
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +6 -0
- package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/LendingMarket.js +8 -1
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.d.ts +3 -12
- package/dist/idl_codegen/accounts/Obligation.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.js +1 -4
- package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts +20 -0
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js +33 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +13 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +25 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +4 -4
- package/dist/idl_codegen/types/index.d.ts.map +1 -1
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.js +22 -18
- package/dist/idl_codegen_kamino_vault/accounts/Reserve.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +45 -15
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +101 -39
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/index.d.ts +4 -4
- package/dist/idl_codegen_kamino_vault/accounts/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/anchor.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/anchor.js +162 -162
- package/dist/idl_codegen_kamino_vault/errors/anchor.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +144 -32
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.js +305 -109
- package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/index.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/errors/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/index.js +7 -2
- package/dist/idl_codegen_kamino_vault/errors/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts +4 -2
- package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.js +3 -1
- package/dist/idl_codegen_kamino_vault/instructions/deposit.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts +13 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js +47 -0
- package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/index.d.ts +18 -10
- package/dist/idl_codegen_kamino_vault/instructions/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/index.js +9 -1
- package/dist/idl_codegen_kamino_vault/instructions/index.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +2 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts +6 -2
- package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.js +9 -1
- package/dist/idl_codegen_kamino_vault/instructions/invest.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.d.ts +7 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js +16 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts +14 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js +52 -0
- package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts +4 -2
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.js +8 -2
- package/dist/idl_codegen_kamino_vault/instructions/withdraw.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts +23 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js +51 -0
- package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/programId.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/programId.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/programId.js +1 -1
- package/dist/idl_codegen_kamino_vault/programId.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js +4 -1
- package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/CurvePoint.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.js +6 -1
- package/dist/idl_codegen_kamino_vault/types/LastUpdate.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js +5 -5
- package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts +27 -24
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js +59 -53
- package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.js +5 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveFees.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts +11 -3
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js +25 -17
- package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js +3 -3
- package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js +1 -1
- package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts +3 -3
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.js +11 -11
- package/dist/idl_codegen_kamino_vault/types/TokenInfo.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts +18 -8
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js +27 -13
- package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +110 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +242 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -0
- package/dist/idl_codegen_kamino_vault/types/index.d.ts +34 -30
- package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/index.js +26 -1
- package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
- package/dist/utils/ObligationType.d.ts.map +1 -1
- package/dist/utils/ObligationType.js.map +1 -1
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/pubkey.d.ts.map +1 -1
- package/dist/utils/pubkey.js.map +1 -1
- package/dist/utils/rpc.d.ts.map +1 -1
- package/dist/utils/rpc.js +2 -1
- package/dist/utils/rpc.js.map +1 -1
- package/package.json +2 -1
- package/src/classes/fraction.ts +5 -0
- package/src/classes/manager.ts +136 -5
- package/src/classes/market.ts +19 -2
- package/src/classes/obligation.ts +141 -30
- package/src/classes/reserve.ts +70 -41
- package/src/classes/utils.ts +30 -0
- package/src/classes/vault.ts +123 -49
- package/src/client_kamino_manager.ts +19 -1
- package/src/idl_codegen/accounts/LendingMarket.ts +12 -1
- package/src/idl_codegen/accounts/Obligation.ts +3 -12
- package/src/idl_codegen/types/UpdateLendingMarketConfigValue.ts +43 -0
- package/src/idl_codegen/types/UpdateLendingMarketMode.ts +30 -0
- package/src/idl_codegen/types/index.ts +4 -0
- package/src/idl_codegen_kamino_vault/accounts/Reserve.ts +132 -105
- package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +217 -124
- package/src/idl_codegen_kamino_vault/accounts/index.ts +4 -4
- package/src/idl_codegen_kamino_vault/errors/anchor.ts +335 -326
- package/src/idl_codegen_kamino_vault/errors/custom.ts +353 -157
- package/src/idl_codegen_kamino_vault/errors/index.ts +35 -22
- package/src/idl_codegen_kamino_vault/instructions/deposit.ts +33 -25
- package/src/idl_codegen_kamino_vault/instructions/giveUpPendingFees.ts +40 -0
- package/src/idl_codegen_kamino_vault/instructions/index.ts +27 -10
- package/src/idl_codegen_kamino_vault/instructions/initVault.ts +25 -20
- package/src/idl_codegen_kamino_vault/instructions/invest.ts +40 -25
- package/src/idl_codegen_kamino_vault/instructions/updateAdmin.ts +24 -0
- package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +24 -24
- package/src/idl_codegen_kamino_vault/instructions/updateVaultConfig.ts +49 -0
- package/src/idl_codegen_kamino_vault/instructions/withdraw.ts +45 -33
- package/src/idl_codegen_kamino_vault/instructions/withdrawPendingFees.ts +75 -0
- package/src/idl_codegen_kamino_vault/programId.ts +5 -3
- package/src/idl_codegen_kamino_vault/types/BigFractionBytes.ts +24 -18
- package/src/idl_codegen_kamino_vault/types/BorrowRateCurve.ts +21 -16
- package/src/idl_codegen_kamino_vault/types/CurvePoint.ts +21 -18
- package/src/idl_codegen_kamino_vault/types/LastUpdate.ts +32 -27
- package/src/idl_codegen_kamino_vault/types/PriceHeuristic.ts +25 -22
- package/src/idl_codegen_kamino_vault/types/PythConfiguration.ts +14 -14
- package/src/idl_codegen_kamino_vault/types/ReserveCollateral.ts +35 -35
- package/src/idl_codegen_kamino_vault/types/ReserveConfig.ts +232 -191
- package/src/idl_codegen_kamino_vault/types/ReserveFees.ts +27 -23
- package/src/idl_codegen_kamino_vault/types/ReserveLiquidity.ts +116 -98
- package/src/idl_codegen_kamino_vault/types/ScopeConfiguration.ts +25 -25
- package/src/idl_codegen_kamino_vault/types/SwitchboardConfiguration.ts +21 -18
- package/src/idl_codegen_kamino_vault/types/TokenInfo.ts +92 -74
- package/src/idl_codegen_kamino_vault/types/VaultAllocation.ts +67 -49
- package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +270 -0
- package/src/idl_codegen_kamino_vault/types/index.ts +77 -30
- package/src/utils/ObligationType.ts +6 -0
- package/src/utils/managerTypes.ts +1 -0
- package/src/utils/pubkey.ts +2 -0
- package/src/utils/rpc.ts +3 -1
|
@@ -1,121 +1,179 @@
|
|
|
1
|
-
import { PublicKey, Connection } from
|
|
2
|
-
import BN from
|
|
3
|
-
import * as borsh from
|
|
4
|
-
import * as types from
|
|
5
|
-
import { PROGRAM_ID } from
|
|
1
|
+
import { PublicKey, Connection } from "@solana/web3.js"
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { PROGRAM_ID } from "../programId"
|
|
6
6
|
|
|
7
7
|
export interface VaultStateFields {
|
|
8
|
-
adminAuthority: PublicKey
|
|
9
|
-
baseVaultAuthority: PublicKey
|
|
10
|
-
baseVaultAuthorityBump: BN
|
|
11
|
-
tokenMint: PublicKey
|
|
12
|
-
tokenMintDecimals: BN
|
|
13
|
-
tokenVault: PublicKey
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
adminAuthority: PublicKey
|
|
9
|
+
baseVaultAuthority: PublicKey
|
|
10
|
+
baseVaultAuthorityBump: BN
|
|
11
|
+
tokenMint: PublicKey
|
|
12
|
+
tokenMintDecimals: BN
|
|
13
|
+
tokenVault: PublicKey
|
|
14
|
+
tokenProgram: PublicKey
|
|
15
|
+
sharesMint: PublicKey
|
|
16
|
+
sharesMintDecimals: BN
|
|
17
|
+
tokenAvailable: BN
|
|
18
|
+
sharesIssued: BN
|
|
19
|
+
availableCrankFunds: BN
|
|
20
|
+
padding0: BN
|
|
21
|
+
performanceFeeBps: BN
|
|
22
|
+
managementFeeBps: BN
|
|
23
|
+
lastFeeChargeTimestamp: BN
|
|
24
|
+
prevAumSf: BN
|
|
25
|
+
pendingFeesSf: BN
|
|
26
|
+
vaultAllocationStrategy: Array<types.VaultAllocationFields>
|
|
27
|
+
minDepositAmount: BN
|
|
28
|
+
minWithdrawAmount: BN
|
|
29
|
+
minInvestAmount: BN
|
|
30
|
+
minInvestDelaySlots: BN
|
|
31
|
+
crankFundFeePerReserve: BN
|
|
32
|
+
pendingAdmin: PublicKey
|
|
33
|
+
padding1: BN
|
|
34
|
+
padding2: Array<BN>
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
export interface VaultStateJSON {
|
|
28
|
-
adminAuthority: string
|
|
29
|
-
baseVaultAuthority: string
|
|
30
|
-
baseVaultAuthorityBump: string
|
|
31
|
-
tokenMint: string
|
|
32
|
-
tokenMintDecimals: string
|
|
33
|
-
tokenVault: string
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
adminAuthority: string
|
|
39
|
+
baseVaultAuthority: string
|
|
40
|
+
baseVaultAuthorityBump: string
|
|
41
|
+
tokenMint: string
|
|
42
|
+
tokenMintDecimals: string
|
|
43
|
+
tokenVault: string
|
|
44
|
+
tokenProgram: string
|
|
45
|
+
sharesMint: string
|
|
46
|
+
sharesMintDecimals: string
|
|
47
|
+
tokenAvailable: string
|
|
48
|
+
sharesIssued: string
|
|
49
|
+
availableCrankFunds: string
|
|
50
|
+
padding0: string
|
|
51
|
+
performanceFeeBps: string
|
|
52
|
+
managementFeeBps: string
|
|
53
|
+
lastFeeChargeTimestamp: string
|
|
54
|
+
prevAumSf: string
|
|
55
|
+
pendingFeesSf: string
|
|
56
|
+
vaultAllocationStrategy: Array<types.VaultAllocationJSON>
|
|
57
|
+
minDepositAmount: string
|
|
58
|
+
minWithdrawAmount: string
|
|
59
|
+
minInvestAmount: string
|
|
60
|
+
minInvestDelaySlots: string
|
|
61
|
+
crankFundFeePerReserve: string
|
|
62
|
+
pendingAdmin: string
|
|
63
|
+
padding1: string
|
|
64
|
+
padding2: Array<string>
|
|
45
65
|
}
|
|
46
66
|
|
|
47
67
|
export class VaultState {
|
|
48
|
-
readonly adminAuthority: PublicKey
|
|
49
|
-
readonly baseVaultAuthority: PublicKey
|
|
50
|
-
readonly baseVaultAuthorityBump: BN
|
|
51
|
-
readonly tokenMint: PublicKey
|
|
52
|
-
readonly tokenMintDecimals: BN
|
|
53
|
-
readonly tokenVault: PublicKey
|
|
54
|
-
readonly
|
|
55
|
-
readonly
|
|
56
|
-
readonly
|
|
57
|
-
readonly
|
|
58
|
-
readonly
|
|
59
|
-
readonly
|
|
60
|
-
readonly
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
63
|
-
readonly
|
|
64
|
-
readonly
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
readonly adminAuthority: PublicKey
|
|
69
|
+
readonly baseVaultAuthority: PublicKey
|
|
70
|
+
readonly baseVaultAuthorityBump: BN
|
|
71
|
+
readonly tokenMint: PublicKey
|
|
72
|
+
readonly tokenMintDecimals: BN
|
|
73
|
+
readonly tokenVault: PublicKey
|
|
74
|
+
readonly tokenProgram: PublicKey
|
|
75
|
+
readonly sharesMint: PublicKey
|
|
76
|
+
readonly sharesMintDecimals: BN
|
|
77
|
+
readonly tokenAvailable: BN
|
|
78
|
+
readonly sharesIssued: BN
|
|
79
|
+
readonly availableCrankFunds: BN
|
|
80
|
+
readonly padding0: BN
|
|
81
|
+
readonly performanceFeeBps: BN
|
|
82
|
+
readonly managementFeeBps: BN
|
|
83
|
+
readonly lastFeeChargeTimestamp: BN
|
|
84
|
+
readonly prevAumSf: BN
|
|
85
|
+
readonly pendingFeesSf: BN
|
|
86
|
+
readonly vaultAllocationStrategy: Array<types.VaultAllocation>
|
|
87
|
+
readonly minDepositAmount: BN
|
|
88
|
+
readonly minWithdrawAmount: BN
|
|
89
|
+
readonly minInvestAmount: BN
|
|
90
|
+
readonly minInvestDelaySlots: BN
|
|
91
|
+
readonly crankFundFeePerReserve: BN
|
|
92
|
+
readonly pendingAdmin: PublicKey
|
|
93
|
+
readonly padding1: BN
|
|
94
|
+
readonly padding2: Array<BN>
|
|
95
|
+
|
|
96
|
+
static readonly discriminator = Buffer.from([
|
|
97
|
+
228, 196, 82, 165, 98, 210, 235, 152,
|
|
98
|
+
])
|
|
67
99
|
|
|
68
100
|
static readonly layout = borsh.struct([
|
|
69
|
-
borsh.publicKey(
|
|
70
|
-
borsh.publicKey(
|
|
71
|
-
borsh.u64(
|
|
72
|
-
borsh.publicKey(
|
|
73
|
-
borsh.u64(
|
|
74
|
-
borsh.publicKey(
|
|
75
|
-
borsh.publicKey(
|
|
76
|
-
borsh.
|
|
77
|
-
borsh.u64(
|
|
78
|
-
borsh.u64(
|
|
79
|
-
borsh.u64(
|
|
80
|
-
borsh.u64(
|
|
81
|
-
borsh.u64(
|
|
82
|
-
borsh.u64(
|
|
83
|
-
borsh.u64(
|
|
84
|
-
borsh.
|
|
85
|
-
borsh.
|
|
86
|
-
|
|
101
|
+
borsh.publicKey("adminAuthority"),
|
|
102
|
+
borsh.publicKey("baseVaultAuthority"),
|
|
103
|
+
borsh.u64("baseVaultAuthorityBump"),
|
|
104
|
+
borsh.publicKey("tokenMint"),
|
|
105
|
+
borsh.u64("tokenMintDecimals"),
|
|
106
|
+
borsh.publicKey("tokenVault"),
|
|
107
|
+
borsh.publicKey("tokenProgram"),
|
|
108
|
+
borsh.publicKey("sharesMint"),
|
|
109
|
+
borsh.u64("sharesMintDecimals"),
|
|
110
|
+
borsh.u64("tokenAvailable"),
|
|
111
|
+
borsh.u64("sharesIssued"),
|
|
112
|
+
borsh.u64("availableCrankFunds"),
|
|
113
|
+
borsh.u64("padding0"),
|
|
114
|
+
borsh.u64("performanceFeeBps"),
|
|
115
|
+
borsh.u64("managementFeeBps"),
|
|
116
|
+
borsh.u64("lastFeeChargeTimestamp"),
|
|
117
|
+
borsh.u128("prevAumSf"),
|
|
118
|
+
borsh.u128("pendingFeesSf"),
|
|
119
|
+
borsh.array(types.VaultAllocation.layout(), 10, "vaultAllocationStrategy"),
|
|
120
|
+
borsh.u64("minDepositAmount"),
|
|
121
|
+
borsh.u64("minWithdrawAmount"),
|
|
122
|
+
borsh.u64("minInvestAmount"),
|
|
123
|
+
borsh.u64("minInvestDelaySlots"),
|
|
124
|
+
borsh.u64("crankFundFeePerReserve"),
|
|
125
|
+
borsh.publicKey("pendingAdmin"),
|
|
126
|
+
borsh.u64("padding1"),
|
|
127
|
+
borsh.array(borsh.u128(), 254, "padding2"),
|
|
128
|
+
])
|
|
87
129
|
|
|
88
130
|
constructor(fields: VaultStateFields) {
|
|
89
|
-
this.adminAuthority = fields.adminAuthority
|
|
90
|
-
this.baseVaultAuthority = fields.baseVaultAuthority
|
|
91
|
-
this.baseVaultAuthorityBump = fields.baseVaultAuthorityBump
|
|
92
|
-
this.tokenMint = fields.tokenMint
|
|
93
|
-
this.tokenMintDecimals = fields.tokenMintDecimals
|
|
94
|
-
this.tokenVault = fields.tokenVault
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
97
|
-
this.
|
|
98
|
-
this.
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
103
|
-
this.
|
|
104
|
-
this.
|
|
105
|
-
this.
|
|
131
|
+
this.adminAuthority = fields.adminAuthority
|
|
132
|
+
this.baseVaultAuthority = fields.baseVaultAuthority
|
|
133
|
+
this.baseVaultAuthorityBump = fields.baseVaultAuthorityBump
|
|
134
|
+
this.tokenMint = fields.tokenMint
|
|
135
|
+
this.tokenMintDecimals = fields.tokenMintDecimals
|
|
136
|
+
this.tokenVault = fields.tokenVault
|
|
137
|
+
this.tokenProgram = fields.tokenProgram
|
|
138
|
+
this.sharesMint = fields.sharesMint
|
|
139
|
+
this.sharesMintDecimals = fields.sharesMintDecimals
|
|
140
|
+
this.tokenAvailable = fields.tokenAvailable
|
|
141
|
+
this.sharesIssued = fields.sharesIssued
|
|
142
|
+
this.availableCrankFunds = fields.availableCrankFunds
|
|
143
|
+
this.padding0 = fields.padding0
|
|
144
|
+
this.performanceFeeBps = fields.performanceFeeBps
|
|
145
|
+
this.managementFeeBps = fields.managementFeeBps
|
|
146
|
+
this.lastFeeChargeTimestamp = fields.lastFeeChargeTimestamp
|
|
147
|
+
this.prevAumSf = fields.prevAumSf
|
|
148
|
+
this.pendingFeesSf = fields.pendingFeesSf
|
|
149
|
+
this.vaultAllocationStrategy = fields.vaultAllocationStrategy.map(
|
|
150
|
+
(item) => new types.VaultAllocation({ ...item })
|
|
151
|
+
)
|
|
152
|
+
this.minDepositAmount = fields.minDepositAmount
|
|
153
|
+
this.minWithdrawAmount = fields.minWithdrawAmount
|
|
154
|
+
this.minInvestAmount = fields.minInvestAmount
|
|
155
|
+
this.minInvestDelaySlots = fields.minInvestDelaySlots
|
|
156
|
+
this.crankFundFeePerReserve = fields.crankFundFeePerReserve
|
|
157
|
+
this.pendingAdmin = fields.pendingAdmin
|
|
158
|
+
this.padding1 = fields.padding1
|
|
159
|
+
this.padding2 = fields.padding2
|
|
106
160
|
}
|
|
107
161
|
|
|
108
|
-
static async fetch(
|
|
109
|
-
|
|
162
|
+
static async fetch(
|
|
163
|
+
c: Connection,
|
|
164
|
+
address: PublicKey,
|
|
165
|
+
programId: PublicKey = PROGRAM_ID
|
|
166
|
+
): Promise<VaultState | null> {
|
|
167
|
+
const info = await c.getAccountInfo(address)
|
|
110
168
|
|
|
111
169
|
if (info === null) {
|
|
112
|
-
return null
|
|
170
|
+
return null
|
|
113
171
|
}
|
|
114
172
|
if (!info.owner.equals(programId)) {
|
|
115
|
-
throw new Error("account doesn't belong to this program")
|
|
173
|
+
throw new Error("account doesn't belong to this program")
|
|
116
174
|
}
|
|
117
175
|
|
|
118
|
-
return this.decode(info.data)
|
|
176
|
+
return this.decode(info.data)
|
|
119
177
|
}
|
|
120
178
|
|
|
121
179
|
static async fetchMultiple(
|
|
@@ -123,26 +181,26 @@ export class VaultState {
|
|
|
123
181
|
addresses: PublicKey[],
|
|
124
182
|
programId: PublicKey = PROGRAM_ID
|
|
125
183
|
): Promise<Array<VaultState | null>> {
|
|
126
|
-
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
184
|
+
const infos = await c.getMultipleAccountsInfo(addresses)
|
|
127
185
|
|
|
128
186
|
return infos.map((info) => {
|
|
129
187
|
if (info === null) {
|
|
130
|
-
return null
|
|
188
|
+
return null
|
|
131
189
|
}
|
|
132
190
|
if (!info.owner.equals(programId)) {
|
|
133
|
-
throw new Error("account doesn't belong to this program")
|
|
191
|
+
throw new Error("account doesn't belong to this program")
|
|
134
192
|
}
|
|
135
193
|
|
|
136
|
-
return this.decode(info.data)
|
|
137
|
-
})
|
|
194
|
+
return this.decode(info.data)
|
|
195
|
+
})
|
|
138
196
|
}
|
|
139
197
|
|
|
140
198
|
static decode(data: Buffer): VaultState {
|
|
141
199
|
if (!data.slice(0, 8).equals(VaultState.discriminator)) {
|
|
142
|
-
throw new Error(
|
|
200
|
+
throw new Error("invalid account discriminator")
|
|
143
201
|
}
|
|
144
202
|
|
|
145
|
-
const dec = VaultState.layout.decode(data.slice(8))
|
|
203
|
+
const dec = VaultState.layout.decode(data.slice(8))
|
|
146
204
|
|
|
147
205
|
return new VaultState({
|
|
148
206
|
adminAuthority: dec.adminAuthority,
|
|
@@ -151,21 +209,32 @@ export class VaultState {
|
|
|
151
209
|
tokenMint: dec.tokenMint,
|
|
152
210
|
tokenMintDecimals: dec.tokenMintDecimals,
|
|
153
211
|
tokenVault: dec.tokenVault,
|
|
212
|
+
tokenProgram: dec.tokenProgram,
|
|
154
213
|
sharesMint: dec.sharesMint,
|
|
155
214
|
sharesMintDecimals: dec.sharesMintDecimals,
|
|
156
215
|
tokenAvailable: dec.tokenAvailable,
|
|
157
216
|
sharesIssued: dec.sharesIssued,
|
|
217
|
+
availableCrankFunds: dec.availableCrankFunds,
|
|
218
|
+
padding0: dec.padding0,
|
|
158
219
|
performanceFeeBps: dec.performanceFeeBps,
|
|
159
220
|
managementFeeBps: dec.managementFeeBps,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
221
|
+
lastFeeChargeTimestamp: dec.lastFeeChargeTimestamp,
|
|
222
|
+
prevAumSf: dec.prevAumSf,
|
|
223
|
+
pendingFeesSf: dec.pendingFeesSf,
|
|
163
224
|
vaultAllocationStrategy: dec.vaultAllocationStrategy.map(
|
|
164
|
-
(
|
|
165
|
-
|
|
225
|
+
(
|
|
226
|
+
item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
|
227
|
+
) => types.VaultAllocation.fromDecoded(item)
|
|
166
228
|
),
|
|
167
|
-
|
|
168
|
-
|
|
229
|
+
minDepositAmount: dec.minDepositAmount,
|
|
230
|
+
minWithdrawAmount: dec.minWithdrawAmount,
|
|
231
|
+
minInvestAmount: dec.minInvestAmount,
|
|
232
|
+
minInvestDelaySlots: dec.minInvestDelaySlots,
|
|
233
|
+
crankFundFeePerReserve: dec.crankFundFeePerReserve,
|
|
234
|
+
pendingAdmin: dec.pendingAdmin,
|
|
235
|
+
padding1: dec.padding1,
|
|
236
|
+
padding2: dec.padding2,
|
|
237
|
+
})
|
|
169
238
|
}
|
|
170
239
|
|
|
171
240
|
toJSON(): VaultStateJSON {
|
|
@@ -176,18 +245,30 @@ export class VaultState {
|
|
|
176
245
|
tokenMint: this.tokenMint.toString(),
|
|
177
246
|
tokenMintDecimals: this.tokenMintDecimals.toString(),
|
|
178
247
|
tokenVault: this.tokenVault.toString(),
|
|
248
|
+
tokenProgram: this.tokenProgram.toString(),
|
|
179
249
|
sharesMint: this.sharesMint.toString(),
|
|
180
250
|
sharesMintDecimals: this.sharesMintDecimals.toString(),
|
|
181
251
|
tokenAvailable: this.tokenAvailable.toString(),
|
|
182
252
|
sharesIssued: this.sharesIssued.toString(),
|
|
253
|
+
availableCrankFunds: this.availableCrankFunds.toString(),
|
|
254
|
+
padding0: this.padding0.toString(),
|
|
183
255
|
performanceFeeBps: this.performanceFeeBps.toString(),
|
|
184
256
|
managementFeeBps: this.managementFeeBps.toString(),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
vaultAllocationStrategy: this.vaultAllocationStrategy.map((item) =>
|
|
189
|
-
|
|
190
|
-
|
|
257
|
+
lastFeeChargeTimestamp: this.lastFeeChargeTimestamp.toString(),
|
|
258
|
+
prevAumSf: this.prevAumSf.toString(),
|
|
259
|
+
pendingFeesSf: this.pendingFeesSf.toString(),
|
|
260
|
+
vaultAllocationStrategy: this.vaultAllocationStrategy.map((item) =>
|
|
261
|
+
item.toJSON()
|
|
262
|
+
),
|
|
263
|
+
minDepositAmount: this.minDepositAmount.toString(),
|
|
264
|
+
minWithdrawAmount: this.minWithdrawAmount.toString(),
|
|
265
|
+
minInvestAmount: this.minInvestAmount.toString(),
|
|
266
|
+
minInvestDelaySlots: this.minInvestDelaySlots.toString(),
|
|
267
|
+
crankFundFeePerReserve: this.crankFundFeePerReserve.toString(),
|
|
268
|
+
pendingAdmin: this.pendingAdmin.toString(),
|
|
269
|
+
padding1: this.padding1.toString(),
|
|
270
|
+
padding2: this.padding2.map((item) => item.toString()),
|
|
271
|
+
}
|
|
191
272
|
}
|
|
192
273
|
|
|
193
274
|
static fromJSON(obj: VaultStateJSON): VaultState {
|
|
@@ -198,17 +279,29 @@ export class VaultState {
|
|
|
198
279
|
tokenMint: new PublicKey(obj.tokenMint),
|
|
199
280
|
tokenMintDecimals: new BN(obj.tokenMintDecimals),
|
|
200
281
|
tokenVault: new PublicKey(obj.tokenVault),
|
|
282
|
+
tokenProgram: new PublicKey(obj.tokenProgram),
|
|
201
283
|
sharesMint: new PublicKey(obj.sharesMint),
|
|
202
284
|
sharesMintDecimals: new BN(obj.sharesMintDecimals),
|
|
203
285
|
tokenAvailable: new BN(obj.tokenAvailable),
|
|
204
286
|
sharesIssued: new BN(obj.sharesIssued),
|
|
287
|
+
availableCrankFunds: new BN(obj.availableCrankFunds),
|
|
288
|
+
padding0: new BN(obj.padding0),
|
|
205
289
|
performanceFeeBps: new BN(obj.performanceFeeBps),
|
|
206
290
|
managementFeeBps: new BN(obj.managementFeeBps),
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
vaultAllocationStrategy: obj.vaultAllocationStrategy.map((item) =>
|
|
211
|
-
|
|
212
|
-
|
|
291
|
+
lastFeeChargeTimestamp: new BN(obj.lastFeeChargeTimestamp),
|
|
292
|
+
prevAumSf: new BN(obj.prevAumSf),
|
|
293
|
+
pendingFeesSf: new BN(obj.pendingFeesSf),
|
|
294
|
+
vaultAllocationStrategy: obj.vaultAllocationStrategy.map((item) =>
|
|
295
|
+
types.VaultAllocation.fromJSON(item)
|
|
296
|
+
),
|
|
297
|
+
minDepositAmount: new BN(obj.minDepositAmount),
|
|
298
|
+
minWithdrawAmount: new BN(obj.minWithdrawAmount),
|
|
299
|
+
minInvestAmount: new BN(obj.minInvestAmount),
|
|
300
|
+
minInvestDelaySlots: new BN(obj.minInvestDelaySlots),
|
|
301
|
+
crankFundFeePerReserve: new BN(obj.crankFundFeePerReserve),
|
|
302
|
+
pendingAdmin: new PublicKey(obj.pendingAdmin),
|
|
303
|
+
padding1: new BN(obj.padding1),
|
|
304
|
+
padding2: obj.padding2.map((item) => new BN(item)),
|
|
305
|
+
})
|
|
213
306
|
}
|
|
214
307
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Reserve } from
|
|
2
|
-
export type { ReserveFields, ReserveJSON } from
|
|
3
|
-
export { VaultState } from
|
|
4
|
-
export type { VaultStateFields, VaultStateJSON } from
|
|
1
|
+
export { Reserve } from "./Reserve"
|
|
2
|
+
export type { ReserveFields, ReserveJSON } from "./Reserve"
|
|
3
|
+
export { VaultState } from "./VaultState"
|
|
4
|
+
export type { VaultStateFields, VaultStateJSON } from "./VaultState"
|