@gearbox-protocol/sdk 16.0.0-next.41 → 16.0.0-next.43

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 (62) hide show
  1. package/dist/cjs/model/errors.js +1 -0
  2. package/dist/cjs/model/index.js +5 -0
  3. package/dist/cjs/model/result.js +27 -0
  4. package/dist/cjs/onchain/accounts/intents/open-strategy.js +1 -1
  5. package/dist/cjs/onchain/accounts/intents/tail.js +1 -1
  6. package/dist/cjs/onchain/accounts/withdrawal-compressor/errors.js +14 -14
  7. package/dist/cjs/onchain/index.js +0 -1
  8. package/dist/cjs/onchain/market/zapper/errors.js +13 -12
  9. package/dist/cjs/onchain/validation/index.js +0 -1
  10. package/dist/cjs/preview/index.js +4 -1
  11. package/dist/cjs/preview/parse/errors.js +25 -22
  12. package/dist/cjs/preview/preview/errors.js +12 -11
  13. package/dist/cjs/preview/preview/previewOperation.js +41 -10
  14. package/dist/cjs/preview/simulate/errors.js +18 -17
  15. package/dist/cjs/sdk/execute/ExecuteApi.js +3 -3
  16. package/dist/cjs/sdk/index.js +5 -0
  17. package/dist/cjs/sdk/prepare/PrepareApi.js +254 -101
  18. package/dist/cjs/sdk/prepare/errors.js +93 -0
  19. package/dist/cjs/sdk/prepare/index.js +5 -0
  20. package/dist/esm/model/errors.js +1 -0
  21. package/dist/esm/model/index.js +3 -1
  22. package/dist/esm/model/result.js +24 -0
  23. package/dist/esm/onchain/accounts/intents/open-strategy.js +1 -1
  24. package/dist/esm/onchain/accounts/intents/tail.js +1 -1
  25. package/dist/esm/onchain/accounts/withdrawal-compressor/errors.js +14 -14
  26. package/dist/esm/onchain/index.js +2 -2
  27. package/dist/esm/onchain/market/zapper/errors.js +13 -12
  28. package/dist/esm/onchain/validation/index.js +2 -2
  29. package/dist/esm/preview/index.js +4 -2
  30. package/dist/esm/preview/parse/errors.js +25 -22
  31. package/dist/esm/preview/preview/errors.js +12 -11
  32. package/dist/esm/preview/preview/previewOperation.js +41 -10
  33. package/dist/esm/preview/simulate/errors.js +18 -17
  34. package/dist/esm/sdk/execute/ExecuteApi.js +3 -3
  35. package/dist/esm/sdk/index.js +2 -1
  36. package/dist/esm/sdk/prepare/PrepareApi.js +255 -102
  37. package/dist/esm/sdk/prepare/errors.js +89 -0
  38. package/dist/esm/sdk/prepare/index.js +2 -1
  39. package/dist/types/model/errors.d.ts +46 -0
  40. package/dist/types/model/index.d.ts +3 -1
  41. package/dist/types/model/result.d.ts +48 -0
  42. package/dist/types/onchain/accounts/intents/open-strategy.d.ts +3 -3
  43. package/dist/types/onchain/accounts/intents/types.d.ts +13 -14
  44. package/dist/types/onchain/accounts/withdrawal-compressor/errors.d.ts +18 -5
  45. package/dist/types/onchain/index.d.ts +2 -2
  46. package/dist/types/onchain/market/zapper/errors.d.ts +20 -6
  47. package/dist/types/onchain/validation/index.d.ts +2 -2
  48. package/dist/types/preview/index.d.ts +5 -3
  49. package/dist/types/preview/parse/errors.d.ts +36 -11
  50. package/dist/types/preview/preview/errors.d.ts +17 -5
  51. package/dist/types/preview/preview/index.d.ts +2 -2
  52. package/dist/types/preview/preview/previewOperation.d.ts +21 -2
  53. package/dist/types/preview/simulate/errors.d.ts +21 -8
  54. package/dist/types/sdk/execute/types.d.ts +9 -14
  55. package/dist/types/sdk/index.d.ts +3 -2
  56. package/dist/types/sdk/prepare/PrepareApi.d.ts +30 -22
  57. package/dist/types/sdk/prepare/errors.d.ts +317 -0
  58. package/dist/types/sdk/prepare/index.d.ts +3 -2
  59. package/dist/types/sdk/prepare/types.d.ts +88 -62
  60. package/dist/types/sdk/preview/PreviewNamespace.d.ts +4 -1
  61. package/dist/types/sdk/preview/types.d.ts +7 -3
  62. package/package.json +11 -2
