@gearbox-protocol/sdk 14.12.0-next.73 → 14.12.0-next.74

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 (67) hide show
  1. package/dist/cjs/dev/AccountOpener.js +2 -5
  2. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +49 -533
  3. package/dist/cjs/sdk/accounts/index.js +0 -4
  4. package/dist/cjs/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +1 -1
  5. package/dist/cjs/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +1 -1
  6. package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +2 -2
  7. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +3 -3
  8. package/dist/cjs/sdk/accounts/liquidations/constants.js +0 -2
  9. package/dist/cjs/sdk/accounts/liquidations/index.js +0 -2
  10. package/dist/cjs/sdk/constants/index.js +1 -0
  11. package/dist/cjs/sdk/constants/math.js +5 -0
  12. package/dist/cjs/sdk/index.js +8 -4
  13. package/dist/cjs/sdk/market/MarketRegister.js +10 -0
  14. package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +181 -0
  15. package/dist/cjs/sdk/market/credit/CreditSuite.js +107 -1
  16. package/dist/cjs/sdk/{accounts → market/credit}/dominantCollateral.js +18 -4
  17. package/dist/cjs/sdk/market/credit/index.js +3 -0
  18. package/dist/cjs/sdk/market/index.js +3 -0
  19. package/dist/cjs/sdk/market/math.js +59 -0
  20. package/dist/cjs/sdk/market/oracle/PriceOracleV310Contract.js +2 -9
  21. package/dist/cjs/sdk/opportunities/index.js +4 -0
  22. package/dist/esm/dev/AccountOpener.js +2 -5
  23. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +50 -534
  24. package/dist/esm/sdk/accounts/index.js +1 -3
  25. package/dist/esm/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +1 -1
  26. package/dist/esm/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +1 -1
  27. package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +2 -2
  28. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +2 -2
  29. package/dist/esm/sdk/accounts/liquidations/constants.js +1 -2
  30. package/dist/esm/sdk/accounts/liquidations/index.js +1 -2
  31. package/dist/esm/sdk/constants/index.js +2 -2
  32. package/dist/esm/sdk/constants/math.js +5 -1
  33. package/dist/esm/sdk/index.js +4 -5
  34. package/dist/esm/sdk/market/MarketRegister.js +10 -0
  35. package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +181 -0
  36. package/dist/esm/sdk/market/credit/CreditSuite.js +108 -2
  37. package/dist/esm/sdk/{accounts → market/credit}/dominantCollateral.js +18 -5
  38. package/dist/esm/sdk/market/credit/index.js +2 -1
  39. package/dist/esm/sdk/market/index.js +2 -1
  40. package/dist/esm/sdk/market/math.js +56 -1
  41. package/dist/esm/sdk/market/oracle/PriceOracleV310Contract.js +3 -10
  42. package/dist/esm/sdk/opportunities/index.js +2 -2
  43. package/dist/types/sdk/OnchainSDK.d.ts +1 -1
  44. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +11 -78
  45. package/dist/types/sdk/accounts/index.d.ts +2 -4
  46. package/dist/types/sdk/accounts/liquidations/constants.d.ts +1 -2
  47. package/dist/types/sdk/accounts/liquidations/index.d.ts +1 -2
  48. package/dist/types/sdk/accounts/types.d.ts +42 -346
  49. package/dist/types/sdk/constants/index.d.ts +2 -2
  50. package/dist/types/sdk/constants/math.d.ts +5 -1
  51. package/dist/types/sdk/index.d.ts +10 -11
  52. package/dist/types/sdk/market/MarketRegister.d.ts +7 -0
  53. package/dist/types/sdk/market/credit/CreditFacadeV310Contract.d.ts +47 -2
  54. package/dist/types/sdk/market/credit/CreditSuite.d.ts +24 -2
  55. package/dist/types/sdk/{accounts → market/credit}/dominantCollateral.d.ts +13 -6
  56. package/dist/types/sdk/market/credit/index.d.ts +3 -2
  57. package/dist/types/sdk/market/credit/types.d.ts +112 -2
  58. package/dist/types/sdk/market/index.d.ts +3 -2
  59. package/dist/types/sdk/market/math.d.ts +60 -1
  60. package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +1 -0
  61. package/dist/types/sdk/market/rwa/securitize/SecuritizeRWAFactory.d.ts +1 -1
  62. package/dist/types/sdk/market/rwa/types.d.ts +1 -1
  63. package/dist/types/sdk/opportunities/index.d.ts +2 -2
  64. package/package.json +1 -1
  65. package/dist/cjs/sdk/accounts/constants.js +0 -12
  66. package/dist/esm/sdk/accounts/constants.js +0 -11
  67. package/dist/types/sdk/accounts/constants.d.ts +0 -11
@@ -18,7 +18,7 @@ import { EtherscanURLParam, etherscanApiUrl, etherscanUrl } from "./utils/ethers
18
18
  import { ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, NO_VERSION } from "./constants/address-provider.js";
19
19
  import { ADDRESS_0X0, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED } from "./constants/addresses.js";
20
20
  import { BotPermissions, botPermissionsToString } from "./constants/bot-permissions.js";
