@gearbox-protocol/sdk 16.0.0-next.18 → 16.0.0-next.19

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 (186) hide show
  1. package/dist/cjs/common-utils/index.js +3 -21
  2. package/dist/cjs/common-utils/test-utils/index.js +4 -3
  3. package/dist/cjs/common-utils/utils/index.js +3 -22
  4. package/dist/cjs/common-utils/utils/strategies/index.js +3 -0
  5. package/dist/cjs/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +5 -5
  6. package/dist/cjs/common-utils/utils/strategies/strategy-info/credit-manager-issues.js +135 -0
  7. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +12 -23
  8. package/dist/cjs/common-utils/utils/strategies/strategy-info/index.js +3 -0
  9. package/dist/cjs/onchain/accounts/index.js +2 -3
  10. package/dist/cjs/onchain/accounts/intents/guards.js +55 -50
  11. package/dist/cjs/onchain/accounts/intents/index.js +7 -8
  12. package/dist/cjs/onchain/accounts/intents/math.js +15 -22
  13. package/dist/cjs/onchain/accounts/intents/open-strategy.js +5 -5
  14. package/dist/cjs/onchain/accounts/intents/plan.js +27 -41
  15. package/dist/cjs/onchain/accounts/intents/realize.js +14 -21
  16. package/dist/cjs/onchain/accounts/intents/tail.js +2 -2
  17. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -0
  18. package/dist/cjs/onchain/accounts/intents/view.js +1 -0
  19. package/dist/cjs/onchain/constants/index.js +1 -0
  20. package/dist/cjs/onchain/constants/math.js +11 -0
  21. package/dist/cjs/onchain/index.js +32 -3
  22. package/dist/cjs/onchain/validation/checks.js +250 -0
  23. package/dist/cjs/onchain/validation/index.js +29 -0
  24. package/dist/cjs/onchain/{accounts/intents → validation}/refusal.js +12 -1
  25. package/dist/cjs/onchain/validation/token.js +29 -0
  26. package/dist/cjs/preview/index.js +10 -0
  27. package/dist/cjs/preview/preview/buildDelayedPreview.js +1 -0
  28. package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +1 -0
  29. package/dist/cjs/preview/preview/previewOpenCreditAccount.js +1 -0
  30. package/dist/cjs/preview/validate/checkOperation.js +173 -0
  31. package/dist/cjs/preview/validate/checkSimulation.js +52 -0
  32. package/dist/cjs/preview/validate/index.js +6 -0
  33. package/dist/cjs/sdk/index.js +4 -0
  34. package/dist/cjs/sdk/prepare/PrepareApi.js +17 -13
  35. package/dist/cjs/sdk/prepare/index.js +4 -0
  36. package/dist/cjs/sdk/prepare/types.js +4 -0
  37. package/dist/esm/common-utils/index.js +2 -11
  38. package/dist/esm/common-utils/test-utils/index.js +4 -3
  39. package/dist/esm/common-utils/utils/index.js +2 -12
  40. package/dist/esm/common-utils/utils/strategies/index.js +2 -1
  41. package/dist/esm/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +5 -5
  42. package/dist/esm/common-utils/utils/strategies/strategy-info/credit-manager-issues.js +133 -0
  43. package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +12 -23
  44. package/dist/esm/common-utils/utils/strategies/strategy-info/index.js +2 -1
  45. package/dist/esm/dev/AccountOpener.js +1 -1
  46. package/dist/esm/dev/withdrawalUtils.js +1 -1
  47. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  48. package/dist/esm/onchain/accounts/index.js +2 -2
  49. package/dist/esm/onchain/accounts/intents/guards.js +55 -50
  50. package/dist/esm/onchain/accounts/intents/index.js +5 -5
  51. package/dist/esm/onchain/accounts/intents/math.js +14 -21
  52. package/dist/esm/onchain/accounts/intents/open-strategy.js +4 -4
  53. package/dist/esm/onchain/accounts/intents/plan.js +15 -29
  54. package/dist/esm/onchain/accounts/intents/realize.js +12 -19
  55. package/dist/esm/onchain/accounts/intents/tail.js +1 -1
  56. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -0
  57. package/dist/esm/onchain/accounts/intents/view.js +1 -0
  58. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  59. package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  60. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  61. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  62. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  63. package/dist/esm/onchain/base/TokensMeta.js +3 -3
  64. package/dist/esm/onchain/chain/detectNetwork.js +1 -1
  65. package/dist/esm/onchain/constants/index.js +2 -2
  66. package/dist/esm/onchain/constants/math.js +11 -1
  67. package/dist/esm/onchain/core/createAddressProvider.js +1 -1
  68. package/dist/esm/onchain/index.js +7 -3
  69. package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
  70. package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  71. package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
  72. package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
  73. package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
  74. package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
  75. package/dist/esm/onchain/pools/PoolService.js +1 -1
  76. package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
  77. package/dist/esm/onchain/validation/checks.js +230 -0
  78. package/dist/esm/onchain/validation/index.js +4 -0
  79. package/dist/esm/onchain/{accounts/intents → validation}/refusal.js +12 -2
  80. package/dist/esm/onchain/validation/token.js +27 -0
  81. package/dist/esm/preview/index.js +5 -1
  82. package/dist/esm/preview/preview/buildDelayedPreview.js +1 -0
  83. package/dist/esm/preview/preview/previewAdjustCreditAccount.js +1 -0
  84. package/dist/esm/preview/preview/previewOpenCreditAccount.js +1 -0
  85. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  86. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  87. package/dist/esm/preview/validate/checkOperation.js +171 -0
  88. package/dist/esm/preview/validate/checkSimulation.js +51 -0
  89. package/dist/esm/preview/validate/index.js +3 -0
  90. package/dist/esm/sdk/index.js +2 -1
  91. package/dist/esm/sdk/prepare/PrepareApi.js +15 -11
  92. package/dist/esm/sdk/prepare/index.js +2 -1
  93. package/dist/esm/sdk/prepare/types.js +2 -1
  94. package/dist/types/common-utils/index.d.ts +2 -12
  95. package/dist/types/common-utils/utils/index.d.ts +2 -13
  96. package/dist/types/common-utils/utils/strategies/index.d.ts +2 -1
  97. package/dist/types/common-utils/utils/strategies/strategy-info/credit-manager-issues.d.ts +34 -0
  98. package/dist/types/common-utils/utils/strategies/strategy-info/index.d.ts +2 -1
  99. package/dist/types/model/previews.d.ts +22 -0
  100. package/dist/types/onchain/accounts/index.d.ts +2 -2
  101. package/dist/types/onchain/accounts/intents/guards.d.ts +8 -4
  102. package/dist/types/onchain/accounts/intents/index.d.ts +4 -3
  103. package/dist/types/onchain/accounts/intents/math.d.ts +2 -1
  104. package/dist/types/onchain/accounts/intents/plan.d.ts +3 -0
  105. package/dist/types/onchain/accounts/intents/types.d.ts +7 -1
  106. package/dist/types/onchain/constants/index.d.ts +2 -2
  107. package/dist/types/onchain/constants/math.d.ts +9 -1
  108. package/dist/types/onchain/index.d.ts +7 -3
  109. package/dist/types/onchain/validation/checks.d.ts +167 -0
  110. package/dist/types/onchain/validation/index.d.ts +4 -0
  111. package/dist/types/onchain/{accounts/intents → validation}/refusal.d.ts +100 -31
  112. package/dist/types/onchain/validation/token.d.ts +17 -0
  113. package/dist/types/preview/index.d.ts +5 -1
  114. package/dist/types/preview/validate/checkOperation.d.ts +46 -0
  115. package/dist/types/preview/validate/checkSimulation.d.ts +34 -0
  116. package/dist/types/preview/validate/index.d.ts +3 -0
  117. package/dist/types/sdk/index.d.ts +2 -2
  118. package/dist/types/sdk/prepare/index.d.ts +2 -2
  119. package/dist/types/sdk/prepare/types.d.ts +2 -2
  120. package/package.json +1 -1
  121. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.spec.js +0 -267
  122. package/dist/cjs/common-utils/utils/validation/index.js +0 -23
  123. package/dist/cjs/common-utils/utils/validation/is-zero-balance.js +0 -7
  124. package/dist/cjs/common-utils/utils/validation/validate-balance.js +0 -22
  125. package/dist/cjs/common-utils/utils/validation/validate-balance.spec.js +0 -54
  126. package/dist/cjs/common-utils/utils/validation/validate-balances.js +0 -17
  127. package/dist/cjs/common-utils/utils/validation/validate-balances.spec.js +0 -45
  128. package/dist/cjs/common-utils/utils/validation/validate-credit-manager.js +0 -8
  129. package/dist/cjs/common-utils/utils/validation/validate-credit-manager.spec.js +0 -36
  130. package/dist/cjs/common-utils/utils/validation/validate-hf.js +0 -10
  131. package/dist/cjs/common-utils/utils/validation/validate-hf.spec.js +0 -26
  132. package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-quota-status.js +0 -14
  133. package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-quota-status.spec.js +0 -29
  134. package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.js +0 -37
  135. package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.spec.js +0 -98
  136. package/dist/cjs/common-utils/utils/validation/validate-open-account.js +0 -18
  137. package/dist/cjs/common-utils/utils/validation/validate-open-account.spec.js +0 -56
  138. package/dist/cjs/common-utils/utils/validation/validate-quota.js +0 -23
  139. package/dist/cjs/common-utils/utils/validation/validate-quota.spec.js +0 -88
  140. package/dist/cjs/common-utils/utils/validation/validate-token-to-obtain.js +0 -18
  141. package/dist/cjs/common-utils/utils/validation/validate-token-to-obtain.spec.js +0 -36
  142. package/dist/cjs/common-utils/utils/validation/validation-types.js +0 -1
  143. package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.spec.js +0 -264
  144. package/dist/esm/common-utils/utils/validation/index.js +0 -12
  145. package/dist/esm/common-utils/utils/validation/is-zero-balance.js +0 -6
  146. package/dist/esm/common-utils/utils/validation/validate-balance.js +0 -21
  147. package/dist/esm/common-utils/utils/validation/validate-balance.spec.js +0 -54
  148. package/dist/esm/common-utils/utils/validation/validate-balances.js +0 -16
  149. package/dist/esm/common-utils/utils/validation/validate-balances.spec.js +0 -45
  150. package/dist/esm/common-utils/utils/validation/validate-credit-manager.js +0 -7
  151. package/dist/esm/common-utils/utils/validation/validate-credit-manager.spec.js +0 -36
  152. package/dist/esm/common-utils/utils/validation/validate-hf.js +0 -8
  153. package/dist/esm/common-utils/utils/validation/validate-hf.spec.js +0 -26
  154. package/dist/esm/common-utils/utils/validation/validate-open-account-pool-quota-status.js +0 -13
  155. package/dist/esm/common-utils/utils/validation/validate-open-account-pool-quota-status.spec.js +0 -29
  156. package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.js +0 -36
  157. package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.spec.js +0 -98
  158. package/dist/esm/common-utils/utils/validation/validate-open-account.js +0 -17
  159. package/dist/esm/common-utils/utils/validation/validate-open-account.spec.js +0 -56
  160. package/dist/esm/common-utils/utils/validation/validate-quota.js +0 -22
  161. package/dist/esm/common-utils/utils/validation/validate-quota.spec.js +0 -88
  162. package/dist/esm/common-utils/utils/validation/validate-token-to-obtain.js +0 -17
  163. package/dist/esm/common-utils/utils/validation/validate-token-to-obtain.spec.js +0 -36
  164. package/dist/esm/common-utils/utils/validation/validation-types.js +0 -1
  165. package/dist/types/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.spec.d.ts +0 -1
  166. package/dist/types/common-utils/utils/validation/index.d.ts +0 -12
  167. package/dist/types/common-utils/utils/validation/is-zero-balance.d.ts +0 -4
  168. package/dist/types/common-utils/utils/validation/validate-balance.d.ts +0 -25
  169. package/dist/types/common-utils/utils/validation/validate-balance.spec.d.ts +0 -1
  170. package/dist/types/common-utils/utils/validation/validate-balances.d.ts +0 -13
  171. package/dist/types/common-utils/utils/validation/validate-balances.spec.d.ts +0 -1
  172. package/dist/types/common-utils/utils/validation/validate-credit-manager.d.ts +0 -13
  173. package/dist/types/common-utils/utils/validation/validate-credit-manager.spec.d.ts +0 -1
  174. package/dist/types/common-utils/utils/validation/validate-hf.d.ts +0 -12
  175. package/dist/types/common-utils/utils/validation/validate-hf.spec.d.ts +0 -1
  176. package/dist/types/common-utils/utils/validation/validate-open-account-pool-quota-status.d.ts +0 -10
  177. package/dist/types/common-utils/utils/validation/validate-open-account-pool-quota-status.spec.d.ts +0 -1
  178. package/dist/types/common-utils/utils/validation/validate-open-account-pool-status.d.ts +0 -26
  179. package/dist/types/common-utils/utils/validation/validate-open-account-pool-status.spec.d.ts +0 -1
  180. package/dist/types/common-utils/utils/validation/validate-open-account.d.ts +0 -25
  181. package/dist/types/common-utils/utils/validation/validate-open-account.spec.d.ts +0 -1
  182. package/dist/types/common-utils/utils/validation/validate-quota.d.ts +0 -24
  183. package/dist/types/common-utils/utils/validation/validate-quota.spec.d.ts +0 -1
  184. package/dist/types/common-utils/utils/validation/validate-token-to-obtain.d.ts +0 -17
  185. package/dist/types/common-utils/utils/validation/validate-token-to-obtain.spec.d.ts +0 -1
  186. package/dist/types/common-utils/utils/validation/validation-types.d.ts +0 -10
