@exponent-labs/klend-idl 0.9.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/build/accounts/LendingMarket.d.ts +88 -0
- package/build/accounts/LendingMarket.js +225 -0
- package/build/accounts/LendingMarket.js.map +1 -0
- package/build/accounts/Obligation.d.ts +85 -0
- package/build/accounts/Obligation.js +217 -0
- package/build/accounts/Obligation.js.map +1 -0
- package/build/accounts/ReferrerState.d.ts +23 -0
- package/build/accounts/ReferrerState.js +85 -0
- package/build/accounts/ReferrerState.js.map +1 -0
- package/build/accounts/ReferrerTokenState.d.ts +36 -0
- package/build/accounts/ReferrerTokenState.js +116 -0
- package/build/accounts/ReferrerTokenState.js.map +1 -0
- package/build/accounts/Reserve.d.ts +61 -0
- package/build/accounts/Reserve.js +169 -0
- package/build/accounts/Reserve.js.map +1 -0
- package/build/accounts/ShortUrl.d.ts +23 -0
- package/build/accounts/ShortUrl.js +85 -0
- package/build/accounts/ShortUrl.js.map +1 -0
- package/build/accounts/UserMetadata.d.ts +36 -0
- package/build/accounts/UserMetadata.js +116 -0
- package/build/accounts/UserMetadata.js.map +1 -0
- package/build/accounts/UserState.d.ts +69 -0
- package/build/accounts/UserState.js +182 -0
- package/build/accounts/UserState.js.map +1 -0
- package/build/accounts/index.d.ts +16 -0
- package/build/accounts/index.js +20 -0
- package/build/accounts/index.js.map +1 -0
- package/build/errors/anchor.d.ts +434 -0
- package/build/errors/anchor.js +767 -0
- package/build/errors/anchor.js.map +1 -0
- package/build/errors/custom.d.ts +898 -0
- package/build/errors/custom.js +1580 -0
- package/build/errors/custom.js.map +1 -0
- package/build/errors/index.d.ts +5 -0
- package/build/errors/index.js +71 -0
- package/build/errors/index.js.map +1 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +34 -0
- package/build/index.js.map +1 -0
- package/build/instructions/borrowObligationLiquidity.d.ts +21 -0
- package/build/instructions/borrowObligationLiquidity.js +80 -0
- package/build/instructions/borrowObligationLiquidity.js.map +1 -0
- package/build/instructions/borrowObligationLiquidityV2.d.ts +28 -0
- package/build/instructions/borrowObligationLiquidityV2.js +90 -0
- package/build/instructions/borrowObligationLiquidityV2.js.map +1 -0
- package/build/instructions/deleteReferrerStateAndShortUrl.d.ts +9 -0
- package/build/instructions/deleteReferrerStateAndShortUrl.js +20 -0
- package/build/instructions/deleteReferrerStateAndShortUrl.js.map +1 -0
- package/build/instructions/depositObligationCollateral.d.ts +17 -0
- package/build/instructions/depositObligationCollateral.js +64 -0
- package/build/instructions/depositObligationCollateral.js.map +1 -0
- package/build/instructions/depositReserveLiquidity.d.ts +21 -0
- package/build/instructions/depositReserveLiquidity.js +88 -0
- package/build/instructions/depositReserveLiquidity.js.map +1 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +23 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +94 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts +30 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +100 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -0
- package/build/instructions/flashBorrowReserveLiquidity.d.ts +21 -0
- package/build/instructions/flashBorrowReserveLiquidity.js +80 -0
- package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -0
- package/build/instructions/flashRepayReserveLiquidity.d.ts +22 -0
- package/build/instructions/flashRepayReserveLiquidity.js +77 -0
- package/build/instructions/flashRepayReserveLiquidity.js.map +1 -0
- package/build/instructions/idlMissingTypes.d.ts +18 -0
- package/build/instructions/idlMissingTypes.js +62 -0
- package/build/instructions/idlMissingTypes.js.map +1 -0
- package/build/instructions/index.d.ts +74 -0
- package/build/instructions/index.js +78 -0
- package/build/instructions/index.js.map +1 -0
- package/build/instructions/initFarmsForReserve.d.ts +18 -0
- package/build/instructions/initFarmsForReserve.js +62 -0
- package/build/instructions/initFarmsForReserve.js.map +1 -0
- package/build/instructions/initLendingMarket.d.ts +13 -0
- package/build/instructions/initLendingMarket.js +53 -0
- package/build/instructions/initLendingMarket.js.map +1 -0
- package/build/instructions/initObligation.d.ts +18 -0
- package/build/instructions/initObligation.js +54 -0
- package/build/instructions/initObligation.js.map +1 -0
- package/build/instructions/initObligationFarmsForReserve.d.ts +19 -0
- package/build/instructions/initObligationFarmsForReserve.js +59 -0
- package/build/instructions/initObligationFarmsForReserve.js.map +1 -0
- package/build/instructions/initReferrerStateAndShortUrl.d.ts +14 -0
- package/build/instructions/initReferrerStateAndShortUrl.js +54 -0
- package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -0
- package/build/instructions/initReferrerTokenState.d.ts +14 -0
- package/build/instructions/initReferrerTokenState.js +50 -0
- package/build/instructions/initReferrerTokenState.js.map +1 -0
- package/build/instructions/initReserve.d.ts +17 -0
- package/build/instructions/initReserve.js +56 -0
- package/build/instructions/initReserve.js.map +1 -0
- package/build/instructions/initUserMetadata.d.ts +14 -0
- package/build/instructions/initUserMetadata.js +54 -0
- package/build/instructions/initUserMetadata.js.map +1 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +31 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js +126 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -0
- package/build/instructions/redeemFees.d.ts +11 -0
- package/build/instructions/redeemFees.js +38 -0
- package/build/instructions/redeemFees.js.map +1 -0
- package/build/instructions/redeemReserveCollateral.d.ts +21 -0
- package/build/instructions/redeemReserveCollateral.js +92 -0
- package/build/instructions/redeemReserveCollateral.js.map +1 -0
- package/build/instructions/refreshObligation.d.ts +6 -0
- package/build/instructions/refreshObligation.js +17 -0
- package/build/instructions/refreshObligation.js.map +1 -0
- package/build/instructions/refreshObligationFarmsForReserve.d.ts +18 -0
- package/build/instructions/refreshObligationFarmsForReserve.js +62 -0
- package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -0
- package/build/instructions/refreshReserve.d.ts +10 -0
- package/build/instructions/refreshReserve.js +29 -0
- package/build/instructions/refreshReserve.js.map +1 -0
- package/build/instructions/refreshReservesBatch.d.ts +6 -0
- package/build/instructions/refreshReservesBatch.js +43 -0
- package/build/instructions/refreshReservesBatch.js.map +1 -0
- package/build/instructions/repayObligationLiquidity.d.ts +18 -0
- package/build/instructions/repayObligationLiquidity.js +65 -0
- package/build/instructions/repayObligationLiquidity.js.map +1 -0
- package/build/instructions/repayObligationLiquidityV2.d.ts +26 -0
- package/build/instructions/repayObligationLiquidityV2.js +76 -0
- package/build/instructions/repayObligationLiquidityV2.js.map +1 -0
- package/build/instructions/requestElevationGroup.d.ts +11 -0
- package/build/instructions/requestElevationGroup.js +47 -0
- package/build/instructions/requestElevationGroup.js.map +1 -0
- package/build/instructions/socializeLoss.d.ts +14 -0
- package/build/instructions/socializeLoss.js +53 -0
- package/build/instructions/socializeLoss.js.map +1 -0
- package/build/instructions/updateLendingMarket.d.ts +12 -0
- package/build/instructions/updateLendingMarket.js +47 -0
- package/build/instructions/updateLendingMarket.js.map +1 -0
- package/build/instructions/updateLendingMarketOwner.d.ts +6 -0
- package/build/instructions/updateLendingMarketOwner.js +21 -0
- package/build/instructions/updateLendingMarketOwner.js.map +1 -0
- package/build/instructions/updateReserveConfig.d.ts +14 -0
- package/build/instructions/updateReserveConfig.js +49 -0
- package/build/instructions/updateReserveConfig.js.map +1 -0
- package/build/instructions/withdrawObligationCollateral.d.ts +18 -0
- package/build/instructions/withdrawObligationCollateral.js +69 -0
- package/build/instructions/withdrawObligationCollateral.js.map +1 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +23 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +98 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts +30 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +104 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -0
- package/build/instructions/withdrawProtocolFee.d.ts +17 -0
- package/build/instructions/withdrawProtocolFee.js +64 -0
- package/build/instructions/withdrawProtocolFee.js.map +1 -0
- package/build/instructions/withdrawReferrerFees.d.ts +13 -0
- package/build/instructions/withdrawReferrerFees.js +40 -0
- package/build/instructions/withdrawReferrerFees.js.map +1 -0
- package/build/kamino_lending.d.ts +3937 -0
- package/build/kamino_lending.js +3940 -0
- package/build/kamino_lending.js.map +1 -0
- package/build/kamino_lending.json +6352 -0
- package/build/programId.d.ts +3 -0
- package/build/programId.js +9 -0
- package/build/programId.js.map +1 -0
- package/build/types/AssetTier.d.ts +44 -0
- package/build/types/AssetTier.js +122 -0
- package/build/types/AssetTier.js.map +1 -0
- package/build/types/BigFractionBytes.d.ts +26 -0
- package/build/types/BigFractionBytes.js +72 -0
- package/build/types/BigFractionBytes.js.map +1 -0
- package/build/types/BorrowRateCurve.d.ts +27 -0
- package/build/types/BorrowRateCurve.js +63 -0
- package/build/types/BorrowRateCurve.js.map +1 -0
- package/build/types/CurvePoint.d.ts +25 -0
- package/build/types/CurvePoint.js +68 -0
- package/build/types/CurvePoint.js.map +1 -0
- package/build/types/ElevationGroup.d.ts +62 -0
- package/build/types/ElevationGroup.js +125 -0
- package/build/types/ElevationGroup.js.map +1 -0
- package/build/types/FeeCalculation.d.ts +31 -0
- package/build/types/FeeCalculation.js +95 -0
- package/build/types/FeeCalculation.js.map +1 -0
- package/build/types/InitObligationArgs.d.ts +25 -0
- package/build/types/InitObligationArgs.js +68 -0
- package/build/types/InitObligationArgs.js.map +1 -0
- package/build/types/LastUpdate.d.ts +36 -0
- package/build/types/LastUpdate.js +84 -0
- package/build/types/LastUpdate.js.map +1 -0
- package/build/types/ObligationCollateral.d.ts +43 -0
- package/build/types/ObligationCollateral.js +98 -0
- package/build/types/ObligationCollateral.js.map +1 -0
- package/build/types/ObligationLiquidity.d.ts +64 -0
- package/build/types/ObligationLiquidity.js +123 -0
- package/build/types/ObligationLiquidity.js.map +1 -0
- package/build/types/PriceHeuristic.d.ts +32 -0
- package/build/types/PriceHeuristic.js +78 -0
- package/build/types/PriceHeuristic.js.map +1 -0
- package/build/types/PythConfiguration.d.ts +22 -0
- package/build/types/PythConfiguration.js +63 -0
- package/build/types/PythConfiguration.js.map +1 -0
- package/build/types/ReserveCollateral.d.ts +43 -0
- package/build/types/ReserveCollateral.js +97 -0
- package/build/types/ReserveCollateral.js.map +1 -0
- package/build/types/ReserveConfig.d.ts +246 -0
- package/build/types/ReserveConfig.js +269 -0
- package/build/types/ReserveConfig.js.map +1 -0
- package/build/types/ReserveFarmKind.d.ts +31 -0
- package/build/types/ReserveFarmKind.js +98 -0
- package/build/types/ReserveFarmKind.js.map +1 -0
- package/build/types/ReserveFees.d.ts +32 -0
- package/build/types/ReserveFees.js +82 -0
- package/build/types/ReserveFees.js.map +1 -0
- package/build/types/ReserveLiquidity.d.ts +114 -0
- package/build/types/ReserveLiquidity.js +191 -0
- package/build/types/ReserveLiquidity.js.map +1 -0
- package/build/types/ReserveStatus.d.ts +44 -0
- package/build/types/ReserveStatus.js +122 -0
- package/build/types/ReserveStatus.js.map +1 -0
- package/build/types/ScopeConfiguration.d.ts +32 -0
- package/build/types/ScopeConfiguration.js +79 -0
- package/build/types/ScopeConfiguration.js.map +1 -0
- package/build/types/SwitchboardConfiguration.d.ts +27 -0
- package/build/types/SwitchboardConfiguration.js +69 -0
- package/build/types/SwitchboardConfiguration.js.map +1 -0
- package/build/types/TokenInfo.d.ts +99 -0
- package/build/types/TokenInfo.js +145 -0
- package/build/types/TokenInfo.js.map +1 -0
- package/build/types/UpdateConfigMode.d.ts +616 -0
- package/build/types/UpdateConfigMode.js +1178 -0
- package/build/types/UpdateConfigMode.js.map +1 -0
- package/build/types/UpdateLendingMarketConfigValue.d.ts +177 -0
- package/build/types/UpdateLendingMarketConfigValue.js +312 -0
- package/build/types/UpdateLendingMarketConfigValue.js.map +1 -0
- package/build/types/UpdateLendingMarketMode.d.ts +239 -0
- package/build/types/UpdateLendingMarketMode.js +482 -0
- package/build/types/UpdateLendingMarketMode.js.map +1 -0
- package/build/types/WithdrawalCaps.d.ts +37 -0
- package/build/types/WithdrawalCaps.js +89 -0
- package/build/types/WithdrawalCaps.js.map +1 -0
- package/build/types/index.d.ts +64 -0
- package/build/types/index.js +77 -0
- package/build/types/index.js.map +1 -0
- package/package.json +44 -0
- package/src/accounts/LendingMarket.ts +292 -0
- package/src/accounts/Obligation.ts +282 -0
- package/src/accounts/ReferrerState.ts +90 -0
- package/src/accounts/ReferrerTokenState.ts +126 -0
- package/src/accounts/Reserve.ts +218 -0
- package/src/accounts/ShortUrl.ts +86 -0
- package/src/accounts/UserMetadata.ts +126 -0
- package/src/accounts/UserState.ts +210 -0
- package/src/accounts/index.ts +19 -0
- package/src/errors/anchor.ts +773 -0
- package/src/errors/custom.ts +1633 -0
- package/src/errors/index.ts +62 -0
- package/src/index.ts +5 -0
- package/src/instructions/borrowObligationLiquidity.ts +81 -0
- package/src/instructions/borrowObligationLiquidityV2.ts +103 -0
- package/src/instructions/deleteReferrerStateAndShortUrl.ts +27 -0
- package/src/instructions/depositObligationCollateral.ts +61 -0
- package/src/instructions/depositReserveLiquidity.ts +89 -0
- package/src/instructions/depositReserveLiquidityAndObligationCollateral.ts +97 -0
- package/src/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +119 -0
- package/src/instructions/flashBorrowReserveLiquidity.ts +81 -0
- package/src/instructions/flashRepayReserveLiquidity.ts +79 -0
- package/src/instructions/idlMissingTypes.ts +59 -0
- package/src/instructions/index.ts +158 -0
- package/src/instructions/initFarmsForReserve.ts +60 -0
- package/src/instructions/initLendingMarket.ts +46 -0
- package/src/instructions/initObligation.ts +51 -0
- package/src/instructions/initObligationFarmsForReserve.ts +58 -0
- package/src/instructions/initReferrerStateAndShortUrl.ts +48 -0
- package/src/instructions/initReferrerTokenState.ts +44 -0
- package/src/instructions/initReserve.ts +68 -0
- package/src/instructions/initUserMetadata.ts +48 -0
- package/src/instructions/liquidateObligationAndRedeemReserveCollateral.ts +137 -0
- package/src/instructions/redeemFees.ts +44 -0
- package/src/instructions/redeemReserveCollateral.ts +93 -0
- package/src/instructions/refreshObligation.ts +18 -0
- package/src/instructions/refreshObligationFarmsForReserve.ts +60 -0
- package/src/instructions/refreshReserve.ts +34 -0
- package/src/instructions/refreshReservesBatch.ts +24 -0
- package/src/instructions/repayObligationLiquidity.ts +63 -0
- package/src/instructions/repayObligationLiquidityV2.ts +87 -0
- package/src/instructions/requestElevationGroup.ts +38 -0
- package/src/instructions/socializeLoss.ts +47 -0
- package/src/instructions/updateLendingMarket.ts +39 -0
- package/src/instructions/updateLendingMarketOwner.ts +25 -0
- package/src/instructions/updateReserveConfig.ts +43 -0
- package/src/instructions/withdrawObligationCollateral.ts +67 -0
- package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +101 -0
- package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +123 -0
- package/src/instructions/withdrawProtocolFee.ts +61 -0
- package/src/instructions/withdrawReferrerFees.ts +48 -0
- package/src/kamino_lending.json +6352 -0
- package/src/kamino_lending.ts +7873 -0
- package/src/programId.ts +9 -0
- package/src/types/AssetTier.ts +116 -0
- package/src/types/BigFractionBytes.ts +59 -0
- package/src/types/BorrowRateCurve.ts +53 -0
- package/src/types/CurvePoint.ts +58 -0
- package/src/types/ElevationGroup.ts +129 -0
- package/src/types/FeeCalculation.ts +83 -0
- package/src/types/InitObligationArgs.ts +58 -0
- package/src/types/LastUpdate.ts +78 -0
- package/src/types/ObligationCollateral.ts +100 -0
- package/src/types/ObligationLiquidity.ts +140 -0
- package/src/types/PriceHeuristic.ts +72 -0
- package/src/types/PythConfiguration.ts +53 -0
- package/src/types/ReserveCollateral.ts +94 -0
- package/src/types/ReserveConfig.ts +349 -0
- package/src/types/ReserveFarmKind.ts +90 -0
- package/src/types/ReserveFees.ts +76 -0
- package/src/types/ReserveLiquidity.ts +219 -0
- package/src/types/ReserveStatus.ts +120 -0
- package/src/types/ScopeConfiguration.ts +76 -0
- package/src/types/SwitchboardConfiguration.ts +64 -0
- package/src/types/TokenInfo.ts +172 -0
- package/src/types/UpdateConfigMode.ts +1440 -0
- package/src/types/UpdateLendingMarketConfigValue.ts +376 -0
- package/src/types/UpdateLendingMarketMode.ts +570 -0
- package/src/types/WithdrawalCaps.ts +85 -0
- package/src/types/index.ts +275 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,219 @@
|
|
|
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
|
+
|
|
6
|
+
export interface ReserveLiquidityFields {
|
|
7
|
+
mintPubkey: PublicKey
|
|
8
|
+
supplyVault: PublicKey
|
|
9
|
+
feeVault: PublicKey
|
|
10
|
+
availableAmount: BN
|
|
11
|
+
borrowedAmountSf: BN
|
|
12
|
+
marketPriceSf: BN
|
|
13
|
+
marketPriceLastUpdatedTs: BN
|
|
14
|
+
mintDecimals: BN
|
|
15
|
+
depositLimitCrossedSlot: BN
|
|
16
|
+
borrowLimitCrossedSlot: BN
|
|
17
|
+
cumulativeBorrowRateBsf: types.BigFractionBytesFields
|
|
18
|
+
accumulatedProtocolFeesSf: BN
|
|
19
|
+
accumulatedReferrerFeesSf: BN
|
|
20
|
+
pendingReferrerFeesSf: BN
|
|
21
|
+
absoluteReferralRateSf: BN
|
|
22
|
+
tokenProgram: PublicKey
|
|
23
|
+
padding2: Array<BN>
|
|
24
|
+
padding3: Array<BN>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ReserveLiquidityJSON {
|
|
28
|
+
mintPubkey: string
|
|
29
|
+
supplyVault: string
|
|
30
|
+
feeVault: string
|
|
31
|
+
availableAmount: string
|
|
32
|
+
borrowedAmountSf: string
|
|
33
|
+
marketPriceSf: string
|
|
34
|
+
marketPriceLastUpdatedTs: string
|
|
35
|
+
mintDecimals: string
|
|
36
|
+
depositLimitCrossedSlot: string
|
|
37
|
+
borrowLimitCrossedSlot: string
|
|
38
|
+
cumulativeBorrowRateBsf: types.BigFractionBytesJSON
|
|
39
|
+
accumulatedProtocolFeesSf: string
|
|
40
|
+
accumulatedReferrerFeesSf: string
|
|
41
|
+
pendingReferrerFeesSf: string
|
|
42
|
+
absoluteReferralRateSf: string
|
|
43
|
+
tokenProgram: string
|
|
44
|
+
padding2: Array<string>
|
|
45
|
+
padding3: Array<string>
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class ReserveLiquidity {
|
|
49
|
+
readonly mintPubkey: PublicKey
|
|
50
|
+
readonly supplyVault: PublicKey
|
|
51
|
+
readonly feeVault: PublicKey
|
|
52
|
+
readonly availableAmount: BN
|
|
53
|
+
readonly borrowedAmountSf: BN
|
|
54
|
+
readonly marketPriceSf: BN
|
|
55
|
+
readonly marketPriceLastUpdatedTs: BN
|
|
56
|
+
readonly mintDecimals: BN
|
|
57
|
+
readonly depositLimitCrossedSlot: BN
|
|
58
|
+
readonly borrowLimitCrossedSlot: BN
|
|
59
|
+
readonly cumulativeBorrowRateBsf: types.BigFractionBytes
|
|
60
|
+
readonly accumulatedProtocolFeesSf: BN
|
|
61
|
+
readonly accumulatedReferrerFeesSf: BN
|
|
62
|
+
readonly pendingReferrerFeesSf: BN
|
|
63
|
+
readonly absoluteReferralRateSf: BN
|
|
64
|
+
readonly tokenProgram: PublicKey
|
|
65
|
+
readonly padding2: Array<BN>
|
|
66
|
+
readonly padding3: Array<BN>
|
|
67
|
+
|
|
68
|
+
constructor(fields: ReserveLiquidityFields) {
|
|
69
|
+
this.mintPubkey = fields.mintPubkey
|
|
70
|
+
this.supplyVault = fields.supplyVault
|
|
71
|
+
this.feeVault = fields.feeVault
|
|
72
|
+
this.availableAmount = fields.availableAmount
|
|
73
|
+
this.borrowedAmountSf = fields.borrowedAmountSf
|
|
74
|
+
this.marketPriceSf = fields.marketPriceSf
|
|
75
|
+
this.marketPriceLastUpdatedTs = fields.marketPriceLastUpdatedTs
|
|
76
|
+
this.mintDecimals = fields.mintDecimals
|
|
77
|
+
this.depositLimitCrossedSlot = fields.depositLimitCrossedSlot
|
|
78
|
+
this.borrowLimitCrossedSlot = fields.borrowLimitCrossedSlot
|
|
79
|
+
this.cumulativeBorrowRateBsf = new types.BigFractionBytes({
|
|
80
|
+
...fields.cumulativeBorrowRateBsf,
|
|
81
|
+
})
|
|
82
|
+
this.accumulatedProtocolFeesSf = fields.accumulatedProtocolFeesSf
|
|
83
|
+
this.accumulatedReferrerFeesSf = fields.accumulatedReferrerFeesSf
|
|
84
|
+
this.pendingReferrerFeesSf = fields.pendingReferrerFeesSf
|
|
85
|
+
this.absoluteReferralRateSf = fields.absoluteReferralRateSf
|
|
86
|
+
this.tokenProgram = fields.tokenProgram
|
|
87
|
+
this.padding2 = fields.padding2
|
|
88
|
+
this.padding3 = fields.padding3
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static layout(property?: string) {
|
|
92
|
+
return borsh.struct(
|
|
93
|
+
[
|
|
94
|
+
borsh.publicKey("mintPubkey"),
|
|
95
|
+
borsh.publicKey("supplyVault"),
|
|
96
|
+
borsh.publicKey("feeVault"),
|
|
97
|
+
borsh.u64("availableAmount"),
|
|
98
|
+
borsh.u128("borrowedAmountSf"),
|
|
99
|
+
borsh.u128("marketPriceSf"),
|
|
100
|
+
borsh.u64("marketPriceLastUpdatedTs"),
|
|
101
|
+
borsh.u64("mintDecimals"),
|
|
102
|
+
borsh.u64("depositLimitCrossedSlot"),
|
|
103
|
+
borsh.u64("borrowLimitCrossedSlot"),
|
|
104
|
+
types.BigFractionBytes.layout("cumulativeBorrowRateBsf"),
|
|
105
|
+
borsh.u128("accumulatedProtocolFeesSf"),
|
|
106
|
+
borsh.u128("accumulatedReferrerFeesSf"),
|
|
107
|
+
borsh.u128("pendingReferrerFeesSf"),
|
|
108
|
+
borsh.u128("absoluteReferralRateSf"),
|
|
109
|
+
borsh.publicKey("tokenProgram"),
|
|
110
|
+
borsh.array(borsh.u64(), 51, "padding2"),
|
|
111
|
+
borsh.array(borsh.u128(), 32, "padding3"),
|
|
112
|
+
],
|
|
113
|
+
property
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
|
+
static fromDecoded(obj: any) {
|
|
119
|
+
return new ReserveLiquidity({
|
|
120
|
+
mintPubkey: obj.mintPubkey,
|
|
121
|
+
supplyVault: obj.supplyVault,
|
|
122
|
+
feeVault: obj.feeVault,
|
|
123
|
+
availableAmount: obj.availableAmount,
|
|
124
|
+
borrowedAmountSf: obj.borrowedAmountSf,
|
|
125
|
+
marketPriceSf: obj.marketPriceSf,
|
|
126
|
+
marketPriceLastUpdatedTs: obj.marketPriceLastUpdatedTs,
|
|
127
|
+
mintDecimals: obj.mintDecimals,
|
|
128
|
+
depositLimitCrossedSlot: obj.depositLimitCrossedSlot,
|
|
129
|
+
borrowLimitCrossedSlot: obj.borrowLimitCrossedSlot,
|
|
130
|
+
cumulativeBorrowRateBsf: types.BigFractionBytes.fromDecoded(
|
|
131
|
+
obj.cumulativeBorrowRateBsf
|
|
132
|
+
),
|
|
133
|
+
accumulatedProtocolFeesSf: obj.accumulatedProtocolFeesSf,
|
|
134
|
+
accumulatedReferrerFeesSf: obj.accumulatedReferrerFeesSf,
|
|
135
|
+
pendingReferrerFeesSf: obj.pendingReferrerFeesSf,
|
|
136
|
+
absoluteReferralRateSf: obj.absoluteReferralRateSf,
|
|
137
|
+
tokenProgram: obj.tokenProgram,
|
|
138
|
+
padding2: obj.padding2,
|
|
139
|
+
padding3: obj.padding3,
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
static toEncodable(fields: ReserveLiquidityFields) {
|
|
144
|
+
return {
|
|
145
|
+
mintPubkey: fields.mintPubkey,
|
|
146
|
+
supplyVault: fields.supplyVault,
|
|
147
|
+
feeVault: fields.feeVault,
|
|
148
|
+
availableAmount: fields.availableAmount,
|
|
149
|
+
borrowedAmountSf: fields.borrowedAmountSf,
|
|
150
|
+
marketPriceSf: fields.marketPriceSf,
|
|
151
|
+
marketPriceLastUpdatedTs: fields.marketPriceLastUpdatedTs,
|
|
152
|
+
mintDecimals: fields.mintDecimals,
|
|
153
|
+
depositLimitCrossedSlot: fields.depositLimitCrossedSlot,
|
|
154
|
+
borrowLimitCrossedSlot: fields.borrowLimitCrossedSlot,
|
|
155
|
+
cumulativeBorrowRateBsf: types.BigFractionBytes.toEncodable(
|
|
156
|
+
fields.cumulativeBorrowRateBsf
|
|
157
|
+
),
|
|
158
|
+
accumulatedProtocolFeesSf: fields.accumulatedProtocolFeesSf,
|
|
159
|
+
accumulatedReferrerFeesSf: fields.accumulatedReferrerFeesSf,
|
|
160
|
+
pendingReferrerFeesSf: fields.pendingReferrerFeesSf,
|
|
161
|
+
absoluteReferralRateSf: fields.absoluteReferralRateSf,
|
|
162
|
+
tokenProgram: fields.tokenProgram,
|
|
163
|
+
padding2: fields.padding2,
|
|
164
|
+
padding3: fields.padding3,
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
toJSON(): ReserveLiquidityJSON {
|
|
169
|
+
return {
|
|
170
|
+
mintPubkey: this.mintPubkey.toString(),
|
|
171
|
+
supplyVault: this.supplyVault.toString(),
|
|
172
|
+
feeVault: this.feeVault.toString(),
|
|
173
|
+
availableAmount: this.availableAmount.toString(),
|
|
174
|
+
borrowedAmountSf: this.borrowedAmountSf.toString(),
|
|
175
|
+
marketPriceSf: this.marketPriceSf.toString(),
|
|
176
|
+
marketPriceLastUpdatedTs: this.marketPriceLastUpdatedTs.toString(),
|
|
177
|
+
mintDecimals: this.mintDecimals.toString(),
|
|
178
|
+
depositLimitCrossedSlot: this.depositLimitCrossedSlot.toString(),
|
|
179
|
+
borrowLimitCrossedSlot: this.borrowLimitCrossedSlot.toString(),
|
|
180
|
+
cumulativeBorrowRateBsf: this.cumulativeBorrowRateBsf.toJSON(),
|
|
181
|
+
accumulatedProtocolFeesSf: this.accumulatedProtocolFeesSf.toString(),
|
|
182
|
+
accumulatedReferrerFeesSf: this.accumulatedReferrerFeesSf.toString(),
|
|
183
|
+
pendingReferrerFeesSf: this.pendingReferrerFeesSf.toString(),
|
|
184
|
+
absoluteReferralRateSf: this.absoluteReferralRateSf.toString(),
|
|
185
|
+
tokenProgram: this.tokenProgram.toString(),
|
|
186
|
+
padding2: this.padding2.map((item) => item.toString()),
|
|
187
|
+
padding3: this.padding3.map((item) => item.toString()),
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static fromJSON(obj: ReserveLiquidityJSON): ReserveLiquidity {
|
|
192
|
+
return new ReserveLiquidity({
|
|
193
|
+
mintPubkey: new PublicKey(obj.mintPubkey),
|
|
194
|
+
supplyVault: new PublicKey(obj.supplyVault),
|
|
195
|
+
feeVault: new PublicKey(obj.feeVault),
|
|
196
|
+
availableAmount: new BN(obj.availableAmount),
|
|
197
|
+
borrowedAmountSf: new BN(obj.borrowedAmountSf),
|
|
198
|
+
marketPriceSf: new BN(obj.marketPriceSf),
|
|
199
|
+
marketPriceLastUpdatedTs: new BN(obj.marketPriceLastUpdatedTs),
|
|
200
|
+
mintDecimals: new BN(obj.mintDecimals),
|
|
201
|
+
depositLimitCrossedSlot: new BN(obj.depositLimitCrossedSlot),
|
|
202
|
+
borrowLimitCrossedSlot: new BN(obj.borrowLimitCrossedSlot),
|
|
203
|
+
cumulativeBorrowRateBsf: types.BigFractionBytes.fromJSON(
|
|
204
|
+
obj.cumulativeBorrowRateBsf
|
|
205
|
+
),
|
|
206
|
+
accumulatedProtocolFeesSf: new BN(obj.accumulatedProtocolFeesSf),
|
|
207
|
+
accumulatedReferrerFeesSf: new BN(obj.accumulatedReferrerFeesSf),
|
|
208
|
+
pendingReferrerFeesSf: new BN(obj.pendingReferrerFeesSf),
|
|
209
|
+
absoluteReferralRateSf: new BN(obj.absoluteReferralRateSf),
|
|
210
|
+
tokenProgram: new PublicKey(obj.tokenProgram),
|
|
211
|
+
padding2: obj.padding2.map((item) => new BN(item)),
|
|
212
|
+
padding3: obj.padding3.map((item) => new BN(item)),
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
toEncodable() {
|
|
217
|
+
return ReserveLiquidity.toEncodable(this)
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
|
|
6
|
+
export interface ActiveJSON {
|
|
7
|
+
kind: "Active"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class Active {
|
|
11
|
+
static readonly discriminator = 0
|
|
12
|
+
static readonly kind = "Active"
|
|
13
|
+
readonly discriminator = 0
|
|
14
|
+
readonly kind = "Active"
|
|
15
|
+
|
|
16
|
+
toJSON(): ActiveJSON {
|
|
17
|
+
return {
|
|
18
|
+
kind: "Active",
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toEncodable() {
|
|
23
|
+
return {
|
|
24
|
+
Active: {},
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ObsoleteJSON {
|
|
30
|
+
kind: "Obsolete"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class Obsolete {
|
|
34
|
+
static readonly discriminator = 1
|
|
35
|
+
static readonly kind = "Obsolete"
|
|
36
|
+
readonly discriminator = 1
|
|
37
|
+
readonly kind = "Obsolete"
|
|
38
|
+
|
|
39
|
+
toJSON(): ObsoleteJSON {
|
|
40
|
+
return {
|
|
41
|
+
kind: "Obsolete",
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
toEncodable() {
|
|
46
|
+
return {
|
|
47
|
+
Obsolete: {},
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface HiddenJSON {
|
|
53
|
+
kind: "Hidden"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export class Hidden {
|
|
57
|
+
static readonly discriminator = 2
|
|
58
|
+
static readonly kind = "Hidden"
|
|
59
|
+
readonly discriminator = 2
|
|
60
|
+
readonly kind = "Hidden"
|
|
61
|
+
|
|
62
|
+
toJSON(): HiddenJSON {
|
|
63
|
+
return {
|
|
64
|
+
kind: "Hidden",
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
toEncodable() {
|
|
69
|
+
return {
|
|
70
|
+
Hidden: {},
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
export function fromDecoded(obj: any): types.ReserveStatusKind {
|
|
77
|
+
if (typeof obj !== "object") {
|
|
78
|
+
throw new Error("Invalid enum object")
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if ("Active" in obj) {
|
|
82
|
+
return new Active()
|
|
83
|
+
}
|
|
84
|
+
if ("Obsolete" in obj) {
|
|
85
|
+
return new Obsolete()
|
|
86
|
+
}
|
|
87
|
+
if ("Hidden" in obj) {
|
|
88
|
+
return new Hidden()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
throw new Error("Invalid enum object")
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function fromJSON(
|
|
95
|
+
obj: types.ReserveStatusJSON
|
|
96
|
+
): types.ReserveStatusKind {
|
|
97
|
+
switch (obj.kind) {
|
|
98
|
+
case "Active": {
|
|
99
|
+
return new Active()
|
|
100
|
+
}
|
|
101
|
+
case "Obsolete": {
|
|
102
|
+
return new Obsolete()
|
|
103
|
+
}
|
|
104
|
+
case "Hidden": {
|
|
105
|
+
return new Hidden()
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function layout(property?: string) {
|
|
111
|
+
const ret = borsh.rustEnum([
|
|
112
|
+
borsh.struct([], "Active"),
|
|
113
|
+
borsh.struct([], "Obsolete"),
|
|
114
|
+
borsh.struct([], "Hidden"),
|
|
115
|
+
])
|
|
116
|
+
if (property !== undefined) {
|
|
117
|
+
return ret.replicate(property)
|
|
118
|
+
}
|
|
119
|
+
return ret
|
|
120
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
|
|
6
|
+
export interface ScopeConfigurationFields {
|
|
7
|
+
priceFeed: PublicKey
|
|
8
|
+
priceChain: Array<number>
|
|
9
|
+
twapChain: Array<number>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ScopeConfigurationJSON {
|
|
13
|
+
priceFeed: string
|
|
14
|
+
priceChain: Array<number>
|
|
15
|
+
twapChain: Array<number>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class ScopeConfiguration {
|
|
19
|
+
readonly priceFeed: PublicKey
|
|
20
|
+
readonly priceChain: Array<number>
|
|
21
|
+
readonly twapChain: Array<number>
|
|
22
|
+
|
|
23
|
+
constructor(fields: ScopeConfigurationFields) {
|
|
24
|
+
this.priceFeed = fields.priceFeed
|
|
25
|
+
this.priceChain = fields.priceChain
|
|
26
|
+
this.twapChain = fields.twapChain
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static layout(property?: string) {
|
|
30
|
+
return borsh.struct(
|
|
31
|
+
[
|
|
32
|
+
borsh.publicKey("priceFeed"),
|
|
33
|
+
borsh.array(borsh.u16(), 4, "priceChain"),
|
|
34
|
+
borsh.array(borsh.u16(), 4, "twapChain"),
|
|
35
|
+
],
|
|
36
|
+
property
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
static fromDecoded(obj: any) {
|
|
42
|
+
return new ScopeConfiguration({
|
|
43
|
+
priceFeed: obj.priceFeed,
|
|
44
|
+
priceChain: obj.priceChain,
|
|
45
|
+
twapChain: obj.twapChain,
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static toEncodable(fields: ScopeConfigurationFields) {
|
|
50
|
+
return {
|
|
51
|
+
priceFeed: fields.priceFeed,
|
|
52
|
+
priceChain: fields.priceChain,
|
|
53
|
+
twapChain: fields.twapChain,
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
toJSON(): ScopeConfigurationJSON {
|
|
58
|
+
return {
|
|
59
|
+
priceFeed: this.priceFeed.toString(),
|
|
60
|
+
priceChain: this.priceChain,
|
|
61
|
+
twapChain: this.twapChain,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static fromJSON(obj: ScopeConfigurationJSON): ScopeConfiguration {
|
|
66
|
+
return new ScopeConfiguration({
|
|
67
|
+
priceFeed: new PublicKey(obj.priceFeed),
|
|
68
|
+
priceChain: obj.priceChain,
|
|
69
|
+
twapChain: obj.twapChain,
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
toEncodable() {
|
|
74
|
+
return ScopeConfiguration.toEncodable(this)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
|
|
6
|
+
export interface SwitchboardConfigurationFields {
|
|
7
|
+
priceAggregator: PublicKey
|
|
8
|
+
twapAggregator: PublicKey
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SwitchboardConfigurationJSON {
|
|
12
|
+
priceAggregator: string
|
|
13
|
+
twapAggregator: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class SwitchboardConfiguration {
|
|
17
|
+
readonly priceAggregator: PublicKey
|
|
18
|
+
readonly twapAggregator: PublicKey
|
|
19
|
+
|
|
20
|
+
constructor(fields: SwitchboardConfigurationFields) {
|
|
21
|
+
this.priceAggregator = fields.priceAggregator
|
|
22
|
+
this.twapAggregator = fields.twapAggregator
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static layout(property?: string) {
|
|
26
|
+
return borsh.struct(
|
|
27
|
+
[borsh.publicKey("priceAggregator"), borsh.publicKey("twapAggregator")],
|
|
28
|
+
property
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
static fromDecoded(obj: any) {
|
|
34
|
+
return new SwitchboardConfiguration({
|
|
35
|
+
priceAggregator: obj.priceAggregator,
|
|
36
|
+
twapAggregator: obj.twapAggregator,
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static toEncodable(fields: SwitchboardConfigurationFields) {
|
|
41
|
+
return {
|
|
42
|
+
priceAggregator: fields.priceAggregator,
|
|
43
|
+
twapAggregator: fields.twapAggregator,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
toJSON(): SwitchboardConfigurationJSON {
|
|
48
|
+
return {
|
|
49
|
+
priceAggregator: this.priceAggregator.toString(),
|
|
50
|
+
twapAggregator: this.twapAggregator.toString(),
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static fromJSON(obj: SwitchboardConfigurationJSON): SwitchboardConfiguration {
|
|
55
|
+
return new SwitchboardConfiguration({
|
|
56
|
+
priceAggregator: new PublicKey(obj.priceAggregator),
|
|
57
|
+
twapAggregator: new PublicKey(obj.twapAggregator),
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
toEncodable() {
|
|
62
|
+
return SwitchboardConfiguration.toEncodable(this)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
|
|
6
|
+
export interface TokenInfoFields {
|
|
7
|
+
name: Array<number>
|
|
8
|
+
heuristic: types.PriceHeuristicFields
|
|
9
|
+
maxTwapDivergenceBps: BN
|
|
10
|
+
maxAgePriceSeconds: BN
|
|
11
|
+
maxAgeTwapSeconds: BN
|
|
12
|
+
scopeConfiguration: types.ScopeConfigurationFields
|
|
13
|
+
switchboardConfiguration: types.SwitchboardConfigurationFields
|
|
14
|
+
pythConfiguration: types.PythConfigurationFields
|
|
15
|
+
blockPriceUsage: number
|
|
16
|
+
reserved: Array<number>
|
|
17
|
+
padding: Array<BN>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface TokenInfoJSON {
|
|
21
|
+
name: Array<number>
|
|
22
|
+
heuristic: types.PriceHeuristicJSON
|
|
23
|
+
maxTwapDivergenceBps: string
|
|
24
|
+
maxAgePriceSeconds: string
|
|
25
|
+
maxAgeTwapSeconds: string
|
|
26
|
+
scopeConfiguration: types.ScopeConfigurationJSON
|
|
27
|
+
switchboardConfiguration: types.SwitchboardConfigurationJSON
|
|
28
|
+
pythConfiguration: types.PythConfigurationJSON
|
|
29
|
+
blockPriceUsage: number
|
|
30
|
+
reserved: Array<number>
|
|
31
|
+
padding: Array<string>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class TokenInfo {
|
|
35
|
+
readonly name: Array<number>
|
|
36
|
+
readonly heuristic: types.PriceHeuristic
|
|
37
|
+
readonly maxTwapDivergenceBps: BN
|
|
38
|
+
readonly maxAgePriceSeconds: BN
|
|
39
|
+
readonly maxAgeTwapSeconds: BN
|
|
40
|
+
readonly scopeConfiguration: types.ScopeConfiguration
|
|
41
|
+
readonly switchboardConfiguration: types.SwitchboardConfiguration
|
|
42
|
+
readonly pythConfiguration: types.PythConfiguration
|
|
43
|
+
readonly blockPriceUsage: number
|
|
44
|
+
readonly reserved: Array<number>
|
|
45
|
+
readonly padding: Array<BN>
|
|
46
|
+
|
|
47
|
+
constructor(fields: TokenInfoFields) {
|
|
48
|
+
this.name = fields.name
|
|
49
|
+
this.heuristic = new types.PriceHeuristic({ ...fields.heuristic })
|
|
50
|
+
this.maxTwapDivergenceBps = fields.maxTwapDivergenceBps
|
|
51
|
+
this.maxAgePriceSeconds = fields.maxAgePriceSeconds
|
|
52
|
+
this.maxAgeTwapSeconds = fields.maxAgeTwapSeconds
|
|
53
|
+
this.scopeConfiguration = new types.ScopeConfiguration({
|
|
54
|
+
...fields.scopeConfiguration,
|
|
55
|
+
})
|
|
56
|
+
this.switchboardConfiguration = new types.SwitchboardConfiguration({
|
|
57
|
+
...fields.switchboardConfiguration,
|
|
58
|
+
})
|
|
59
|
+
this.pythConfiguration = new types.PythConfiguration({
|
|
60
|
+
...fields.pythConfiguration,
|
|
61
|
+
})
|
|
62
|
+
this.blockPriceUsage = fields.blockPriceUsage
|
|
63
|
+
this.reserved = fields.reserved
|
|
64
|
+
this.padding = fields.padding
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static layout(property?: string) {
|
|
68
|
+
return borsh.struct(
|
|
69
|
+
[
|
|
70
|
+
borsh.array(borsh.u8(), 32, "name"),
|
|
71
|
+
types.PriceHeuristic.layout("heuristic"),
|
|
72
|
+
borsh.u64("maxTwapDivergenceBps"),
|
|
73
|
+
borsh.u64("maxAgePriceSeconds"),
|
|
74
|
+
borsh.u64("maxAgeTwapSeconds"),
|
|
75
|
+
types.ScopeConfiguration.layout("scopeConfiguration"),
|
|
76
|
+
types.SwitchboardConfiguration.layout("switchboardConfiguration"),
|
|
77
|
+
types.PythConfiguration.layout("pythConfiguration"),
|
|
78
|
+
borsh.u8("blockPriceUsage"),
|
|
79
|
+
borsh.array(borsh.u8(), 7, "reserved"),
|
|
80
|
+
borsh.array(borsh.u64(), 19, "padding"),
|
|
81
|
+
],
|
|
82
|
+
property
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
static fromDecoded(obj: any) {
|
|
88
|
+
return new TokenInfo({
|
|
89
|
+
name: obj.name,
|
|
90
|
+
heuristic: types.PriceHeuristic.fromDecoded(obj.heuristic),
|
|
91
|
+
maxTwapDivergenceBps: obj.maxTwapDivergenceBps,
|
|
92
|
+
maxAgePriceSeconds: obj.maxAgePriceSeconds,
|
|
93
|
+
maxAgeTwapSeconds: obj.maxAgeTwapSeconds,
|
|
94
|
+
scopeConfiguration: types.ScopeConfiguration.fromDecoded(
|
|
95
|
+
obj.scopeConfiguration
|
|
96
|
+
),
|
|
97
|
+
switchboardConfiguration: types.SwitchboardConfiguration.fromDecoded(
|
|
98
|
+
obj.switchboardConfiguration
|
|
99
|
+
),
|
|
100
|
+
pythConfiguration: types.PythConfiguration.fromDecoded(
|
|
101
|
+
obj.pythConfiguration
|
|
102
|
+
),
|
|
103
|
+
blockPriceUsage: obj.blockPriceUsage,
|
|
104
|
+
reserved: obj.reserved,
|
|
105
|
+
padding: obj.padding,
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static toEncodable(fields: TokenInfoFields) {
|
|
110
|
+
return {
|
|
111
|
+
name: fields.name,
|
|
112
|
+
heuristic: types.PriceHeuristic.toEncodable(fields.heuristic),
|
|
113
|
+
maxTwapDivergenceBps: fields.maxTwapDivergenceBps,
|
|
114
|
+
maxAgePriceSeconds: fields.maxAgePriceSeconds,
|
|
115
|
+
maxAgeTwapSeconds: fields.maxAgeTwapSeconds,
|
|
116
|
+
scopeConfiguration: types.ScopeConfiguration.toEncodable(
|
|
117
|
+
fields.scopeConfiguration
|
|
118
|
+
),
|
|
119
|
+
switchboardConfiguration: types.SwitchboardConfiguration.toEncodable(
|
|
120
|
+
fields.switchboardConfiguration
|
|
121
|
+
),
|
|
122
|
+
pythConfiguration: types.PythConfiguration.toEncodable(
|
|
123
|
+
fields.pythConfiguration
|
|
124
|
+
),
|
|
125
|
+
blockPriceUsage: fields.blockPriceUsage,
|
|
126
|
+
reserved: fields.reserved,
|
|
127
|
+
padding: fields.padding,
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
toJSON(): TokenInfoJSON {
|
|
132
|
+
return {
|
|
133
|
+
name: this.name,
|
|
134
|
+
heuristic: this.heuristic.toJSON(),
|
|
135
|
+
maxTwapDivergenceBps: this.maxTwapDivergenceBps.toString(),
|
|
136
|
+
maxAgePriceSeconds: this.maxAgePriceSeconds.toString(),
|
|
137
|
+
maxAgeTwapSeconds: this.maxAgeTwapSeconds.toString(),
|
|
138
|
+
scopeConfiguration: this.scopeConfiguration.toJSON(),
|
|
139
|
+
switchboardConfiguration: this.switchboardConfiguration.toJSON(),
|
|
140
|
+
pythConfiguration: this.pythConfiguration.toJSON(),
|
|
141
|
+
blockPriceUsage: this.blockPriceUsage,
|
|
142
|
+
reserved: this.reserved,
|
|
143
|
+
padding: this.padding.map((item) => item.toString()),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static fromJSON(obj: TokenInfoJSON): TokenInfo {
|
|
148
|
+
return new TokenInfo({
|
|
149
|
+
name: obj.name,
|
|
150
|
+
heuristic: types.PriceHeuristic.fromJSON(obj.heuristic),
|
|
151
|
+
maxTwapDivergenceBps: new BN(obj.maxTwapDivergenceBps),
|
|
152
|
+
maxAgePriceSeconds: new BN(obj.maxAgePriceSeconds),
|
|
153
|
+
maxAgeTwapSeconds: new BN(obj.maxAgeTwapSeconds),
|
|
154
|
+
scopeConfiguration: types.ScopeConfiguration.fromJSON(
|
|
155
|
+
obj.scopeConfiguration
|
|
156
|
+
),
|
|
157
|
+
switchboardConfiguration: types.SwitchboardConfiguration.fromJSON(
|
|
158
|
+
obj.switchboardConfiguration
|
|
159
|
+
),
|
|
160
|
+
pythConfiguration: types.PythConfiguration.fromJSON(
|
|
161
|
+
obj.pythConfiguration
|
|
162
|
+
),
|
|
163
|
+
blockPriceUsage: obj.blockPriceUsage,
|
|
164
|
+
reserved: obj.reserved,
|
|
165
|
+
padding: obj.padding.map((item) => new BN(item)),
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
toEncodable() {
|
|
170
|
+
return TokenInfo.toEncodable(this)
|
|
171
|
+
}
|
|
172
|
+
}
|