@kamino-finance/klend-sdk 2.10.21 → 2.11.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/dist/classes/action.d.ts +1 -0
- package/dist/classes/action.js +55 -38
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/obligation.js +21 -0
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +30 -0
- package/dist/classes/reserve.js +66 -6
- package/dist/classes/reserve.js.map +1 -1
- package/dist/idl.json +156 -72
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +3 -3
- package/dist/idl_codegen/accounts/LendingMarket.js +7 -1
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/Obligation.d.ts +6 -3
- package/dist/idl_codegen/accounts/Obligation.js +12 -6
- package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
- package/dist/idl_codegen/accounts/Reserve.d.ts +18 -0
- package/dist/idl_codegen/accounts/Reserve.js +14 -2
- package/dist/idl_codegen/accounts/Reserve.js.map +1 -1
- package/dist/idl_codegen/errors/custom.d.ts +76 -4
- package/dist/idl_codegen/errors/custom.js +126 -8
- package/dist/idl_codegen/errors/custom.js.map +1 -1
- package/dist/idl_codegen/instructions/index.d.ts +2 -4
- package/dist/idl_codegen/instructions/index.js +3 -5
- package/dist/idl_codegen/instructions/index.js.map +1 -1
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +1 -1
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js +2 -2
- package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts +2 -1
- package/dist/idl_codegen/instructions/updateReserveConfig.js +4 -2
- package/dist/idl_codegen/instructions/updateReserveConfig.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.js +1 -1
- package/dist/idl_codegen/instructions/withdrawObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/types/ElevationGroup.d.ts +24 -10
- package/dist/idl_codegen/types/ElevationGroup.js +25 -12
- package/dist/idl_codegen/types/ElevationGroup.js.map +1 -1
- package/dist/idl_codegen/types/ObligationCollateral.d.ts +23 -0
- package/dist/idl_codegen/types/ObligationCollateral.js +8 -1
- package/dist/idl_codegen/types/ObligationCollateral.js.map +1 -1
- package/dist/idl_codegen/types/ObligationLiquidity.d.ts +8 -0
- package/dist/idl_codegen/types/ObligationLiquidity.js +8 -1
- package/dist/idl_codegen/types/ObligationLiquidity.js.map +1 -1
- package/dist/idl_codegen/types/ReserveConfig.d.ts +55 -9
- package/dist/idl_codegen/types/ReserveConfig.js +20 -6
- package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
- package/dist/idl_codegen/types/UpdateConfigMode.d.ts +39 -0
- package/dist/idl_codegen/types/UpdateConfigMode.js +79 -1
- package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts +4 -2
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +13 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +27 -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.js.map +1 -1
- package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +3 -2
- package/dist/idl_codegen/zero_padding/ObligationZP.js +8 -3
- package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/idl_codegen/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAsD;AAQ7C,4CAAgB;AAPzB,iGAAkF;AAoGzE,wEAA8B;AAnGvC,mFAAoE;AAwH3D,0DAAuB;AAvHhC,uDAAwC;AA+K/B,8BAAS;AA9KlB,iEAAkD;AA8LzC,wCAAc;AA7LvB,mEAAoD;AA8M3C,0CAAe;AA7MxB,+DAAgD;AA6NvC,sCAAa;AApEtB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AAEnB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAK7B,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAgB5B,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AAezB,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAK1B,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAWtB,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AAEpB,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AAgBzB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAK1B,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA;AAKjC,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AAKxB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA","sourcesContent":["import * as UpdateConfigMode from \"./UpdateConfigMode\"\nimport * as UpdateLendingMarketConfigValue from \"./UpdateLendingMarketConfigValue\"\nimport * as UpdateLendingMarketMode from \"./UpdateLendingMarketMode\"\nimport * as AssetTier from \"./AssetTier\"\nimport * as FeeCalculation from \"./FeeCalculation\"\nimport * as ReserveFarmKind from \"./ReserveFarmKind\"\nimport * as ReserveStatus from \"./ReserveStatus\"\n\nexport { UpdateConfigMode }\n\nexport type UpdateConfigModeKind =\n | UpdateConfigMode.UpdateLoanToValuePct\n | UpdateConfigMode.UpdateMaxLiquidationBonusBps\n | UpdateConfigMode.UpdateLiquidationThresholdPct\n | UpdateConfigMode.UpdateProtocolLiquidationFee\n | UpdateConfigMode.UpdateProtocolTakeRate\n | UpdateConfigMode.UpdateFeesBorrowFee\n | UpdateConfigMode.UpdateFeesFlashLoanFee\n | UpdateConfigMode.UpdateFeesReferralFeeBps\n | UpdateConfigMode.UpdateDepositLimit\n | UpdateConfigMode.UpdateBorrowLimit\n | UpdateConfigMode.UpdateTokenInfoLowerHeuristic\n | UpdateConfigMode.UpdateTokenInfoUpperHeuristic\n | UpdateConfigMode.UpdateTokenInfoExpHeuristic\n | UpdateConfigMode.UpdateTokenInfoTwapDivergence\n | UpdateConfigMode.UpdateTokenInfoScopeTwap\n | UpdateConfigMode.UpdateTokenInfoScopeChain\n | UpdateConfigMode.UpdateTokenInfoName\n | UpdateConfigMode.UpdateTokenInfoPriceMaxAge\n | UpdateConfigMode.UpdateTokenInfoTwapMaxAge\n | UpdateConfigMode.UpdateScopePriceFeed\n | UpdateConfigMode.UpdatePythPrice\n | UpdateConfigMode.UpdateSwitchboardFeed\n | UpdateConfigMode.UpdateSwitchboardTwapFeed\n | UpdateConfigMode.UpdateBorrowRateCurve\n | UpdateConfigMode.UpdateEntireReserveConfig\n | UpdateConfigMode.UpdateDebtWithdrawalCap\n | UpdateConfigMode.UpdateDepositWithdrawalCap\n | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotal\n | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotal\n | UpdateConfigMode.UpdateBadDebtLiquidationBonusBps\n | UpdateConfigMode.UpdateMinLiquidationBonusBps\n | UpdateConfigMode.DeleveragingMarginCallPeriod\n | UpdateConfigMode.UpdateBorrowFactor\n | UpdateConfigMode.UpdateAssetTier\n | UpdateConfigMode.UpdateElevationGroup\n | UpdateConfigMode.DeleveragingThresholdSlotsPerBps\n | UpdateConfigMode.UpdateMultiplierSideBoost\n | UpdateConfigMode.UpdateMultiplierTagBoost\n | UpdateConfigMode.UpdateReserveStatus\n | UpdateConfigMode.UpdateFarmCollateral\n | UpdateConfigMode.UpdateFarmDebt\n | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmode\n | UpdateConfigMode.UpdateBlockBorrowingAboveUtilization\n | UpdateConfigMode.UpdateBlockPriceUsage\nexport type UpdateConfigModeJSON =\n | UpdateConfigMode.UpdateLoanToValuePctJSON\n | UpdateConfigMode.UpdateMaxLiquidationBonusBpsJSON\n | UpdateConfigMode.UpdateLiquidationThresholdPctJSON\n | UpdateConfigMode.UpdateProtocolLiquidationFeeJSON\n | UpdateConfigMode.UpdateProtocolTakeRateJSON\n | UpdateConfigMode.UpdateFeesBorrowFeeJSON\n | UpdateConfigMode.UpdateFeesFlashLoanFeeJSON\n | UpdateConfigMode.UpdateFeesReferralFeeBpsJSON\n | UpdateConfigMode.UpdateDepositLimitJSON\n | UpdateConfigMode.UpdateBorrowLimitJSON\n | UpdateConfigMode.UpdateTokenInfoLowerHeuristicJSON\n | UpdateConfigMode.UpdateTokenInfoUpperHeuristicJSON\n | UpdateConfigMode.UpdateTokenInfoExpHeuristicJSON\n | UpdateConfigMode.UpdateTokenInfoTwapDivergenceJSON\n | UpdateConfigMode.UpdateTokenInfoScopeTwapJSON\n | UpdateConfigMode.UpdateTokenInfoScopeChainJSON\n | UpdateConfigMode.UpdateTokenInfoNameJSON\n | UpdateConfigMode.UpdateTokenInfoPriceMaxAgeJSON\n | UpdateConfigMode.UpdateTokenInfoTwapMaxAgeJSON\n | UpdateConfigMode.UpdateScopePriceFeedJSON\n | UpdateConfigMode.UpdatePythPriceJSON\n | UpdateConfigMode.UpdateSwitchboardFeedJSON\n | UpdateConfigMode.UpdateSwitchboardTwapFeedJSON\n | UpdateConfigMode.UpdateBorrowRateCurveJSON\n | UpdateConfigMode.UpdateEntireReserveConfigJSON\n | UpdateConfigMode.UpdateDebtWithdrawalCapJSON\n | UpdateConfigMode.UpdateDepositWithdrawalCapJSON\n | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotalJSON\n | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotalJSON\n | UpdateConfigMode.UpdateBadDebtLiquidationBonusBpsJSON\n | UpdateConfigMode.UpdateMinLiquidationBonusBpsJSON\n | UpdateConfigMode.DeleveragingMarginCallPeriodJSON\n | UpdateConfigMode.UpdateBorrowFactorJSON\n | UpdateConfigMode.UpdateAssetTierJSON\n | UpdateConfigMode.UpdateElevationGroupJSON\n | UpdateConfigMode.DeleveragingThresholdSlotsPerBpsJSON\n | UpdateConfigMode.UpdateMultiplierSideBoostJSON\n | UpdateConfigMode.UpdateMultiplierTagBoostJSON\n | UpdateConfigMode.UpdateReserveStatusJSON\n | UpdateConfigMode.UpdateFarmCollateralJSON\n | UpdateConfigMode.UpdateFarmDebtJSON\n | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmodeJSON\n | UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationJSON\n | UpdateConfigMode.UpdateBlockPriceUsageJSON\n\nexport { UpdateLendingMarketConfigValue }\n\nexport type UpdateLendingMarketConfigValueKind =\n | UpdateLendingMarketConfigValue.Bool\n | UpdateLendingMarketConfigValue.U8\n | UpdateLendingMarketConfigValue.U8Array\n | UpdateLendingMarketConfigValue.U16\n | UpdateLendingMarketConfigValue.U64\n | UpdateLendingMarketConfigValue.U128\n | UpdateLendingMarketConfigValue.Pubkey\n | UpdateLendingMarketConfigValue.ElevationGroup\nexport type UpdateLendingMarketConfigValueJSON =\n | UpdateLendingMarketConfigValue.BoolJSON\n | UpdateLendingMarketConfigValue.U8JSON\n | UpdateLendingMarketConfigValue.U8ArrayJSON\n | UpdateLendingMarketConfigValue.U16JSON\n | UpdateLendingMarketConfigValue.U64JSON\n | UpdateLendingMarketConfigValue.U128JSON\n | UpdateLendingMarketConfigValue.PubkeyJSON\n | UpdateLendingMarketConfigValue.ElevationGroupJSON\n\nexport { UpdateLendingMarketMode }\n\nexport type UpdateLendingMarketModeKind =\n | UpdateLendingMarketMode.UpdateOwner\n | UpdateLendingMarketMode.UpdateEmergencyMode\n | UpdateLendingMarketMode.UpdateLiquidationCloseFactor\n | UpdateLendingMarketMode.UpdateLiquidationMaxValue\n | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrow\n | UpdateLendingMarketMode.UpdateGlobalAllowedBorrow\n | UpdateLendingMarketMode.UpdateRiskCouncil\n | UpdateLendingMarketMode.UpdateMinFullLiquidationThreshold\n | UpdateLendingMarketMode.UpdateInsolvencyRiskLtv\n | UpdateLendingMarketMode.UpdateElevationGroup\n | UpdateLendingMarketMode.UpdateReferralFeeBps\n | UpdateLendingMarketMode.UpdateMultiplierPoints\n | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePct\n | UpdateLendingMarketMode.UpdateAutodeleverageEnabled\n | UpdateLendingMarketMode.UpdateBorrowingDisabled\n | UpdateLendingMarketMode.UpdateMinNetValueObligationPostAction\nexport type UpdateLendingMarketModeJSON =\n | UpdateLendingMarketMode.UpdateOwnerJSON\n | UpdateLendingMarketMode.UpdateEmergencyModeJSON\n | UpdateLendingMarketMode.UpdateLiquidationCloseFactorJSON\n | UpdateLendingMarketMode.UpdateLiquidationMaxValueJSON\n | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrowJSON\n | UpdateLendingMarketMode.UpdateGlobalAllowedBorrowJSON\n | UpdateLendingMarketMode.UpdateRiskCouncilJSON\n | UpdateLendingMarketMode.UpdateMinFullLiquidationThresholdJSON\n | UpdateLendingMarketMode.UpdateInsolvencyRiskLtvJSON\n | UpdateLendingMarketMode.UpdateElevationGroupJSON\n | UpdateLendingMarketMode.UpdateReferralFeeBpsJSON\n | UpdateLendingMarketMode.UpdateMultiplierPointsJSON\n | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePctJSON\n | UpdateLendingMarketMode.UpdateAutodeleverageEnabledJSON\n | UpdateLendingMarketMode.UpdateBorrowingDisabledJSON\n | UpdateLendingMarketMode.UpdateMinNetValueObligationPostActionJSON\n\nexport { LastUpdate } from \"./LastUpdate\"\nexport type { LastUpdateFields, LastUpdateJSON } from \"./LastUpdate\"\nexport { ElevationGroup } from \"./ElevationGroup\"\nexport type { ElevationGroupFields, ElevationGroupJSON } from \"./ElevationGroup\"\nexport { InitObligationArgs } from \"./InitObligationArgs\"\nexport type {\n InitObligationArgsFields,\n InitObligationArgsJSON,\n} from \"./InitObligationArgs\"\nexport { ObligationCollateral } from \"./ObligationCollateral\"\nexport type {\n ObligationCollateralFields,\n ObligationCollateralJSON,\n} from \"./ObligationCollateral\"\nexport { ObligationLiquidity } from \"./ObligationLiquidity\"\nexport type {\n ObligationLiquidityFields,\n ObligationLiquidityJSON,\n} from \"./ObligationLiquidity\"\nexport { AssetTier }\n\nexport type AssetTierKind =\n | AssetTier.Regular\n | AssetTier.IsolatedCollateral\n | AssetTier.IsolatedDebt\nexport type AssetTierJSON =\n | AssetTier.RegularJSON\n | AssetTier.IsolatedCollateralJSON\n | AssetTier.IsolatedDebtJSON\n\nexport { BigFractionBytes } from \"./BigFractionBytes\"\nexport type {\n BigFractionBytesFields,\n BigFractionBytesJSON,\n} from \"./BigFractionBytes\"\nexport { FeeCalculation }\n\n/** Calculate fees exlusive or inclusive of an amount */\nexport type FeeCalculationKind =\n | FeeCalculation.Exclusive\n | FeeCalculation.Inclusive\nexport type FeeCalculationJSON =\n | FeeCalculation.ExclusiveJSON\n | FeeCalculation.InclusiveJSON\n\nexport { ReserveCollateral } from \"./ReserveCollateral\"\nexport type {\n ReserveCollateralFields,\n ReserveCollateralJSON,\n} from \"./ReserveCollateral\"\nexport { ReserveConfig } from \"./ReserveConfig\"\nexport type { ReserveConfigFields, ReserveConfigJSON } from \"./ReserveConfig\"\nexport { ReserveFarmKind }\n\nexport type ReserveFarmKindKind =\n | ReserveFarmKind.Collateral\n | ReserveFarmKind.Debt\nexport type ReserveFarmKindJSON =\n | ReserveFarmKind.CollateralJSON\n | ReserveFarmKind.DebtJSON\n\nexport { ReserveFees } from \"./ReserveFees\"\nexport type { ReserveFeesFields, ReserveFeesJSON } from \"./ReserveFees\"\nexport { ReserveLiquidity } from \"./ReserveLiquidity\"\nexport type {\n ReserveLiquidityFields,\n ReserveLiquidityJSON,\n} from \"./ReserveLiquidity\"\nexport { ReserveStatus }\n\nexport type ReserveStatusKind =\n | ReserveStatus.Active\n | ReserveStatus.Obsolete\n | ReserveStatus.Hidden\nexport type ReserveStatusJSON =\n | ReserveStatus.ActiveJSON\n | ReserveStatus.ObsoleteJSON\n | ReserveStatus.HiddenJSON\n\nexport { WithdrawalCaps } from \"./WithdrawalCaps\"\nexport type { WithdrawalCapsFields, WithdrawalCapsJSON } from \"./WithdrawalCaps\"\nexport { PriceHeuristic } from \"./PriceHeuristic\"\nexport type { PriceHeuristicFields, PriceHeuristicJSON } from \"./PriceHeuristic\"\nexport { PythConfiguration } from \"./PythConfiguration\"\nexport type {\n PythConfigurationFields,\n PythConfigurationJSON,\n} from \"./PythConfiguration\"\nexport { ScopeConfiguration } from \"./ScopeConfiguration\"\nexport type {\n ScopeConfigurationFields,\n ScopeConfigurationJSON,\n} from \"./ScopeConfiguration\"\nexport { SwitchboardConfiguration } from \"./SwitchboardConfiguration\"\nexport type {\n SwitchboardConfigurationFields,\n SwitchboardConfigurationJSON,\n} from \"./SwitchboardConfiguration\"\nexport { TokenInfo } from \"./TokenInfo\"\nexport type { TokenInfoFields, TokenInfoJSON } from \"./TokenInfo\"\nexport { BorrowRateCurve } from \"./BorrowRateCurve\"\nexport type {\n BorrowRateCurveFields,\n BorrowRateCurveJSON,\n} from \"./BorrowRateCurve\"\nexport { CurvePoint } from \"./CurvePoint\"\nexport type { CurvePointFields, CurvePointJSON } from \"./CurvePoint\"\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/idl_codegen/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAsD;AAQ7C,4CAAgB;AAPzB,iGAAkF;AA0GzE,wEAA8B;AAzGvC,mFAAoE;AA8H3D,0DAAuB;AA7HhC,uDAAwC;AAuL/B,8BAAS;AAtLlB,iEAAkD;AAsMzC,wCAAc;AArMvB,mEAAoD;AAsN3C,0CAAe;AArNxB,+DAAgD;AAqOvC,sCAAa;AApEtB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AAEnB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA;AAK7B,6DAA2D;AAAlD,0HAAA,mBAAmB,OAAA;AAgB5B,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AAezB,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAK1B,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAWtB,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AAEpB,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AAgBzB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAEvB,yDAAuD;AAA9C,sHAAA,iBAAiB,OAAA;AAK1B,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,uEAAqE;AAA5D,oIAAA,wBAAwB,OAAA;AAKjC,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AAKxB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA","sourcesContent":["import * as UpdateConfigMode from \"./UpdateConfigMode\"\nimport * as UpdateLendingMarketConfigValue from \"./UpdateLendingMarketConfigValue\"\nimport * as UpdateLendingMarketMode from \"./UpdateLendingMarketMode\"\nimport * as AssetTier from \"./AssetTier\"\nimport * as FeeCalculation from \"./FeeCalculation\"\nimport * as ReserveFarmKind from \"./ReserveFarmKind\"\nimport * as ReserveStatus from \"./ReserveStatus\"\n\nexport { UpdateConfigMode }\n\nexport type UpdateConfigModeKind =\n | UpdateConfigMode.UpdateLoanToValuePct\n | UpdateConfigMode.UpdateMaxLiquidationBonusBps\n | UpdateConfigMode.UpdateLiquidationThresholdPct\n | UpdateConfigMode.UpdateProtocolLiquidationFee\n | UpdateConfigMode.UpdateProtocolTakeRate\n | UpdateConfigMode.UpdateFeesBorrowFee\n | UpdateConfigMode.UpdateFeesFlashLoanFee\n | UpdateConfigMode.UpdateFeesReferralFeeBps\n | UpdateConfigMode.UpdateDepositLimit\n | UpdateConfigMode.UpdateBorrowLimit\n | UpdateConfigMode.UpdateTokenInfoLowerHeuristic\n | UpdateConfigMode.UpdateTokenInfoUpperHeuristic\n | UpdateConfigMode.UpdateTokenInfoExpHeuristic\n | UpdateConfigMode.UpdateTokenInfoTwapDivergence\n | UpdateConfigMode.UpdateTokenInfoScopeTwap\n | UpdateConfigMode.UpdateTokenInfoScopeChain\n | UpdateConfigMode.UpdateTokenInfoName\n | UpdateConfigMode.UpdateTokenInfoPriceMaxAge\n | UpdateConfigMode.UpdateTokenInfoTwapMaxAge\n | UpdateConfigMode.UpdateScopePriceFeed\n | UpdateConfigMode.UpdatePythPrice\n | UpdateConfigMode.UpdateSwitchboardFeed\n | UpdateConfigMode.UpdateSwitchboardTwapFeed\n | UpdateConfigMode.UpdateBorrowRateCurve\n | UpdateConfigMode.UpdateEntireReserveConfig\n | UpdateConfigMode.UpdateDebtWithdrawalCap\n | UpdateConfigMode.UpdateDepositWithdrawalCap\n | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotal\n | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotal\n | UpdateConfigMode.UpdateBadDebtLiquidationBonusBps\n | UpdateConfigMode.UpdateMinLiquidationBonusBps\n | UpdateConfigMode.DeleveragingMarginCallPeriod\n | UpdateConfigMode.UpdateBorrowFactor\n | UpdateConfigMode.UpdateAssetTier\n | UpdateConfigMode.UpdateElevationGroup\n | UpdateConfigMode.DeleveragingThresholdSlotsPerBps\n | UpdateConfigMode.UpdateMultiplierSideBoost\n | UpdateConfigMode.UpdateMultiplierTagBoost\n | UpdateConfigMode.UpdateReserveStatus\n | UpdateConfigMode.UpdateFarmCollateral\n | UpdateConfigMode.UpdateFarmDebt\n | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmode\n | UpdateConfigMode.UpdateBlockBorrowingAboveUtilization\n | UpdateConfigMode.UpdateBlockPriceUsage\n | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroup\n | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserve\n | UpdateConfigMode.UpdateHostFixedInterestRateBps\nexport type UpdateConfigModeJSON =\n | UpdateConfigMode.UpdateLoanToValuePctJSON\n | UpdateConfigMode.UpdateMaxLiquidationBonusBpsJSON\n | UpdateConfigMode.UpdateLiquidationThresholdPctJSON\n | UpdateConfigMode.UpdateProtocolLiquidationFeeJSON\n | UpdateConfigMode.UpdateProtocolTakeRateJSON\n | UpdateConfigMode.UpdateFeesBorrowFeeJSON\n | UpdateConfigMode.UpdateFeesFlashLoanFeeJSON\n | UpdateConfigMode.UpdateFeesReferralFeeBpsJSON\n | UpdateConfigMode.UpdateDepositLimitJSON\n | UpdateConfigMode.UpdateBorrowLimitJSON\n | UpdateConfigMode.UpdateTokenInfoLowerHeuristicJSON\n | UpdateConfigMode.UpdateTokenInfoUpperHeuristicJSON\n | UpdateConfigMode.UpdateTokenInfoExpHeuristicJSON\n | UpdateConfigMode.UpdateTokenInfoTwapDivergenceJSON\n | UpdateConfigMode.UpdateTokenInfoScopeTwapJSON\n | UpdateConfigMode.UpdateTokenInfoScopeChainJSON\n | UpdateConfigMode.UpdateTokenInfoNameJSON\n | UpdateConfigMode.UpdateTokenInfoPriceMaxAgeJSON\n | UpdateConfigMode.UpdateTokenInfoTwapMaxAgeJSON\n | UpdateConfigMode.UpdateScopePriceFeedJSON\n | UpdateConfigMode.UpdatePythPriceJSON\n | UpdateConfigMode.UpdateSwitchboardFeedJSON\n | UpdateConfigMode.UpdateSwitchboardTwapFeedJSON\n | UpdateConfigMode.UpdateBorrowRateCurveJSON\n | UpdateConfigMode.UpdateEntireReserveConfigJSON\n | UpdateConfigMode.UpdateDebtWithdrawalCapJSON\n | UpdateConfigMode.UpdateDepositWithdrawalCapJSON\n | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotalJSON\n | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotalJSON\n | UpdateConfigMode.UpdateBadDebtLiquidationBonusBpsJSON\n | UpdateConfigMode.UpdateMinLiquidationBonusBpsJSON\n | UpdateConfigMode.DeleveragingMarginCallPeriodJSON\n | UpdateConfigMode.UpdateBorrowFactorJSON\n | UpdateConfigMode.UpdateAssetTierJSON\n | UpdateConfigMode.UpdateElevationGroupJSON\n | UpdateConfigMode.DeleveragingThresholdSlotsPerBpsJSON\n | UpdateConfigMode.UpdateMultiplierSideBoostJSON\n | UpdateConfigMode.UpdateMultiplierTagBoostJSON\n | UpdateConfigMode.UpdateReserveStatusJSON\n | UpdateConfigMode.UpdateFarmCollateralJSON\n | UpdateConfigMode.UpdateFarmDebtJSON\n | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmodeJSON\n | UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationJSON\n | UpdateConfigMode.UpdateBlockPriceUsageJSON\n | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroupJSON\n | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserveJSON\n | UpdateConfigMode.UpdateHostFixedInterestRateBpsJSON\n\nexport { UpdateLendingMarketConfigValue }\n\nexport type UpdateLendingMarketConfigValueKind =\n | UpdateLendingMarketConfigValue.Bool\n | UpdateLendingMarketConfigValue.U8\n | UpdateLendingMarketConfigValue.U8Array\n | UpdateLendingMarketConfigValue.U16\n | UpdateLendingMarketConfigValue.U64\n | UpdateLendingMarketConfigValue.U128\n | UpdateLendingMarketConfigValue.Pubkey\n | UpdateLendingMarketConfigValue.ElevationGroup\nexport type UpdateLendingMarketConfigValueJSON =\n | UpdateLendingMarketConfigValue.BoolJSON\n | UpdateLendingMarketConfigValue.U8JSON\n | UpdateLendingMarketConfigValue.U8ArrayJSON\n | UpdateLendingMarketConfigValue.U16JSON\n | UpdateLendingMarketConfigValue.U64JSON\n | UpdateLendingMarketConfigValue.U128JSON\n | UpdateLendingMarketConfigValue.PubkeyJSON\n | UpdateLendingMarketConfigValue.ElevationGroupJSON\n\nexport { UpdateLendingMarketMode }\n\nexport type UpdateLendingMarketModeKind =\n | UpdateLendingMarketMode.UpdateOwner\n | UpdateLendingMarketMode.UpdateEmergencyMode\n | UpdateLendingMarketMode.UpdateLiquidationCloseFactor\n | UpdateLendingMarketMode.UpdateLiquidationMaxValue\n | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrow\n | UpdateLendingMarketMode.UpdateGlobalAllowedBorrow\n | UpdateLendingMarketMode.UpdateRiskCouncil\n | UpdateLendingMarketMode.UpdateMinFullLiquidationThreshold\n | UpdateLendingMarketMode.UpdateInsolvencyRiskLtv\n | UpdateLendingMarketMode.UpdateElevationGroup\n | UpdateLendingMarketMode.UpdateReferralFeeBps\n | UpdateLendingMarketMode.UpdateMultiplierPoints\n | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePct\n | UpdateLendingMarketMode.UpdateAutodeleverageEnabled\n | UpdateLendingMarketMode.UpdateBorrowingDisabled\n | UpdateLendingMarketMode.UpdateMinNetValueObligationPostAction\n | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheck\nexport type UpdateLendingMarketModeJSON =\n | UpdateLendingMarketMode.UpdateOwnerJSON\n | UpdateLendingMarketMode.UpdateEmergencyModeJSON\n | UpdateLendingMarketMode.UpdateLiquidationCloseFactorJSON\n | UpdateLendingMarketMode.UpdateLiquidationMaxValueJSON\n | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrowJSON\n | UpdateLendingMarketMode.UpdateGlobalAllowedBorrowJSON\n | UpdateLendingMarketMode.UpdateRiskCouncilJSON\n | UpdateLendingMarketMode.UpdateMinFullLiquidationThresholdJSON\n | UpdateLendingMarketMode.UpdateInsolvencyRiskLtvJSON\n | UpdateLendingMarketMode.UpdateElevationGroupJSON\n | UpdateLendingMarketMode.UpdateReferralFeeBpsJSON\n | UpdateLendingMarketMode.UpdateMultiplierPointsJSON\n | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePctJSON\n | UpdateLendingMarketMode.UpdateAutodeleverageEnabledJSON\n | UpdateLendingMarketMode.UpdateBorrowingDisabledJSON\n | UpdateLendingMarketMode.UpdateMinNetValueObligationPostActionJSON\n | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheckJSON\n\nexport { LastUpdate } from \"./LastUpdate\"\nexport type { LastUpdateFields, LastUpdateJSON } from \"./LastUpdate\"\nexport { ElevationGroup } from \"./ElevationGroup\"\nexport type { ElevationGroupFields, ElevationGroupJSON } from \"./ElevationGroup\"\nexport { InitObligationArgs } from \"./InitObligationArgs\"\nexport type {\n InitObligationArgsFields,\n InitObligationArgsJSON,\n} from \"./InitObligationArgs\"\nexport { ObligationCollateral } from \"./ObligationCollateral\"\nexport type {\n ObligationCollateralFields,\n ObligationCollateralJSON,\n} from \"./ObligationCollateral\"\nexport { ObligationLiquidity } from \"./ObligationLiquidity\"\nexport type {\n ObligationLiquidityFields,\n ObligationLiquidityJSON,\n} from \"./ObligationLiquidity\"\nexport { AssetTier }\n\nexport type AssetTierKind =\n | AssetTier.Regular\n | AssetTier.IsolatedCollateral\n | AssetTier.IsolatedDebt\nexport type AssetTierJSON =\n | AssetTier.RegularJSON\n | AssetTier.IsolatedCollateralJSON\n | AssetTier.IsolatedDebtJSON\n\nexport { BigFractionBytes } from \"./BigFractionBytes\"\nexport type {\n BigFractionBytesFields,\n BigFractionBytesJSON,\n} from \"./BigFractionBytes\"\nexport { FeeCalculation }\n\n/** Calculate fees exlusive or inclusive of an amount */\nexport type FeeCalculationKind =\n | FeeCalculation.Exclusive\n | FeeCalculation.Inclusive\nexport type FeeCalculationJSON =\n | FeeCalculation.ExclusiveJSON\n | FeeCalculation.InclusiveJSON\n\nexport { ReserveCollateral } from \"./ReserveCollateral\"\nexport type {\n ReserveCollateralFields,\n ReserveCollateralJSON,\n} from \"./ReserveCollateral\"\nexport { ReserveConfig } from \"./ReserveConfig\"\nexport type { ReserveConfigFields, ReserveConfigJSON } from \"./ReserveConfig\"\nexport { ReserveFarmKind }\n\nexport type ReserveFarmKindKind =\n | ReserveFarmKind.Collateral\n | ReserveFarmKind.Debt\nexport type ReserveFarmKindJSON =\n | ReserveFarmKind.CollateralJSON\n | ReserveFarmKind.DebtJSON\n\nexport { ReserveFees } from \"./ReserveFees\"\nexport type { ReserveFeesFields, ReserveFeesJSON } from \"./ReserveFees\"\nexport { ReserveLiquidity } from \"./ReserveLiquidity\"\nexport type {\n ReserveLiquidityFields,\n ReserveLiquidityJSON,\n} from \"./ReserveLiquidity\"\nexport { ReserveStatus }\n\nexport type ReserveStatusKind =\n | ReserveStatus.Active\n | ReserveStatus.Obsolete\n | ReserveStatus.Hidden\nexport type ReserveStatusJSON =\n | ReserveStatus.ActiveJSON\n | ReserveStatus.ObsoleteJSON\n | ReserveStatus.HiddenJSON\n\nexport { WithdrawalCaps } from \"./WithdrawalCaps\"\nexport type { WithdrawalCapsFields, WithdrawalCapsJSON } from \"./WithdrawalCaps\"\nexport { PriceHeuristic } from \"./PriceHeuristic\"\nexport type { PriceHeuristicFields, PriceHeuristicJSON } from \"./PriceHeuristic\"\nexport { PythConfiguration } from \"./PythConfiguration\"\nexport type {\n PythConfigurationFields,\n PythConfigurationJSON,\n} from \"./PythConfiguration\"\nexport { ScopeConfiguration } from \"./ScopeConfiguration\"\nexport type {\n ScopeConfigurationFields,\n ScopeConfigurationJSON,\n} from \"./ScopeConfiguration\"\nexport { SwitchboardConfiguration } from \"./SwitchboardConfiguration\"\nexport type {\n SwitchboardConfigurationFields,\n SwitchboardConfigurationJSON,\n} from \"./SwitchboardConfiguration\"\nexport { TokenInfo } from \"./TokenInfo\"\nexport type { TokenInfoFields, TokenInfoJSON } from \"./TokenInfo\"\nexport { BorrowRateCurve } from \"./BorrowRateCurve\"\nexport type {\n BorrowRateCurveFields,\n BorrowRateCurveJSON,\n} from \"./BorrowRateCurve\"\nexport { CurvePoint } from \"./CurvePoint\"\nexport type { CurvePointFields, CurvePointJSON } from \"./CurvePoint\"\n"]}
|
|
@@ -19,7 +19,7 @@ export declare class ObligationZP {
|
|
|
19
19
|
*/
|
|
20
20
|
readonly deposits: Array<types.ObligationCollateral>;
|
|
21
21
|
/** Worst LTV for the collaterals backing the loan, represented as a percentage */
|
|
22
|
-
readonly
|
|
22
|
+
readonly lowestReserveDepositLiquidationLtv: BN;
|
|
23
23
|
/** Market value of deposits (scaled fraction) */
|
|
24
24
|
readonly depositedValueSf: BN;
|
|
25
25
|
/** Borrowed liquidity for the obligation, unique by borrow reserve address */
|
|
@@ -45,8 +45,9 @@ export declare class ObligationZP {
|
|
|
45
45
|
/** Wallet address of the referrer */
|
|
46
46
|
readonly referrer: PublicKey;
|
|
47
47
|
/** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
|
|
48
|
-
borrowingDisabled: number;
|
|
48
|
+
readonly borrowingDisabled: number;
|
|
49
49
|
reserved: Array<BN>;
|
|
50
|
+
highestBorrowFactorPct: BN;
|
|
50
51
|
padding3: Array<BN>;
|
|
51
52
|
static readonly layout: any;
|
|
52
53
|
constructor(fields: ObligationFields);
|
|
@@ -47,7 +47,8 @@ class ObligationZP {
|
|
|
47
47
|
this.lendingMarket = fields.lendingMarket;
|
|
48
48
|
this.owner = fields.owner;
|
|
49
49
|
this.deposits = fields.deposits.map((item) => new types.ObligationCollateral(Object.assign({}, item)));
|
|
50
|
-
this.
|
|
50
|
+
this.lowestReserveDepositLiquidationLtv =
|
|
51
|
+
fields.lowestReserveDepositLiquidationLtv;
|
|
51
52
|
this.depositedValueSf = fields.depositedValueSf;
|
|
52
53
|
this.borrows = fields.borrows.map((item) => new types.ObligationLiquidity(Object.assign({}, item)));
|
|
53
54
|
this.borrowFactorAdjustedDebtValueSf =
|
|
@@ -63,6 +64,7 @@ class ObligationZP {
|
|
|
63
64
|
this.referrer = fields.referrer;
|
|
64
65
|
this.borrowingDisabled = fields.borrowingDisabled;
|
|
65
66
|
this.reserved = new Array(0);
|
|
67
|
+
this.highestBorrowFactorPct = fields.highestBorrowFactorPct;
|
|
66
68
|
this.padding3 = new Array(0);
|
|
67
69
|
}
|
|
68
70
|
static fetch(c, address, programId = programId_1.PROGRAM_ID) {
|
|
@@ -102,7 +104,7 @@ class ObligationZP {
|
|
|
102
104
|
lendingMarket: dec.lendingMarket,
|
|
103
105
|
owner: dec.owner,
|
|
104
106
|
deposits: dec.deposits.map((item /* eslint-disable-line @typescript-eslint/no-explicit-any */) => types.ObligationCollateral.fromDecoded(item)),
|
|
105
|
-
|
|
107
|
+
lowestReserveDepositLiquidationLtv: dec.lowestReserveDepositLiquidationLtv,
|
|
106
108
|
depositedValueSf: dec.depositedValueSf,
|
|
107
109
|
borrows: dec.borrows.map((item /* eslint-disable-line @typescript-eslint/no-explicit-any */) => types.ObligationLiquidity.fromDecoded(item)),
|
|
108
110
|
borrowFactorAdjustedDebtValueSf: dec.borrowFactorAdjustedDebtValueSf,
|
|
@@ -116,6 +118,7 @@ class ObligationZP {
|
|
|
116
118
|
hasDebt: dec.hasDebt,
|
|
117
119
|
referrer: dec.referrer,
|
|
118
120
|
borrowingDisabled: dec.borrowingDisabled,
|
|
121
|
+
highestBorrowFactorPct: dec.highestBorrowFactorPct,
|
|
119
122
|
reserved: [],
|
|
120
123
|
padding3: [],
|
|
121
124
|
});
|
|
@@ -128,7 +131,7 @@ ObligationZP.layout = borsh.struct([
|
|
|
128
131
|
borsh.publicKey("lendingMarket"),
|
|
129
132
|
borsh.publicKey("owner"),
|
|
130
133
|
borsh.array(types.ObligationCollateral.layout(), 8, "deposits"),
|
|
131
|
-
borsh.u64("
|
|
134
|
+
borsh.u64("lowestReserveDepositLiquidationLtv"),
|
|
132
135
|
borsh.u128("depositedValueSf"),
|
|
133
136
|
borsh.array(types.ObligationLiquidity.layout(), 5, "borrows"),
|
|
134
137
|
borsh.u128("borrowFactorAdjustedDebtValueSf"),
|
|
@@ -142,5 +145,7 @@ ObligationZP.layout = borsh.struct([
|
|
|
142
145
|
borsh.u8("hasDebt"),
|
|
143
146
|
borsh.publicKey("referrer"),
|
|
144
147
|
borsh.u8("borrowingDisabled"),
|
|
148
|
+
borsh.array(borsh.u8(), 7, "reserved"),
|
|
149
|
+
borsh.u64("highestBorrowFactorPct"),
|
|
145
150
|
]);
|
|
146
151
|
//# sourceMappingURL=ObligationZP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObligationZP.js","sourceRoot":"","sources":["../../../src/idl_codegen/zero_padding/ObligationZP.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wDAAyC,CAAC,wDAAwD;AAClG,gDAAiC,CAAC,wDAAwD;AAC1F,4CAAyC;AACzC,0CAA2D;AAE3D,sCAAsC;AACtC,MAAa,YAAY;IAmEvB,YAAY,MAAwB;QAzBpC,aAAQ,GAAc,IAAI,KAAK,CAAC,CAAC,CAAC,CAAA;QAClC,aAAQ,GAAc,IAAI,KAAK,CAAC,CAAC,CAAC,CAAA;QAyBhC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,CAAC,UAAU,mBAAM,MAAM,CAAC,UAAU,EAAG,CAAA;QAChE,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAA;QACzC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CACjC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,oBA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AC,SAAS,CAAC,OAAO,CAAC;IACxB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC;IAC/D,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC;IACpC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC;IAC9B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,CAAC;IAC7D,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC;IAC7C,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC;IACzC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAClC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC;IACpC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,oBAAoB,CAAC;IAChD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,mBAAmB,CAAC;IAC/C,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC;IAC1B,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC;IACnB,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;IAC3B,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC;CAC9B,CAAC,CAAA","sourcesContent":["import { PublicKey, Connection } from \"@solana/web3.js\"\nimport BN from \"bn.js\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as borsh from \"@coral-xyz/borsh\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as types from \"../types\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport { PROGRAM_ID } from \"../programId\"\nimport { Obligation, ObligationFields } from '../accounts';\n\n/** Lending market obligation state */\nexport class ObligationZP {\n /** Version of the struct */\n readonly tag: BN\n /** Last update to collateral, liquidity, or their market values */\n readonly lastUpdate: types.LastUpdate\n /** Lending market address */\n readonly lendingMarket: PublicKey\n /** Owner authority which can borrow liquidity */\n readonly owner: PublicKey\n /**\n * TODO: Does this break the stack size when copied onto the stack, if too big?\n * Deposited collateral for the obligation, unique by deposit reserve address\n */\n readonly deposits: Array<types.ObligationCollateral>\n /** Worst LTV for the collaterals backing the loan, represented as a percentage */\n readonly lowestReserveDepositLtv: BN\n /** Market value of deposits (scaled fraction) */\n readonly depositedValueSf: BN\n /** Borrowed liquidity for the obligation, unique by borrow reserve address */\n readonly borrows: Array<types.ObligationLiquidity>\n /** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */\n readonly borrowFactorAdjustedDebtValueSf: BN\n /** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */\n readonly borrowedAssetsMarketValueSf: BN\n /** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */\n readonly allowedBorrowValueSf: BN\n /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */\n readonly unhealthyBorrowValueSf: BN\n /** The asset tier of the deposits */\n readonly depositsAssetTiers: Array<number>\n /** The asset tier of the borrows */\n readonly borrowsAssetTiers: Array<number>\n /** The elevation group id the obligation opted into. */\n readonly elevationGroup: number\n /** The number of deprecated reserves the obligation has a deposit */\n readonly numOfObsoleteReserves: number\n /** Marked = 1 if borrows array is not empty, 0 = borrows empty */\n readonly hasDebt: number\n /** Wallet address of the referrer */\n readonly referrer: PublicKey\n /** Marked = 1 if borrowing disabled, 0 = borrowing enabled */\n borrowingDisabled: number\n reserved: Array<BN> = new Array(0)\n padding3: Array<BN> = new Array(0)\n\n static readonly layout = borsh.struct([\n borsh.u64(\"tag\"),\n types.LastUpdate.layout(\"lastUpdate\"),\n borsh.publicKey(\"lendingMarket\"),\n borsh.publicKey(\"owner\"),\n borsh.array(types.ObligationCollateral.layout(), 8, \"deposits\"),\n borsh.u64(\"lowestReserveDepositLtv\"),\n borsh.u128(\"depositedValueSf\"),\n borsh.array(types.ObligationLiquidity.layout(), 5, \"borrows\"),\n borsh.u128(\"borrowFactorAdjustedDebtValueSf\"),\n borsh.u128(\"borrowedAssetsMarketValueSf\"),\n borsh.u128(\"allowedBorrowValueSf\"),\n borsh.u128(\"unhealthyBorrowValueSf\"),\n borsh.array(borsh.u8(), 8, \"depositsAssetTiers\"),\n borsh.array(borsh.u8(), 5, \"borrowsAssetTiers\"),\n borsh.u8(\"elevationGroup\"),\n borsh.u8(\"numOfObsoleteReserves\"),\n borsh.u8(\"hasDebt\"),\n borsh.publicKey(\"referrer\"),\n borsh.u8(\"borrowingDisabled\"),\n ])\n\n constructor(fields: ObligationFields) {\n this.tag = fields.tag\n this.lastUpdate = new types.LastUpdate({ ...fields.lastUpdate })\n this.lendingMarket = fields.lendingMarket\n this.owner = fields.owner\n this.deposits = fields.deposits.map(\n (item) => new types.ObligationCollateral({ ...item })\n )\n this.lowestReserveDepositLtv = fields.lowestReserveDepositLtv\n this.depositedValueSf = fields.depositedValueSf\n this.borrows = fields.borrows.map(\n (item) => new types.ObligationLiquidity({ ...item })\n )\n this.borrowFactorAdjustedDebtValueSf =\n fields.borrowFactorAdjustedDebtValueSf\n this.borrowedAssetsMarketValueSf = fields.borrowedAssetsMarketValueSf\n this.allowedBorrowValueSf = fields.allowedBorrowValueSf\n this.unhealthyBorrowValueSf = fields.unhealthyBorrowValueSf\n this.depositsAssetTiers = fields.depositsAssetTiers\n this.borrowsAssetTiers = fields.borrowsAssetTiers\n this.elevationGroup = fields.elevationGroup\n this.numOfObsoleteReserves = fields.numOfObsoleteReserves\n this.hasDebt = fields.hasDebt\n this.referrer = fields.referrer\n this.borrowingDisabled = fields.borrowingDisabled\n this.reserved = new Array<BN>(0);\n this.padding3 = new Array<BN>(0);\n }\n\n static async fetch(\n c: Connection,\n address: PublicKey,\n programId: PublicKey = PROGRAM_ID\n ): Promise<Obligation | null> {\n const info = await c.getAccountInfo(address)\n\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n }\n\n static async fetchMultiple(\n c: Connection,\n addresses: PublicKey[],\n programId: PublicKey = PROGRAM_ID\n ): Promise<Array<Obligation | null>> {\n const infos = await c.getMultipleAccountsInfo(addresses)\n\n return infos.map((info) => {\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n })\n }\n\n static decode(data: Buffer): Obligation {\n if (!data.slice(0, 8).equals(Obligation.discriminator)) {\n throw new Error(\"invalid account discriminator\")\n }\n\n const dec = ObligationZP.layout.decode(data.slice(8))\n\n return new Obligation({\n tag: dec.tag,\n lastUpdate: types.LastUpdate.fromDecoded(dec.lastUpdate),\n lendingMarket: dec.lendingMarket,\n owner: dec.owner,\n deposits: dec.deposits.map(\n (\n item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */\n ) => types.ObligationCollateral.fromDecoded(item)\n ),\n lowestReserveDepositLtv: dec.lowestReserveDepositLtv,\n depositedValueSf: dec.depositedValueSf,\n borrows: dec.borrows.map(\n (\n item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */\n ) => types.ObligationLiquidity.fromDecoded(item)\n ),\n borrowFactorAdjustedDebtValueSf: dec.borrowFactorAdjustedDebtValueSf,\n borrowedAssetsMarketValueSf: dec.borrowedAssetsMarketValueSf,\n allowedBorrowValueSf: dec.allowedBorrowValueSf,\n unhealthyBorrowValueSf: dec.unhealthyBorrowValueSf,\n depositsAssetTiers: dec.depositsAssetTiers,\n borrowsAssetTiers: dec.borrowsAssetTiers,\n elevationGroup: dec.elevationGroup,\n numOfObsoleteReserves: dec.numOfObsoleteReserves,\n hasDebt: dec.hasDebt,\n referrer: dec.referrer,\n borrowingDisabled: dec.borrowingDisabled,\n reserved: [],\n padding3: [],\n })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ObligationZP.js","sourceRoot":"","sources":["../../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ACzC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC;IAClC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC;IACpC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,oBAAoB,CAAC;IAChD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,mBAAmB,CAAC;IAC/C,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC;IAC1B,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC;IACnB,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;IAC3B,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC;IAC7B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC;IACtC,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC;CACpC,CAAC,CAAA","sourcesContent":["import { PublicKey, Connection } from \"@solana/web3.js\"\nimport BN from \"bn.js\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as borsh from \"@coral-xyz/borsh\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as types from \"../types\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport { PROGRAM_ID } from \"../programId\"\nimport { Obligation, ObligationFields } from '../accounts';\n\n/** Lending market obligation state */\nexport class ObligationZP {\n /** Version of the struct */\n readonly tag: BN\n /** Last update to collateral, liquidity, or their market values */\n readonly lastUpdate: types.LastUpdate\n /** Lending market address */\n readonly lendingMarket: PublicKey\n /** Owner authority which can borrow liquidity */\n readonly owner: PublicKey\n /**\n * TODO: Does this break the stack size when copied onto the stack, if too big?\n * Deposited collateral for the obligation, unique by deposit reserve address\n */\n readonly deposits: Array<types.ObligationCollateral>\n /** Worst LTV for the collaterals backing the loan, represented as a percentage */\n readonly lowestReserveDepositLiquidationLtv: BN\n /** Market value of deposits (scaled fraction) */\n readonly depositedValueSf: BN\n /** Borrowed liquidity for the obligation, unique by borrow reserve address */\n readonly borrows: Array<types.ObligationLiquidity>\n /** Risk adjusted market value of borrows/debt (sum of price * borrowed_amount * borrow_factor) (scaled fraction) */\n readonly borrowFactorAdjustedDebtValueSf: BN\n /** Market value of borrows - used for max_liquidatable_borrowed_amount (scaled fraction) */\n readonly borrowedAssetsMarketValueSf: BN\n /** The maximum borrow value at the weighted average loan to value ratio (scaled fraction) */\n readonly allowedBorrowValueSf: BN\n /** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */\n readonly unhealthyBorrowValueSf: BN\n /** The asset tier of the deposits */\n readonly depositsAssetTiers: Array<number>\n /** The asset tier of the borrows */\n readonly borrowsAssetTiers: Array<number>\n /** The elevation group id the obligation opted into. */\n readonly elevationGroup: number\n /** The number of deprecated reserves the obligation has a deposit */\n readonly numOfObsoleteReserves: number\n /** Marked = 1 if borrows array is not empty, 0 = borrows empty */\n readonly hasDebt: number\n /** Wallet address of the referrer */\n readonly referrer: PublicKey\n /** Marked = 1 if borrowing disabled, 0 = borrowing enabled */\n readonly borrowingDisabled: number\n reserved: Array<BN> = new Array(0)\n highestBorrowFactorPct: BN\n padding3: Array<BN> = new Array(0)\n\n static readonly layout = borsh.struct([\n borsh.u64(\"tag\"),\n types.LastUpdate.layout(\"lastUpdate\"),\n borsh.publicKey(\"lendingMarket\"),\n borsh.publicKey(\"owner\"),\n borsh.array(types.ObligationCollateral.layout(), 8, \"deposits\"),\n borsh.u64(\"lowestReserveDepositLiquidationLtv\"),\n borsh.u128(\"depositedValueSf\"),\n borsh.array(types.ObligationLiquidity.layout(), 5, \"borrows\"),\n borsh.u128(\"borrowFactorAdjustedDebtValueSf\"),\n borsh.u128(\"borrowedAssetsMarketValueSf\"),\n borsh.u128(\"allowedBorrowValueSf\"),\n borsh.u128(\"unhealthyBorrowValueSf\"),\n borsh.array(borsh.u8(), 8, \"depositsAssetTiers\"),\n borsh.array(borsh.u8(), 5, \"borrowsAssetTiers\"),\n borsh.u8(\"elevationGroup\"),\n borsh.u8(\"numOfObsoleteReserves\"),\n borsh.u8(\"hasDebt\"),\n borsh.publicKey(\"referrer\"),\n borsh.u8(\"borrowingDisabled\"),\n borsh.array(borsh.u8(), 7, \"reserved\"),\n borsh.u64(\"highestBorrowFactorPct\"),\n ])\n\n constructor(fields: ObligationFields) {\n this.tag = fields.tag\n this.lastUpdate = new types.LastUpdate({ ...fields.lastUpdate })\n this.lendingMarket = fields.lendingMarket\n this.owner = fields.owner\n this.deposits = fields.deposits.map(\n (item) => new types.ObligationCollateral({ ...item })\n )\n this.lowestReserveDepositLiquidationLtv =\n fields.lowestReserveDepositLiquidationLtv\n this.depositedValueSf = fields.depositedValueSf\n this.borrows = fields.borrows.map(\n (item) => new types.ObligationLiquidity({ ...item })\n )\n this.borrowFactorAdjustedDebtValueSf =\n fields.borrowFactorAdjustedDebtValueSf\n this.borrowedAssetsMarketValueSf = fields.borrowedAssetsMarketValueSf\n this.allowedBorrowValueSf = fields.allowedBorrowValueSf\n this.unhealthyBorrowValueSf = fields.unhealthyBorrowValueSf\n this.depositsAssetTiers = fields.depositsAssetTiers\n this.borrowsAssetTiers = fields.borrowsAssetTiers\n this.elevationGroup = fields.elevationGroup\n this.numOfObsoleteReserves = fields.numOfObsoleteReserves\n this.hasDebt = fields.hasDebt\n this.referrer = fields.referrer\n this.borrowingDisabled = fields.borrowingDisabled\n this.reserved = new Array<BN>(0);\n this.highestBorrowFactorPct = fields.highestBorrowFactorPct\n this.padding3 = new Array<BN>(0);\n }\n\n static async fetch(\n c: Connection,\n address: PublicKey,\n programId: PublicKey = PROGRAM_ID\n ): Promise<Obligation | null> {\n const info = await c.getAccountInfo(address)\n\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n }\n\n static async fetchMultiple(\n c: Connection,\n addresses: PublicKey[],\n programId: PublicKey = PROGRAM_ID\n ): Promise<Array<Obligation | null>> {\n const infos = await c.getMultipleAccountsInfo(addresses)\n\n return infos.map((info) => {\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n })\n }\n\n static decode(data: Buffer): Obligation {\n if (!data.slice(0, 8).equals(Obligation.discriminator)) {\n throw new Error(\"invalid account discriminator\")\n }\n\n const dec = ObligationZP.layout.decode(data.slice(8))\n\n return new Obligation({\n tag: dec.tag,\n lastUpdate: types.LastUpdate.fromDecoded(dec.lastUpdate),\n lendingMarket: dec.lendingMarket,\n owner: dec.owner,\n deposits: dec.deposits.map(\n (\n item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */\n ) => types.ObligationCollateral.fromDecoded(item)\n ),\n lowestReserveDepositLiquidationLtv: dec.lowestReserveDepositLiquidationLtv,\n depositedValueSf: dec.depositedValueSf,\n borrows: dec.borrows.map(\n (\n item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */\n ) => types.ObligationLiquidity.fromDecoded(item)\n ),\n borrowFactorAdjustedDebtValueSf: dec.borrowFactorAdjustedDebtValueSf,\n borrowedAssetsMarketValueSf: dec.borrowedAssetsMarketValueSf,\n allowedBorrowValueSf: dec.allowedBorrowValueSf,\n unhealthyBorrowValueSf: dec.unhealthyBorrowValueSf,\n depositsAssetTiers: dec.depositsAssetTiers,\n borrowsAssetTiers: dec.borrowsAssetTiers,\n elevationGroup: dec.elevationGroup,\n numOfObsoleteReserves: dec.numOfObsoleteReserves,\n hasDebt: dec.hasDebt,\n referrer: dec.referrer,\n borrowingDisabled: dec.borrowingDisabled,\n highestBorrowFactorPct: dec.highestBorrowFactorPct,\n reserved: [],\n padding3: [],\n })\n }\n}\n"]}
|