@kamino-finance/klend-sdk 5.0.4 → 5.0.5
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.map +1 -1
- package/dist/classes/obligation.js +2 -1
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +1 -0
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +22 -27
- 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 +2 -1
- package/src/classes/reserve.ts +55 -39
- 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,104 +1,104 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
2
|
-
import BN from
|
|
3
|
-
import * as types from
|
|
4
|
-
import * as borsh from
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
|
5
5
|
|
|
6
6
|
export interface TokenInfoFields {
|
|
7
7
|
/** UTF-8 encoded name of the token (null-terminated) */
|
|
8
|
-
name: Array<number
|
|
8
|
+
name: Array<number>
|
|
9
9
|
/** Heuristics limits of acceptable price */
|
|
10
|
-
heuristic: types.PriceHeuristicFields
|
|
10
|
+
heuristic: types.PriceHeuristicFields
|
|
11
11
|
/** Max divergence between twap and price in bps */
|
|
12
|
-
maxTwapDivergenceBps: BN
|
|
13
|
-
maxAgePriceSeconds: BN
|
|
14
|
-
maxAgeTwapSeconds: BN
|
|
12
|
+
maxTwapDivergenceBps: BN
|
|
13
|
+
maxAgePriceSeconds: BN
|
|
14
|
+
maxAgeTwapSeconds: BN
|
|
15
15
|
/** Scope price configuration */
|
|
16
|
-
scopeConfiguration: types.ScopeConfigurationFields
|
|
16
|
+
scopeConfiguration: types.ScopeConfigurationFields
|
|
17
17
|
/** Switchboard configuration */
|
|
18
|
-
switchboardConfiguration: types.SwitchboardConfigurationFields
|
|
18
|
+
switchboardConfiguration: types.SwitchboardConfigurationFields
|
|
19
19
|
/** Pyth configuration */
|
|
20
|
-
pythConfiguration: types.PythConfigurationFields
|
|
21
|
-
blockPriceUsage: number
|
|
22
|
-
reserved: Array<number
|
|
23
|
-
padding: Array<BN
|
|
20
|
+
pythConfiguration: types.PythConfigurationFields
|
|
21
|
+
blockPriceUsage: number
|
|
22
|
+
reserved: Array<number>
|
|
23
|
+
padding: Array<BN>
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface TokenInfoJSON {
|
|
27
27
|
/** UTF-8 encoded name of the token (null-terminated) */
|
|
28
|
-
name: Array<number
|
|
28
|
+
name: Array<number>
|
|
29
29
|
/** Heuristics limits of acceptable price */
|
|
30
|
-
heuristic: types.PriceHeuristicJSON
|
|
30
|
+
heuristic: types.PriceHeuristicJSON
|
|
31
31
|
/** Max divergence between twap and price in bps */
|
|
32
|
-
maxTwapDivergenceBps: string
|
|
33
|
-
maxAgePriceSeconds: string
|
|
34
|
-
maxAgeTwapSeconds: string
|
|
32
|
+
maxTwapDivergenceBps: string
|
|
33
|
+
maxAgePriceSeconds: string
|
|
34
|
+
maxAgeTwapSeconds: string
|
|
35
35
|
/** Scope price configuration */
|
|
36
|
-
scopeConfiguration: types.ScopeConfigurationJSON
|
|
36
|
+
scopeConfiguration: types.ScopeConfigurationJSON
|
|
37
37
|
/** Switchboard configuration */
|
|
38
|
-
switchboardConfiguration: types.SwitchboardConfigurationJSON
|
|
38
|
+
switchboardConfiguration: types.SwitchboardConfigurationJSON
|
|
39
39
|
/** Pyth configuration */
|
|
40
|
-
pythConfiguration: types.PythConfigurationJSON
|
|
41
|
-
blockPriceUsage: number
|
|
42
|
-
reserved: Array<number
|
|
43
|
-
padding: Array<string
|
|
40
|
+
pythConfiguration: types.PythConfigurationJSON
|
|
41
|
+
blockPriceUsage: number
|
|
42
|
+
reserved: Array<number>
|
|
43
|
+
padding: Array<string>
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export class TokenInfo {
|
|
47
47
|
/** UTF-8 encoded name of the token (null-terminated) */
|
|
48
|
-
readonly name: Array<number
|
|
48
|
+
readonly name: Array<number>
|
|
49
49
|
/** Heuristics limits of acceptable price */
|
|
50
|
-
readonly heuristic: types.PriceHeuristic
|
|
50
|
+
readonly heuristic: types.PriceHeuristic
|
|
51
51
|
/** Max divergence between twap and price in bps */
|
|
52
|
-
readonly maxTwapDivergenceBps: BN
|
|
53
|
-
readonly maxAgePriceSeconds: BN
|
|
54
|
-
readonly maxAgeTwapSeconds: BN
|
|
52
|
+
readonly maxTwapDivergenceBps: BN
|
|
53
|
+
readonly maxAgePriceSeconds: BN
|
|
54
|
+
readonly maxAgeTwapSeconds: BN
|
|
55
55
|
/** Scope price configuration */
|
|
56
|
-
readonly scopeConfiguration: types.ScopeConfiguration
|
|
56
|
+
readonly scopeConfiguration: types.ScopeConfiguration
|
|
57
57
|
/** Switchboard configuration */
|
|
58
|
-
readonly switchboardConfiguration: types.SwitchboardConfiguration
|
|
58
|
+
readonly switchboardConfiguration: types.SwitchboardConfiguration
|
|
59
59
|
/** Pyth configuration */
|
|
60
|
-
readonly pythConfiguration: types.PythConfiguration
|
|
61
|
-
readonly blockPriceUsage: number
|
|
62
|
-
readonly reserved: Array<number
|
|
63
|
-
readonly padding: Array<BN
|
|
60
|
+
readonly pythConfiguration: types.PythConfiguration
|
|
61
|
+
readonly blockPriceUsage: number
|
|
62
|
+
readonly reserved: Array<number>
|
|
63
|
+
readonly padding: Array<BN>
|
|
64
64
|
|
|
65
65
|
constructor(fields: TokenInfoFields) {
|
|
66
|
-
this.name = fields.name
|
|
67
|
-
this.heuristic = new types.PriceHeuristic({ ...fields.heuristic })
|
|
68
|
-
this.maxTwapDivergenceBps = fields.maxTwapDivergenceBps
|
|
69
|
-
this.maxAgePriceSeconds = fields.maxAgePriceSeconds
|
|
70
|
-
this.maxAgeTwapSeconds = fields.maxAgeTwapSeconds
|
|
66
|
+
this.name = fields.name
|
|
67
|
+
this.heuristic = new types.PriceHeuristic({ ...fields.heuristic })
|
|
68
|
+
this.maxTwapDivergenceBps = fields.maxTwapDivergenceBps
|
|
69
|
+
this.maxAgePriceSeconds = fields.maxAgePriceSeconds
|
|
70
|
+
this.maxAgeTwapSeconds = fields.maxAgeTwapSeconds
|
|
71
71
|
this.scopeConfiguration = new types.ScopeConfiguration({
|
|
72
72
|
...fields.scopeConfiguration,
|
|
73
|
-
})
|
|
73
|
+
})
|
|
74
74
|
this.switchboardConfiguration = new types.SwitchboardConfiguration({
|
|
75
75
|
...fields.switchboardConfiguration,
|
|
76
|
-
})
|
|
76
|
+
})
|
|
77
77
|
this.pythConfiguration = new types.PythConfiguration({
|
|
78
78
|
...fields.pythConfiguration,
|
|
79
|
-
})
|
|
80
|
-
this.blockPriceUsage = fields.blockPriceUsage
|
|
81
|
-
this.reserved = fields.reserved
|
|
82
|
-
this.padding = fields.padding
|
|
79
|
+
})
|
|
80
|
+
this.blockPriceUsage = fields.blockPriceUsage
|
|
81
|
+
this.reserved = fields.reserved
|
|
82
|
+
this.padding = fields.padding
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
static layout(property?: string) {
|
|
86
86
|
return borsh.struct(
|
|
87
87
|
[
|
|
88
|
-
borsh.array(borsh.u8(), 32,
|
|
89
|
-
types.PriceHeuristic.layout(
|
|
90
|
-
borsh.u64(
|
|
91
|
-
borsh.u64(
|
|
92
|
-
borsh.u64(
|
|
93
|
-
types.ScopeConfiguration.layout(
|
|
94
|
-
types.SwitchboardConfiguration.layout(
|
|
95
|
-
types.PythConfiguration.layout(
|
|
96
|
-
borsh.u8(
|
|
97
|
-
borsh.array(borsh.u8(), 7,
|
|
98
|
-
borsh.array(borsh.u64(), 19,
|
|
88
|
+
borsh.array(borsh.u8(), 32, "name"),
|
|
89
|
+
types.PriceHeuristic.layout("heuristic"),
|
|
90
|
+
borsh.u64("maxTwapDivergenceBps"),
|
|
91
|
+
borsh.u64("maxAgePriceSeconds"),
|
|
92
|
+
borsh.u64("maxAgeTwapSeconds"),
|
|
93
|
+
types.ScopeConfiguration.layout("scopeConfiguration"),
|
|
94
|
+
types.SwitchboardConfiguration.layout("switchboardConfiguration"),
|
|
95
|
+
types.PythConfiguration.layout("pythConfiguration"),
|
|
96
|
+
borsh.u8("blockPriceUsage"),
|
|
97
|
+
borsh.array(borsh.u8(), 7, "reserved"),
|
|
98
|
+
borsh.array(borsh.u64(), 19, "padding"),
|
|
99
99
|
],
|
|
100
100
|
property
|
|
101
|
-
)
|
|
101
|
+
)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -109,13 +109,19 @@ export class TokenInfo {
|
|
|
109
109
|
maxTwapDivergenceBps: obj.maxTwapDivergenceBps,
|
|
110
110
|
maxAgePriceSeconds: obj.maxAgePriceSeconds,
|
|
111
111
|
maxAgeTwapSeconds: obj.maxAgeTwapSeconds,
|
|
112
|
-
scopeConfiguration: types.ScopeConfiguration.fromDecoded(
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
scopeConfiguration: types.ScopeConfiguration.fromDecoded(
|
|
113
|
+
obj.scopeConfiguration
|
|
114
|
+
),
|
|
115
|
+
switchboardConfiguration: types.SwitchboardConfiguration.fromDecoded(
|
|
116
|
+
obj.switchboardConfiguration
|
|
117
|
+
),
|
|
118
|
+
pythConfiguration: types.PythConfiguration.fromDecoded(
|
|
119
|
+
obj.pythConfiguration
|
|
120
|
+
),
|
|
115
121
|
blockPriceUsage: obj.blockPriceUsage,
|
|
116
122
|
reserved: obj.reserved,
|
|
117
123
|
padding: obj.padding,
|
|
118
|
-
})
|
|
124
|
+
})
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
static toEncodable(fields: TokenInfoFields) {
|
|
@@ -125,13 +131,19 @@ export class TokenInfo {
|
|
|
125
131
|
maxTwapDivergenceBps: fields.maxTwapDivergenceBps,
|
|
126
132
|
maxAgePriceSeconds: fields.maxAgePriceSeconds,
|
|
127
133
|
maxAgeTwapSeconds: fields.maxAgeTwapSeconds,
|
|
128
|
-
scopeConfiguration: types.ScopeConfiguration.toEncodable(
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
scopeConfiguration: types.ScopeConfiguration.toEncodable(
|
|
135
|
+
fields.scopeConfiguration
|
|
136
|
+
),
|
|
137
|
+
switchboardConfiguration: types.SwitchboardConfiguration.toEncodable(
|
|
138
|
+
fields.switchboardConfiguration
|
|
139
|
+
),
|
|
140
|
+
pythConfiguration: types.PythConfiguration.toEncodable(
|
|
141
|
+
fields.pythConfiguration
|
|
142
|
+
),
|
|
131
143
|
blockPriceUsage: fields.blockPriceUsage,
|
|
132
144
|
reserved: fields.reserved,
|
|
133
145
|
padding: fields.padding,
|
|
134
|
-
}
|
|
146
|
+
}
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
toJSON(): TokenInfoJSON {
|
|
@@ -147,7 +159,7 @@ export class TokenInfo {
|
|
|
147
159
|
blockPriceUsage: this.blockPriceUsage,
|
|
148
160
|
reserved: this.reserved,
|
|
149
161
|
padding: this.padding.map((item) => item.toString()),
|
|
150
|
-
}
|
|
162
|
+
}
|
|
151
163
|
}
|
|
152
164
|
|
|
153
165
|
static fromJSON(obj: TokenInfoJSON): TokenInfo {
|
|
@@ -157,16 +169,22 @@ export class TokenInfo {
|
|
|
157
169
|
maxTwapDivergenceBps: new BN(obj.maxTwapDivergenceBps),
|
|
158
170
|
maxAgePriceSeconds: new BN(obj.maxAgePriceSeconds),
|
|
159
171
|
maxAgeTwapSeconds: new BN(obj.maxAgeTwapSeconds),
|
|
160
|
-
scopeConfiguration: types.ScopeConfiguration.fromJSON(
|
|
161
|
-
|
|
162
|
-
|
|
172
|
+
scopeConfiguration: types.ScopeConfiguration.fromJSON(
|
|
173
|
+
obj.scopeConfiguration
|
|
174
|
+
),
|
|
175
|
+
switchboardConfiguration: types.SwitchboardConfiguration.fromJSON(
|
|
176
|
+
obj.switchboardConfiguration
|
|
177
|
+
),
|
|
178
|
+
pythConfiguration: types.PythConfiguration.fromJSON(
|
|
179
|
+
obj.pythConfiguration
|
|
180
|
+
),
|
|
163
181
|
blockPriceUsage: obj.blockPriceUsage,
|
|
164
182
|
reserved: obj.reserved,
|
|
165
183
|
padding: obj.padding.map((item) => new BN(item)),
|
|
166
|
-
})
|
|
184
|
+
})
|
|
167
185
|
}
|
|
168
186
|
|
|
169
187
|
toEncodable() {
|
|
170
|
-
return TokenInfo.toEncodable(this)
|
|
188
|
+
return TokenInfo.toEncodable(this)
|
|
171
189
|
}
|
|
172
190
|
}
|
|
@@ -1,115 +1,133 @@
|
|
|
1
|
-
import { PublicKey } from
|
|
2
|
-
import BN from
|
|
3
|
-
import * as types from
|
|
4
|
-
import * as borsh from
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
|
5
5
|
|
|
6
6
|
export interface VaultAllocationFields {
|
|
7
|
-
reserve: PublicKey
|
|
8
|
-
|
|
7
|
+
reserve: PublicKey
|
|
8
|
+
ctokenVault: PublicKey
|
|
9
|
+
targetAllocationWeight: BN
|
|
9
10
|
/** Maximum token invested in this reserve */
|
|
10
|
-
tokenAllocationCap: BN
|
|
11
|
-
configPadding: Array<BN
|
|
12
|
-
cTokenAllocation: BN
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
tokenAllocationCap: BN
|
|
12
|
+
configPadding: Array<BN>
|
|
13
|
+
cTokenAllocation: BN
|
|
14
|
+
lastInvestSlot: BN
|
|
15
|
+
tokenTargetAllocationSf: BN
|
|
16
|
+
statePadding: Array<BN>
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export interface VaultAllocationJSON {
|
|
18
|
-
reserve: string
|
|
19
|
-
|
|
20
|
+
reserve: string
|
|
21
|
+
ctokenVault: string
|
|
22
|
+
targetAllocationWeight: string
|
|
20
23
|
/** Maximum token invested in this reserve */
|
|
21
|
-
tokenAllocationCap: string
|
|
22
|
-
configPadding: Array<string
|
|
23
|
-
cTokenAllocation: string
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
tokenAllocationCap: string
|
|
25
|
+
configPadding: Array<string>
|
|
26
|
+
cTokenAllocation: string
|
|
27
|
+
lastInvestSlot: string
|
|
28
|
+
tokenTargetAllocationSf: string
|
|
29
|
+
statePadding: Array<string>
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export class VaultAllocation {
|
|
29
|
-
readonly reserve: PublicKey
|
|
30
|
-
readonly
|
|
33
|
+
readonly reserve: PublicKey
|
|
34
|
+
readonly ctokenVault: PublicKey
|
|
35
|
+
readonly targetAllocationWeight: BN
|
|
31
36
|
/** Maximum token invested in this reserve */
|
|
32
|
-
readonly tokenAllocationCap: BN
|
|
33
|
-
readonly configPadding: Array<BN
|
|
34
|
-
readonly cTokenAllocation: BN
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
+
readonly tokenAllocationCap: BN
|
|
38
|
+
readonly configPadding: Array<BN>
|
|
39
|
+
readonly cTokenAllocation: BN
|
|
40
|
+
readonly lastInvestSlot: BN
|
|
41
|
+
readonly tokenTargetAllocationSf: BN
|
|
42
|
+
readonly statePadding: Array<BN>
|
|
37
43
|
|
|
38
44
|
constructor(fields: VaultAllocationFields) {
|
|
39
|
-
this.reserve = fields.reserve
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
45
|
+
this.reserve = fields.reserve
|
|
46
|
+
this.ctokenVault = fields.ctokenVault
|
|
47
|
+
this.targetAllocationWeight = fields.targetAllocationWeight
|
|
48
|
+
this.tokenAllocationCap = fields.tokenAllocationCap
|
|
49
|
+
this.configPadding = fields.configPadding
|
|
50
|
+
this.cTokenAllocation = fields.cTokenAllocation
|
|
51
|
+
this.lastInvestSlot = fields.lastInvestSlot
|
|
52
|
+
this.tokenTargetAllocationSf = fields.tokenTargetAllocationSf
|
|
53
|
+
this.statePadding = fields.statePadding
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
static layout(property?: string) {
|
|
49
57
|
return borsh.struct(
|
|
50
58
|
[
|
|
51
|
-
borsh.publicKey(
|
|
52
|
-
borsh.
|
|
53
|
-
borsh.u64(
|
|
54
|
-
borsh.
|
|
55
|
-
borsh.u64(
|
|
56
|
-
borsh.u64(
|
|
57
|
-
borsh.
|
|
59
|
+
borsh.publicKey("reserve"),
|
|
60
|
+
borsh.publicKey("ctokenVault"),
|
|
61
|
+
borsh.u64("targetAllocationWeight"),
|
|
62
|
+
borsh.u64("tokenAllocationCap"),
|
|
63
|
+
borsh.array(borsh.u64(), 128, "configPadding"),
|
|
64
|
+
borsh.u64("cTokenAllocation"),
|
|
65
|
+
borsh.u64("lastInvestSlot"),
|
|
66
|
+
borsh.u128("tokenTargetAllocationSf"),
|
|
67
|
+
borsh.array(borsh.u64(), 128, "statePadding"),
|
|
58
68
|
],
|
|
59
69
|
property
|
|
60
|
-
)
|
|
70
|
+
)
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
74
|
static fromDecoded(obj: any) {
|
|
65
75
|
return new VaultAllocation({
|
|
66
76
|
reserve: obj.reserve,
|
|
77
|
+
ctokenVault: obj.ctokenVault,
|
|
67
78
|
targetAllocationWeight: obj.targetAllocationWeight,
|
|
68
79
|
tokenAllocationCap: obj.tokenAllocationCap,
|
|
69
80
|
configPadding: obj.configPadding,
|
|
70
81
|
cTokenAllocation: obj.cTokenAllocation,
|
|
71
|
-
|
|
82
|
+
lastInvestSlot: obj.lastInvestSlot,
|
|
83
|
+
tokenTargetAllocationSf: obj.tokenTargetAllocationSf,
|
|
72
84
|
statePadding: obj.statePadding,
|
|
73
|
-
})
|
|
85
|
+
})
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
static toEncodable(fields: VaultAllocationFields) {
|
|
77
89
|
return {
|
|
78
90
|
reserve: fields.reserve,
|
|
91
|
+
ctokenVault: fields.ctokenVault,
|
|
79
92
|
targetAllocationWeight: fields.targetAllocationWeight,
|
|
80
93
|
tokenAllocationCap: fields.tokenAllocationCap,
|
|
81
94
|
configPadding: fields.configPadding,
|
|
82
95
|
cTokenAllocation: fields.cTokenAllocation,
|
|
83
|
-
|
|
96
|
+
lastInvestSlot: fields.lastInvestSlot,
|
|
97
|
+
tokenTargetAllocationSf: fields.tokenTargetAllocationSf,
|
|
84
98
|
statePadding: fields.statePadding,
|
|
85
|
-
}
|
|
99
|
+
}
|
|
86
100
|
}
|
|
87
101
|
|
|
88
102
|
toJSON(): VaultAllocationJSON {
|
|
89
103
|
return {
|
|
90
104
|
reserve: this.reserve.toString(),
|
|
105
|
+
ctokenVault: this.ctokenVault.toString(),
|
|
91
106
|
targetAllocationWeight: this.targetAllocationWeight.toString(),
|
|
92
107
|
tokenAllocationCap: this.tokenAllocationCap.toString(),
|
|
93
108
|
configPadding: this.configPadding.map((item) => item.toString()),
|
|
94
109
|
cTokenAllocation: this.cTokenAllocation.toString(),
|
|
95
|
-
|
|
110
|
+
lastInvestSlot: this.lastInvestSlot.toString(),
|
|
111
|
+
tokenTargetAllocationSf: this.tokenTargetAllocationSf.toString(),
|
|
96
112
|
statePadding: this.statePadding.map((item) => item.toString()),
|
|
97
|
-
}
|
|
113
|
+
}
|
|
98
114
|
}
|
|
99
115
|
|
|
100
116
|
static fromJSON(obj: VaultAllocationJSON): VaultAllocation {
|
|
101
117
|
return new VaultAllocation({
|
|
102
118
|
reserve: new PublicKey(obj.reserve),
|
|
119
|
+
ctokenVault: new PublicKey(obj.ctokenVault),
|
|
103
120
|
targetAllocationWeight: new BN(obj.targetAllocationWeight),
|
|
104
121
|
tokenAllocationCap: new BN(obj.tokenAllocationCap),
|
|
105
122
|
configPadding: obj.configPadding.map((item) => new BN(item)),
|
|
106
123
|
cTokenAllocation: new BN(obj.cTokenAllocation),
|
|
107
|
-
|
|
124
|
+
lastInvestSlot: new BN(obj.lastInvestSlot),
|
|
125
|
+
tokenTargetAllocationSf: new BN(obj.tokenTargetAllocationSf),
|
|
108
126
|
statePadding: obj.statePadding.map((item) => new BN(item)),
|
|
109
|
-
})
|
|
127
|
+
})
|
|
110
128
|
}
|
|
111
129
|
|
|
112
130
|
toEncodable() {
|
|
113
|
-
return VaultAllocation.toEncodable(this)
|
|
131
|
+
return VaultAllocation.toEncodable(this)
|
|
114
132
|
}
|
|
115
133
|
}
|