@kamino-finance/klend-sdk 3.2.18 → 3.2.20

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.
Files changed (54) hide show
  1. package/README.md +42 -0
  2. package/dist/classes/action.d.ts +4 -4
  3. package/dist/classes/action.js +12 -10
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/manager.js +0 -17
  6. package/dist/classes/manager.js.map +1 -1
  7. package/dist/classes/market.d.ts +31 -0
  8. package/dist/classes/market.js +121 -0
  9. package/dist/classes/market.js.map +1 -1
  10. package/dist/classes/obligation.d.ts +8 -4
  11. package/dist/classes/obligation.js +137 -8
  12. package/dist/classes/obligation.js.map +1 -1
  13. package/dist/classes/reserve.d.ts +5 -3
  14. package/dist/classes/reserve.js +70 -45
  15. package/dist/classes/reserve.js.map +1 -1
  16. package/dist/client_kamino_manager.d.ts +2 -1
  17. package/dist/client_kamino_manager.js +22 -21
  18. package/dist/client_kamino_manager.js.map +1 -1
  19. package/dist/idl.json +41 -19
  20. package/dist/idl_codegen/accounts/LendingMarket.d.ts +6 -6
  21. package/dist/idl_codegen/accounts/LendingMarket.js +5 -5
  22. package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
  23. package/dist/idl_codegen/errors/custom.d.ts +25 -1
  24. package/dist/idl_codegen/errors/custom.js +40 -1
  25. package/dist/idl_codegen/errors/custom.js.map +1 -1
  26. package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.d.ts +0 -1
  27. package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.js +1 -1
  28. package/dist/idl_codegen/instructions/flashBorrowReserveLiquidity.js.map +1 -1
  29. package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.d.ts +0 -1
  30. package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.js +1 -1
  31. package/dist/idl_codegen/instructions/flashRepayReserveLiquidity.js.map +1 -1
  32. package/dist/idl_codegen/instructions/index.d.ts +2 -0
  33. package/dist/idl_codegen/instructions/index.js +3 -1
  34. package/dist/idl_codegen/instructions/index.js.map +1 -1
  35. package/dist/idl_codegen/instructions/refreshReservesBatch.d.ts +6 -0
  36. package/dist/idl_codegen/instructions/refreshReservesBatch.js +43 -0
  37. package/dist/idl_codegen/instructions/refreshReservesBatch.js.map +1 -0
  38. package/dist/idl_codegen/programId.js.map +1 -1
  39. package/dist/idl_codegen/types/ReserveConfig.d.ts +16 -16
  40. package/dist/idl_codegen/types/ReserveConfig.js +12 -12
  41. package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
  42. package/dist/idl_codegen/types/UpdateConfigMode.d.ts +14 -14
  43. package/dist/idl_codegen/types/UpdateConfigMode.js +25 -25
  44. package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
  45. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +20 -7
  46. package/dist/idl_codegen/types/UpdateLendingMarketMode.js +39 -13
  47. package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
  48. package/dist/idl_codegen/types/index.d.ts +4 -4
  49. package/dist/idl_codegen/types/index.js.map +1 -1
  50. package/dist/utils/instruction.js +0 -1
  51. package/dist/utils/instruction.js.map +1 -1
  52. package/dist/utils/managerTypes.js +2 -2
  53. package/dist/utils/managerTypes.js.map +1 -1
  54. package/package.json +1 -1
@@ -6,14 +6,14 @@ import * as FeeCalculation from "./FeeCalculation";
6
6
  import * as ReserveFarmKind from "./ReserveFarmKind";
7
7
  import * as ReserveStatus from "./ReserveStatus";
8
8
  export { UpdateConfigMode };
9
- export type UpdateConfigModeKind = UpdateConfigMode.UpdateLoanToValuePct | UpdateConfigMode.UpdateMaxLiquidationBonusBps | UpdateConfigMode.UpdateLiquidationThresholdPct | UpdateConfigMode.UpdateProtocolLiquidationFee | UpdateConfigMode.UpdateProtocolTakeRate | UpdateConfigMode.UpdateFeesBorrowFee | UpdateConfigMode.UpdateFeesFlashLoanFee | UpdateConfigMode.UpdateFeesReferralFeeBps | UpdateConfigMode.UpdateDepositLimit | UpdateConfigMode.UpdateBorrowLimit | UpdateConfigMode.UpdateTokenInfoLowerHeuristic | UpdateConfigMode.UpdateTokenInfoUpperHeuristic | UpdateConfigMode.UpdateTokenInfoExpHeuristic | UpdateConfigMode.UpdateTokenInfoTwapDivergence | UpdateConfigMode.UpdateTokenInfoScopeTwap | UpdateConfigMode.UpdateTokenInfoScopeChain | UpdateConfigMode.UpdateTokenInfoName | UpdateConfigMode.UpdateTokenInfoPriceMaxAge | UpdateConfigMode.UpdateTokenInfoTwapMaxAge | UpdateConfigMode.UpdateScopePriceFeed | UpdateConfigMode.UpdatePythPrice | UpdateConfigMode.UpdateSwitchboardFeed | UpdateConfigMode.UpdateSwitchboardTwapFeed | UpdateConfigMode.UpdateBorrowRateCurve | UpdateConfigMode.UpdateEntireReserveConfig | UpdateConfigMode.UpdateDebtWithdrawalCap | UpdateConfigMode.UpdateDepositWithdrawalCap | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotal | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotal | UpdateConfigMode.UpdateBadDebtLiquidationBonusBps | UpdateConfigMode.UpdateMinLiquidationBonusBps | UpdateConfigMode.DeleveragingMarginCallPeriod | UpdateConfigMode.UpdateBorrowFactor | UpdateConfigMode.UpdateAssetTier | UpdateConfigMode.UpdateElevationGroup | UpdateConfigMode.DeleveragingThresholdSlotsPerBps | UpdateConfigMode.UpdateMultiplierSideBoost | UpdateConfigMode.UpdateMultiplierTagBoost | UpdateConfigMode.UpdateReserveStatus | UpdateConfigMode.UpdateFarmCollateral | UpdateConfigMode.UpdateFarmDebt | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmode | UpdateConfigMode.UpdateBlockBorrowingAboveUtilization | UpdateConfigMode.UpdateBlockPriceUsage | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroup | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserve | UpdateConfigMode.UpdateHostFixedInterestRateBps;
10
- export type UpdateConfigModeJSON = UpdateConfigMode.UpdateLoanToValuePctJSON | UpdateConfigMode.UpdateMaxLiquidationBonusBpsJSON | UpdateConfigMode.UpdateLiquidationThresholdPctJSON | UpdateConfigMode.UpdateProtocolLiquidationFeeJSON | UpdateConfigMode.UpdateProtocolTakeRateJSON | UpdateConfigMode.UpdateFeesBorrowFeeJSON | UpdateConfigMode.UpdateFeesFlashLoanFeeJSON | UpdateConfigMode.UpdateFeesReferralFeeBpsJSON | UpdateConfigMode.UpdateDepositLimitJSON | UpdateConfigMode.UpdateBorrowLimitJSON | UpdateConfigMode.UpdateTokenInfoLowerHeuristicJSON | UpdateConfigMode.UpdateTokenInfoUpperHeuristicJSON | UpdateConfigMode.UpdateTokenInfoExpHeuristicJSON | UpdateConfigMode.UpdateTokenInfoTwapDivergenceJSON | UpdateConfigMode.UpdateTokenInfoScopeTwapJSON | UpdateConfigMode.UpdateTokenInfoScopeChainJSON | UpdateConfigMode.UpdateTokenInfoNameJSON | UpdateConfigMode.UpdateTokenInfoPriceMaxAgeJSON | UpdateConfigMode.UpdateTokenInfoTwapMaxAgeJSON | UpdateConfigMode.UpdateScopePriceFeedJSON | UpdateConfigMode.UpdatePythPriceJSON | UpdateConfigMode.UpdateSwitchboardFeedJSON | UpdateConfigMode.UpdateSwitchboardTwapFeedJSON | UpdateConfigMode.UpdateBorrowRateCurveJSON | UpdateConfigMode.UpdateEntireReserveConfigJSON | UpdateConfigMode.UpdateDebtWithdrawalCapJSON | UpdateConfigMode.UpdateDepositWithdrawalCapJSON | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotalJSON | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotalJSON | UpdateConfigMode.UpdateBadDebtLiquidationBonusBpsJSON | UpdateConfigMode.UpdateMinLiquidationBonusBpsJSON | UpdateConfigMode.DeleveragingMarginCallPeriodJSON | UpdateConfigMode.UpdateBorrowFactorJSON | UpdateConfigMode.UpdateAssetTierJSON | UpdateConfigMode.UpdateElevationGroupJSON | UpdateConfigMode.DeleveragingThresholdSlotsPerBpsJSON | UpdateConfigMode.UpdateMultiplierSideBoostJSON | UpdateConfigMode.UpdateMultiplierTagBoostJSON | UpdateConfigMode.UpdateReserveStatusJSON | UpdateConfigMode.UpdateFarmCollateralJSON | UpdateConfigMode.UpdateFarmDebtJSON | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmodeJSON | UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationJSON | UpdateConfigMode.UpdateBlockPriceUsageJSON | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroupJSON | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserveJSON | UpdateConfigMode.UpdateHostFixedInterestRateBpsJSON;
9
+ export type UpdateConfigModeKind = UpdateConfigMode.UpdateLoanToValuePct | UpdateConfigMode.UpdateMaxLiquidationBonusBps | UpdateConfigMode.UpdateLiquidationThresholdPct | UpdateConfigMode.UpdateProtocolLiquidationFee | UpdateConfigMode.UpdateProtocolTakeRate | UpdateConfigMode.UpdateFeesBorrowFee | UpdateConfigMode.UpdateFeesFlashLoanFee | UpdateConfigMode.UpdateFeesReferralFeeBps | UpdateConfigMode.UpdateDepositLimit | UpdateConfigMode.UpdateBorrowLimit | UpdateConfigMode.UpdateTokenInfoLowerHeuristic | UpdateConfigMode.UpdateTokenInfoUpperHeuristic | UpdateConfigMode.UpdateTokenInfoExpHeuristic | UpdateConfigMode.UpdateTokenInfoTwapDivergence | UpdateConfigMode.UpdateTokenInfoScopeTwap | UpdateConfigMode.UpdateTokenInfoScopeChain | UpdateConfigMode.UpdateTokenInfoName | UpdateConfigMode.UpdateTokenInfoPriceMaxAge | UpdateConfigMode.UpdateTokenInfoTwapMaxAge | UpdateConfigMode.UpdateScopePriceFeed | UpdateConfigMode.UpdatePythPrice | UpdateConfigMode.UpdateSwitchboardFeed | UpdateConfigMode.UpdateSwitchboardTwapFeed | UpdateConfigMode.UpdateBorrowRateCurve | UpdateConfigMode.UpdateEntireReserveConfig | UpdateConfigMode.UpdateDebtWithdrawalCap | UpdateConfigMode.UpdateDepositWithdrawalCap | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotal | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotal | UpdateConfigMode.UpdateBadDebtLiquidationBonusBps | UpdateConfigMode.UpdateMinLiquidationBonusBps | UpdateConfigMode.DeleveragingMarginCallPeriod | UpdateConfigMode.UpdateBorrowFactor | UpdateConfigMode.UpdateAssetTier | UpdateConfigMode.UpdateElevationGroup | UpdateConfigMode.DeleveragingThresholdSlotsPerBps | UpdateConfigMode.DeprecatedUpdateMultiplierSideBoost | UpdateConfigMode.DeprecatedUpdateMultiplierTagBoost | UpdateConfigMode.UpdateReserveStatus | UpdateConfigMode.UpdateFarmCollateral | UpdateConfigMode.UpdateFarmDebt | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmode | UpdateConfigMode.UpdateBlockBorrowingAboveUtilization | UpdateConfigMode.UpdateBlockPriceUsage | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroup | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserve | UpdateConfigMode.UpdateHostFixedInterestRateBps;
10
+ export type UpdateConfigModeJSON = UpdateConfigMode.UpdateLoanToValuePctJSON | UpdateConfigMode.UpdateMaxLiquidationBonusBpsJSON | UpdateConfigMode.UpdateLiquidationThresholdPctJSON | UpdateConfigMode.UpdateProtocolLiquidationFeeJSON | UpdateConfigMode.UpdateProtocolTakeRateJSON | UpdateConfigMode.UpdateFeesBorrowFeeJSON | UpdateConfigMode.UpdateFeesFlashLoanFeeJSON | UpdateConfigMode.UpdateFeesReferralFeeBpsJSON | UpdateConfigMode.UpdateDepositLimitJSON | UpdateConfigMode.UpdateBorrowLimitJSON | UpdateConfigMode.UpdateTokenInfoLowerHeuristicJSON | UpdateConfigMode.UpdateTokenInfoUpperHeuristicJSON | UpdateConfigMode.UpdateTokenInfoExpHeuristicJSON | UpdateConfigMode.UpdateTokenInfoTwapDivergenceJSON | UpdateConfigMode.UpdateTokenInfoScopeTwapJSON | UpdateConfigMode.UpdateTokenInfoScopeChainJSON | UpdateConfigMode.UpdateTokenInfoNameJSON | UpdateConfigMode.UpdateTokenInfoPriceMaxAgeJSON | UpdateConfigMode.UpdateTokenInfoTwapMaxAgeJSON | UpdateConfigMode.UpdateScopePriceFeedJSON | UpdateConfigMode.UpdatePythPriceJSON | UpdateConfigMode.UpdateSwitchboardFeedJSON | UpdateConfigMode.UpdateSwitchboardTwapFeedJSON | UpdateConfigMode.UpdateBorrowRateCurveJSON | UpdateConfigMode.UpdateEntireReserveConfigJSON | UpdateConfigMode.UpdateDebtWithdrawalCapJSON | UpdateConfigMode.UpdateDepositWithdrawalCapJSON | UpdateConfigMode.UpdateDebtWithdrawalCapCurrentTotalJSON | UpdateConfigMode.UpdateDepositWithdrawalCapCurrentTotalJSON | UpdateConfigMode.UpdateBadDebtLiquidationBonusBpsJSON | UpdateConfigMode.UpdateMinLiquidationBonusBpsJSON | UpdateConfigMode.DeleveragingMarginCallPeriodJSON | UpdateConfigMode.UpdateBorrowFactorJSON | UpdateConfigMode.UpdateAssetTierJSON | UpdateConfigMode.UpdateElevationGroupJSON | UpdateConfigMode.DeleveragingThresholdSlotsPerBpsJSON | UpdateConfigMode.DeprecatedUpdateMultiplierSideBoostJSON | UpdateConfigMode.DeprecatedUpdateMultiplierTagBoostJSON | UpdateConfigMode.UpdateReserveStatusJSON | UpdateConfigMode.UpdateFarmCollateralJSON | UpdateConfigMode.UpdateFarmDebtJSON | UpdateConfigMode.UpdateDisableUsageAsCollateralOutsideEmodeJSON | UpdateConfigMode.UpdateBlockBorrowingAboveUtilizationJSON | UpdateConfigMode.UpdateBlockPriceUsageJSON | UpdateConfigMode.UpdateBorrowLimitOutsideElevationGroupJSON | UpdateConfigMode.UpdateBorrowLimitsInElevationGroupAgainstThisReserveJSON | UpdateConfigMode.UpdateHostFixedInterestRateBpsJSON;
11
11
  export { UpdateLendingMarketConfigValue };
