@gearbox-protocol/sdk 16.0.0-next.49 → 16.0.0-next.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/model/index.js +0 -7
- package/dist/cjs/model/previews.js +0 -40
- package/dist/cjs/onchain/index.js +2 -0
- package/dist/cjs/onchain/market/index.js +2 -0
- package/dist/cjs/onchain/market/oracle/errors.js +14 -0
- package/dist/cjs/onchain/market/oracle/index.js +2 -0
- package/dist/cjs/onchain/validation/checks.js +19 -11
- package/dist/cjs/preview/index.js +7 -2
- package/dist/cjs/preview/preview/buildDelayedStrategyPositionOperationPreview.js +8 -8
- package/dist/cjs/preview/preview/errors.js +77 -9
- package/dist/cjs/preview/preview/index.js +7 -2
- package/dist/cjs/preview/preview/previewAdjustStrategyPosition.js +7 -7
- package/dist/cjs/preview/preview/previewExitOrRepayStrategyPosition.js +10 -10
- package/dist/cjs/preview/preview/previewOpenStrategyPosition.js +7 -9
- package/dist/cjs/preview/preview/replayInnerOperations.js +15 -37
- package/dist/cjs/preview/preview/replayMulticall.js +1 -1
- package/dist/cjs/preview/preview/unwrapNativeCollateral.js +4 -9
- package/dist/cjs/preview/validate/checkOperation.js +1 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/model/previews.js +1 -34
- package/dist/esm/onchain/index.js +2 -1
- package/dist/esm/onchain/market/index.js +2 -1
- package/dist/esm/onchain/market/oracle/errors.js +13 -0
- package/dist/esm/onchain/market/oracle/index.js +2 -1
- package/dist/esm/onchain/validation/checks.js +19 -11
- package/dist/esm/preview/index.js +2 -2
- package/dist/esm/preview/preview/buildDelayedStrategyPositionOperationPreview.js +8 -8
- package/dist/esm/preview/preview/errors.js +72 -9
- package/dist/esm/preview/preview/index.js +2 -2
- package/dist/esm/preview/preview/previewAdjustStrategyPosition.js +7 -7
- package/dist/esm/preview/preview/previewExitOrRepayStrategyPosition.js +10 -10
- package/dist/esm/preview/preview/previewOpenStrategyPosition.js +8 -10
- package/dist/esm/preview/preview/replayInnerOperations.js +15 -37
- package/dist/esm/preview/preview/replayMulticall.js +1 -1
- package/dist/esm/preview/preview/unwrapNativeCollateral.js +4 -9
- package/dist/esm/preview/validate/checkOperation.js +1 -1
- package/dist/types/model/index.d.ts +2 -2
- package/dist/types/model/previews.d.ts +78 -49
- package/dist/types/onchain/index.d.ts +2 -1
- package/dist/types/onchain/market/MarketSuite.d.ts +2 -2
- package/dist/types/onchain/market/index.d.ts +2 -1
- package/dist/types/onchain/market/oracle/errors.d.ts +19 -0
- package/dist/types/onchain/market/oracle/index.d.ts +2 -1
- package/dist/types/onchain/validation/checks.d.ts +10 -13
- package/dist/types/onchain/validation/refusal.d.ts +4 -6
- package/dist/types/preview/index.d.ts +2 -2
- package/dist/types/preview/preview/buildDelayedStrategyPositionOperationPreview.d.ts +1 -1
- package/dist/types/preview/preview/errors.d.ts +27 -6
- package/dist/types/preview/preview/index.d.ts +2 -2
- package/dist/types/preview/preview/replayInnerOperations.d.ts +2 -2
- package/dist/types/preview/preview/replayMulticall.d.ts +1 -1
- package/dist/types/preview/preview/unwrapNativeCollateral.d.ts +4 -5
- package/dist/types/sdk/prepare/errors.d.ts +5 -3
- package/package.json +1 -1
|
@@ -24,8 +24,8 @@ import { Address } from "viem";
|
|
|
24
24
|
* Oracle estimate of a bag of holdings in this market's underlying.
|
|
25
25
|
*
|
|
26
26
|
* Tokens the oracle cannot price contribute `0` and are named on
|
|
27
|
-
* {@link unpriceable} (the first miss). Callers that speak preview
|
|
28
|
-
* that address to `
|
|
27
|
+
* {@link unpriceable} (the first miss). Callers that speak preview warnings
|
|
28
|
+
* map that address to an `UnpriceableTokenError` themselves.
|
|
29
29
|
**/
|
|
30
30
|
interface ValueInUnderlying {
|
|
31
31
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UnpriceableTokenError, unpriceableTokenError } from "./oracle/errors.js";
|
|
1
2
|
import { PHANTOM_TOKEN_MIDAS_REDEMPTION, RWA_LIQUIDATOR_MIDAS } from "./rwa/midas/constants.js";
|
|
2
3
|
import { MidasLiquidatorContract } from "./rwa/midas/MidasLiquidatorContract.js";
|
|
3
4
|
import { PHANTOM_TOKEN_SECURITIZE_REDEMPTION, RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE } from "./rwa/securitize/constants.js";
|
|
@@ -152,4 +153,4 @@ import "./zapper/index.js";
|
|
|
152
153
|
import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./MarketRegister.js";
|
|
153
154
|
import { DEFAULT_QUOTA_BUFFER_BPS, MAX_LEVERAGE_BUFFER_BPS, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, QuotaMode, StrategyRateInputs, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./math.js";
|
|
154
155
|
import { strategyName } from "./strategyName.js";
|
|
155
|
-
export { AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterContractStateHuman, AdapterContractType, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BasicSwapCall, BoundedPriceFeedContract, CamelotPool, CamelotV3AdapterContract, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DStokenData, DaiUsdsAdapterContract, DelayedWithdrawalClaim, DelayedWithdrawalRequest, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FluidDexAdapterContract, GaugeContract, GaugeParams, GetInvestorOptions, GetOpenAccountRequirementsProps, GetReward, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InterestRateModelType, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LatestUpdate, LegacyAdapterOperation, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationFees, MAX_LEVERAGE_BUFFER_BPS, MakerDeposit, MakerRedeem, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PrepareUpdateQuotasProps, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaMode, QuotaSlice, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StakingRewardsAdapterContract, StrategyCollateralProps, StrategyRateInputs, Swap, type TimestampedCalldata, TokenAmount, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, ValueInUnderlying, VaultDeposit, VelodromeV2RouterAdapterContract, VersionedAbi, WithdrawCollateral, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fetchRedstonePayloads, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, usdToNumber };
|
|
156
|
+
export { AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterContractStateHuman, AdapterContractType, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BasicSwapCall, BoundedPriceFeedContract, CamelotPool, CamelotV3AdapterContract, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DStokenData, DaiUsdsAdapterContract, DelayedWithdrawalClaim, DelayedWithdrawalRequest, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FluidDexAdapterContract, GaugeContract, GaugeParams, GetInvestorOptions, GetOpenAccountRequirementsProps, GetReward, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InterestRateModelType, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LatestUpdate, LegacyAdapterOperation, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationFees, MAX_LEVERAGE_BUFFER_BPS, MakerDeposit, MakerRedeem, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PrepareUpdateQuotasProps, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaMode, QuotaSlice, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StakingRewardsAdapterContract, StrategyCollateralProps, StrategyRateInputs, Swap, type TimestampedCalldata, TokenAmount, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnpriceableTokenError, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, ValueInUnderlying, VaultDeposit, VelodromeV2RouterAdapterContract, VersionedAbi, WithdrawCollateral, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fetchRedstonePayloads, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, unpriceableTokenError, usdToNumber };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IGearboxError } from "../../../model/errors.js";
|
|
2
|
+
import { Address } from "viem";
|
|
3
|
+
//#region src/onchain/market/oracle/errors.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The oracle has no price for `token`. Preview callers attach this with
|
|
6
|
+
* `warning ??=` so a malformed-transaction warning already recorded keeps
|
|
7
|
+
* precedence.
|
|
8
|
+
**/
|
|
9
|
+
interface UnpriceableTokenError extends IGearboxError {
|
|
10
|
+
code: "unpriceableToken";
|
|
11
|
+
/** Token the oracle could not price. */
|
|
12
|
+
token: Address;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds an {@link UnpriceableTokenError} for `token`.
|
|
16
|
+
**/
|
|
17
|
+
declare function unpriceableTokenError(token: Address): UnpriceableTokenError;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { UnpriceableTokenError, unpriceableTokenError };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { UnpriceableTokenError, unpriceableTokenError } from "./errors.js";
|
|
1
2
|
import { ConvertFn, IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions } from "./types.js";
|
|
2
3
|
import { collateralPriceInUnderlying } from "./collateralPriceInUnderlying.js";
|
|
3
4
|
import { createPriceOracle } from "./createPriceOracle.js";
|
|
4
5
|
import { PriceOracleV310Contract } from "./PriceOracleV310Contract.js";
|
|
5
|
-
export { ConvertFn, IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, collateralPriceInUnderlying, createPriceOracle };
|
|
6
|
+
export { ConvertFn, IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, UnpriceableTokenError, collateralPriceInUnderlying, createPriceOracle, unpriceableTokenError };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Bps, Token, TokenAmount } from "../../model/primitives.js";
|
|
2
|
+
import { IGearboxError } from "../../model/errors.js";
|
|
3
|
+
import { MalformedPreviewError } from "../../model/previews.js";
|
|
2
4
|
import "../../model/index.js";
|
|
3
5
|
import { BorrowLimitBinding, PreviewIssue } from "./refusal.js";
|
|
4
6
|
import { Address } from "viem";
|
|
@@ -147,21 +149,16 @@ declare function checkFunding(args: {
|
|
|
147
149
|
/**
|
|
148
150
|
* The SDK could not replay the transaction.
|
|
149
151
|
*
|
|
150
|
-
* Only
|
|
151
|
-
*
|
|
152
|
-
*
|
|
152
|
+
* Only a {@link MalformedPreviewError} lands here. An `unpriceableToken`
|
|
153
|
+
* warning says the transaction is fine and the SDK could not fully evaluate
|
|
154
|
+
* it, which is a caveat on the numbers rather than a reason to refuse — it
|
|
155
|
+
* stays on the preview for the caller to surface.
|
|
153
156
|
*/
|
|
154
|
-
declare function checkPreviewError(
|
|
155
|
-
code: number;
|
|
156
|
-
message: string;
|
|
157
|
-
} | undefined): PreviewIssue | null;
|
|
157
|
+
declare function checkPreviewError(warning: IGearboxError | undefined): PreviewIssue | null;
|
|
158
158
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* incomplete. A range, so a future 1007 classifies itself.
|
|
159
|
+
* Whether the preview warning means the transaction itself is malformed,
|
|
160
|
+
* rather than that only the evaluation was incomplete.
|
|
162
161
|
*/
|
|
163
|
-
declare function isMalformedPreviewError(
|
|
164
|
-
code: number;
|
|
165
|
-
}): boolean;
|
|
162
|
+
declare function isMalformedPreviewError(warning: IGearboxError): warning is MalformedPreviewError;
|
|
166
163
|
//#endregion
|
|
167
164
|
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 };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Bps, Token, TokenAmount } from "../../model/primitives.js";
|
|
2
|
+
import { MalformedPreviewError } from "../../model/previews.js";
|
|
2
3
|
import "../../model/index.js";
|
|
3
4
|
import { Address } from "viem";
|
|
4
5
|
//#region src/onchain/validation/refusal.d.ts
|
|
@@ -181,13 +182,10 @@ interface PreviewErrorDetails {
|
|
|
181
182
|
max: number;
|
|
182
183
|
};
|
|
183
184
|
/**
|
|
184
|
-
* The
|
|
185
|
-
*
|
|
185
|
+
* The malformed-preview warning the SDK recorded, and its human-readable
|
|
186
|
+
* detail.
|
|
186
187
|
*/
|
|
187
|
-
malformedTransaction:
|
|
188
|
-
code: number;
|
|
189
|
-
message: string;
|
|
190
|
-
};
|
|
188
|
+
malformedTransaction: MalformedPreviewError;
|
|
191
189
|
}
|
|
192
190
|
/**
|
|
193
191
|
* Which ceiling ran out when a borrow could not be served.
|
|
@@ -32,7 +32,7 @@ import { DetectedDelayedOperation, detectDelayedOperation } from "./preview/dete
|
|
|
32
32
|
import { buildDelayedStrategyPositionOperationPreview } from "./preview/buildDelayedStrategyPositionOperationPreview.js";
|
|
33
33
|
import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRepay.js";
|
|
34
34
|
import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./preview/detectDelayedClaim.js";
|
|
35
|
-
import { UnsupportedOperationError,
|
|
35
|
+
import { UnsupportedOperationError, adapterCallOutsideBracketError, invalidTransactionValueError, malformedBracketError, nonAdapterCallInBracketError, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError } from "./preview/errors.js";
|
|
36
36
|
import { estimateClaimableAt } from "./preview/estimateClaimableAt.js";
|
|
37
37
|
import { previewAdjustStrategyPosition } from "./preview/previewAdjustStrategyPosition.js";
|
|
38
38
|
import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./preview/previewExitOrRepayStrategyPosition.js";
|
|
@@ -44,4 +44,4 @@ import "./preview/index.js";
|
|
|
44
44
|
import { CheckOperationOptions, WeighedFactors, checkOperation, collateralIssue, marketIssues, quotaCountIssue } from "./validate/checkOperation.js";
|
|
45
45
|
import { checkSimulation } from "./validate/checkSimulation.js";
|
|
46
46
|
import "./validate/index.js";
|
|
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, type 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, PreviewOperationError, PreviewOperationInput, PreviewOperationOptions, type PreviewRefusal, type PreviewSimulationError, 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, type UnsupportedZapperFunctionError, UpdateQuotaOp, WeighedFactors, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, asPreviewSimulationError, 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, type 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, PreviewOperationError, PreviewOperationInput, PreviewOperationOptions, type PreviewRefusal, type PreviewSimulationError, 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, type UnsupportedZapperFunctionError, UpdateQuotaOp, WeighedFactors, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, adapterCallOutsideBracketError, asPreviewSimulationError, buildDelayedStrategyPositionOperationPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssue, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, extractAdapterCallTraces, extractTransfers, findFacadeCalls, invalidTransactionValueError, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, malformedBracketError, marketIssues, nonAdapterCallInBracketError, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, quotaCountIssue, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError };
|
|
@@ -15,7 +15,7 @@ import { Address } from "viem";
|
|
|
15
15
|
* Pure function: the input states are never mutated and no network access is performed.
|
|
16
16
|
* Swaps are estimated with the injected conversion; remaining holdings are
|
|
17
17
|
* priced by `MarketSuite.valueInUnderlying`. Tokens that cannot be priced
|
|
18
|
-
* contribute nothing and set a non-fatal `
|
|
18
|
+
* contribute nothing and set a non-fatal `unpriceableToken` warning on the
|
|
19
19
|
* preview.
|
|
20
20
|
*
|
|
21
21
|
* The changes (e.g. `totalDebtChange`) are reported relative to the account
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IGearboxError } from "../../model/errors.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AdapterCallOutsideBracketError, InvalidTransactionValueError, MalformedBracketError, MalformedBracketKind, NonAdapterCallInBracketError, UnpreviewableAdapterCallError, UnsupportedOutOfBracketCallError } from "../../model/previews.js";
|
|
3
3
|
import "../../model/index.js";
|
|
4
4
|
import { Address } from "viem";
|
|
5
5
|
//#region src/preview/preview/errors.d.ts
|
|
@@ -14,10 +14,31 @@ interface UnsupportedOperationError extends IGearboxError {
|
|
|
14
14
|
operation: string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
* attach this with `error ??=` so a malformed-transaction (1xxx) error
|
|
19
|
-
* already recorded keeps precedence.
|
|
17
|
+
* Builds a {@link MalformedBracketError} for the given bracket invariant.
|
|
20
18
|
**/
|
|
21
|
-
declare function
|
|
19
|
+
declare function malformedBracketError(kind: MalformedBracketKind): MalformedBracketError;
|
|
20
|
+
/**
|
|
21
|
+
* Builds an {@link AdapterCallOutsideBracketError} for `adapter`.
|
|
22
|
+
**/
|
|
23
|
+
declare function adapterCallOutsideBracketError(adapter: Address): AdapterCallOutsideBracketError;
|
|
24
|
+
/**
|
|
25
|
+
* Builds a {@link NonAdapterCallInBracketError} for `target`.
|
|
26
|
+
**/
|
|
27
|
+
declare function nonAdapterCallInBracketError(target: Address): NonAdapterCallInBracketError;
|
|
28
|
+
/**
|
|
29
|
+
* Builds an {@link UnpreviewableAdapterCallError} for a bracketed adapter
|
|
30
|
+
* call that could not be replayed.
|
|
31
|
+
**/
|
|
32
|
+
declare function unpreviewableAdapterCallError(adapter: Address, cause: unknown): UnpreviewableAdapterCallError;
|
|
33
|
+
/**
|
|
34
|
+
* Builds an {@link UnsupportedOutOfBracketCallError} for an allowed
|
|
35
|
+
* out-of-bracket adapter call that could not be replayed.
|
|
36
|
+
**/
|
|
37
|
+
declare function unsupportedOutOfBracketCallError(adapter: Address, cause: unknown): UnsupportedOutOfBracketCallError;
|
|
38
|
+
/**
|
|
39
|
+
* Builds an {@link InvalidTransactionValueError} when `msg.value` does not
|
|
40
|
+
* fit into the declared WETH collateral.
|
|
41
|
+
**/
|
|
42
|
+
declare function invalidTransactionValueError(value: bigint, wethCollateral: bigint): InvalidTransactionValueError;
|
|
22
43
|
//#endregion
|
|
23
|
-
export { UnsupportedOperationError,
|
|
44
|
+
export { UnsupportedOperationError, adapterCallOutsideBracketError, invalidTransactionValueError, malformedBracketError, nonAdapterCallInBracketError, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError };
|
|
@@ -3,11 +3,11 @@ import { DetectedDelayedOperation, detectDelayedOperation } from "./detectDelaye
|
|
|
3
3
|
import { buildDelayedStrategyPositionOperationPreview } from "./buildDelayedStrategyPositionOperationPreview.js";
|
|
4
4
|
import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
|
|
5
5
|
import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
|
|
6
|
-
import { UnsupportedOperationError,
|
|
6
|
+
import { UnsupportedOperationError, adapterCallOutsideBracketError, invalidTransactionValueError, malformedBracketError, nonAdapterCallInBracketError, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError } 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
10
|
import { PreviewOperationError, 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, PreviewOperationError, ReplayMulticallResult, ReplayState, ReplayableOperation, UnsupportedOperationError, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent,
|
|
13
|
+
export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, PreviewOperationError, ReplayMulticallResult, ReplayState, ReplayableOperation, UnsupportedOperationError, adapterCallOutsideBracketError, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, invalidTransactionValueError, isCloseOrRepay, makeReplayState, malformedBracketError, nonAdapterCallInBracketError, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError };
|
|
@@ -41,10 +41,10 @@ declare function makeReplayState(account: CreditAccountState): ReplayState;
|
|
|
41
41
|
* facade execution order. The result is the *minimal guaranteed* post-state.
|
|
42
42
|
*
|
|
43
43
|
* The function assumes that the call was generated by our frontend using
|
|
44
|
-
* router/withdrawal compressor, otherwise it returns
|
|
44
|
+
* router/withdrawal compressor, otherwise it returns a warning, but still
|
|
45
45
|
* proceeds best-effort.
|
|
46
46
|
*
|
|
47
|
-
* @returns `undefined` on success, the
|
|
47
|
+
* @returns `undefined` on success, the warning on a malformed multicall.
|
|
48
48
|
*/
|
|
49
49
|
declare function replayInnerOperations<P extends PluginsMap>(sdk: OnchainSDK<P>, multicall: InnerOperation[], state: ReplayState): OperationPreviewError | undefined;
|
|
50
50
|
//#endregion
|
|
@@ -10,9 +10,9 @@ interface UnwrapNativeCollateralResult {
|
|
|
10
10
|
*/
|
|
11
11
|
assets: Asset[];
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Warning set when the transaction value is malformed.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
warning?: OperationPreviewError;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Represents the transaction's attached native value as a `NATIVE_ADDRESS`
|
|
@@ -26,14 +26,13 @@ interface UnwrapNativeCollateralResult {
|
|
|
26
26
|
*
|
|
27
27
|
* When `nativeAmount` is positive but the WETH collateral is missing or
|
|
28
28
|
* smaller than it, the transaction is malformed: the collateral is returned
|
|
29
|
-
* as-is (no unwrapping) together with an `
|
|
30
|
-
* error.
|
|
29
|
+
* as-is (no unwrapping) together with an `invalidTransactionValue` warning.
|
|
31
30
|
*
|
|
32
31
|
* @param collateral - Collateral assets as declared by the multicall.
|
|
33
32
|
* @param nativeAmount - Transaction `msg.value`.
|
|
34
33
|
* @param wethToken - Wrapped native token address.
|
|
35
34
|
* @returns Collateral with the native amount unwrapped from the WETH entry,
|
|
36
|
-
* plus the
|
|
35
|
+
* plus the warning on a malformed transaction value.
|
|
37
36
|
*/
|
|
38
37
|
declare function unwrapNativeCollateral(collateral: Asset[], nativeAmount: bigint, wethToken: Address): UnwrapNativeCollateralResult;
|
|
39
38
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Bps, Token, TokenAmount } from "../../model/primitives.js";
|
|
2
2
|
import { IGearboxError } from "../../model/errors.js";
|
|
3
|
+
import { MalformedPreviewError } from "../../model/previews.js";
|
|
3
4
|
import "../../model/index.js";
|
|
4
5
|
import { BorrowLimitBinding, PreviewIssue } from "../../onchain/validation/refusal.js";
|
|
5
6
|
import { RouteRefusals } from "../../onchain/accounts/intents/types.js";
|
|
@@ -204,10 +205,11 @@ interface QuotaCountExceededError extends IGearboxError {
|
|
|
204
205
|
interface MalformedTransactionError extends IGearboxError {
|
|
205
206
|
code: "malformedTransaction";
|
|
206
207
|
/**
|
|
207
|
-
* The SDK's own preview
|
|
208
|
-
* apart from `code`, which every error in the
|
|
208
|
+
* The SDK's own preview warning code (the `MalformedPreviewError`
|
|
209
|
+
* discriminant). Named apart from `code`, which every error in the
|
|
210
|
+
* envelope spells the same way.
|
|
209
211
|
**/
|
|
210
|
-
previewCode:
|
|
212
|
+
previewCode: MalformedPreviewError["code"];
|
|
211
213
|
/** What the replay reported, which is narrower than {@link message}. */
|
|
212
214
|
detail: string;
|
|
213
215
|
}
|