@@ -0,0 +1,48 @@
1
+ import { IGearboxError } from "./errors.js";
2
+ //#region src/model/result.d.ts
3
+ /**
4
+ * The success half of every refusable answer: the data the method was asked
5
+ * for, behind the `ok` discriminant a caller must narrow first.
6
+ **/
7
+ interface SDKResult<T> {
8
+ ok: true;
9
+ data: T;
10
+ }
11
+ /**
12
+ * The failure half: one of the errors that method's own signature names —
13
+ * see {@link IGearboxError} for what every error carries.
14
+ **/
15
+ interface SDKError<E extends IGearboxError = IGearboxError> {
16
+ ok: false;
17
+ error: E;
18
+ }
19
+ /**
20
+ * What a method that can be refused answers with. `ok` is the discriminant,
21
+ * and narrowing it settles which of the two fields is there — a caller
22
+ * cannot read `data` without having ruled the failure out first.
23
+ *
24
+ * ```ts
25
+ * const res = await sdk.opportunities.prepare.depositStrategy(position, params);
26
+ * if (isSDKError(res)) {
27
+ * return showRefusal(res.error); // res.error: exactly this method's union
28
+ * }
29
+ * res.data; // res.data: StrategyResult
30
+ * ```
31
+ *
32
+ * @typeParam T - What the method answers when it can.
33
+ * @typeParam E - The errors that method can refuse with. Naming them
34
+ * per method is the point: the union is the list of everything a caller has
35
+ * to handle, checked by the compiler.
36
+ **/
37
+ type SDKReturn<T, E extends IGearboxError> = SDKResult<T> | SDKError<E>;
38
+ /** The success half, built. */
39
+ declare function sdkOk<T>(data: T): SDKResult<T>;
40
+ /** The failure half, built. */
41
+ declare function sdkErr<E extends IGearboxError>(error: E): SDKError<E>;
42
+ /**
43
+ * Narrows a {@link SDKReturn} to its failure half. Trivial over `ok`, but it
44
+ * names the intent at call sites that would otherwise read `!r.ok`.
45
+ **/
46
+ declare function isSDKError<T, E extends IGearboxError>(answer: SDKReturn<T, E>): answer is SDKError<E>;
47
+ //#endregion
48
+ export { SDKError, SDKResult, SDKReturn, isSDKError, sdkErr, sdkOk };
@@ -4,7 +4,7 @@ import "../../../model/index.js";
4
4
  import { Asset } from "../../base/types.js";
5
5
  import { MultiCall } from "../../types/transactions.js";
6
6
  import { OnchainSDK } from "../../OnchainSDK.js";
7
- import { PreparedPrices } from "./types.js";
7
+ import { SimulationPrices } from "./types.js";
8
8
  import "../../index.js";
9
9
  import { Address } from "viem";
10
10
  //#region src/onchain/accounts/intents/open-strategy.d.ts