12
12
  export type UpdateLendingMarketConfigValueKind = UpdateLendingMarketConfigValue.Bool | UpdateLendingMarketConfigValue.U8 | UpdateLendingMarketConfigValue.U8Array | UpdateLendingMarketConfigValue.U16 | UpdateLendingMarketConfigValue.U64 | UpdateLendingMarketConfigValue.U128 | UpdateLendingMarketConfigValue.Pubkey | UpdateLendingMarketConfigValue.ElevationGroup;
13
13
  export type UpdateLendingMarketConfigValueJSON = UpdateLendingMarketConfigValue.BoolJSON | UpdateLendingMarketConfigValue.U8JSON | UpdateLendingMarketConfigValue.U8ArrayJSON | UpdateLendingMarketConfigValue.U16JSON | UpdateLendingMarketConfigValue.U64JSON | UpdateLendingMarketConfigValue.U128JSON | UpdateLendingMarketConfigValue.PubkeyJSON | UpdateLendingMarketConfigValue.ElevationGroupJSON;
14
14
  export { UpdateLendingMarketMode };
15
- export type UpdateLendingMarketModeKind = UpdateLendingMarketMode.UpdateOwner | UpdateLendingMarketMode.UpdateEmergencyMode | UpdateLendingMarketMode.UpdateLiquidationCloseFactor | UpdateLendingMarketMode.UpdateLiquidationMaxValue | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrow | UpdateLendingMarketMode.UpdateGlobalAllowedBorrow | UpdateLendingMarketMode.UpdateRiskCouncil | UpdateLendingMarketMode.UpdateMinFullLiquidationThreshold | UpdateLendingMarketMode.UpdateInsolvencyRiskLtv | UpdateLendingMarketMode.UpdateElevationGroup | UpdateLendingMarketMode.UpdateReferralFeeBps | UpdateLendingMarketMode.UpdateMultiplierPoints | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePct | UpdateLendingMarketMode.UpdateAutodeleverageEnabled | UpdateLendingMarketMode.UpdateBorrowingDisabled | UpdateLendingMarketMode.UpdateMinNetValueObligationPostAction | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheck;
16
- export type UpdateLendingMarketModeJSON = UpdateLendingMarketMode.UpdateOwnerJSON | UpdateLendingMarketMode.UpdateEmergencyModeJSON | UpdateLendingMarketMode.UpdateLiquidationCloseFactorJSON | UpdateLendingMarketMode.UpdateLiquidationMaxValueJSON | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrowJSON | UpdateLendingMarketMode.UpdateGlobalAllowedBorrowJSON | UpdateLendingMarketMode.UpdateRiskCouncilJSON | UpdateLendingMarketMode.UpdateMinFullLiquidationThresholdJSON | UpdateLendingMarketMode.UpdateInsolvencyRiskLtvJSON | UpdateLendingMarketMode.UpdateElevationGroupJSON | UpdateLendingMarketMode.UpdateReferralFeeBpsJSON | UpdateLendingMarketMode.UpdateMultiplierPointsJSON | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePctJSON | UpdateLendingMarketMode.UpdateAutodeleverageEnabledJSON | UpdateLendingMarketMode.UpdateBorrowingDisabledJSON | UpdateLendingMarketMode.UpdateMinNetValueObligationPostActionJSON | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheckJSON;
15
+ export type UpdateLendingMarketModeKind = UpdateLendingMarketMode.UpdateOwner | UpdateLendingMarketMode.UpdateEmergencyMode | UpdateLendingMarketMode.UpdateLiquidationCloseFactor | UpdateLendingMarketMode.UpdateLiquidationMaxValue | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrow | UpdateLendingMarketMode.UpdateGlobalAllowedBorrow | UpdateLendingMarketMode.UpdateRiskCouncil | UpdateLendingMarketMode.UpdateMinFullLiquidationThreshold | UpdateLendingMarketMode.UpdateInsolvencyRiskLtv | UpdateLendingMarketMode.UpdateElevationGroup | UpdateLendingMarketMode.UpdateReferralFeeBps | UpdateLendingMarketMode.DeprecatedUpdateMultiplierPoints | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePct | UpdateLendingMarketMode.UpdateAutodeleverageEnabled | UpdateLendingMarketMode.UpdateBorrowingDisabled | UpdateLendingMarketMode.UpdateMinNetValueObligationPostAction | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheck | UpdateLendingMarketMode.UpdatePaddingFields;
16
+ export type UpdateLendingMarketModeJSON = UpdateLendingMarketMode.UpdateOwnerJSON | UpdateLendingMarketMode.UpdateEmergencyModeJSON | UpdateLendingMarketMode.UpdateLiquidationCloseFactorJSON | UpdateLendingMarketMode.UpdateLiquidationMaxValueJSON | UpdateLendingMarketMode.UpdateGlobalUnhealthyBorrowJSON | UpdateLendingMarketMode.UpdateGlobalAllowedBorrowJSON | UpdateLendingMarketMode.UpdateRiskCouncilJSON | UpdateLendingMarketMode.UpdateMinFullLiquidationThresholdJSON | UpdateLendingMarketMode.UpdateInsolvencyRiskLtvJSON | UpdateLendingMarketMode.UpdateElevationGroupJSON | UpdateLendingMarketMode.UpdateReferralFeeBpsJSON | UpdateLendingMarketMode.DeprecatedUpdateMultiplierPointsJSON | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePctJSON | UpdateLendingMarketMode.UpdateAutodeleverageEnabledJSON | UpdateLendingMarketMode.UpdateBorrowingDisabledJSON | UpdateLendingMarketMode.UpdateMinNetValueObligationPostActionJSON | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheckJSON | UpdateLendingMarketMode.UpdatePaddingFieldsJSON;
17
17
  export { LastUpdate } from "./LastUpdate";