@@ -145,6 +145,17 @@ interface OpenCreditAccountPreview {
145
145
  * @example `12500` for a health factor of 1.25
146
146
  **/
147
147
  healthFactor: Bps;
148
+ /**
149
+ * The same factor with collateral valued at safe prices — the lower of each
150
+ * token's main and reserve oracle feeds, which is what the credit manager
151
+ * switches to for a call that hands funds over.
152
+ *
153
+ * Always reported, so a caller that needs the stricter reading does not have
154
+ * to recompute it; whether to hold the account to it is the caller's call.
155
+ *
156
+ * @example `11800` where `healthFactor` is `12500`
157
+ **/
158
+ safeHealthFactor: Bps;
148
159
  /**
149
160
  * Cost of the debt, broken down by source.
150
161
  **/
@@ -229,6 +240,17 @@ interface AdjustCreditAccountPreview {
229
240
  * @example `12500` for a health factor of 1.25
230
241
  **/
231
242
  healthFactor: Bps;
243
+ /**
244
+ * The same factor with collateral valued at safe prices — the lower of each
245
+ * token's main and reserve oracle feeds, which is what the credit manager
246
+ * switches to for a call that hands funds over.
247
+ *
248
+ * Always reported, so a caller that needs the stricter reading does not have
249
+ * to recompute it; whether to hold the account to it is the caller's call.
250
+ *
251
+ * @example `11800` where `healthFactor` is `12500`
252
+ **/
253
+ safeHealthFactor: Bps;
232
254
  /**
233
255
  * Cost of the debt, broken down by source.
234
256
  **/
@@ -20,9 +20,9 @@ import { AccountBotsService } from "./bots/AccountBotsService.js";
20
20
  import { PeripheryCompressorV310Contract } from "./bots/PeripheryCompressorV310Contract.js";
21
21
  import "./bots/index.js";
22
22
  import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
23
+ import { borrowable } from "./intents/guards.js";
23
24
  import { LeverageBand } from "./intents/leverage-band.js";
24
25
  import { AccountCalculatorOperation } from "./intents/operations.js";
25
- import { IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewRefusal, refuse } from "./intents/refusal.js";
26
26
  import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./intents/types.js";
27
27
  import { OpenStrategyPreview, OpenStrategyProps } from "./intents/open-strategy.js";
28
28
  import { fetchCreditAccountSlice, toCreditAccountSlice } from "./intents/utils/credit-account-slice.js";
@@ -32,4 +32,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
32
32
  import { LiquidationsService } from "./liquidations/LiquidationsService.js";
33
33
  import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
34
34
  import "./liquidations/index.js";
35
- export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EncodableCreditAccountOperation, type FinishIntentProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, type PreviewErrorDetails, type PreviewErrorReason, type PreviewRefusal, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteRefusals, SetBotProps, SetBotResult, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, refuse, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
35
+ export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EncodableCreditAccountOperation, type FinishIntentProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteRefusals, SetBotProps, SetBotResult, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, borrowable, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
@@ -2,6 +2,7 @@ import { Asset } from "../../base/types.js";
2
2
  import { MarketSuite } from "../../market/MarketSuite.js";
3
3
  import { CreditSuite } from "../../market/credit/CreditSuite.js";
4
4
  import { OnchainSDK } from "../../OnchainSDK.js";
5
+ import { BorrowLimitBinding } from "../../validation/refusal.js";
5
6
  import "../../index.js";
6
7
  //#region src/onchain/accounts/intents/guards.d.ts
7
8
  /**
@@ -29,9 +30,12 @@ declare function assertMarketOperable(suite: CreditSuite): void;
29
30
  * facade puts on a single borrow. A zero multiplier switches borrowing off
30
31
  * outright, which reads here as nothing being available.
31
32
  */
32
- declare function borrowable(suite: CreditSuite): bigint;
33
+ declare function borrowable(suite: CreditSuite): {
34
+ limit: bigint;
35
+ binding: BorrowLimitBinding;
36
+ };
33
37
  /** The pool has to be able to lend what the plan means to draw. */
34
- declare function assertCanBorrow(suite: CreditSuite, amount: bigint): void;
38
+ declare function assertCanBorrow(sdk: OnchainSDK, suite: CreditSuite, amount: bigint): void;
35
39
  /**
36
40
  * What the account is allowed to end up holding more of than it started with.
37
41
  *
@@ -63,7 +67,7 @@ declare function assertGrowthAllowed(args: {
63
67
  * - here, `1.0` — what the facade enforces, so what a plan must clear to land;
64
68
  * - `maxWithdrawCollateral` sizes at `MIN_HF_LIMITED + 2` — a *sizing* helper
65
69
  * leaving headroom, which is not the same as a validity check;
66
- * - `validateHF` refuses at or below `MIN_HF_LIMITED` — a form's own caution.
70
+ * - a form refuses at or below `MIN_HF_LIMITED` (`MIN_HEALTH_FACTOR_FORM`).
67
71
  *
68
72
  * Raising this one to `MIN_HF_LIMITED` was tried and reverted: it made
69
73
  * `maxWithdraw` hand back a ceiling this guard then refused, and it blocked
@@ -85,6 +89,6 @@ declare function assertCollateralised(healthFactorBps: number, safePrices: boole
85
89
  * A quota can only be raised as far as the market still has room for: past the
86
90
  * token's limit the keeper takes nothing more, whoever is asking.
87
91
  */
88
- declare function assertQuotaHeadroom(market: MarketSuite, increases: readonly Asset[]): void;
92
+ declare function assertQuotaHeadroom(sdk: OnchainSDK, market: MarketSuite, increases: readonly Asset[]): void;
89
93
  //#endregion
90
94
  export { assertCanBorrow, assertCollateralised, assertGrowthAllowed, assertMarketOperable, assertQuotaHeadroom, borrowable };
@@ -1,7 +1,8 @@
1
1
  import { SDKConstruct } from "../../base/SDKConstruct.js";
2
+ import { PreviewRefusal } from "../../validation/refusal.js";
3
+ import { borrowable } from "./guards.js";
2
4
  import { LeverageBand, LeverageBandProps } from "./leverage-band.js";
3
5
  import { AccountCalculatorOperation } from "./operations.js";
4
- import { IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewRefusal, refuse } from "./refusal.js";
5
6
  import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, StartIntentProps, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
6
7
  import { OpenStrategyPreview, OpenStrategyProps } from "./open-strategy.js";
7
8
  import { fetchCreditAccountSlice, toCreditAccountSlice } from "./utils/credit-account-slice.js";
@@ -93,7 +94,7 @@ declare class CreditAccountOperationsService extends SDKConstruct {
93
94
  * activity come from the account's market, valued the way the facade values
94
95
  * a call that pays out; zero debt frees the whole balance.
95
96
  *
96
- * The default is {@link MIN_HF_LIMITED}, the bar `validateHF` holds an
97
+ * The default is {@link MIN_HF_LIMITED}, the bar a form holds an
97
98
  * account to.
98
99
  *
99
100
  * @param props - Account slice, the SDK holding its market, the collateral
@@ -181,4 +182,4 @@ declare class CreditAccountOperationsService extends SDKConstruct {
181
182
  openStrategyIntent(props: OpenStrategyProps): Promise<OpenStrategyPreviewResult>;
182
183
  }
183
184
  //#endregion
184
- export { type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, CreditAccountOperationsService, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, type FinishIntentProps, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type LeverageBand, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, type PathLossRate, type PreviewErrorDetails, type PreviewErrorReason, type PreviewRefusal, type RepayStrategyIntent, type ResumableIntent, type RouteRefusals, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, fetchCreditAccountSlice, refuse, toCreditAccountSlice };
185
+ export { type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, CreditAccountOperationsService, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, type FinishIntentProps, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type LeverageBand, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, type PathLossRate, type RepayStrategyIntent, type ResumableIntent, type RouteRefusals, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, borrowable, fetchCreditAccountSlice, toCreditAccountSlice };
@@ -1,3 +1,4 @@
1
+ import { OnchainSDK } from "../../OnchainSDK.js";
1
2
  import { Address } from "viem";
2
3
  //#region src/onchain/accounts/intents/math.d.ts
3
4
  /**
@@ -42,6 +43,6 @@ declare function assertLeverageAtLeastOne(leverage: bigint): void;
42
43
  * Rejects a debt the facade would revert on: zero is always fine (no loan at
43
44
  * all), anything else has to sit inside `[minDebt, maxDebt]`.
44
45
  */
45
- declare function assertDebtInBand(debt: bigint, band: DebtBand, underlying: Address): void;
46
+ declare function assertDebtInBand(sdk: OnchainSDK, debt: bigint, band: DebtBand, underlying: Address): void;
46
47
  //#endregion
47
48
  export { DebtBand, Position, assertDebtInBand, assertLeverageAtLeastOne, debtForLeverage, maxProportionalWithdrawal, proportionalDebt };
@@ -1,6 +1,7 @@
1
1
  import { DelayedIntent } from "../../../model/delayed-intents.js";
2
2
  import "../../../model/index.js";
3
3
  import { ClaimableWithdrawal } from "../withdrawal-compressor/types.js";
4
+ import { OnchainSDK } from "../../OnchainSDK.js";
4
5
  import { AddCollateralIntent, AdjustLeverageIntent, DepositStrategyIntent, RepayStrategyIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
5
6
  import { DebtBand } from "./math.js";
6
7
  import { Address } from "viem";
@@ -100,6 +101,8 @@ type Step = {
100
101
  /** What a planner is allowed to know about the account. */
101
102
  interface AccountView {
102
103
  underlying: Address;
104
+ /** The attached SDK, for the guards that inline a token into a refusal. */
105
+ sdk: OnchainSDK;
103
106
  /** Raw asset of an RWA market (e.g. USDC behind dcUSDC); undefined otherwise. */
104
107
  rwaAsset: Address | undefined;
105
108
  debt: bigint;
@@ -7,8 +7,8 @@ import { Asset } from "../../base/types.js";
7
7
  import { RouterCASlice } from "../../router/types.js";
8
8
  import { MultiCall } from "../../types/transactions.js";
9
9
  import { OnchainSDK } from "../../OnchainSDK.js";
10
+ import { PreviewErrorReason, PreviewRefusal } from "../../validation/refusal.js";
10
11
  import { AccountCalculatorOperation } from "./operations.js";
11
- import { PreviewErrorReason, PreviewRefusal } from "./refusal.js";
12
12
  import "../../index.js";
13
13
  import { Address } from "viem";
14
14
  //#region src/onchain/accounts/intents/types.d.ts
@@ -40,6 +40,12 @@ interface OperationState {
40
40
  * @example `12500` for a health factor of 1.25
41
41
  **/
42
42
  healthFactor: Bps;
43
+ /**
44
+ * The same factor with collateral valued at safe prices, present only where
45
+ * the walk had reason to compute it — a call that hands funds over, which is
46
+ * the one the credit manager weighs at safe prices on-chain.
47
+ **/
48
+ safeHealthFactor?: Bps;
43
49
  /**
44
50
  * Cost of the debt, broken down by source.
45
51
  **/
@@ -1,8 +1,8 @@
1
1
  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 "./address-provider.js";
2
2
  import { ADDRESS_0X0, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED } from "./addresses.js";
3
3
  import { BotPermissions, botPermissionsToString } from "./bot-permissions.js";
4
- 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 "./math.js";
4
+ 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, isZeroBalance } from "./math.js";
5
5
  import { BLOCKS_PER_WEEK_BY_NETWORK, RAMP_DURATION_BY_NETWORK } from "./networks.js";
6
6
  import { PERIPHERY_CONTRACTS, PeripheryContract } from "./periphery.js";
7
7
  import { VERSION_RANGE_310, VersionRange, isV310, isVersionRange } from "./versions.js";
8
- 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, BLOCKS_PER_WEEK_BY_NETWORK, BotPermissions, DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PRICE_DECIMALS, PRICE_DECIMALS_POW, PeripheryContract, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, VERSION_RANGE_310, VersionRange, WAD, WAD_DECIMALS_POW, botPermissionsToString, halfRAY, isV310, isVersionRange };
8
+ 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, BLOCKS_PER_WEEK_BY_NETWORK, BotPermissions, DUST_THRESHOLD, LEVERAGE_DECIMALS, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PRICE_DECIMALS, PRICE_DECIMALS_POW, PeripheryContract, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, VERSION_RANGE_310, VersionRange, WAD, WAD_DECIMALS_POW, botPermissionsToString, halfRAY, isV310, isVersionRange, isZeroBalance };
@@ -20,5 +20,13 @@ declare const SLIPPAGE_DECIMALS = 100n;
20
20
  * Token balances at or below this threshold are treated as dust and ignored.
21
21
  **/
22
22
  declare const DUST_THRESHOLD = 10n;
23
+ /**
24
+ * Whether a balance is nothing worth acting on.
25
+ *
26
+ * The threshold is a dust floor, not a zero test: rounding leaves amounts that
27
+ * are technically non-zero and worthless, and a form that offered to spend one
28
+ * would build a transaction nobody wants.
29
+ */
30
+ declare function isZeroBalance(balance: bigint | undefined): boolean;
23
31
  //#endregion
24
- export { 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 };
32
+ export { 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, isZeroBalance };
@@ -26,7 +26,7 @@ import { EtherscanURLParam, etherscanApiUrl, etherscanUrl } from "./utils/ethers
26
26
  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";
27
27
  import { ADDRESS_0X0, MULTICALL_ADDRESS, NATIVE_ADDRESS, NOT_DEPLOYED } from "./constants/addresses.js";
28
28
  import { BotPermissions, botPermissionsToString } from "./constants/bot-permissions.js";
29
- 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";
29
+ 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, isZeroBalance } from "./constants/math.js";
30
30
  import { BLOCKS_PER_WEEK_BY_NETWORK, RAMP_DURATION_BY_NETWORK } from "./constants/networks.js";
31
31
  import { PERIPHERY_CONTRACTS, PeripheryContract } from "./constants/periphery.js";
32
32
  import { VERSION_RANGE_310, VersionRange, isV310, isVersionRange } from "./constants/versions.js";
@@ -251,9 +251,10 @@ import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBo
251
251
  import { AccountBotsService } from "./accounts/bots/AccountBotsService.js";
252
252
  import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
253
253
  import { CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.js";
254
+ import { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "./validation/refusal.js";
255
+ import { borrowable } from "./accounts/intents/guards.js";
254
256
  import { LeverageBand } from "./accounts/intents/leverage-band.js";
255
257
  import { AccountCalculatorOperation } from "./accounts/intents/operations.js";
256
- import { IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewRefusal, refuse } from "./accounts/intents/refusal.js";
257
258
  import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./accounts/intents/types.js";
258
259
  import { OpenStrategyPreview, OpenStrategyProps } from "./accounts/intents/open-strategy.js";
259
260
  import { fetchCreditAccountSlice, toCreditAccountSlice } from "./accounts/intents/utils/credit-account-slice.js";
@@ -264,4 +265,7 @@ import { LiquidationsService } from "./accounts/liquidations/LiquidationsService
264
265
  import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
265
266
  import "./accounts/index.js";
266
267
  import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
267
- 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, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, 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, CurrentWithdrawals, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetReward, 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, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, type LeverageBand, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OperationState, 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, type PathLossRate, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, type PreviewErrorDetails, type PreviewErrorReason, type PreviewRefusal, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaKeeperState, QuotaMode, 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, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteRefusals, 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, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StakingRewardsAdapterContract, type StartIntent, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, type WithdrawAssetIntent, WithdrawCollateral, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, refuse, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
268
+ import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError } from "./validation/checks.js";
269
+ import { toToken, toTokenAmount } from "./validation/token.js";
270
+ import "./validation/index.js";
271
+ 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, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, BorrowLimitBinding, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, 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, CurrentWithdrawals, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetReward, 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, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, type LeverageBand, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OperationState, 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, type PathLossRate, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaKeeperState, QuotaMode, 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, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteRefusals, 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, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StakingRewardsAdapterContract, type StartIntent, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, type WithdrawAssetIntent, WithdrawCollateral, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, borrowable, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isMalformedPreviewError, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, raise, rayToBps, rayToNumber, refuse, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -0,0 +1,167 @@
1
+ import { Bps, Token, TokenAmount } from "../../model/primitives.js";
2
+ import "../../model/index.js";
3
+ import { BorrowLimitBinding, PreviewIssue } from "./refusal.js";
4
+ import { Address } from "viem";
5
+ //#region src/onchain/validation/checks.d.ts
6
+ /**
7
+ * Every verdict the protocol can pass on an operation, as values.
8
+ *
9
+ * Each check is handed the numbers it compares — never a suite, a market or an
10
+ * SDK — so the engine, `checkOperation` and the strategy lists share one
11
+ * implementation.
12
+ *
13
+ * Ladders stay with the caller because they differ deliberately: the engine
14
+ * reports the tightest ceiling it found, the account-opening path the first one
15
+ * exceeded in its own order.
16
+ */
17
+ /** A factor at or below this is refused; kept for the callers that size on it. */
18
+ declare const MIN_HF_LIMITED = 10100n;
19
+ /** The same bar as a `required` argument — the lowest factor that passes. */
20
+ declare const MIN_HEALTH_FACTOR_FORM = 10101;
21
+ /** The bar the facade itself enforces: an account may end exactly at 1.0. */
22
+ declare const MIN_HEALTH_FACTOR_FACADE = 10000;
23
+ /**
24
+ * The safe-price bar a form holds an account to. A step above the facade's,
25
+ * because a factor of exactly 1.0 at safe prices is already a refusal.
26
+ */
27
+ declare const MIN_SAFE_HEALTH_FACTOR_FORM = 10001;
28
+ /** A refusal names what a limit was measured in, never what it is worth. */
29
+ declare function amountOf(token: Token, value: bigint): TokenAmount;
30
+ /** The credit manager takes no multicall while it is paused. */
31
+ declare function checkCreditManagerPaused(args: {
32
+ isPaused: boolean;
33
+ creditManager: Address;
34
+ }): PreviewIssue | null;
35
+ /** Past its expiration date the facade takes no more multicalls. */
36
+ declare function checkMarketExpired(args: {
37
+ isExpired: boolean;
38
+ creditManager: Address;
39
+ /** Unix seconds, as the facade reports it. */
40
+ expirationDate: number;
41
+ }): PreviewIssue | null;
42
+ /** A paused pool neither takes deposits nor pays out. */
43
+ declare function checkPoolPaused(args: {
44
+ isPaused: boolean;
45
+ pool: Address;
46
+ }): PreviewIssue | null;
47
+ /**
48
+ * A pool winding down still pays out, so only what puts money in is refused.
49
+ */
50
+ declare function checkPoolSunset(args: {
51
+ isSunset: boolean;
52
+ isDeposit: boolean;
53
+ pool: Address;
54
+ }): PreviewIssue | null;
55
+ /**
56
+ * What the pool will hand over, against what is asked for.
57
+ *
58
+ * `binding` and `available` are the caller's answer to "which ceiling stands in
59
+ * the way", not this check's: see the ladder note above. `solutionAmount` is
60
+ * the largest position still openable, left out when none is.
61
+ */
62
+ declare function checkBorrowLimit(args: {
63
+ requested: bigint;
64
+ available: bigint;
65
+ binding: BorrowLimitBinding;
66
+ underlying: Token;
67
+ solutionAmount?: bigint;
68
+ }): PreviewIssue | null;
69
+ /**
70
+ * What the pool can pay out, against what is being taken out.
71
+ *
72
+ * The operator is not `checkBorrowLimit`'s: a pool holding exactly the amount
73
+ * asked for still cannot serve it, so equality is already a refusal. That is
74
+ * the rule the legacy withdrawal validator enforced and it is preserved to the
75
+ * unit.
76
+ */
77
+ declare function checkPoolPayout(args: {
78
+ requested: bigint;
79
+ available: bigint;
80
+ underlying: Token;
81
+ }): PreviewIssue | null;
82
+ /**
83
+ * A debt the facade would revert on.
84
+ *
85
+ * `allowZero` is the one place the two callers genuinely disagree: an account
86
+ * being adjusted may end owing nothing, while one being opened may not — so the
87
+ * exemption is stated rather than assumed.
88
+ */
89
+ declare function checkDebtInBand(args: {
90
+ debt: bigint;
91
+ minDebt: bigint;
92
+ maxDebt: bigint;
93
+ underlying: Token;
94
+ allowZero: boolean;
95
+ }): PreviewIssue | null;
96
+ /** Leverage below 1x is not a position, it is a withdrawal. */
97
+ declare function checkLeverageAtLeastOne(args: {
98
+ leverage: bigint;
99
+ min: bigint;
100
+ }): PreviewIssue | null;
101
+ /**
102
+ * The account against its debt, at whichever bar the caller holds it to.
103
+ *
104
+ * An unread factor counts as failing: a check that cannot see the number is not
105
+ * evidence that the number is fine.
106
+ */
107
+ declare function checkCollateralised(args: {
108
+ healthFactor: Bps | undefined;
109
+ /** The lowest acceptable factor — a factor equal to it passes. */
110
+ required: Bps;
111
+ safePrices: boolean;
112
+ /**
113
+ * The factor the account stands at now. Given, an operation that raises it
114
+ * passes even from under the bar: an account already below is rescued by
115
+ * exactly the top-ups a flat bar would refuse.
116
+ */
117
+ improvesFrom?: Bps;
118
+ }): PreviewIssue | null;
119
+ /** A token the market will not let the account hold. */
120
+ declare function checkForbiddenToken(args: {
121
+ token: Token;
122
+ isForbidden: boolean;
123
+ }): PreviewIssue | null;
124
+ /**
125
+ * The room the keeper still has for a token's quota, in the underlying.
126
+ *
127
+ * `requested` is absent for a token the market opened no quota for at all —
128
+ * nothing was weighed against a limit, the token simply counts as no collateral.
129
+ */
130
+ declare function checkQuotaLimit(args: {
131
+ token: Token;
132
+ requested: bigint | undefined;
133
+ available: bigint;
134
+ underlying: Token;
135
+ }): PreviewIssue | null;
136
+ /** How many quoted tokens the facade enables at once. */
137
+ declare function checkQuotaCount(args: {
138
+ count: number;
139
+ max: number;
140
+ }): PreviewIssue | null;
141
+ /** What the operation is funded from, against what is there. */
142
+ declare function checkFunding(args: {
143
+ token: Token;
144
+ required: bigint;
145
+ held: bigint;
146
+ }): PreviewIssue | null;
147
+ /**
148
+ * The SDK could not replay the transaction.
149
+ *
150
+ * Only the 1xxx class lands here. A 2xxx error says the transaction is fine and
151
+ * the SDK could not fully evaluate it, which is a caveat on the numbers rather
152
+ * than a reason to refuse — it stays on the preview for the caller to surface.
153
+ */
154
+ declare function checkPreviewError(error: {
155
+ code: number;
156
+ message: string;
157
+ } | undefined): PreviewIssue | null;
158
+ /**
159
+ * The class boundary the preview error codes are written against: 1xxx means
160
+ * the transaction itself is malformed, 2xxx that only the evaluation was
161
+ * incomplete. A range, so a future 1007 classifies itself.
162
+ */
163
+ declare function isMalformedPreviewError(error: {
164
+ code: number;
165
+ }): boolean;
166
+ //#endregion
167
+ export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError };
@@ -0,0 +1,4 @@
1
+ import { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "./refusal.js";
2
+ import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError } from "./checks.js";
3
+ import { toToken, toTokenAmount } from "./token.js";
4
+ export { BorrowLimitBinding, IntentPreviewError, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError, raise, refuse, toToken, toTokenAmount };