@@ -32,7 +32,7 @@ interface OpenStrategyProps {
32
32
  * hands back expected and floor balances from a single call, and `openCA` wants
33
33
  * both `minQuota` and `averageQuota`, so there is nothing to gain by dropping one.
34
34
  */
35
- interface OpenStrategyState extends Omit<AccountProjection, "assets" | "quotas">, PreparedPrices {
35
+ interface OpenStrategyState extends Omit<AccountProjection, "assets" | "quotas">, SimulationPrices {
36
36
  /** Expected post-open balances. */
37
37
  averageAssets: TokenAmount[];
38
38
  /** Floor post-open balances after slippage. */
@@ -52,7 +52,7 @@ interface OpenStrategyState extends Omit<AccountProjection, "assets" | "quotas">
52
52
  }
53
53
  /**
54
54
  * Builds the state opening a leveraged position out of wallet collateral would
55
- * land in.
55
+ * reach.
56
56
  *
57
57
  * Debt follows from the target leverage against the supplied margin
58
58
  * (`debt = margin * (L - 1)`, `totalValue = margin * L`); the collateral and the
@@ -31,14 +31,14 @@ interface PathLossRate {
31
31
  totalValuePriceImpact: bigint;
32
32
  }
33
33
  /**
34
- * The two prices only a planned walk can quote, carried by every `prepare`
34
+ * The two prices only a planned walk can quote, carried by every simulation
35
35
  * result beside its projection.
36
36
  *
37
37
  * A calldata preview is asked for neither: it reads a transaction that already
38
38
  * names its amounts, and it reports what that transaction does rather than what
39
39
  * the market charges while a form is open.
40
40
  */
41
- interface PreparedPrices {
41
+ interface SimulationPrices {
42
42
  /**
43
43
  * What the routed legs lost to market depth. `undefined` where nothing was
44
44
  * routed or nothing could be measured — never a manufactured zero.
@@ -60,10 +60,10 @@ interface PreparedPrices {
60
60
  * {@link AccountProjection} vocabulary, plus the prices only a routed walk can
61
61
  * report.
62
62
  */
63
- interface OperationState extends AccountProjection, PreparedPrices {}
63
+ interface OperationState extends AccountProjection, SimulationPrices {}
64
64
  /**
65
- * What a preview yields: the operation chain, the state it projects, and the
66
- * calldata that realises it — or the reason the request is not viable.
65
+ * What planning an intent yields: the operation chain, the state it projects,
66
+ * and the calldata that realises it — or the reason the request is not viable.
67
67
  */
68
68
  type IntentPreviewResult = {
69
69
  ok: true;
@@ -105,8 +105,8 @@ interface DelayedStart {
105
105
  * the phantom of the in-flight redemption in its place, the debt untouched.
106
106
  *
107
107
  * This is the state the facade judges when the transaction lands, so it is
108
- * the one the engine's guards are applied to — while the `state` beside it is
109
- * where the intent ends up, tail included, which is what a caller asking
108
+ * the one the engine's guards are applied to — while the `state` beside it
109
+ * is where the intent ends up, tail included, which is what a caller asking
110
110
  * "what does this do to my position" means.
111
111
  */
112
112
  afterRequest: OperationState;
@@ -116,10 +116,10 @@ interface DelayedStart {
116
116
  * plus what it recorded for the tail.
117
117
  *
118
118
  * `operations` and `calls` are the request and nothing else — that is the only
119
- * transaction there is to send now. `state`, though, is where the intent ends:
120
- * the account once the redemption matures, is claimed and the tail runs, since
121
- * that is what the caller asked for when they asked to withdraw. The half-way
122
- * state the request itself lands in is
119
+ * transaction there is to send now. `state`, though, is where the intent
120
+ * ends: the state the account reaches once the redemption matures, is claimed
121
+ * and the tail runs, since that is what the caller asked for when they asked
122
+ * to withdraw. The half-way state the request itself lands in is
123
123
  * {@link DelayedStart.afterRequest}, and both are validated before either is
124
124
  * reported.
125
125
  *
@@ -390,10 +390,9 @@ type FinishIntentProps = StartIntentProps & {
390
390
  intent: ResumableIntent;
391
391
  /**
392
392
  * The matured withdrawal, as reported by
393
- * `sdk.positions.getCurrentWithdrawals` (mapped back to the compressor
394
- * shape at `prepare.finalize`).
393
+ * `sdk.accounts.getPendingWithdrawals`.
395
394
  */
396
395
  claimable: ClaimableWithdrawal;
397
396
  };
398
397
  //#endregion
399
- export { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, PreparedPrices, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, StartIntentProps, WithdrawAssetIntent, WithdrawStrategyIntent };
398
+ export { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteRefusals, SimulationPrices, StartIntent, StartIntentProps, WithdrawAssetIntent, WithdrawStrategyIntent };
@@ -1,16 +1,29 @@
1
+ import { IGearboxError } from "../../../model/errors.js";
2
+ import "../../../model/index.js";
1
3
  import { Hex } from "viem";
2
4
  //#region src/onchain/accounts/withdrawal-compressor/errors.d.ts
3
5
  /**
4
- * Thrown when a delayed-withdrawal request or redemption log carries
6
+ * Verdict answered when a delayed-withdrawal request or redemption log carries
5
7
  * non-empty `extraData` that cannot be decoded as a `DelayedIntent`.
6
8
  * Requests produced by our stack always encode a valid intent, so garbage
7
9
  * here means a malformed/foreign transaction that must not be previewed as
8
- * if it were fine.
10
+ * if it were fine. A plain returned object — not a thrown `Error`.
9
11
  */
10
- declare class InvalidDelayedIntentError extends Error {
12
+ interface InvalidDelayedIntentError extends IGearboxError {
13
+ code: "invalidDelayedIntent";
11
14
  /** Raw `extraData` that failed to decode. */
12
- readonly extraData: Hex;
13
- constructor(extraData: Hex, cause?: unknown);
15
+ extraData: Hex;
16
+ /** The decoding failure this verdict stands in front of. */
17
+ cause?: Error;
14
18
  }
19
+ /**
20
+ * Builds the verdict. Callable with or without `new`, so pre-declassing raise
21
+ * sites keep compiling; `instanceof` matches on the `code` discriminant, and
22
+ * the answer is never an `Error`.
23
+ */
24
+ declare const InvalidDelayedIntentError: {
25
+ (extraData: Hex, cause?: unknown): InvalidDelayedIntentError;
26
+ new (extraData: Hex, cause?: unknown): InvalidDelayedIntentError;
27
+ };
15
28
  //#endregion
16
29
  export { InvalidDelayedIntentError };
@@ -254,7 +254,7 @@ import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBo
254
254
  import { AccountBotsService } from "./accounts/bots/AccountBotsService.js";
255
255
  import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
256
256
  import { CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.js";
257
- import { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "./validation/refusal.js";
257
+ import { BorrowLimitBinding, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "./validation/refusal.js";
258
258
  import { borrowable } from "./accounts/intents/guards.js";
259
259
  import { LeverageBand } from "./accounts/intents/leverage-band.js";
260
260
  import { CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, roundUpQuota } from "./accounts/quota-utils.js";
@@ -273,4 +273,4 @@ import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./opti
273
273
  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";
274
274
  import { toToken, toTokenAmount } from "./validation/token.js";
275
275
  import "./validation/index.js";
276
- 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, AssetWithAmountInTarget, 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, CalcDefaultQuotaProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, CallTrace, 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, ConvertFn, 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, EXECUTE_BYTES_SELECTOR, 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, GetCurrentWithdrawalsProps, GetCurrentWithdrawalsPropsBase, GetExternalAccountCurrentWithdrawalsProps, GetInvestorOptions, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetReward, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IMultichainOpportunitiesService, IMultichainPositionsService, 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, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OpenStrategyState, 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, QuotaSlice, 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, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, collateralPriceInUnderlying, collectTraces, 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, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, 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, isPhantomToken, 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, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
276
+ 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, AssetWithAmountInTarget, 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 BorrowLimitBinding, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcDefaultQuotaProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, CallTrace, 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, ConvertFn, 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, EXECUTE_BYTES_SELECTOR, 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, GetCurrentWithdrawalsProps, GetCurrentWithdrawalsPropsBase, GetExternalAccountCurrentWithdrawalsProps, GetInvestorOptions, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetReward, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IMultichainOpportunitiesService, IMultichainPositionsService, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, 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, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OpenStrategyState, 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 PreviewIssue, 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, QuotaSlice, 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, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, collateralPriceInUnderlying, collectTraces, 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, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, 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, isPhantomToken, 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, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -1,13 +1,27 @@
1
+ import { IGearboxError } from "../../../model/errors.js";
2
+ import "../../../model/index.js";
1
3
  import { Address } from "viem";
2
4
  //#region src/onchain/market/zapper/errors.d.ts
3
5
  /**
4
- * Thrown when a zapper call uses a function other than a known
5
- * `deposit`/`redeem` variant.
6
+ * Verdict answered when a zapper call uses a function other than a known
7
+ * `deposit`/`redeem` variant. A plain returned object per the SDK's refusal
8
+ * vocabulary — not a thrown `Error`.
6
9
  */
7
- declare class UnsupportedZapperFunctionError extends Error {
8
- readonly zapper: Address;
9
- readonly functionName: string;
10
- constructor(zapper: Address, functionName: string);
10
+ interface UnsupportedZapperFunctionError extends IGearboxError {
11
+ code: "unsupportedZapperFunction";
12
+ /** Zapper contract the call targets. */
13
+ zapper: Address;
14
+ /** Decoded function name the SDK cannot preview. */
15
+ functionName: string;
11
16
  }
17
+ /**
18
+ * Builds the verdict. Callable with or without `new`, so pre-declassing raise
19
+ * sites keep compiling; `instanceof` matches on the `code` discriminant, and
20
+ * the answer is never an `Error`.
21
+ */
22
+ declare const UnsupportedZapperFunctionError: {
23
+ (zapper: Address, functionName: string): UnsupportedZapperFunctionError;
24
+ new (zapper: Address, functionName: string): UnsupportedZapperFunctionError;
25
+ };
12
26
  //#endregion
13
27
  export { UnsupportedZapperFunctionError };
@@ -1,4 +1,4 @@
1
- import { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "./refusal.js";
1
+ import { BorrowLimitBinding, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "./refusal.js";
2
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
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 };
4
+ export { type BorrowLimitBinding, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, type PreviewErrorDetails, type PreviewErrorReason, type PreviewIssue, type PreviewRefusal, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError, raise, refuse, toToken, toTokenAmount };
@@ -1,5 +1,6 @@
1
1
  import { UnsupportedZapperFunctionError } from "../onchain/market/zapper/errors.js";
2
- import { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "../onchain/validation/refusal.js";
2
+ import { InvalidDelayedIntentError } from "../onchain/accounts/withdrawal-compressor/errors.js";
3
+ import { BorrowLimitBinding, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "../onchain/validation/refusal.js";
3
4
  import { AdapterOperation, AdapterOperationBase, TokenTransfer, TraceAdapterExt } from "./parse/types-adapters.js";
4
5
  import { AddCollateralOp, CloseCreditAccountOperation, CompareBalancesOp, CreditAccountOperation, DecreaseDebtOp, DirectTokenTransferOperation, FacadeOperationMetadata, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, StoreExpectedBalancesOp, UpdateQuotaOp, WithdrawCollateralOp } from "./parse/types-facades.js";
5
6
  import { PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation } from "./parse/types-pools.js";
@@ -35,11 +36,12 @@ import { UnsupportedOperationError } from "./preview/errors.js";
35
36
  import { estimateClaimableAt } from "./preview/estimateClaimableAt.js";
36
37
  import { previewAdjustStrategyPosition } from "./preview/previewAdjustStrategyPosition.js";
37
38
  import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./preview/previewExitOrRepayStrategyPosition.js";
38
- import { previewOperation } from "./preview/previewOperation.js";
39
+ import { PreviewSimulationError, SimulationError, SimulationFlowFailure, SimulationFlowSource } from "./simulate/errors.js";
40
+ import { PreviewVerdictError, previewOperation } from "./preview/previewOperation.js";
39
41
  import { ReplayState, makeReplayState, replayInnerOperations } from "./preview/replayInnerOperations.js";
40
42
  import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./preview/replayMulticall.js";
41
43
  import "./preview/index.js";
42
44
  import { CheckOperationOptions, WeighedFactors, checkOperation, collateralIssue, marketIssues, quotaCountIssue } from "./validate/checkOperation.js";
43
45
  import { checkSimulation } from "./validate/checkSimulation.js";
44
46
  import "./validate/index.js";
45
- export { AdapterOperation, AdapterOperationBase, AddCollateralOp, AllowanceDetail, AllowancePrerequisite, AllowanceResult, BalanceDetail, BalancePrerequisite, BalanceResult, BorrowLimitBinding, CheckOperationOptions, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ExtractTransfersResult, FacadeCallType, FacadeOperationMetadata, FacadeParsedCall, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, IntentPreviewError, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, Prerequisite, PrerequisiteContext, PrerequisiteError, PrerequisiteKind, PrerequisiteOutcome, PrerequisiteResult, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewOperationInput, PreviewOperationOptions, PreviewRefusal, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, StoreExpectedBalancesOp, TokenTransfer, TraceAdapterExt, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, UpdateQuotaOp, WeighedFactors, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, buildDelayedStrategyPositionOperationPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssue, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, marketIssues, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, quotaCountIssue, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
47
+ export { AdapterOperation, AdapterOperationBase, AddCollateralOp, AllowanceDetail, AllowancePrerequisite, AllowanceResult, BalanceDetail, BalancePrerequisite, BalanceResult, type BorrowLimitBinding, CheckOperationOptions, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ExtractTransfersResult, FacadeCallType, FacadeOperationMetadata, FacadeParsedCall, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, InvalidDelayedIntentError, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, Prerequisite, PrerequisiteContext, PrerequisiteError, PrerequisiteKind, PrerequisiteOutcome, PrerequisiteResult, type PreviewErrorDetails, type PreviewErrorReason, type PreviewIssue, PreviewOperationInput, PreviewOperationOptions, type PreviewRefusal, PreviewSimulationError, PreviewVerdictError, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, type SimulationError, type SimulationFlowFailure, type SimulationFlowSource, StoreExpectedBalancesOp, TokenTransfer, TraceAdapterExt, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, UpdateQuotaOp, WeighedFactors, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, buildDelayedStrategyPositionOperationPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssue, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, marketIssues, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, quotaCountIssue, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -1,22 +1,47 @@
1
+ import { IGearboxError } from "../../model/errors.js";
2
+ import "../../model/index.js";
1
3
  import { UnsupportedZapperFunctionError } from "../../onchain/market/zapper/errors.js";
2
- import "../../onchain/index.js";
3
4
  import { Address } from "viem";
4
5
  //#region src/preview/parse/errors.d.ts
5
6
  /**
6
- * Thrown when the target of a transaction is neither a known Gearbox pool nor a
7
- * credit facade.
7
+ * Verdict answered when the target of a transaction is neither a known
8
+ * Gearbox pool nor a credit facade. A plain returned object per the SDK's
9
+ * refusal vocabulary — not a thrown `Error`.
8
10
  */
9
- declare class UnsupportedTargetError extends Error {
10
- readonly target: Address;
11
- constructor(target: Address);
11
+ interface UnsupportedTargetError extends IGearboxError {
12
+ code: "unsupportedTarget";
13
+ /** Target address no known Gearbox contract answers for. */
14
+ target: Address;
12
15
  }
13
16
  /**
14
- * Thrown when a pool call uses a function other than ERC4626 `deposit`/`redeem`.
17
+ * Builds the verdict. Callable with or without `new`, so pre-declassing raise
18
+ * sites keep compiling; `instanceof` matches on the `code` discriminant, and
19
+ * the answer is never an `Error`.
15
20
  */
16
- declare class UnsupportedPoolFunctionError extends Error {
17
- readonly pool: Address;
18
- readonly functionName: string;
19
- constructor(pool: Address, functionName: string);
21
+ declare const UnsupportedTargetError: {
22
+ (target: Address): UnsupportedTargetError;
23
+ new (target: Address): UnsupportedTargetError;
24
+ };
25
+ /**
26
+ * Verdict answered when a pool call uses a function other than ERC4626
27
+ * `deposit`/`redeem`. A plain returned object per the SDK's refusal
28
+ * vocabulary — not a thrown `Error`.
29
+ */
30
+ interface UnsupportedPoolFunctionError extends IGearboxError {
31
+ code: "unsupportedPoolFunction";
32
+ /** Pool the call targets. */
33
+ pool: Address;
34
+ /** Decoded function name the SDK cannot preview. */
35
+ functionName: string;
20
36
  }
37
+ /**
38
+ * Builds the verdict. Callable with or without `new`, so pre-declassing raise
39
+ * sites keep compiling; `instanceof` matches on the `code` discriminant, and
40
+ * the answer is never an `Error`.
41
+ */
42
+ declare const UnsupportedPoolFunctionError: {
43
+ (pool: Address, functionName: string): UnsupportedPoolFunctionError;
44
+ new (pool: Address, functionName: string): UnsupportedPoolFunctionError;
45
+ };
21
46
  //#endregion
22
47
  export { UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError };
@@ -1,12 +1,24 @@
1
+ import { IGearboxError } from "../../model/errors.js";
2
+ import "../../model/index.js";
1
3
  //#region src/preview/preview/errors.d.ts
2
4
  /**
3
- * Thrown by `previewOperation` for parsed operations it cannot preview yet.
4
- * Currently only pool operations and credit account opening are supported.
5
+ * Verdict answered by `previewOperation` for parsed operations it cannot
6
+ * preview yet. A plain returned object per the SDK's refusal vocabulary —
7
+ * not a thrown `Error`.
5
8
  */
6
- declare class UnsupportedOperationError extends Error {
9
+ interface UnsupportedOperationError extends IGearboxError {
10
+ code: "unsupportedOperation";
7
11
  /** The parsed operation kind (the `operation` discriminant). */
8
- readonly operation: string;
9
- constructor(operation: string);
12
+ operation: string;
10
13
  }
14
+ /**
15
+ * Builds the verdict. Callable with or without `new`, so pre-declassing raise
16
+ * sites keep compiling; `instanceof` matches on the `code` discriminant, and
17
+ * the answer is never an `Error`.
18
+ */
19
+ declare const UnsupportedOperationError: {
20
+ (operation: string): UnsupportedOperationError;
21
+ new (operation: string): UnsupportedOperationError;
22
+ };
11
23
  //#endregion
12
24
  export { UnsupportedOperationError };
@@ -7,7 +7,7 @@ import { UnsupportedOperationError } from "./errors.js";
7
7
  import { estimateClaimableAt } from "./estimateClaimableAt.js";
8
8
  import { previewAdjustStrategyPosition } from "./previewAdjustStrategyPosition.js";
9
9
  import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./previewExitOrRepayStrategyPosition.js";
10
- import { previewOperation } from "./previewOperation.js";
10
+ import { PreviewVerdictError, previewOperation } from "./previewOperation.js";
11
11
  import { ReplayState, makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
12
12
  import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./replayMulticall.js";
13
- export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, ReplayMulticallResult, ReplayState, ReplayableOperation, UnsupportedOperationError, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
13
+ export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, PreviewVerdictError, ReplayMulticallResult, ReplayState, ReplayableOperation, UnsupportedOperationError, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -1,13 +1,32 @@
1
1
  import { OperationPreview } from "../../model/previews.js";
2
+ import { SDKReturn } from "../../model/result.js";
2
3
  import "../../model/index.js";
4
+ import { UnsupportedZapperFunctionError } from "../../onchain/market/zapper/errors.js";
3
5
  import { PluginsMap } from "../../onchain/plugins/types.js";
6
+ import { InvalidDelayedIntentError } from "../../onchain/accounts/withdrawal-compressor/errors.js";
4
7
  import "../../onchain/index.js";
8
+ import { UnsupportedPoolFunctionError, UnsupportedTargetError } from "../parse/errors.js";
5
9
  import { PreviewOperationInput, PreviewOperationOptions } from "../types.js";
10
+ import "../parse/index.js";
11
+ import { UnsupportedOperationError } from "./errors.js";
12
+ import { PreviewSimulationError } from "../simulate/errors.js";
6
13
  //#region src/preview/preview/previewOperation.d.ts
14
+ /**
15
+ * Everything {@link previewOperation} can refuse with: the verdicts its
16
+ * pipeline raises, discriminated by `code`. Each is a plain object — never a
17
+ * thrown `Error` — per the SDK's refusal vocabulary.
18
+ */
19
+ type PreviewVerdictError = UnsupportedTargetError | UnsupportedPoolFunctionError | UnsupportedZapperFunctionError | UnsupportedOperationError | InvalidDelayedIntentError | PreviewSimulationError;
7
20
  /**
8
21
  * Previews a raw operation calldata: decodes it into a typed operation and
9
22
  * assembles an operation-specific, human-displayable preview.
23
+ *
24
+ * Answers an {@link SDKReturn} envelope: the preview behind `ok: true`, or —
25
+ * when the transaction is one the previewer refuses to read — a
26
+ * {@link PreviewVerdictError} behind `ok: false`. A thrown exception still
27
+ * means the SDK could not do its job (a read failed, the targeted credit
28
+ * account could not be resolved), not a verdict on the transaction.
10
29
  */
11
- declare function previewOperation<P extends PluginsMap = PluginsMap>(input: PreviewOperationInput<P>, options?: PreviewOperationOptions): Promise<OperationPreview>;
30
+ declare function previewOperation<P extends PluginsMap = PluginsMap>(input: PreviewOperationInput<P>, options?: PreviewOperationOptions): Promise<SDKReturn<OperationPreview, PreviewVerdictError>>;
12
31
  //#endregion
13
- export { previewOperation };
32
+ export { PreviewVerdictError, previewOperation };
@@ -1,4 +1,6 @@
1
- import { BaseError, Hex } from "viem";
1
+ import { IGearboxError } from "../../model/errors.js";
2
+ import "../../model/index.js";
3
+ import { Hex } from "viem";
2
4
  //#region src/preview/simulate/errors.d.ts
3
5
  /** Which simulation flow produced a failure. */
4
6
  type SimulationFlowSource = "multicall" | "unknown";
@@ -8,15 +10,26 @@ interface SimulationFlowFailure {
8
10
  detail: SimulationError;
9
11
  }
10
12
  /**
11
- * Error returned by the pool simulation when it fails. It wraps the flow's
12
- * decoded revert reason (see {@link failures}).
13
+ * Verdict answered when the pool simulation fails. It wraps each flow's
14
+ * decoded revert reason (see {@link failures}). A plain returned object per
15
+ * the SDK's refusal vocabulary — not a thrown `Error`.
13
16
  */
14
- declare class PreviewSimulationError extends BaseError {
15
- name: string;
16
- /** Per-flow decoded failures behind this error. */
17
- readonly failures: SimulationFlowFailure[];
18
- constructor(failures: SimulationFlowFailure[]);
17
+ interface PreviewSimulationError extends IGearboxError {
18
+ code: "previewSimulationFailed";
19
+ /** Per-flow decoded failures behind this verdict. */
20
+ failures: SimulationFlowFailure[];
21
+ /** First flow failure that was itself an `Error`, kept for debugging. */
22
+ cause?: Error;
19
23
  }
24
+ /**
25
+ * Builds the verdict. Callable with or without `new`, so pre-declassing raise
26
+ * sites keep compiling; `instanceof` matches on the `code` discriminant, and
27
+ * the answer is never an `Error`.
28
+ */
29
+ declare const PreviewSimulationError: {
30
+ (failures: SimulationFlowFailure[]): PreviewSimulationError;
31
+ new (failures: SimulationFlowFailure[]): PreviewSimulationError;
32
+ };
20
33
  /**
21
34
  * Normalises an unknown rejection reason into a {@link PreviewSimulationError}.
22
35
  * Pass-through when it already is one; otherwise decodes it under `source`.
@@ -1,10 +1,11 @@
1
1
  import { ChainId } from "../../model/primitives.js";
2
+ import { SDKResult } from "../../model/result.js";
2
3
  import "../../model/index.js";
3
4
  import { Asset } from "../../onchain/base/types.js";
4
5
  import { SecuritizeRegisterMessage } from "../../onchain/market/rwa/securitize/types.js";
5
6
  import { RawTx } from "../../onchain/types/transactions.js";
6
7
  import "../../onchain/index.js";
7
- import { LpPrepare, OpenStrategyPrepare, StrategyPrepare } from "../prepare/types.js";
8
+ import { LpResult, OpenStrategyResult, StrategyResult } from "../prepare/types.js";
8
9
  import "../prepare/index.js";
9
10
  import { Address } from "viem";
10
11
  //#region src/sdk/execute/types.d.ts
@@ -21,9 +22,7 @@ interface PoolPrepareRequest {
21
22
  pool: Address;
22
23
  wallet: Address;
23
24
  op: "deposit" | "withdraw" | "redeem";
24
- sim: Extract<LpPrepare, {
25
- ok: true;
26
- }>;
25
+ sim: SDKResult<LpResult>;
27
26
  }
28
27
  /**
29
28
  * Opening a new position, from a viable
@@ -36,9 +35,7 @@ interface OpenPrepareRequest {
36
35
  chainId: ChainId;
37
36
  creditManager: Address;
38
37
  wallet: Address;
39
- sim: Extract<OpenStrategyPrepare, {
40
- ok: true;
41
- }>;
38
+ sim: SDKResult<OpenStrategyResult>;
42
39
  /** What leaves the wallet, token by token. */
43
40
  collateral: Asset[];
44
41
  /** Native value to attach when paying a wrapped-native market in the coin. */
@@ -56,16 +53,14 @@ interface OpenPrepareRequest {
56
53
  }
57
54
  /**
58
55
  * Any of the five operations on an existing account, from a viable
59
- * {@link StrategyPrepare}: the facade multicall is the result's `calls`.
56
+ * {@link StrategyResult}: the facade multicall is the result's `calls`.
60
57
  **/
61
58
  interface AccountPrepareRequest {
62
59
  kind: "account";
63
60
  chainId: ChainId;
64
61
  creditAccount: Address;
65
62
  wallet: Address;
66
- sim: Extract<StrategyPrepare, {
67
- ok: true;
68
- }>;
63
+ sim: SDKResult<StrategyResult>;
69
64
  }
70
65
  /**
71
66
  * What {@link IOpportunitiesExecute.buildTx} turns into a transaction: a
@@ -86,9 +81,9 @@ interface IOpportunitiesExecute {
86
81
  * the state's router path and quotas to `openCA`, `pool` requests encode the
87
82
  * deposit / redeem the result priced.
88
83
  *
89
- * @throws on a `prepare` result that is not `ok`; when a `pool` request names a
90
- * route the pool has no metadata for, or one the pool does not accept a
91
- * transaction for (RWA on-demand deposits)
84
+ * @throws on a refused `prepare` result; when a `pool` request names a route
85
+ * the pool has no metadata for, or one the pool does not accept a transaction
86
+ * for (RWA on-demand deposits)
92
87
  **/
93
88
  buildTx(request: PrepareRequest): Promise<RawTx>;
94
89
  }