18
18
  export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate";
19
19
  export { ElevationGroup } from "./ElevationGroup";
@@ -1 +1 @@
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"]}
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;AAyL/B,8BAAS;AAxLlB,iEAAkD;AAwMzC,wCAAc;AAvMvB,mEAAoD;AAwN3C,0CAAe;AAvNxB,+DAAgD;AAuOvC,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.DeprecatedUpdateMultiplierSideBoost\n | UpdateConfigMode.DeprecatedUpdateMultiplierTagBoost\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.DeprecatedUpdateMultiplierSideBoostJSON\n | UpdateConfigMode.DeprecatedUpdateMultiplierTagBoostJSON\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.DeprecatedUpdateMultiplierPoints\n | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePct\n | UpdateLendingMarketMode.UpdateAutodeleverageEnabled\n | UpdateLendingMarketMode.UpdateBorrowingDisabled\n | UpdateLendingMarketMode.UpdateMinNetValueObligationPostAction\n | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheck\n | UpdateLendingMarketMode.UpdatePaddingFields\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.DeprecatedUpdateMultiplierPointsJSON\n | UpdateLendingMarketMode.UpdatePriceRefreshTriggerToMaxAgePctJSON\n | UpdateLendingMarketMode.UpdateAutodeleverageEnabledJSON\n | UpdateLendingMarketMode.UpdateBorrowingDisabledJSON\n | UpdateLendingMarketMode.UpdateMinNetValueObligationPostActionJSON\n | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheckJSON\n | UpdateLendingMarketMode.UpdatePaddingFieldsJSON\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"]}
@@ -65,7 +65,6 @@ function sendAndConfirmVersionedTransaction(c_1, tx_1) {
65
65
  var _a, _b;
66
66
  const defaultOptions = { skipPreflight: true };
67
67
  const txId = yield c.sendTransaction(tx, Object.assign(Object.assign({}, defaultOptions), sendTransactionOptions));
68
- console.log('Sending versioned txn', txId.toString());
69
68
  const latestBlockHash = yield c.getLatestBlockhash('finalized');
70
69
  const t = yield c.confirmTransaction({
71
70
  blockhash: latestBlockHash.blockhash,
@@ -1 +1 @@
1
- {"version":3,"file":"instruction.js","sourceRoot":"","sources":["../../src/utils/instruction.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,0DAoCC;AAED,0CAWC;AAED,gFA8BC;AAED,kCAmBC;AAED,oDAEC;AAUD,8CAsBC;AAED,sDAqBC;AA4DD,4BAQC;AAzPD,6CAgByB;AACzB,kDAAoD;AACpD,4CAAyC;AAEzC,SAAsB,uBAAuB;yDAC3C,CAAa,EACb,EAAwB,EACxB,KAAc,EACd,OAAiB,EACjB,oBAA6B,KAAK,EAClC,kBAA0B,EAAE;;QAE5B,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,GAAG,OAAO,CA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AS,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/G,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAbW,QAAA,kCAAkC,sCAa7C;AAEF,2DAA2D;AAC3D,SAAgB,QAAQ,CAAS,KAAgC;IAC/D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,EAAE;IACF,4EAA4E;IAC5E,MAAM,SAAS,GAAW,KAAK,CAAC;IAChC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import Decimal from 'decimal.js';\n\nimport {\n AddressLookupTableAccount,\n Commitment,\n ComputeBudgetProgram,\n Connection,\n Keypair,\n PublicKey,\n SendOptions,\n Signer,\n Transaction,\n TransactionInstruction,\n TransactionMessage,\n TransactionResponse,\n TransactionSignature,\n VersionedTransaction,\n VersionedTransactionResponse,\n} from '@solana/web3.js';\nimport { fromTxError } from '../idl_codegen/errors';\nimport { sleep } from '../classes/utils';\n\nexport async function buildAndSendTxnWithLogs(\n c: Connection,\n tx: VersionedTransaction,\n owner: Keypair,\n signers: Signer[],\n withLogsIfSuccess: boolean = false,\n withDescription: string = ''\n): Promise<TransactionSignature> {\n tx.sign([owner, ...signers]);\n\n try {\n const sig: string = await sendAndConfirmVersionedTransaction(c, tx, 'confirmed', {\n preflightCommitment: 'processed',\n });\n console.log('Transaction Hash:', withDescription, sig);\n if (withLogsIfSuccess) {\n await sleep(5000);\n const res = await c.getTransaction(sig, {\n commitment: 'confirmed',\n maxSupportedTransactionVersion: 6,\n });\n console.log('Transaction Logs:\\n', res?.meta?.logMessages);\n }\n return sig;\n } catch (e: any) {\n console.log(e);\n process.stdout.write(e.logs.toString());\n await sleep(5000);\n const sig = e.toString().split(' failed ')[0].split('Transaction ')[1];\n const res: VersionedTransactionResponse | null = await c.getTransaction(sig, {\n commitment: 'confirmed',\n maxSupportedTransactionVersion: 6,\n });\n console.log('Txn', res!.meta!.logMessages);\n return sig;\n }\n}\n\nexport async function buildAndSendTxn(\n c: Connection,\n owner: Keypair,\n ixns: TransactionInstruction[],\n signers: Signer[],\n lutAddresses: PublicKey[] = [],\n description: string = ''\n): Promise<TransactionSignature> {\n const tx = await buildVersionedTransaction(c, owner.publicKey, ixns, lutAddresses);\n\n return await buildAndSendTxnWithLogs(c, tx, owner, signers, true, description);\n}\n\nexport async function sendAndConfirmVersionedTransaction(\n c: Connection,\n tx: VersionedTransaction,\n commitment: Commitment = 'confirmed',\n sendTransactionOptions: SendOptions = { preflightCommitment: 'processed' }\n) {\n const defaultOptions: SendOptions = { skipPreflight: true };\n const txId = await c.sendTransaction(tx, { ...defaultOptions, ...sendTransactionOptions });\n console.log('Sending versioned txn', txId.toString());\n\n const latestBlockHash = await c.getLatestBlockhash('finalized');\n const t = await c.confirmTransaction(\n {\n blockhash: latestBlockHash.blockhash,\n lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,\n signature: txId,\n },\n commitment\n );\n if (t.value && t.value.err) {\n const txDetails = await c.getTransaction(txId, {\n maxSupportedTransactionVersion: 0,\n commitment: 'confirmed',\n });\n if (txDetails) {\n throw { err: txDetails.meta?.err, logs: txDetails.meta?.logMessages || [] };\n }\n throw t.value.err;\n }\n return txId;\n}\n\nexport async function simulateTxn(c: Connection, tx: Transaction, owner: Keypair, signers: Signer[]) {\n const { blockhash } = await c.getLatestBlockhash();\n tx.recentBlockhash = blockhash;\n tx.feePayer = owner.publicKey;\n\n try {\n const simulation = await c.simulateTransaction(tx, [owner, ...signers]);\n console.log('Transaction Hash:', simulation);\n } catch (e: any) {\n console.log(e);\n process.stdout.write(e.logs.toString());\n await sleep(5000);\n const sig = e.toString().split(' failed ')[0].split('Transaction ')[1];\n const res: TransactionResponse | null = await c.getTransaction(sig, {\n commitment: 'confirmed',\n });\n console.log('Txn', res!.meta!.logMessages);\n return sig;\n }\n}\n\nexport function buildComputeBudgetIx(units: number): TransactionInstruction {\n return ComputeBudgetProgram.setComputeUnitLimit({ units });\n}\n\n/**\n * Send a transaction with optional address lookup tables\n * Translates anchor errors into anchor error types\n * @param connection\n * @param payer\n * @param instructions\n * @param lookupTables\n */\nexport async function sendTransactionV0(\n connection: Connection,\n payer: Keypair,\n instructions: TransactionInstruction[],\n lookupTables: AddressLookupTableAccount[] | undefined = undefined,\n options?: SendOptions\n): Promise<string> {\n const recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n\n const messageV0 = new TransactionMessage({\n payerKey: payer.publicKey,\n recentBlockhash,\n instructions,\n }).compileToV0Message(lookupTables);\n\n const tx = new VersionedTransaction(messageV0);\n tx.sign([payer]);\n try {\n return await connection.sendTransaction(tx, options);\n } catch (err) {\n throw fromTxError(err) ?? err;\n }\n}\n\nexport async function simulateTransactionV0(\n connection: Connection,\n payer: Keypair,\n instructions: TransactionInstruction[],\n lookupTables: AddressLookupTableAccount[] | undefined = undefined\n) {\n const recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n\n const messageV0 = new TransactionMessage({\n payerKey: payer.publicKey,\n recentBlockhash,\n instructions,\n }).compileToV0Message(lookupTables);\n\n const tx = new VersionedTransaction(messageV0);\n tx.sign([payer]);\n try {\n return await connection.simulateTransaction(tx);\n } catch (err) {\n throw fromTxError(err) ?? err;\n }\n}\n\nexport const buildVersionedTransaction = async (\n connection: Connection,\n payer: PublicKey,\n instructions: TransactionInstruction[],\n lookupTables: PublicKey[] = []\n): Promise<VersionedTransaction> => {\n const blockhash = await connection.getLatestBlockhash('confirmed').then((res) => res.blockhash);\n\n const lookupTablesAccounts = await Promise.all(\n lookupTables.map((address) => {\n return getLookupTableAccount(connection, address);\n })\n );\n\n const messageV0 = new TransactionMessage({\n payerKey: payer,\n recentBlockhash: blockhash,\n instructions,\n }).compileToV0Message(lookupTablesAccounts.filter(notEmpty));\n\n return new VersionedTransaction(messageV0);\n};\n\nexport const getLookupTableAccount = async (connection: Connection, address: PublicKey) => {\n return connection.getAddressLookupTable(address).then((res) => res.value);\n};\n\nexport const getLookupTableAccounts = async (connection: Connection, addresses: PublicKey[]) => {\n const lookupTableAccounts: AddressLookupTableAccount[] = [];\n for (const address of addresses) {\n const lookupTableAccount = await connection.getAddressLookupTable(address).then((res) => res.value);\n\n if (!lookupTableAccount) {\n console.error('lookup table is not found');\n throw new Error('lookup table is not found');\n }\n\n lookupTableAccounts.push(lookupTableAccount);\n }\n return lookupTableAccounts;\n};\n\nexport const getComputeBudgetAndPriorityFeeIxns = (\n units: number,\n priorityFeeLamports?: Decimal\n): TransactionInstruction[] => {\n const ixns: TransactionInstruction[] = [];\n ixns.push(ComputeBudgetProgram.setComputeUnitLimit({ units }));\n\n if (priorityFeeLamports && priorityFeeLamports.gt(0)) {\n const unitPrice = priorityFeeLamports.mul(10 ** 6).div(units);\n ixns.push(ComputeBudgetProgram.setComputeUnitPrice({ microLamports: BigInt(unitPrice.floor().toString()) }));\n }\n\n return ixns;\n};\n\n// filters null values from array and make typescript happy\nexport function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {\n if (value === null || value === undefined) {\n return false;\n }\n //\n // eslint-disable-next-line no-unused-vars,@typescript-eslint/no-unused-vars\n const testDummy: TValue = value;\n return true;\n}\n"]}
1
+ {"version":3,"file":"instruction.js","sourceRoot":"","sources":["../../src/utils/instruction.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,0DAoCC;AAED,0CAWC;AAED,gFA6BC;AAED,kCAmBC;AAED,oDAEC;AAUD,8CAsBC;AAED,sDAqBC;AA4DD,4BAQC;AAxPD,6CAgByB;AACzB,kDAAoD;AACpD,4CAAyC;AAEzC,SAAsB,uBAAuB;yDAC3C,CAAa,EACb,EAAwB,EACxB,KAAc,EACd,OAAiB,EACjB,oBAA6B,KAAK,EAClC,kBAA0B,EAAE;;QAE5B,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;QAE7B,IAAI,CAAC;YACH,M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AAbW,QAAA,kCAAkC,sCAa7C;AAEF,2DAA2D;AAC3D,SAAgB,QAAQ,CAAS,KAAgC;IAC/D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,EAAE;IACF,4EAA4E;IAC5E,MAAM,SAAS,GAAW,KAAK,CAAC;IAChC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import Decimal from 'decimal.js';\n\nimport {\n AddressLookupTableAccount,\n Commitment,\n ComputeBudgetProgram,\n Connection,\n Keypair,\n PublicKey,\n SendOptions,\n Signer,\n Transaction,\n TransactionInstruction,\n TransactionMessage,\n TransactionResponse,\n TransactionSignature,\n VersionedTransaction,\n VersionedTransactionResponse,\n} from '@solana/web3.js';\nimport { fromTxError } from '../idl_codegen/errors';\nimport { sleep } from '../classes/utils';\n\nexport async function buildAndSendTxnWithLogs(\n c: Connection,\n tx: VersionedTransaction,\n owner: Keypair,\n signers: Signer[],\n withLogsIfSuccess: boolean = false,\n withDescription: string = ''\n): Promise<TransactionSignature> {\n tx.sign([owner, ...signers]);\n\n try {\n const sig: string = await sendAndConfirmVersionedTransaction(c, tx, 'confirmed', {\n preflightCommitment: 'processed',\n });\n console.log('Transaction Hash:', withDescription, sig);\n if (withLogsIfSuccess) {\n await sleep(5000);\n const res = await c.getTransaction(sig, {\n commitment: 'confirmed',\n maxSupportedTransactionVersion: 6,\n });\n console.log('Transaction Logs:\\n', res?.meta?.logMessages);\n }\n return sig;\n } catch (e: any) {\n console.log(e);\n process.stdout.write(e.logs.toString());\n await sleep(5000);\n const sig = e.toString().split(' failed ')[0].split('Transaction ')[1];\n const res: VersionedTransactionResponse | null = await c.getTransaction(sig, {\n commitment: 'confirmed',\n maxSupportedTransactionVersion: 6,\n });\n console.log('Txn', res!.meta!.logMessages);\n return sig;\n }\n}\n\nexport async function buildAndSendTxn(\n c: Connection,\n owner: Keypair,\n ixns: TransactionInstruction[],\n signers: Signer[],\n lutAddresses: PublicKey[] = [],\n description: string = ''\n): Promise<TransactionSignature> {\n const tx = await buildVersionedTransaction(c, owner.publicKey, ixns, lutAddresses);\n\n return await buildAndSendTxnWithLogs(c, tx, owner, signers, true, description);\n}\n\nexport async function sendAndConfirmVersionedTransaction(\n c: Connection,\n tx: VersionedTransaction,\n commitment: Commitment = 'confirmed',\n sendTransactionOptions: SendOptions = { preflightCommitment: 'processed' }\n) {\n const defaultOptions: SendOptions = { skipPreflight: true };\n const txId = await c.sendTransaction(tx, { ...defaultOptions, ...sendTransactionOptions });\n\n const latestBlockHash = await c.getLatestBlockhash('finalized');\n const t = await c.confirmTransaction(\n {\n blockhash: latestBlockHash.blockhash,\n lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,\n signature: txId,\n },\n commitment\n );\n if (t.value && t.value.err) {\n const txDetails = await c.getTransaction(txId, {\n maxSupportedTransactionVersion: 0,\n commitment: 'confirmed',\n });\n if (txDetails) {\n throw { err: txDetails.meta?.err, logs: txDetails.meta?.logMessages || [] };\n }\n throw t.value.err;\n }\n return txId;\n}\n\nexport async function simulateTxn(c: Connection, tx: Transaction, owner: Keypair, signers: Signer[]) {\n const { blockhash } = await c.getLatestBlockhash();\n tx.recentBlockhash = blockhash;\n tx.feePayer = owner.publicKey;\n\n try {\n const simulation = await c.simulateTransaction(tx, [owner, ...signers]);\n console.log('Transaction Hash:', simulation);\n } catch (e: any) {\n console.log(e);\n process.stdout.write(e.logs.toString());\n await sleep(5000);\n const sig = e.toString().split(' failed ')[0].split('Transaction ')[1];\n const res: TransactionResponse | null = await c.getTransaction(sig, {\n commitment: 'confirmed',\n });\n console.log('Txn', res!.meta!.logMessages);\n return sig;\n }\n}\n\nexport function buildComputeBudgetIx(units: number): TransactionInstruction {\n return ComputeBudgetProgram.setComputeUnitLimit({ units });\n}\n\n/**\n * Send a transaction with optional address lookup tables\n * Translates anchor errors into anchor error types\n * @param connection\n * @param payer\n * @param instructions\n * @param lookupTables\n */\nexport async function sendTransactionV0(\n connection: Connection,\n payer: Keypair,\n instructions: TransactionInstruction[],\n lookupTables: AddressLookupTableAccount[] | undefined = undefined,\n options?: SendOptions\n): Promise<string> {\n const recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n\n const messageV0 = new TransactionMessage({\n payerKey: payer.publicKey,\n recentBlockhash,\n instructions,\n }).compileToV0Message(lookupTables);\n\n const tx = new VersionedTransaction(messageV0);\n tx.sign([payer]);\n try {\n return await connection.sendTransaction(tx, options);\n } catch (err) {\n throw fromTxError(err) ?? err;\n }\n}\n\nexport async function simulateTransactionV0(\n connection: Connection,\n payer: Keypair,\n instructions: TransactionInstruction[],\n lookupTables: AddressLookupTableAccount[] | undefined = undefined\n) {\n const recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n\n const messageV0 = new TransactionMessage({\n payerKey: payer.publicKey,\n recentBlockhash,\n instructions,\n }).compileToV0Message(lookupTables);\n\n const tx = new VersionedTransaction(messageV0);\n tx.sign([payer]);\n try {\n return await connection.simulateTransaction(tx);\n } catch (err) {\n throw fromTxError(err) ?? err;\n }\n}\n\nexport const buildVersionedTransaction = async (\n connection: Connection,\n payer: PublicKey,\n instructions: TransactionInstruction[],\n lookupTables: PublicKey[] = []\n): Promise<VersionedTransaction> => {\n const blockhash = await connection.getLatestBlockhash('confirmed').then((res) => res.blockhash);\n\n const lookupTablesAccounts = await Promise.all(\n lookupTables.map((address) => {\n return getLookupTableAccount(connection, address);\n })\n );\n\n const messageV0 = new TransactionMessage({\n payerKey: payer,\n recentBlockhash: blockhash,\n instructions,\n }).compileToV0Message(lookupTablesAccounts.filter(notEmpty));\n\n return new VersionedTransaction(messageV0);\n};\n\nexport const getLookupTableAccount = async (connection: Connection, address: PublicKey) => {\n return connection.getAddressLookupTable(address).then((res) => res.value);\n};\n\nexport const getLookupTableAccounts = async (connection: Connection, addresses: PublicKey[]) => {\n const lookupTableAccounts: AddressLookupTableAccount[] = [];\n for (const address of addresses) {\n const lookupTableAccount = await connection.getAddressLookupTable(address).then((res) => res.value);\n\n if (!lookupTableAccount) {\n console.error('lookup table is not found');\n throw new Error('lookup table is not found');\n }\n\n lookupTableAccounts.push(lookupTableAccount);\n }\n return lookupTableAccounts;\n};\n\nexport const getComputeBudgetAndPriorityFeeIxns = (\n units: number,\n priorityFeeLamports?: Decimal\n): TransactionInstruction[] => {\n const ixns: TransactionInstruction[] = [];\n ixns.push(ComputeBudgetProgram.setComputeUnitLimit({ units }));\n\n if (priorityFeeLamports && priorityFeeLamports.gt(0)) {\n const unitPrice = priorityFeeLamports.mul(10 ** 6).div(units);\n ixns.push(ComputeBudgetProgram.setComputeUnitPrice({ microLamports: BigInt(unitPrice.floor().toString()) }));\n }\n\n return ixns;\n};\n\n// filters null values from array and make typescript happy\nexport function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {\n if (value === null || value === undefined) {\n return false;\n }\n //\n // eslint-disable-next-line no-unused-vars,@typescript-eslint/no-unused-vars\n const testDummy: TValue = value;\n return true;\n}\n"]}
@@ -158,7 +158,6 @@ function buildReserveConfig(fields) {
158
158
  protocolLiquidationFeePct: 0,
159
159
  protocolTakeRatePct: fields.configParams.protocolTakeRate,
160
160
  assetTier: 0,
161
- multiplierSideBoost: Array(2).fill(1),
162
161
  maxLiquidationBonusBps: fields.configParams.maxLiquidationBonusBps,
163
162
  badDebtLiquidationBonusBps: fields.configParams.badDebtLiquidationBonusBps,
164
163
  fees: {
@@ -190,13 +189,14 @@ function buildReserveConfig(fields) {
190
189
  borrowFactorPct: new bn_js_1.default(100),
191
190
  elevationGroups: fields.configParams.elevationGroups,
192
191
  deleveragingThresholdSlotsPerBps: new bn_js_1.default(7200),
193
- multiplierTagBoost: Array(8).fill(1),
194
192
  disableUsageAsCollOutsideEmode: 0,
195
193
  utilizationLimitBlockBorrowingAbove: 0,
196
194
  hostFixedInterestRateBps: 0,
197
195
  borrowLimitOutsideElevationGroup: new bn_js_1.default(0),
198
196
  borrowLimitAgainstThisCollateralInElevationGroup: Array(32).fill(new bn_js_1.default(0)),
199
197
  reserved1: Array(2).fill(0),
198
+ reserved2: Array(2).fill(0),
199
+ reserved3: Array(8).fill(0),
200
200
  };
201
201
  return new types_1.ReserveConfig(reserveConfigFields);
202
202
  }
@@ -1 +1 @@
1
- {"version":3,"file":"managerTypes.js","sourceRoot":"","sources":["../../src/utils/managerTypes.ts"],"names":[],"mappings":";;;;;;AAgWA,0DA2CC;AAED,0CAqDC;AAjcD,gDAY8B;AAC9B,4DAAiC;AACjC,kDAA8D;AAC9D,kDAAuB;AACvB,wCAAqD;AACrD,qCAAuC;AACvC,yDAAgE;AAmChE,MAAa,kBAAkB;IAO7B,YAAY,MAWX;QACC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAEhD,+CAA+C;QAC/C,IAAI,CAAC,wBAAwB,GAAG,2BAAmB,CAAC;QACpD,IAAI,CAAC,wBAAwB,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAC3D,IAAI,CAAC,wBAAwB,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QACrE,IAAI,CAAC,wBAAwB,CAAC,uBAAuB,GAAG,MAAM,CAAC,uBAAuB,CAAC;QACvF,IAAI,CAAC,wBAAwB,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QACvE,IAAI,CAAC,wBAAwB,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACjE,IAAI,CAAC,wBAAwB,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACjE,CAAC;IAED,oBAAoB,CAAC,wBAAkD;QACrE,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;IAC3D,CAAC;IAED,gBAAgB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,OAAO,mBAAmB,CAAC;QAC7B,KAAK,IAAI,sBAAU,CAAC,gBAAgB,EAAE,CAAC,aAAa;YAClD,OAAO,kBAAkB,CAAC;QAC5B,KAAK,IAAI,sBAAU,CAAC,gBAAgB,EAAE,CAAC,aAAa;YAClD,OAAO,kBAAkB,CAAC;QAC5B,KAAK,IAAI,sBAAU,CAAC,gBAAgB,EAAE,CAAC,aAAa;YAClD,OAAO,kBAAkB,CAAC;QAC5B,KAAK,IAAI,sBAAU,CAAC,eAAe,EAAE,CAAC,aAAa;YACjD,OAAO,iBAAiB,CAAC;QAC3B,KAAK,IAAI,sBAAU,CAAC,eAAe,EAAE,CAAC,aAAa;YACjD,OAAO,iBAAiB,CAAC;QAC3B,KAAK,IAAI,sBAAU,CAAC,cAAc,EAAE,CAAC,aAAa;YAChD,OAAO,gBAAgB,CAAC;QAC1B,KAAK,IAAI,sBAAU,CAAC,aAAa,EAAE,CAAC,aAAa;YAC/C,OAAO,eAAe,CAAC;QACzB,KAAK,IAAI,sBAAU,CAAC,gBAAgB,EAAE,CAAC,aAAa;YAClD,OAAO,kBAAkB,CAAC;QAC5B,KAAK,IAAI,sBAAU,CAAC,UAAU,EAAE,CAAC,aAAa;YAC5C,OAAO,YAAY,CAAC;QACtB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC","sourcesContent":["import { PublicKey } from '@solana/web3.js';\nimport {\n BorrowRateCurve,\n BorrowRateCurveFields,\n CurvePoint,\n PriceHeuristic,\n PythConfiguration,\n ReserveConfig,\n ReserveConfigFields,\n ScopeConfiguration,\n SwitchboardConfiguration,\n TokenInfo,\n WithdrawalCaps,\n} from '../idl_codegen/types';\nimport Decimal from 'decimal.js';\nimport { Fraction, ZERO_FRACTION } from '../classes/fraction';\nimport BN from 'bn.js';\nimport { numberToLamportsDecimal } from '../classes';\nimport { NULL_PUBKEY } from './pubkey';\nimport { OracleType, U16_MAX } from '@hubbleprotocol/scope-sdk';\nimport { LendingMarket } from '../lib';\n\nexport type ScopeOracleConfig = {\n scopePriceConfigAddress: PublicKey;\n name: string;\n oracleType: string;\n oracleId: number;\n oracleAccount: PublicKey;\n twapEnabled: boolean;\n twapSourceId: number;\n max_age: number;\n};\n\nexport type CreateKaminoMarketParams = {\n admin: PublicKey;\n};\n\nexport type AddAssetToMarketParams = {\n admin: PublicKey;\n marketAddress: PublicKey;\n assetConfig: AssetConfig;\n};\n\nexport interface AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void;\n getReserveConfig(): ReserveConfig;\n}\n\nexport class AssetReserveConfig implements AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n constructor(fields: {\n mint: PublicKey;\n mintTokenProgram: PublicKey;\n tokenName: string;\n mintDecimals: number;\n priceFeed: PriceFeed;\n loanToValuePct: number;\n liquidationThresholdPct: number;\n borrowRateCurve: BorrowRateCurve;\n depositLimit: Decimal;\n borrowLimit: Decimal;\n }) {\n this.mint = fields.mint;\n this.tokenName = fields.tokenName;\n this.mintDecimals = fields.mintDecimals;\n this.mintTokenProgram = fields.mintTokenProgram;\n\n // TODO: verify defaults and ensure opinionated\n this.assetReserveConfigParams = DefaultConfigParams;\n this.assetReserveConfigParams.priceFeed = fields.priceFeed;\n this.assetReserveConfigParams.loanToValuePct = fields.loanToValuePct;\n this.assetReserveConfigParams.liquidationThresholdPct = fields.liquidationThresholdPct;\n this.assetReserveConfigParams.borrowRateCurve = fields.borrowRateCurve;\n this.assetReserveConfigParams.depositLimit = fields.depositLimit;\n this.assetReserveConfigParams.borrowLimit = fields.borrowLimit;\n }\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void {\n this.assetReserveConfigParams = assetReserveConfigParams;\n }\n\n getReserveConfig(): ReserveConfig {\n return buildReserveConfig({\n configParams: this.assetReserveConfigParams,\n mintDecimals: this.mintDecimals,\n tokenName: this.tokenName,\n });\n }\n}\n\nexport class AssetReserveConfigCli implements AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n private reserveConfig: ReserveConfig | undefined;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n constructor(mint: PublicKey, mintTokenProgram: PublicKey, reserveConfig: ReserveConfig) {\n this.reserveConfig = reserveConfig;\n this.tokenName = '';\n this.mintDecimals = 0;\n this.assetReserveConfigParams = DefaultConfigParams;\n this.mint = mint;\n this.mintTokenProgram = mintTokenProgram;\n }\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void {\n this.assetReserveConfigParams = assetReserveConfigParams;\n }\n\n setReserveConfig(reserveConfig: ReserveConfig) {\n this.reserveConfig = reserveConfig;\n }\n\n getReserveConfig(): ReserveConfig {\n return this.reserveConfig\n ? this.reserveConfig\n : buildReserveConfig({\n configParams: this.assetReserveConfigParams,\n mintDecimals: this.mintDecimals,\n tokenName: this.tokenName,\n });\n }\n}\n\nexport class CollateralConfig implements AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n constructor(fields: {\n mint: PublicKey;\n mintTokenProgram: PublicKey;\n tokenName: string;\n mintDecimals: number;\n priceFeed: PriceFeed;\n loanToValuePct: number;\n liquidationThresholdPct: number;\n }) {\n this.mint = fields.mint;\n this.tokenName = fields.tokenName;\n this.mintDecimals = fields.mintDecimals;\n this.mintTokenProgram = fields.mintTokenProgram;\n\n // TODO: verify defaults and ensure opinionated\n this.assetReserveConfigParams = DefaultConfigParams;\n this.assetReserveConfigParams.priceFeed = fields.priceFeed;\n this.assetReserveConfigParams.loanToValuePct = fields.loanToValuePct;\n this.assetReserveConfigParams.liquidationThresholdPct = fields.liquidationThresholdPct;\n this.assetReserveConfigParams.borrowLimit = new Decimal(0);\n }\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void {\n this.assetReserveConfigParams = assetReserveConfigParams;\n }\n\n getReserveConfig(): ReserveConfig {\n return buildReserveConfig({\n configParams: this.assetReserveConfigParams,\n mintDecimals: this.mintDecimals,\n tokenName: this.tokenName,\n });\n }\n}\n\nexport class DebtConfig implements AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n constructor(fields: {\n mint: PublicKey;\n mintTokenProgram: PublicKey;\n tokenName: string;\n mintDecimals: number;\n priceFeed: PriceFeed;\n borrowRateCurve: BorrowRateCurve;\n }) {\n this.mint = fields.mint;\n this.tokenName = fields.tokenName;\n this.mintDecimals = fields.mintDecimals;\n this.mintTokenProgram = fields.mintTokenProgram;\n\n // TODO: verify defaults and ensure opinionated\n this.assetReserveConfigParams = DefaultConfigParams;\n this.assetReserveConfigParams.priceFeed = fields.priceFeed;\n this.assetReserveConfigParams.borrowRateCurve = fields.borrowRateCurve;\n }\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void {\n this.assetReserveConfigParams = assetReserveConfigParams;\n }\n\n getReserveConfig(): ReserveConfig {\n return buildReserveConfig({\n configParams: this.assetReserveConfigParams,\n mintDecimals: this.mintDecimals,\n tokenName: this.tokenName,\n });\n }\n}\n\nexport type PriceFeed = {\n scopePriceConfigAddress?: PublicKey;\n scopeChain?: number[];\n scopeTwapChain?: number[];\n pythPrice?: PublicKey;\n switchboardPrice?: PublicKey;\n switchboardTwapPrice?: PublicKey;\n};\n\nexport type AssetReserveConfigParams = {\n loanToValuePct: number;\n depositLimit: Decimal;\n borrowLimit: Decimal;\n maxLiquidationBonusBps: number;\n minLiquidationBonusBps: number;\n badDebtLiquidationBonusBps: number;\n liquidationThresholdPct: number;\n borrowFeeSf: Fraction;\n flashLoanFeeSf: Fraction;\n protocolTakeRate: number;\n elevationGroups: number[];\n priceFeed: PriceFeed | null;\n maxAgePriceSeconds: number;\n maxAgeTwapSeconds: number;\n borrowRateCurve: BorrowRateCurve;\n};\n\nexport const DefaultConfigParams: AssetReserveConfigParams = {\n loanToValuePct: 70,\n maxLiquidationBonusBps: 500,\n minLiquidationBonusBps: 200,\n badDebtLiquidationBonusBps: 10,\n liquidationThresholdPct: 75,\n borrowFeeSf: ZERO_FRACTION,\n flashLoanFeeSf: ZERO_FRACTION,\n protocolTakeRate: 0,\n elevationGroups: [0, 0, 0, 0, 0],\n priceFeed: null,\n borrowLimit: new Decimal(1000.0),\n depositLimit: new Decimal(1000.0),\n borrowRateCurve: new BorrowRateCurve({\n points: [\n new CurvePoint({ utilizationRateBps: 0, borrowRateBps: 1000 }),\n new CurvePoint({ utilizationRateBps: 10000, borrowRateBps: 1000 }),\n ...Array(9).fill(new CurvePoint({ utilizationRateBps: 10000, borrowRateBps: 1000 })),\n ],\n } as BorrowRateCurveFields),\n maxAgePriceSeconds: 180,\n maxAgeTwapSeconds: 240,\n};\n\nexport const encodeTokenName = (tokenName: string): number[] => {\n const buffer: Buffer = Buffer.alloc(32);\n\n const tokenNameEncoded = new Uint8Array(32);\n const s: Uint8Array = new TextEncoder().encode(tokenName);\n tokenNameEncoded.set(s);\n for (let i = 0; i < tokenNameEncoded.length; i++) {\n buffer[i] = tokenNameEncoded[i];\n }\n\n const result = [...buffer];\n return result;\n};\n\nfunction buildReserveConfig(fields: {\n configParams: AssetReserveConfigParams;\n mintDecimals: number;\n tokenName: string;\n}): ReserveConfig {\n const reserveConfigFields: ReserveConfigFields = {\n status: 0,\n loanToValuePct: fields.configParams.loanToValuePct,\n liquidationThresholdPct: fields.configParams.liquidationThresholdPct,\n minLiquidationBonusBps: fields.configParams.minLiquidationBonusBps,\n protocolLiquidationFeePct: 0,\n protocolTakeRatePct: fields.configParams.protocolTakeRate,\n assetTier: 0,\n multiplierSideBoost: Array(2).fill(1),\n maxLiquidationBonusBps: fields.configParams.maxLiquidationBonusBps,\n badDebtLiquidationBonusBps: fields.configParams.badDebtLiquidationBonusBps,\n fees: {\n borrowFeeSf: fields.configParams.borrowFeeSf.getValue(),\n flashLoanFeeSf: fields.configParams.flashLoanFeeSf.getValue(),\n padding: Array(6).fill(0),\n },\n depositLimit: new BN(\n numberToLamportsDecimal(fields.configParams.depositLimit, fields.mintDecimals).floor().toString()\n ),\n borrowLimit: new BN(\n numberToLamportsDecimal(fields.configParams.borrowLimit, fields.mintDecimals).floor().toString()\n ),\n tokenInfo: {\n name: encodeTokenName(fields.tokenName),\n heuristic: new PriceHeuristic({\n lower: new BN(0),\n upper: new BN(0),\n exp: new BN(0),\n }),\n maxTwapDivergenceBps: new BN(0),\n maxAgePriceSeconds: new BN(fields.configParams.maxAgePriceSeconds),\n maxAgeTwapSeconds: new BN(fields.configParams.maxAgeTwapSeconds),\n ...getReserveOracleConfigs(fields.configParams.priceFeed),\n padding: Array(20).fill(new BN(0)),\n } as TokenInfo,\n borrowRateCurve: fields.configParams.borrowRateCurve,\n depositWithdrawalCap: new WithdrawalCaps({\n configCapacity: new BN(0),\n currentTotal: new BN(0),\n lastIntervalStartTimestamp: new BN(0),\n configIntervalLengthSeconds: new BN(0),\n }),\n debtWithdrawalCap: new WithdrawalCaps({\n configCapacity: new BN(0),\n currentTotal: new BN(0),\n lastIntervalStartTimestamp: new BN(0),\n configIntervalLengthSeconds: new BN(0),\n }),\n deleveragingMarginCallPeriodSecs: new BN(0),\n borrowFactorPct: new BN(100),\n elevationGroups: fields.configParams.elevationGroups,\n deleveragingThresholdSlotsPerBps: new BN(7200),\n multiplierTagBoost: Array(8).fill(1),\n disableUsageAsCollOutsideEmode: 0,\n utilizationLimitBlockBorrowingAbove: 0,\n hostFixedInterestRateBps: 0,\n borrowLimitOutsideElevationGroup: new BN(0),\n borrowLimitAgainstThisCollateralInElevationGroup: Array(32).fill(new BN(0)),\n reserved1: Array(2).fill(0),\n };\n\n return new ReserveConfig(reserveConfigFields);\n}\n\nexport function getReserveOracleConfigs(priceFeed: PriceFeed | null): {\n pythConfiguration: PythConfiguration;\n switchboardConfiguration: SwitchboardConfiguration;\n scopeConfiguration: ScopeConfiguration;\n} {\n let pythConfiguration = new PythConfiguration({\n price: NULL_PUBKEY,\n });\n let switchboardConfiguration = new SwitchboardConfiguration({\n priceAggregator: NULL_PUBKEY,\n twapAggregator: NULL_PUBKEY,\n });\n let scopeConfiguration = new ScopeConfiguration({\n priceFeed: NULL_PUBKEY,\n priceChain: [65535, 65535, 65535, 65535],\n twapChain: [65535, 65535, 65535, 65535],\n });\n\n if (priceFeed) {\n const { scopePriceConfigAddress, scopeChain, scopeTwapChain, pythPrice, switchboardPrice, switchboardTwapPrice } =\n priceFeed;\n if (pythPrice) {\n pythConfiguration = new PythConfiguration({ price: pythPrice });\n }\n if (switchboardPrice) {\n switchboardConfiguration = new SwitchboardConfiguration({\n priceAggregator: switchboardPrice ? switchboardPrice : NULL_PUBKEY,\n twapAggregator: switchboardTwapPrice ? switchboardTwapPrice : NULL_PUBKEY,\n });\n }\n if (scopePriceConfigAddress) {\n scopeConfiguration = new ScopeConfiguration({\n priceFeed: scopePriceConfigAddress,\n priceChain: scopeChain!.concat(Array(4 - scopeChain!.length).fill(U16_MAX)),\n twapChain: scopeTwapChain!.concat(Array(4 - scopeTwapChain!.length).fill(U16_MAX)),\n });\n }\n }\n return {\n pythConfiguration,\n switchboardConfiguration,\n scopeConfiguration,\n };\n}\n\nexport function parseOracleType(type: number): string {\n switch (type) {\n case new OracleType.Pyth().discriminator:\n return 'Pyth';\n case new OracleType.SwitchboardV2().discriminator:\n return 'SwitchboardV2';\n case new OracleType.CToken().discriminator:\n return 'CToken';\n case new OracleType.KToken().discriminator:\n return 'KToken';\n case new OracleType.SplStake().discriminator:\n return 'SplStake';\n case new OracleType.PythEMA().discriminator:\n return 'PythEMA';\n case new OracleType.DeprecatedPlaceholder1().discriminator:\n return 'DeprecatedPlaceholder1';\n case new OracleType.DeprecatedPlaceholder2().discriminator:\n return 'DeprecatedPlaceholder2';\n case new OracleType.MsolStake().discriminator:\n return 'MsolStake';\n case new OracleType.KTokenToTokenA().discriminator:\n return 'KTokenToTokenA';\n case new OracleType.KTokenToTokenB().discriminator:\n return 'KTokenToTokenB';\n case new OracleType.JupiterLpFetch().discriminator:\n return 'JupiterLpFetch';\n case new OracleType.ScopeTwap().discriminator:\n return 'ScopeTwap';\n case new OracleType.OrcaWhirlpoolAtoB().discriminator:\n return 'OrcaWhirlpoolAtoB';\n case new OracleType.OrcaWhirlpoolBtoA().discriminator:\n return 'OrcaWhirlpoolBtoA';\n case new OracleType.RaydiumAmmV3AtoB().discriminator:\n return 'RaydiumAmmV3AtoB';\n case new OracleType.RaydiumAmmV3BtoA().discriminator:\n return 'RaydiumAmmV3BtoA';\n case new OracleType.JupiterLpCompute().discriminator:\n return 'JupiterLpCompute';\n case new OracleType.MeteoraDlmmAtoB().discriminator:\n return 'MeteoraDlmmAtoB';\n case new OracleType.MeteoraDlmmBtoA().discriminator:\n return 'MeteoraDlmmBtoA';\n case new OracleType.JupiterLpScope().discriminator:\n return 'JupiterLpScope';\n case new OracleType.PythPullBased().discriminator:\n return 'PythPullBased';\n case new OracleType.PythPullBasedEMA().discriminator:\n return 'PythPullBasedEMA';\n case new OracleType.FixedPrice().discriminator:\n return 'FixedPrice';\n default:\n return 'Unknown';\n }\n}\n\nexport type MarketWithAddress = {\n address: PublicKey;\n state: LendingMarket;\n};\n"]}
1
+ {"version":3,"file":"managerTypes.js","sourceRoot":"","sources":["../../src/utils/managerTypes.ts"],"names":[],"mappings":";;;;;;AAgWA,0DA2CC;AAED,0CAqDC;AAjcD,gDAY8B;AAC9B,4DAAiC;AACjC,kDAA8D;AAC9D,kDAAuB;AACvB,wCAAqD;AACrD,qCAAuC;AACvC,yDAAgE;AAmChE,MAAa,kBAAkB;IAO7B,YAAY,MAWX;QACC,I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O,iBAAiB,CAAC;QAC3B,KAAK,IAAI,sBAAU,CAAC,cAAc,EAAE,CAAC,aAAa;YAChD,OAAO,gBAAgB,CAAC;QAC1B,KAAK,IAAI,sBAAU,CAAC,aAAa,EAAE,CAAC,aAAa;YAC/C,OAAO,eAAe,CAAC;QACzB,KAAK,IAAI,sBAAU,CAAC,gBAAgB,EAAE,CAAC,aAAa;YAClD,OAAO,kBAAkB,CAAC;QAC5B,KAAK,IAAI,sBAAU,CAAC,UAAU,EAAE,CAAC,aAAa;YAC5C,OAAO,YAAY,CAAC;QACtB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC","sourcesContent":["import { PublicKey } from '@solana/web3.js';\nimport {\n BorrowRateCurve,\n BorrowRateCurveFields,\n CurvePoint,\n PriceHeuristic,\n PythConfiguration,\n ReserveConfig,\n ReserveConfigFields,\n ScopeConfiguration,\n SwitchboardConfiguration,\n TokenInfo,\n WithdrawalCaps,\n} from '../idl_codegen/types';\nimport Decimal from 'decimal.js';\nimport { Fraction, ZERO_FRACTION } from '../classes/fraction';\nimport BN from 'bn.js';\nimport { numberToLamportsDecimal } from '../classes';\nimport { NULL_PUBKEY } from './pubkey';\nimport { OracleType, U16_MAX } from '@hubbleprotocol/scope-sdk';\nimport { LendingMarket } from '../lib';\n\nexport type ScopeOracleConfig = {\n scopePriceConfigAddress: PublicKey;\n name: string;\n oracleType: string;\n oracleId: number;\n oracleAccount: PublicKey;\n twapEnabled: boolean;\n twapSourceId: number;\n max_age: number;\n};\n\nexport type CreateKaminoMarketParams = {\n admin: PublicKey;\n};\n\nexport type AddAssetToMarketParams = {\n admin: PublicKey;\n marketAddress: PublicKey;\n assetConfig: AssetConfig;\n};\n\nexport interface AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void;\n getReserveConfig(): ReserveConfig;\n}\n\nexport class AssetReserveConfig implements AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n constructor(fields: {\n mint: PublicKey;\n mintTokenProgram: PublicKey;\n tokenName: string;\n mintDecimals: number;\n priceFeed: PriceFeed;\n loanToValuePct: number;\n liquidationThresholdPct: number;\n borrowRateCurve: BorrowRateCurve;\n depositLimit: Decimal;\n borrowLimit: Decimal;\n }) {\n this.mint = fields.mint;\n this.tokenName = fields.tokenName;\n this.mintDecimals = fields.mintDecimals;\n this.mintTokenProgram = fields.mintTokenProgram;\n\n // TODO: verify defaults and ensure opinionated\n this.assetReserveConfigParams = DefaultConfigParams;\n this.assetReserveConfigParams.priceFeed = fields.priceFeed;\n this.assetReserveConfigParams.loanToValuePct = fields.loanToValuePct;\n this.assetReserveConfigParams.liquidationThresholdPct = fields.liquidationThresholdPct;\n this.assetReserveConfigParams.borrowRateCurve = fields.borrowRateCurve;\n this.assetReserveConfigParams.depositLimit = fields.depositLimit;\n this.assetReserveConfigParams.borrowLimit = fields.borrowLimit;\n }\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void {\n this.assetReserveConfigParams = assetReserveConfigParams;\n }\n\n getReserveConfig(): ReserveConfig {\n return buildReserveConfig({\n configParams: this.assetReserveConfigParams,\n mintDecimals: this.mintDecimals,\n tokenName: this.tokenName,\n });\n }\n}\n\nexport class AssetReserveConfigCli implements AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n private reserveConfig: ReserveConfig | undefined;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n constructor(mint: PublicKey, mintTokenProgram: PublicKey, reserveConfig: ReserveConfig) {\n this.reserveConfig = reserveConfig;\n this.tokenName = '';\n this.mintDecimals = 0;\n this.assetReserveConfigParams = DefaultConfigParams;\n this.mint = mint;\n this.mintTokenProgram = mintTokenProgram;\n }\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void {\n this.assetReserveConfigParams = assetReserveConfigParams;\n }\n\n setReserveConfig(reserveConfig: ReserveConfig) {\n this.reserveConfig = reserveConfig;\n }\n\n getReserveConfig(): ReserveConfig {\n return this.reserveConfig\n ? this.reserveConfig\n : buildReserveConfig({\n configParams: this.assetReserveConfigParams,\n mintDecimals: this.mintDecimals,\n tokenName: this.tokenName,\n });\n }\n}\n\nexport class CollateralConfig implements AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n constructor(fields: {\n mint: PublicKey;\n mintTokenProgram: PublicKey;\n tokenName: string;\n mintDecimals: number;\n priceFeed: PriceFeed;\n loanToValuePct: number;\n liquidationThresholdPct: number;\n }) {\n this.mint = fields.mint;\n this.tokenName = fields.tokenName;\n this.mintDecimals = fields.mintDecimals;\n this.mintTokenProgram = fields.mintTokenProgram;\n\n // TODO: verify defaults and ensure opinionated\n this.assetReserveConfigParams = DefaultConfigParams;\n this.assetReserveConfigParams.priceFeed = fields.priceFeed;\n this.assetReserveConfigParams.loanToValuePct = fields.loanToValuePct;\n this.assetReserveConfigParams.liquidationThresholdPct = fields.liquidationThresholdPct;\n this.assetReserveConfigParams.borrowLimit = new Decimal(0);\n }\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void {\n this.assetReserveConfigParams = assetReserveConfigParams;\n }\n\n getReserveConfig(): ReserveConfig {\n return buildReserveConfig({\n configParams: this.assetReserveConfigParams,\n mintDecimals: this.mintDecimals,\n tokenName: this.tokenName,\n });\n }\n}\n\nexport class DebtConfig implements AssetConfig {\n readonly mint: PublicKey;\n readonly tokenName: string;\n readonly mintDecimals: number;\n readonly mintTokenProgram: PublicKey;\n assetReserveConfigParams: AssetReserveConfigParams;\n\n constructor(fields: {\n mint: PublicKey;\n mintTokenProgram: PublicKey;\n tokenName: string;\n mintDecimals: number;\n priceFeed: PriceFeed;\n borrowRateCurve: BorrowRateCurve;\n }) {\n this.mint = fields.mint;\n this.tokenName = fields.tokenName;\n this.mintDecimals = fields.mintDecimals;\n this.mintTokenProgram = fields.mintTokenProgram;\n\n // TODO: verify defaults and ensure opinionated\n this.assetReserveConfigParams = DefaultConfigParams;\n this.assetReserveConfigParams.priceFeed = fields.priceFeed;\n this.assetReserveConfigParams.borrowRateCurve = fields.borrowRateCurve;\n }\n\n setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void {\n this.assetReserveConfigParams = assetReserveConfigParams;\n }\n\n getReserveConfig(): ReserveConfig {\n return buildReserveConfig({\n configParams: this.assetReserveConfigParams,\n mintDecimals: this.mintDecimals,\n tokenName: this.tokenName,\n });\n }\n}\n\nexport type PriceFeed = {\n scopePriceConfigAddress?: PublicKey;\n scopeChain?: number[];\n scopeTwapChain?: number[];\n pythPrice?: PublicKey;\n switchboardPrice?: PublicKey;\n switchboardTwapPrice?: PublicKey;\n};\n\nexport type AssetReserveConfigParams = {\n loanToValuePct: number;\n depositLimit: Decimal;\n borrowLimit: Decimal;\n maxLiquidationBonusBps: number;\n minLiquidationBonusBps: number;\n badDebtLiquidationBonusBps: number;\n liquidationThresholdPct: number;\n borrowFeeSf: Fraction;\n flashLoanFeeSf: Fraction;\n protocolTakeRate: number;\n elevationGroups: number[];\n priceFeed: PriceFeed | null;\n maxAgePriceSeconds: number;\n maxAgeTwapSeconds: number;\n borrowRateCurve: BorrowRateCurve;\n};\n\nexport const DefaultConfigParams: AssetReserveConfigParams = {\n loanToValuePct: 70,\n maxLiquidationBonusBps: 500,\n minLiquidationBonusBps: 200,\n badDebtLiquidationBonusBps: 10,\n liquidationThresholdPct: 75,\n borrowFeeSf: ZERO_FRACTION,\n flashLoanFeeSf: ZERO_FRACTION,\n protocolTakeRate: 0,\n elevationGroups: [0, 0, 0, 0, 0],\n priceFeed: null,\n borrowLimit: new Decimal(1000.0),\n depositLimit: new Decimal(1000.0),\n borrowRateCurve: new BorrowRateCurve({\n points: [\n new CurvePoint({ utilizationRateBps: 0, borrowRateBps: 1000 }),\n new CurvePoint({ utilizationRateBps: 10000, borrowRateBps: 1000 }),\n ...Array(9).fill(new CurvePoint({ utilizationRateBps: 10000, borrowRateBps: 1000 })),\n ],\n } as BorrowRateCurveFields),\n maxAgePriceSeconds: 180,\n maxAgeTwapSeconds: 240,\n};\n\nexport const encodeTokenName = (tokenName: string): number[] => {\n const buffer: Buffer = Buffer.alloc(32);\n\n const tokenNameEncoded = new Uint8Array(32);\n const s: Uint8Array = new TextEncoder().encode(tokenName);\n tokenNameEncoded.set(s);\n for (let i = 0; i < tokenNameEncoded.length; i++) {\n buffer[i] = tokenNameEncoded[i];\n }\n\n const result = [...buffer];\n return result;\n};\n\nfunction buildReserveConfig(fields: {\n configParams: AssetReserveConfigParams;\n mintDecimals: number;\n tokenName: string;\n}): ReserveConfig {\n const reserveConfigFields: ReserveConfigFields = {\n status: 0,\n loanToValuePct: fields.configParams.loanToValuePct,\n liquidationThresholdPct: fields.configParams.liquidationThresholdPct,\n minLiquidationBonusBps: fields.configParams.minLiquidationBonusBps,\n protocolLiquidationFeePct: 0,\n protocolTakeRatePct: fields.configParams.protocolTakeRate,\n assetTier: 0,\n maxLiquidationBonusBps: fields.configParams.maxLiquidationBonusBps,\n badDebtLiquidationBonusBps: fields.configParams.badDebtLiquidationBonusBps,\n fees: {\n borrowFeeSf: fields.configParams.borrowFeeSf.getValue(),\n flashLoanFeeSf: fields.configParams.flashLoanFeeSf.getValue(),\n padding: Array(6).fill(0),\n },\n depositLimit: new BN(\n numberToLamportsDecimal(fields.configParams.depositLimit, fields.mintDecimals).floor().toString()\n ),\n borrowLimit: new BN(\n numberToLamportsDecimal(fields.configParams.borrowLimit, fields.mintDecimals).floor().toString()\n ),\n tokenInfo: {\n name: encodeTokenName(fields.tokenName),\n heuristic: new PriceHeuristic({\n lower: new BN(0),\n upper: new BN(0),\n exp: new BN(0),\n }),\n maxTwapDivergenceBps: new BN(0),\n maxAgePriceSeconds: new BN(fields.configParams.maxAgePriceSeconds),\n maxAgeTwapSeconds: new BN(fields.configParams.maxAgeTwapSeconds),\n ...getReserveOracleConfigs(fields.configParams.priceFeed),\n padding: Array(20).fill(new BN(0)),\n } as TokenInfo,\n borrowRateCurve: fields.configParams.borrowRateCurve,\n depositWithdrawalCap: new WithdrawalCaps({\n configCapacity: new BN(0),\n currentTotal: new BN(0),\n lastIntervalStartTimestamp: new BN(0),\n configIntervalLengthSeconds: new BN(0),\n }),\n debtWithdrawalCap: new WithdrawalCaps({\n configCapacity: new BN(0),\n currentTotal: new BN(0),\n lastIntervalStartTimestamp: new BN(0),\n configIntervalLengthSeconds: new BN(0),\n }),\n deleveragingMarginCallPeriodSecs: new BN(0),\n borrowFactorPct: new BN(100),\n elevationGroups: fields.configParams.elevationGroups,\n deleveragingThresholdSlotsPerBps: new BN(7200),\n disableUsageAsCollOutsideEmode: 0,\n utilizationLimitBlockBorrowingAbove: 0,\n hostFixedInterestRateBps: 0,\n borrowLimitOutsideElevationGroup: new BN(0),\n borrowLimitAgainstThisCollateralInElevationGroup: Array(32).fill(new BN(0)),\n reserved1: Array(2).fill(0),\n reserved2: Array(2).fill(0),\n reserved3: Array(8).fill(0),\n };\n\n return new ReserveConfig(reserveConfigFields);\n}\n\nexport function getReserveOracleConfigs(priceFeed: PriceFeed | null): {\n pythConfiguration: PythConfiguration;\n switchboardConfiguration: SwitchboardConfiguration;\n scopeConfiguration: ScopeConfiguration;\n} {\n let pythConfiguration = new PythConfiguration({\n price: NULL_PUBKEY,\n });\n let switchboardConfiguration = new SwitchboardConfiguration({\n priceAggregator: NULL_PUBKEY,\n twapAggregator: NULL_PUBKEY,\n });\n let scopeConfiguration = new ScopeConfiguration({\n priceFeed: NULL_PUBKEY,\n priceChain: [65535, 65535, 65535, 65535],\n twapChain: [65535, 65535, 65535, 65535],\n });\n\n if (priceFeed) {\n const { scopePriceConfigAddress, scopeChain, scopeTwapChain, pythPrice, switchboardPrice, switchboardTwapPrice } =\n priceFeed;\n if (pythPrice) {\n pythConfiguration = new PythConfiguration({ price: pythPrice });\n }\n if (switchboardPrice) {\n switchboardConfiguration = new SwitchboardConfiguration({\n priceAggregator: switchboardPrice ? switchboardPrice : NULL_PUBKEY,\n twapAggregator: switchboardTwapPrice ? switchboardTwapPrice : NULL_PUBKEY,\n });\n }\n if (scopePriceConfigAddress) {\n scopeConfiguration = new ScopeConfiguration({\n priceFeed: scopePriceConfigAddress,\n priceChain: scopeChain!.concat(Array(4 - scopeChain!.length).fill(U16_MAX)),\n twapChain: scopeTwapChain!.concat(Array(4 - scopeTwapChain!.length).fill(U16_MAX)),\n });\n }\n }\n return {\n pythConfiguration,\n switchboardConfiguration,\n scopeConfiguration,\n };\n}\n\nexport function parseOracleType(type: number): string {\n switch (type) {\n case new OracleType.Pyth().discriminator:\n return 'Pyth';\n case new OracleType.SwitchboardV2().discriminator:\n return 'SwitchboardV2';\n case new OracleType.CToken().discriminator:\n return 'CToken';\n case new OracleType.KToken().discriminator:\n return 'KToken';\n case new OracleType.SplStake().discriminator:\n return 'SplStake';\n case new OracleType.PythEMA().discriminator:\n return 'PythEMA';\n case new OracleType.DeprecatedPlaceholder1().discriminator:\n return 'DeprecatedPlaceholder1';\n case new OracleType.DeprecatedPlaceholder2().discriminator:\n return 'DeprecatedPlaceholder2';\n case new OracleType.MsolStake().discriminator:\n return 'MsolStake';\n case new OracleType.KTokenToTokenA().discriminator:\n return 'KTokenToTokenA';\n case new OracleType.KTokenToTokenB().discriminator:\n return 'KTokenToTokenB';\n case new OracleType.JupiterLpFetch().discriminator:\n return 'JupiterLpFetch';\n case new OracleType.ScopeTwap().discriminator:\n return 'ScopeTwap';\n case new OracleType.OrcaWhirlpoolAtoB().discriminator:\n return 'OrcaWhirlpoolAtoB';\n case new OracleType.OrcaWhirlpoolBtoA().discriminator:\n return 'OrcaWhirlpoolBtoA';\n case new OracleType.RaydiumAmmV3AtoB().discriminator:\n return 'RaydiumAmmV3AtoB';\n case new OracleType.RaydiumAmmV3BtoA().discriminator:\n return 'RaydiumAmmV3BtoA';\n case new OracleType.JupiterLpCompute().discriminator:\n return 'JupiterLpCompute';\n case new OracleType.MeteoraDlmmAtoB().discriminator:\n return 'MeteoraDlmmAtoB';\n case new OracleType.MeteoraDlmmBtoA().discriminator:\n return 'MeteoraDlmmBtoA';\n case new OracleType.JupiterLpScope().discriminator:\n return 'JupiterLpScope';\n case new OracleType.PythPullBased().discriminator:\n return 'PythPullBased';\n case new OracleType.PythPullBasedEMA().discriminator:\n return 'PythPullBasedEMA';\n case new OracleType.FixedPrice().discriminator:\n return 'FixedPrice';\n default:\n return 'Unknown';\n }\n}\n\nexport type MarketWithAddress = {\n address: PublicKey;\n state: LendingMarket;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kamino-finance/klend-sdk",
3
- "version": "3.2.18",
3
+ "version": "3.2.20",
4
4
  "description": "Typescript SDK for interacting with the Kamino Lending (klend) protocol",
5
5
  "repository": {
6
6
  "type": "git",