21
- import { LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, PRICE_DECIMALS_POW, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, WAD, WAD_DECIMALS_POW, halfRAY } from "./constants/math.js";
21
+ import { DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PRICE_DECIMALS, PRICE_DECIMALS_POW, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, WAD, WAD_DECIMALS_POW, halfRAY } from "./constants/math.js";
22
22
  import { BLOCKS_PER_WEEK_BY_NETWORK, RAMP_DURATION_BY_NETWORK } from "./constants/networks.js";
23
23
  import { PERIPHERY_CONTRACTS, PeripheryContract } from "./constants/periphery.js";
24
24
  import { VERSION_RANGE_310, VersionRange, isV310, isVersionRange } from "./constants/versions.js";
@@ -41,6 +41,10 @@ import { WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, watchBlocksAsyn
41
41
  import "./utils/viem/index.js";
42
42
  import { PHANTOM_TOKEN_SECURITIZE_REDEMPTION, RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE } from "./market/rwa/securitize/constants.js";
43
43
  import { SecuritizeLiquidatorContract } from "./market/rwa/securitize/SecuritizeLiquidatorContract.js";
44
+ import { IRWAFactory, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_TYPES, isRWAFactory } from "./market/rwa/types.js";
45
+ import { DStokenData, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./market/rwa/securitize/types.js";
46
+ import { SecuritizeRWAFactory } from "./market/rwa/securitize/SecuritizeRWAFactory.js";
47
+ import { RWARegistry } from "./market/rwa/RWARegistry.js";
44
48
  import { ClosePathBalances, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, IRouterContract, OpenStrategyResult, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, SwapOperation } from "./router/types.js";
45
49
  import { createRouter } from "./router/createRouter.js";
46
50
  import { assetsMap } from "./router/helpers.js";
@@ -56,11 +60,7 @@ import { RedemptionLoggerV310Contract } from "./accounts/withdrawal-compressor/R
56
60
  import { WithdrawalCompressorV310Contract } from "./accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js";
57
61
  import { WithdrawalCompressorV311Contract } from "./accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js";
58
62
  import { WithdrawalCompressorV313Contract } from "./accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js";
59
- import { AccountToCheck, AddCollateralProps, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, CreditAccountFilter, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerFilter, CreditManagerOperationResult, DefaultPartialLiquidationParams, EncodableCreditAccountOperation, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, Rewards, SetBotProps, StartDelayedWithdrawalProps, UpdateQuotasProps, WithdrawCollateralProps } from "./accounts/types.js";
60
- import { IRWAFactory, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_TYPES, isRWAFactory } from "./market/rwa/types.js";
61
- import { DStokenData, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./market/rwa/securitize/types.js";
62
- import { SecuritizeRWAFactory } from "./market/rwa/securitize/SecuritizeRWAFactory.js";
63
- import { RWARegistry } from "./market/rwa/RWARegistry.js";
63
+ import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CloseCreditAccountResult, CreditAccountFilter, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerFilter, CreditManagerOperationResult, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps } from "./accounts/types.js";
64
64
  import { AddressProviderV3StateHuman, AliasLossPolicyStateHuman, AssetPriceFeedStateHuman, BalancerWeightedPriceFeedStateHuman, BaseContractStateHuman, BasePriceFeedStateHuman, BotListStateHuman, BoundedOracleStateHuman, ConstantOracleStateHuman, CoreStateHuman, CreditConfiguratorStateHuman, CreditFacadeStateHuman, CreditManagerDebtParamsHuman, CreditManagerStateHuman, CreditSuiteStateHuman, GaugeParamsHuman, GaugeStateHuman, GearStakingV3StateHuman, GearboxStateHuman, InterestRateModelStateHuman, LPPriceFeedStateHuman, LinearInterestRateModelStateHuman, LossPolicyStateHuman, MarketStateHuman, MultichainStateHuman, PoolQuotaKeeperStateHuman, PoolStateHuman, PoolSuiteStateHuman, PriceFeedStateHuman, PriceOracleStateHuman, QuotaParamsHuman, RateKeeperStateHuman, RedstonePriceFeedStateHuman, TumblerStateHuman, ZapperStateHuman } from "./types/state-human.js";
65
65
  import { IPriceFeedContract, IUpdatablePriceFeedContract, PriceFeedContractType, PriceFeedUsageType, PriceUpdate, UpdatePriceFeedsResult } from "./market/pricefeeds/types.js";
66
66
  import { PriceFeedRef } from "./market/pricefeeds/PriceFeedRef.js";
@@ -88,7 +88,7 @@ import { RedstonePriceFeedContract } from "./market/pricefeeds/RedstonePriceFeed
88
88
  import { WstETHPriceFeedContract } from "./market/pricefeeds/WstETHPriceFeed.js";
89
89
  import { YearnPriceFeedContract } from "./market/pricefeeds/YearnPriceFeed.js";
90
90
  import { ZeroPriceFeedContract } from "./market/pricefeeds/ZeroPriceFeed.js";
91
- import { ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract } from "./market/credit/types.js";
91
+ import { BalanceDelta, CreditAccountTokenQuota, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, LiquidationFees, PartialLiquidationParams } from "./market/credit/types.js";
92
92
  import { CreditConfiguratorV310Contract, RampEvent } from "./market/credit/CreditConfiguratorV310Contract.js";
93
93
  import { CreditFacadeV310Abi as abi, CreditFacadeV310BaseContract } from "./market/credit/CreditFacadeV310BaseContract.js";
94
94
  import { CreditFacadeV310Contract } from "./market/credit/CreditFacadeV310Contract.js";
@@ -103,6 +103,7 @@ import { PoolSuite } from "./market/pool/PoolSuite.js";
103
103
  import { PoolV310Contract } from "./market/pool/PoolV310Contract.js";
104
104
  import { MarketSuite, StrategyRef } from "./market/MarketSuite.js";
105
105
  import { CreditSuite } from "./market/credit/CreditSuite.js";
106
+ import { dominantCollateral, mustGetDominantCollateral } from "./market/credit/dominantCollateral.js";
106
107
  import { ZapperData } from "./market/types.js";
107
108
  import { IZapperContract, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem } from "./market/zapper/types.js";
108
109
  import { createZapper } from "./market/zapper/createZapper.js";
@@ -112,7 +113,7 @@ import { IERC20ZapperContract } from "./market/zapper/IERC20ZapperContract.js";
112
113
  import { IETHZapperContract } from "./market/zapper/IETHZapperContract.js";
113
114
  import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./market/MarketRegister.js";
114
115
  import "./market/index.js";
115
- import { additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, positionLeverage, rayToBps, usdToNumber, utilizationBps } from "./market/math.js";
116
+ import { OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps } from "./market/math.js";
116
117
  import { MultichainOpportunitiesService } from "./opportunities/MultichainOpportunitiesService.js";
117
118
  import { OpportunitiesService } from "./opportunities/OpportunitiesService.js";
118
119
  import "./opportunities/index.js";
@@ -155,8 +156,6 @@ import { PlaceholderContract } from "./base/PlaceholderContract.js";
155
156
  import { SDKConstruct } from "./base/SDKConstruct.js";
156
157
  import "./base/index.js";
157
158
  import { CreditAccountServiceOptions, CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.js";
158
- import { DUST_THRESHOLD } from "./accounts/constants.js";
159
- import { dominantCollateral } from "./accounts/dominantCollateral.js";
160
159
  import { CreditAccountSlice, IntentPreviewResult } from "./accounts/intents/types.js";
161
160
  import { primaryInstantOutput } from "./accounts/intents/operations/claim-delayed/index.js";
162
161
  import { CreditAccountOperationsService } from "./accounts/intents/index.js";
@@ -166,4 +165,4 @@ import { LiquidationsService } from "./accounts/liquidations/LiquidationsService
166
165
  import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
167
166
  import "./accounts/index.js";
168
167
  import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
169
- export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountToCheck, AdapterData, AddCollateralProps, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, ClosePathBalances, CompositePriceFeedContract, ConnectedBotData, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountData, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountServiceOptions, type CreditAccountSlice, CreditAccountTokensSlice, CreditAccountsServiceV310, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, Curator, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DefaultPartialLiquidationParams, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteSwapProps, ExternalPriceFeedContract, type FetchPythPayloadsOptions, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type IntentPreviewResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MultichainAttachOptions, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkMeta, type MultichainNetworkProps, type MultichainNetworksProps, MultichainOpportunitiesService, MultichainPositionsService, type MultichainResult, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnDemandPriceUpdates, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StartDelayedWithdrawalProps, StrategyRef, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpdateQuotasProps, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithMultichain, WithdrawCollateralProps, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodHex, additionalBorrowApyBps, assetsMap, attachOptionsSchema, borrowApyBps, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, maxLeverage, numberWithCommas, onchainSDKOptionsSchema, percentFmt, positionLeverage, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, utilizationBps, watchBlocksAsync };
168
+ export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountToCheck, AdapterData, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, ConnectedBotData, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountData, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountServiceOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsServiceV310, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, Curator, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExternalPriceFeedContract, type FetchPythPayloadsOptions, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type IntentPreviewResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MultichainAttachOptions, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkMeta, type MultichainNetworkProps, type MultichainNetworksProps, MultichainOpportunitiesService, MultichainPositionsService, type MultichainResult, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnDemandPriceUpdates, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StrategyRef, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithMultichain, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodHex, additionalBorrowApyBps, assetsMap, attachOptionsSchema, borrowApyBps, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, maxLeverage, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, positionLeverage, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, utilizationBps, watchBlocksAsync };
@@ -3,6 +3,7 @@ import { MarketData, MarketFilter } from "../base/types.js";
3
3
  import { DelegatedMulticall } from "../utils/viem/executeDelegatedMulticalls.js";
4
4
  import "../utils/viem/index.js";
5
5
  import { MarketStateHuman, ZapperStateHuman } from "../types/state-human.js";
6
+ import { ICreditFacadeContract } from "./credit/types.js";
6
7
  import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
7
8
  import { IPriceOracleContract } from "./oracle/types.js";
8
9
  import "./oracle/index.js";
@@ -104,6 +105,12 @@ declare class MarketRegister extends ZapperRegister {
104
105
  * @throws If no loaded market contains the given credit manager.
105
106
  **/
106
107
  findCreditManager(creditManager: Address): CreditSuite;
108
+ /**
109
+ * Finds a credit facade by its on-chain address.
110
+ * @param creditFacade - Credit facade contract address.
111
+ * @throws If no loaded market contains the given credit facade.
112
+ **/
113
+ findCreditFacade(creditFacade: Address): ICreditFacadeContract;
107
114
  /**
108
115
  * Finds the market that contains the given credit manager.
109
116
  * @param creditManager - Credit manager contract address.
@@ -1,8 +1,9 @@
1
- import { CreditFacadeState, CreditSuiteState } from "../../base/types.js";
1
+ import { Asset, CreditFacadeState, CreditSuiteState } from "../../base/types.js";
2
+ import { PermitResult, PrepareUpdateQuotasProps } from "../../accounts/types.js";
2
3
  import { CreditFacadeStateHuman } from "../../types/state-human.js";
3
4
  import { PriceUpdate } from "../pricefeeds/types.js";
4
5
  import "../pricefeeds/index.js";
5
- import { ICreditFacadeContract } from "./types.js";
6
+ import { BalanceDelta, CreditAccountTokenQuota, ICreditFacadeContract } from "./types.js";
6
7
  import { CreditFacadeV310Abi as abi$1, CreditFacadeV310BaseContract } from "./CreditFacadeV310BaseContract.js";
7
8
  import { MultiCall, RawTx } from "../../types/transactions.js";
8
9
  import { ConstructOptions } from "../../base/Construct.js";
@@ -23,6 +24,50 @@ declare class CreditFacadeV310Contract extends CreditFacadeV310BaseContract impl
23
24
  multicall(ca: Address, calls: MultiCall[]): RawTx;
24
25
  botMulticall(ca: Address, calls: MultiCall[]): RawTx;
25
26
  openCreditAccount(to: Address, calls: MultiCall[], referralCode: bigint): RawTx;
27
+ /**
28
+ * {@inheritDoc ICreditFacadeContract.prepareIncreaseDebt}
29
+ */
30
+ prepareIncreaseDebt(amount: bigint): MultiCall;
31
+ /**
32
+ * {@inheritDoc ICreditFacadeContract.prepareChangeDebt}
33
+ */
34
+ prepareChangeDebt(change: bigint, isDecrease: boolean): MultiCall;
35
+ /**
36
+ * {@inheritDoc ICreditFacadeContract.prepareDecreaseDebtFull}
37
+ */
38
+ prepareDecreaseDebtFull(): MultiCall;
39
+ /**
40
+ * {@inheritDoc ICreditFacadeContract.prepareWithdrawCollateral}
41
+ */
42
+ prepareWithdrawCollateral(token: Address, amount: bigint, to: Address): MultiCall;
43
+ /**
44
+ * {@inheritDoc ICreditFacadeContract.prepareAddCollateral}
45
+ */
46
+ prepareAddCollateral(assets: Asset[], permits: Record<string, PermitResult>): MultiCall[];
47
+ /**
48
+ * {@inheritDoc ICreditFacadeContract.prepareUpdateQuotas}
49
+ */
50
+ prepareUpdateQuotas({ averageQuota, minQuota }: PrepareUpdateQuotasProps): MultiCall[];
51
+ /**
52
+ * {@inheritDoc ICreditFacadeContract.prepareDisableQuotas}
53
+ */
54
+ prepareDisableQuotas(tokens: CreditAccountTokenQuota[]): MultiCall[];
55
+ /**
56
+ * {@inheritDoc ICreditFacadeContract.prepareSetBotPermissions}
57
+ */
58
+ prepareSetBotPermissions(bot: Address, permissions: bigint): MultiCall;
59
+ /**
60
+ * {@inheritDoc ICreditFacadeContract.prepareOnDemandPriceUpdates}
61
+ */
62
+ prepareOnDemandPriceUpdates(updates: PriceUpdate[]): MultiCall;
63
+ /**
64
+ * {@inheritDoc ICreditFacadeContract.prepareStoreExpectedBalances}
65
+ */
66
+ prepareStoreExpectedBalances(deltas: BalanceDelta[]): MultiCall;
67
+ /**
68
+ * {@inheritDoc ICreditFacadeContract.prepareCompareBalances}
69
+ */
70
+ prepareCompareBalances(): MultiCall;
26
71
  }
27
72
  //#endregion
28
73
  export { CreditFacadeV310Contract };
@@ -1,11 +1,11 @@
1
1
  import { Timestamp } from "../../../model/primitives.js";
2
2
  import { StrategyOpportunity, StrategyOpportunityDetail } from "../../../model/opportunities.js";
3
3
  import "../../../model/index.js";
4
- import { CreditSuiteState } from "../../base/types.js";
4
+ import { CreditAccountData, CreditSuiteState } from "../../base/types.js";
5
5
  import { IRouterContract } from "../../router/types.js";
6
6
  import "../../router/index.js";
7
7
  import { CreditSuiteStateHuman } from "../../types/state-human.js";
8
- import { ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract } from "./types.js";
8
+ import { ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, LiquidationFees, PartialLiquidationParams } from "./types.js";
9
9
  import { MarketConfiguratorContract } from "../MarketConfiguratorContract.js";
10
10
  import { MarketSuite } from "../MarketSuite.js";
11
11
  import { OnchainSDK } from "../../OnchainSDK.js";
@@ -26,6 +26,7 @@ import { Address } from "viem";
26
26
  * `creditConfigurator` for risk-parameter and adapter configuration.
27
27
  */
28
28
  declare class CreditSuite extends SDKConstruct {
29
+ #private;
29
30
  /**
30
31
  * Pool that supplies underlying liquidity to this credit manager.
31
32
  */
@@ -98,6 +99,11 @@ declare class CreditSuite extends SDKConstruct {
98
99
  * would read as 1970 rather than as "never".
99
100
  */
100
101
  get expirationDate(): Timestamp | null;
102
+ /**
103
+ * Liquidation fee pair in effect right now, resolving {@link isExpired} once
104
+ * for both.
105
+ */
106
+ liquidationFees(): LiquidationFees;
101
107
  /**
102
108
  * Whether this suite can be used right now. A paused pool blocks borrowing,
103
109
  * so the suite is unusable even when its own facade is live.
@@ -136,6 +142,22 @@ declare class CreditSuite extends SDKConstruct {
136
142
  * @param collateral - Target collateral of the position.
137
143
  */
138
144
  strategyOpportunityDetail(collateral: Address): StrategyOpportunityDetail;
145
+ /**
146
+ * Everything a partial liquidation of credit account needs, with any parameter the
147
+ * caller pinned down taken as given and the rest derived from current state.
148
+ *
149
+ * @param ca - Credit account to partially liquidate.
150
+ * @param overrides - Parameters to use instead of the derived defaults.
151
+ * @throws If a derived `tokenOut` cannot be picked, or if the seized token is
152
+ * not a collateral token of this credit manager.
153
+ */
154
+ partialLiquidationParams(ca: CreditAccountData, overrides?: PartialLiquidationParams): Required<PartialLiquidationParams>;
155
+ /**
156
+ * Health factor a partial liquidation of `ca` should target, in basis points.
157
+ *
158
+ * @param ca - Credit account to partially liquidate.
159
+ */
160
+ optimalHFForPartialLiquidation(ca: CreditAccountData): bigint;
139
161
  /**
140
162
  * Whether the facade, manager, or configurator has observed logs that require
141
163
  * a credit-suite resync.
@@ -1,9 +1,8 @@
1
- import { CreditAccountData } from "../base/types.js";
2
- import { MarketSuite } from "../market/MarketSuite.js";
3
- import "../market/index.js";
4
- import "../base/index.js";
1
+ import { CreditAccountData } from "../../base/types.js";
2
+ import { MarketSuite } from "../MarketSuite.js";
3
+ import "../../base/index.js";
5
4
  import { Address } from "viem";
6
- //#region src/sdk/accounts/dominantCollateral.d.ts
5
+ //#region src/sdk/market/credit/dominantCollateral.d.ts
7
6
  /**
8
7
  * The account's dominant collateral: the most valuable enabled non-underlying
9
8
  * token it holds above dust, by USD value.
@@ -18,5 +17,13 @@ import { Address } from "viem";
18
17
  * nothing but its underlying, or nothing the oracle can price.
19
18
  **/
20
19
  declare function dominantCollateral(account: CreditAccountData, market: MarketSuite): Address | undefined;
20
+ /**
21
+ * {@link dominantCollateral}, for callers that cannot proceed without one, such
22
+ * as picking the collateral a partial liquidation seizes.
23
+ *
24
+ * @throws If the account holds no enabled non-underlying collateral the oracle
25
+ * can price.
26
+ **/
27
+ declare function mustGetDominantCollateral(account: CreditAccountData, market: MarketSuite): Address;
21
28
  //#endregion
22
- export { dominantCollateral };
29
+ export { dominantCollateral, mustGetDominantCollateral };
@@ -1,7 +1,8 @@
1
- import { ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract } from "./types.js";
1
+ import { BalanceDelta, CreditAccountTokenQuota, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, LiquidationFees, PartialLiquidationParams } from "./types.js";
2
2
  import { CreditConfiguratorV310Contract, RampEvent } from "./CreditConfiguratorV310Contract.js";
3
3
  import { CreditFacadeV310Abi as abi, CreditFacadeV310BaseContract } from "./CreditFacadeV310BaseContract.js";
4
4
  import { CreditFacadeV310Contract } from "./CreditFacadeV310Contract.js";
5
5
  import { CreditManagerV310Contract } from "./CreditManagerV310Contract.js";
6
6
  import { CreditSuite } from "./CreditSuite.js";
7
- export { CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, RampEvent };
7
+ import { dominantCollateral, mustGetDominantCollateral } from "./dominantCollateral.js";
8
+ export { BalanceDelta, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, LiquidationFees, PartialLiquidationParams, RampEvent, dominantCollateral, mustGetDominantCollateral };
@@ -1,9 +1,10 @@
1
1
  import { Bps, Leverage } from "../../../model/primitives.js";
2
2
  import "../../../model/index.js";
3
3
  import { AddressMap } from "../../utils/AddressMap.js";
4
- import { IBaseContract } from "../../base/types.js";
4
+ import { Asset, IBaseContract } from "../../base/types.js";
5
5
  import { IAdapterContract } from "../adapters/types.js";
6
6
  import "../adapters/index.js";
7
+ import { PermitResult, PrepareUpdateQuotasProps } from "../../accounts/types.js";
7
8
  import { CreditConfiguratorStateHuman, CreditFacadeStateHuman, CreditManagerStateHuman } from "../../types/state-human.js";
8
9
  import { PriceUpdate } from "../pricefeeds/types.js";
9
10
  import "../pricefeeds/index.js";
@@ -19,6 +20,34 @@ interface ICreditConfiguratorContract extends IBaseContract {
19
20
  checkRamps: () => Promise<RampEvent[]>;
20
21
  stateHuman: (raw?: boolean) => CreditConfiguratorStateHuman;
21
22
  }
23
+ /**
24
+ * Fee parameters of a liquidation, with the suite's expiration already resolved.
25
+ **/
26
+ interface LiquidationFees {
27
+ /** Protocol's cut of the liquidated collateral, in basis points. */
28
+ feeLiquidation: Bps;
29
+ /** Price the liquidator pays for collateral, in basis points. */
30
+ liquidationDiscount: Bps;
31
+ }
32
+ /**
33
+ * Expected balance change of one token, as the facade's `storeExpectedBalances`
34
+ * takes it. Negative amounts mark tokens the multicall spends.
35
+ */
36
+ interface BalanceDelta {
37
+ token: Address;
38
+ /**
39
+ * Signed balance change, `int256` on-chain.
40
+ */
41
+ amount: bigint;
42
+ }
43
+ /**
44
+ * Quota a credit account currently holds for one token, in pool underlying
45
+ * units. Enough to decide whether the quota needs a disabling call.
46
+ */
47
+ interface CreditAccountTokenQuota {
48
+ token: Address;
49
+ quota: bigint;
50
+ }
22
51
  /**
23
52
  * Wrapper around the core credit manager contract.
24
53
  */
@@ -181,6 +210,87 @@ interface ICreditFacadeContract extends IBaseContract {
181
210
  * Builds a raw transaction that opens a new credit account.
182
211
  */
183
212
  openCreditAccount(to: Address, calls: MultiCall[], referralCode: bigint): RawTx;
213
+ /**
214
+ * Encodes an `increaseDebt` multicall entry.
215
+ */
216
+ prepareIncreaseDebt(amount: bigint): MultiCall;
217
+ /**
218
+ * Encodes an `increaseDebt` or `decreaseDebt` multicall entry.
219
+ */
220
+ prepareChangeDebt(change: bigint, isDecrease: boolean): MultiCall;
221
+ /**
222
+ * Encodes a `decreaseDebt` multicall entry that repays the whole debt.
223
+ */
224
+ prepareDecreaseDebtFull(): MultiCall;
225
+ /**
226
+ * Encodes a `withdrawCollateral` multicall entry.
227
+ */
228
+ prepareWithdrawCollateral(token: Address, amount: bigint, to: Address): MultiCall;
229
+ /**
230
+ * Encodes `addCollateral` / `addCollateralWithPermit` multicall entries, one
231
+ * per asset, using the permit when one is available for the asset's token.
232
+ */
233
+ prepareAddCollateral(assets: Asset[], permits: Record<string, PermitResult>): MultiCall[];
234
+ /**
235
+ * Encodes `updateQuota` multicall entries from average and min quota assets.
236
+ */
237
+ prepareUpdateQuotas(props: PrepareUpdateQuotasProps): MultiCall[];
238
+ /**
239
+ * Encodes `updateQuota` multicall entries that zero out the quotas the
240
+ * account currently holds.
241
+ */
242
+ prepareDisableQuotas(tokens: CreditAccountTokenQuota[]): MultiCall[];
243
+ /**
244
+ * Encodes a `setBotPermissions` multicall entry.
245
+ */
246
+ prepareSetBotPermissions(bot: Address, permissions: bigint): MultiCall;
247
+ /**
248
+ * Encodes an `onDemandPriceUpdates` multicall entry.
249
+ */
250
+ prepareOnDemandPriceUpdates(updates: PriceUpdate[]): MultiCall;
251
+ /**
252
+ * Encodes a `storeExpectedBalances` multicall entry.
253
+ */
254
+ prepareStoreExpectedBalances(deltas: BalanceDelta[]): MultiCall;
255
+ /**
256
+ * Encodes a `compareBalances` multicall entry.
257
+ */
258
+ prepareCompareBalances(): MultiCall;
259
+ }
260
+ /**
261
+ * Partial liquidation parameters a caller wants to pin down instead of letting
262
+ * {@link CreditSuite.partialLiquidationParams} derive them.
263
+ *
264
+ * @remarks
265
+ * The defaults are derived in order - `optimalHF` feeds `repaidAmount`, which
266
+ * feeds `minSeizedAmount` - so overriding one still lets the ones after it
267
+ * follow from the override.
268
+ **/
269
+ interface PartialLiquidationParams {
270
+ /**
271
+ * Collateral token to seize.
272
+ * If omitted, the most valuable enabled non-underlying collateral token
273
+ * (by oracle)
274
+ */
275
+ tokenOut?: Address;
276
+ /**
277
+ * Amount of underlying token to repay.
278
+ * If omitted, computed internally
279
+ */
280
+ repaidAmount?: bigint;
281
+ /**
282
+ * Minimum amount of `token` to seize from `creditAccount`.
283
+ * If `token` is a phantom token, it's withdrawn first, and its `depositedToken` is then sent to the liquidator.
284
+ * In this case, `minSeizedAmount` is denominated in `depositedToken`.
285
+ * If omitted, computed internally.
286
+ */
287
+ minSeizedAmount?: bigint;
288
+ /**
289
+ * Target health factor for partial liquidation (4 digits precision, 10000 = 100%).
290
+ * If omitted, defaults to {@link CreditSuite.optimalHFForPartialLiquidation}.
291
+ * Only used when `repaidAmount` is not explicitly provided.
292
+ */
293
+ optimalHF?: bigint;
184
294
  }
185
295
  //#endregion
186
- export { ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract };
296
+ export { BalanceDelta, CreditAccountTokenQuota, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, LiquidationFees, PartialLiquidationParams };
@@ -38,7 +38,7 @@ import { WstETHPriceFeedContract } from "./pricefeeds/WstETHPriceFeed.js";
38
38
  import { YearnPriceFeedContract } from "./pricefeeds/YearnPriceFeed.js";
39
39
  import { ZeroPriceFeedContract } from "./pricefeeds/ZeroPriceFeed.js";
40
40
  import "./pricefeeds/index.js";
41
- import { ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract } from "./credit/types.js";
41
+ import { BalanceDelta, CreditAccountTokenQuota, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, LiquidationFees, PartialLiquidationParams } from "./credit/types.js";
42
42
  import { CreditConfiguratorV310Contract, RampEvent } from "./credit/CreditConfiguratorV310Contract.js";
43
43
  import { CreditFacadeV310Abi as abi, CreditFacadeV310BaseContract } from "./credit/CreditFacadeV310BaseContract.js";
44
44
  import { CreditFacadeV310Contract } from "./credit/CreditFacadeV310Contract.js";
@@ -55,6 +55,7 @@ import { PoolV310Contract } from "./pool/PoolV310Contract.js";
55
55
  import "./pool/index.js";
56
56
  import { MarketSuite, StrategyRef } from "./MarketSuite.js";
57
57
  import { CreditSuite } from "./credit/CreditSuite.js";
58
+ import { dominantCollateral, mustGetDominantCollateral } from "./credit/dominantCollateral.js";
58
59
  import "./credit/index.js";
59
60
  import { ZapperData } from "./types.js";
60
61
  import { IZapperContract, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem } from "./zapper/types.js";
@@ -65,4 +66,4 @@ import { IERC20ZapperContract } from "./zapper/IERC20ZapperContract.js";
65
66
  import { IETHZapperContract } from "./zapper/IETHZapperContract.js";
66
67
  import "./zapper/index.js";
67
68
  import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./MarketRegister.js";
68
- export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DStokenData, Erc4626PriceFeedContract, ExternalPriceFeedContract, type FetchPythPayloadsOptions, type FetchRedstonePayloadsOptions, GaugeContract, GaugeParams, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InterestRateModelType, LatestUpdate, LinearInterestRateModelContract, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, OnDemandPriceUpdates, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyRef, type TimestampedCalldata, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, createAdapter, createPriceOracle, createZapper, fetchPythPayloads, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isRWAFactory, isUpdatablePriceFeed };
69
+ export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalanceDelta, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DStokenData, Erc4626PriceFeedContract, ExternalPriceFeedContract, type FetchPythPayloadsOptions, type FetchRedstonePayloadsOptions, GaugeContract, GaugeParams, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InterestRateModelType, LatestUpdate, LinearInterestRateModelContract, LiquidationFees, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, OnDemandPriceUpdates, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyRef, type TimestampedCalldata, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, createAdapter, createPriceOracle, createZapper, dominantCollateral, fetchPythPayloads, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isRWAFactory, isUpdatablePriceFeed, mustGetDominantCollateral };
@@ -98,5 +98,64 @@ declare function positionLeverage(totalDebt: bigint, totalValue: bigint): Levera
98
98
  * ```
99
99
  **/
100
100
  declare function additionalBorrowApyBps(quotaRate: Bps, leverage: Leverage): Bps;
101
+ /**
102
+ * {@link PERCENTAGE_FACTOR} less a 0.1% safety buffer.
103
+ *
104
+ * Partial liquidation amounts are computed off prices that can drift between
105
+ * quoting and execution, so both the seized and the repaid amount are pulled
106
+ * this far away from the boundary the contracts would revert on.
107
+ **/
108
+ declare const PARTIAL_LIQUIDATION_BUFFER_BPS = 9990n;
109
+ /**
110
+ * Minimum collateral a partial liquidation must seize for a given repayment,
111
+ * derived from the liquidation discount and buffered by
112
+ * {@link PARTIAL_LIQUIDATION_BUFFER_BPS}.
113
+ *
114
+ * @param tokenAmount - Repaid amount converted from underlying into the seized
115
+ * token by the oracle.
116
+ * @param liquidationDiscount - Discount in effect for this account, in basis
117
+ * points (the expired variant once the credit manager has expired).
118
+ **/
119
+ declare function minSeizedAmount(tokenAmount: bigint, liquidationDiscount: Bps): bigint;
120
+ /**
121
+ * Inputs of {@link optimalRepaidAmount}, all resolved against the account's
122
+ * market and credit manager by the caller.
123
+ **/
124
+ interface OptimalRepaidAmountProps {
125
+ /** Debt principal plus accrued interest and fees, in underlying. */
126
+ totalDebt: bigint;
127
+ /** Threshold-weighted value of the account, converted to underlying. */
128
+ twvUnderlying: bigint;
129
+ /** Credit facade's minimum debt, in underlying. */
130
+ minDebt: bigint;
131
+ /** Health factor to aim for, in basis points. */
132
+ optimalHF: bigint;
133
+ /** `liquidationDiscount - feeLiquidation`, in basis points. */
134
+ discount: bigint;
135
+ /** Liquidation threshold of the seized token, in basis points. */
136
+ ltTokenOut: bigint;
137
+ }
138
+ /**
139
+ * Amount of underlying whose repayment brings the account's health factor close
140
+ * to `optimalHF`, capped so the account keeps at least `minDebt` of debt.
141
+ *
142
+ * Ported from solidity:
143
+ * https://github.com/Gearbox-protocol/router-v3/blob/56e2d515ec6d9bb1e324e71c3708e59710779b24/contracts/liquidation/AbstractLiquidator.sol#L292
144
+ *
145
+ * @returns The repaid amount, or `0n` when the account is already healthy
146
+ * enough or carries less than the minimum debt.
147
+ * @throws If the discounted target health factor does not exceed the seized
148
+ * token's liquidation threshold, in which case no repayment improves the
149
+ * account.
150
+ **/
151
+ declare function optimalRepaidAmount({ totalDebt, twvUnderlying, minDebt, optimalHF, discount, ltTokenOut }: OptimalRepaidAmountProps): bigint;
152
+ /**
153
+ * Health factor a partial liquidation should target, in basis points: just
154
+ * above 1, by enough to cover up to 1% of borrow cost so the account does not
155
+ * fall back under water immediately.
156
+ *
157
+ * @param borrowRate - Blended borrow rate of the account, in basis points.
158
+ **/
159
+ declare function optimalHFForPartialLiquidation(borrowRate: bigint): bigint;
101
160
  //#endregion
102
- export { additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, positionLeverage, rayToBps, usdToNumber, utilizationBps };
161
+ export { OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps };
@@ -350,6 +350,7 @@ declare class PriceOracleV310Contract extends PriceOracleBaseContract<abi> {
350
350
  * @param creditFacade
351
351
  * @param updates
352
352
  * @returns
353
+ * @throws If `creditFacade` does not belong to a loaded market.
353
354
  */
354
355
  onDemandPriceUpdates(creditFacade: Address, updates?: UpdatePriceFeedsResult): OnDemandPriceUpdates;
355
356
  /**
@@ -1,8 +1,8 @@
1
1
  import { RWA_FACTORY_SECURITIZE } from "./constants.js";
2
- import { GetOpenAccountRequirementsProps } from "../../../accounts/types.js";
3
2
  import { IRWAFactory, RWACompressorInvestorData, RWAFactoryData } from "../types.js";
4
3
  import { SecuritizeDegenNFT } from "./SecuritizeDegenNFT.js";
5
4
  import { DStokenData, SecuritizeInvestorData, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactoryStateHuman } from "./types.js";
5
+ import { GetOpenAccountRequirementsProps } from "../../../accounts/types.js";
6
6
  import { MultiCall, RawTx } from "../../../types/transactions.js";
7
7
  import { OnchainSDK } from "../../../OnchainSDK.js";
8
8
  import "../../../types/index.js";
@@ -1,9 +1,9 @@
1
1
  import { iRWACompressorAbi } from "../../../abi/rwa/iRWACompressor.js";
2
2
  import { IBaseContract, Unarray } from "../../base/types.js";
3
3
  import { RWA_FACTORY_SECURITIZE } from "./securitize/constants.js";
4
- import { GetOpenAccountRequirementsProps } from "../../accounts/types.js";
5
4
  import { SecuritizeInvestorData, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactoryStateHuman } from "./securitize/types.js";
6
5
  import "./securitize/index.js";
6
+ import { GetOpenAccountRequirementsProps } from "../../accounts/types.js";
7
7
  import { MultiCall, RawTx } from "../../types/transactions.js";
8
8
  import "../../types/index.js";
9
9
  import "../../base/index.js";
@@ -1,4 +1,4 @@
1
- import { additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, positionLeverage, rayToBps, usdToNumber, utilizationBps } from "../market/math.js";
1
+ import { OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps } from "../market/math.js";
2
2
  import { MultichainOpportunitiesService } from "./MultichainOpportunitiesService.js";
3
3
  import { OpportunitiesService } from "./OpportunitiesService.js";
4
- export { MultichainOpportunitiesService, OpportunitiesService, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, positionLeverage, rayToBps, usdToNumber, utilizationBps };
4
+ export { MultichainOpportunitiesService, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "14.12.0-next.73",
3
+ "version": "14.12.0-next.74",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,12 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/sdk/accounts/constants.ts
3
- /**
4
- * Token balances at or below this threshold are treated as dust and ignored,
5
- * consistent with the rest of the SDK (see `filterDust`).
6
- *
7
- * Shared by every service that describes what a credit account holds, so that
8
- * a liquidation row and a position row agree on which balances exist at all.
9
- **/
10
- const DUST_THRESHOLD = 10n;
11
- //#endregion
12
- exports.DUST_THRESHOLD = DUST_THRESHOLD;