@gearbox-protocol/sdk 16.2.0 → 16.3.0-next.2
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/abi/rwa/iMidasAccessControl.js +23 -0
- package/dist/cjs/abi/rwa/iMidasDegenNFT.js +92 -0
- package/dist/cjs/history/assembleOperations.js +3 -3
- package/dist/cjs/history/classifyMulticallOperations.js +7 -7
- package/dist/cjs/history/index.js +13 -0
- package/dist/cjs/history/parseCreditAccountTransaction.js +5 -5
- package/dist/cjs/{preview → history}/trace/errors.js +1 -1
- package/dist/cjs/{preview → history}/trace/extractAdapterCallTraces.js +1 -1
- package/dist/cjs/{preview → history}/trace/extractTransfers.js +3 -3
- package/dist/cjs/{preview → history}/trace/findFacadeCalls.js +3 -3
- package/dist/cjs/history/trace/index.js +14 -0
- package/dist/cjs/model/errors/index.js +37 -0
- package/dist/cjs/model/errors/liquidation-errors.js +32 -0
- package/dist/cjs/model/errors/operation-errors.js +135 -0
- package/dist/cjs/{onchain/market/oracle/errors.js → model/errors/oracle-errors.js} +1 -1
- package/dist/cjs/model/errors/prepare-errors.js +108 -0
- package/dist/cjs/model/errors/preview-errors.js +12 -0
- package/dist/cjs/model/index.js +45 -2
- package/dist/cjs/model/opportunities.schema.js +3 -1
- package/dist/cjs/model/positions.js +1 -1
- package/dist/cjs/model/result.js +0 -8
- package/dist/cjs/model/rwa.js +53 -0
- package/dist/cjs/model/rwa.schema.js +20 -0
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/cjs/onchain/accounts/index.js +0 -2
- package/dist/cjs/onchain/accounts/intents/guards.js +42 -66
- package/dist/cjs/onchain/accounts/intents/index.js +38 -35
- package/dist/cjs/onchain/accounts/intents/leverage-band.js +1 -1
- package/dist/cjs/onchain/accounts/intents/math.js +19 -15
- package/dist/cjs/onchain/accounts/intents/open-strategy.js +6 -4
- package/dist/cjs/onchain/accounts/intents/plan.js +52 -48
- package/dist/cjs/onchain/accounts/intents/realize.js +26 -24
- package/dist/cjs/onchain/accounts/intents/tail.js +15 -12
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +7 -0
- package/dist/cjs/onchain/accounts/intents/tests/finish-withdraw.fixtures.js +6 -6
- package/dist/cjs/onchain/accounts/intents/tests/withdraw.fixtures.js +12 -12
- package/dist/cjs/onchain/accounts/intents/view.js +1 -1
- package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +2 -2
- package/dist/cjs/onchain/accounts/withdrawal-compressor/index.js +0 -1
- package/dist/cjs/onchain/index.js +130 -38
- package/dist/cjs/onchain/market/MarketSuite.js +10 -4
- package/dist/cjs/onchain/market/adapters/index.js +1 -0
- package/dist/cjs/onchain/market/credit/CreditSuite.js +77 -15
- package/dist/cjs/onchain/market/index.js +8 -8
- package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +6 -6
- package/dist/cjs/onchain/market/oracle/index.js +0 -2
- package/dist/cjs/onchain/market/pool/PoolQuotaKeeperV310Contract.js +8 -0
- package/dist/cjs/onchain/market/rwa/RWARegistry.js +3 -2
- package/dist/cjs/onchain/market/rwa/createDegenNFT.js +53 -0
- package/dist/cjs/onchain/market/rwa/index.js +7 -5
- package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +56 -0
- package/dist/cjs/onchain/market/rwa/midas/constants.js +2 -0
- package/dist/cjs/onchain/market/rwa/midas/index.js +3 -0
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +22 -3
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -9
- package/dist/cjs/onchain/market/rwa/securitize/constants.js +2 -2
- package/dist/cjs/onchain/market/rwa/securitize/index.js +4 -3
- package/dist/cjs/onchain/market/rwa/securitize/types.js +0 -29
- package/dist/cjs/onchain/market/rwa/types.js +0 -7
- package/dist/cjs/onchain/market/zapper/index.js +0 -1
- package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +2 -2
- package/dist/cjs/onchain/opportunities/OpportunitiesService.js +11 -3
- package/dist/cjs/onchain/pools/PoolService.js +10 -16
- package/dist/cjs/onchain/preview/index.js +41 -0
- package/dist/cjs/{preview → onchain/preview}/parse/classifyInnerOperations.js +2 -3
- package/dist/cjs/onchain/preview/parse/index.js +14 -0
- package/dist/cjs/{preview → onchain/preview}/parse/parseFacadeOperationCalldata.js +3 -3
- package/dist/cjs/{preview → onchain/preview}/parse/parseOperationCalldata.js +16 -17
- package/dist/cjs/{preview → onchain/preview}/parse/parsePoolOperationCalldata.js +3 -3
- package/dist/cjs/{preview → onchain/preview}/parse/parseRWAFactoryOperationCalldata.js +11 -12
- package/dist/cjs/{preview → onchain/preview}/parse/types.js +1 -1
- package/dist/cjs/{preview → onchain/preview}/preview/CreditAccountState.js +3 -4
- package/dist/cjs/{preview → onchain/preview}/preview/buildDelayedStrategyPositionOperationPreview.js +10 -11
- package/dist/cjs/{preview → onchain/preview}/preview/detectCloseOrRepay.js +2 -3
- package/dist/cjs/{preview → onchain/preview}/preview/detectDelayedClaim.js +4 -5
- package/dist/cjs/{preview → onchain/preview}/preview/detectDelayedOperation.js +5 -6
- package/dist/cjs/{preview → onchain/preview}/preview/estimateClaimableAt.js +1 -1
- package/dist/cjs/onchain/preview/preview/index.js +26 -0
- package/dist/cjs/{preview → onchain/preview}/preview/previewAdjustStrategyPosition.js +18 -22
- package/dist/cjs/{preview → onchain/preview}/preview/previewExitOrRepayStrategyPosition.js +22 -28
- package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +60 -0
- package/dist/cjs/onchain/preview/preview/previewOperation.js +119 -0
- package/dist/cjs/{preview/simulate/simulatePoolOperation.js → onchain/preview/preview/previewPoolPositionOperation.js} +46 -32
- package/dist/cjs/onchain/preview/preview/replayInnerOperations.js +109 -0
- package/dist/cjs/onchain/preview/preview/replayMulticall.js +22 -0
- package/dist/cjs/{preview → onchain/preview}/preview/unwrapNativeCollateral.js +11 -14
- package/dist/cjs/onchain/validation/bundles/checkAccountQuotas.js +20 -0
- package/dist/cjs/onchain/validation/bundles/checkCollateralFunding.js +59 -0
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +65 -0
- package/dist/cjs/onchain/validation/bundles/checkDraw.js +28 -0
- package/dist/cjs/onchain/validation/bundles/checkHealthFactors.js +27 -0
- package/dist/cjs/onchain/validation/bundles/checkLiquidationEligibility.js +33 -0
- package/dist/cjs/onchain/validation/bundles/checkLiquidationFunding.js +29 -0
- package/dist/cjs/onchain/validation/bundles/checkMarket.js +24 -0
- package/dist/cjs/onchain/validation/bundles/checkObtained.js +13 -0
- package/dist/cjs/onchain/validation/bundles/checkPoolFunding.js +22 -0
- package/dist/cjs/onchain/validation/bundles/checkPoolOperation.js +35 -0
- package/dist/cjs/onchain/validation/bundles/checkQuotasAsked.js +20 -0
- package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +33 -0
- package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +24 -0
- package/dist/cjs/onchain/validation/bundles/checkWallet.js +22 -0
- package/dist/cjs/onchain/validation/bundles/checkWalletAllowance.js +32 -0
- package/dist/cjs/onchain/validation/bundles/checkWalletBalance.js +41 -0
- package/dist/cjs/onchain/validation/bundles/index.js +35 -0
- package/dist/cjs/onchain/validation/checkLiquidation.js +22 -0
- package/dist/cjs/onchain/validation/checkOperation.js +62 -0
- package/dist/cjs/onchain/validation/checkSimulation.js +60 -0
- package/dist/cjs/onchain/validation/checks/checkBorrowLimit.js +25 -0
- package/dist/cjs/onchain/validation/checks/checkCollateralised.js +26 -0
- package/dist/cjs/onchain/validation/checks/checkCreditAccountFrozen.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkCreditManagerPaused.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkDebtLimits.js +18 -0
- package/dist/cjs/onchain/validation/checks/checkEmergencyLiquidator.js +13 -0
- package/dist/cjs/onchain/validation/checks/checkForbiddenToken.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkLeverage.js +13 -0
- package/dist/cjs/onchain/validation/checks/checkLiquidatorEligible.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkMarketExpired.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkPoolLiquidity.js +25 -0
- package/dist/cjs/onchain/validation/checks/checkPoolPaused.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkPoolSunset.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkQuotaCount.js +10 -0
- package/dist/cjs/onchain/validation/checks/checkQuotaLimit.js +18 -0
- package/dist/cjs/onchain/validation/checks/index.js +31 -0
- package/dist/cjs/onchain/validation/helpers/amount.js +12 -0
- package/dist/cjs/onchain/validation/helpers/health-factor-limits.js +25 -0
- package/dist/cjs/onchain/validation/helpers/index.js +11 -0
- package/dist/cjs/onchain/validation/{token.js → helpers/token.js} +4 -4
- package/dist/cjs/onchain/validation/index.js +85 -27
- package/dist/cjs/onchain/validation/raise.js +33 -0
- package/dist/cjs/sdk/index.js +6 -11
- package/dist/cjs/sdk/liquidations/LiquidationsNamespace.js +9 -0
- package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +19 -4
- package/dist/cjs/sdk/prepare/PrepareApi.js +40 -50
- package/dist/cjs/sdk/prepare/index.js +7 -11
- package/dist/cjs/sdk/prepare/types.js +0 -4
- package/dist/cjs/sdk/preview/PreviewNamespace.js +24 -13
- package/dist/esm/abi/rwa/iMidasAccessControl.js +22 -0
- package/dist/esm/abi/rwa/iMidasDegenNFT.js +91 -0
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/history/assembleOperations.js +2 -2
- package/dist/esm/history/classifyMulticallOperations.js +2 -2
- package/dist/esm/history/index.js +6 -1
- package/dist/esm/history/parseCreditAccountTransaction.js +3 -3
- package/dist/esm/{preview → history}/trace/errors.js +1 -1
- package/dist/esm/{preview → history}/trace/extractAdapterCallTraces.js +1 -1
- package/dist/esm/{preview → history}/trace/extractTransfers.js +2 -2
- package/dist/esm/{preview → history}/trace/findFacadeCalls.js +1 -1
- package/dist/esm/model/errors/index.js +7 -0
- package/dist/esm/model/errors/liquidation-errors.js +29 -0
- package/dist/esm/model/errors/operation-errors.js +121 -0
- package/dist/esm/{onchain/market/oracle/errors.js → model/errors/oracle-errors.js} +1 -1
- package/dist/esm/model/errors/prepare-errors.js +97 -0
- package/dist/esm/model/errors/preview-errors.js +11 -0
- package/dist/esm/model/index.js +10 -3
- package/dist/esm/model/opportunities.schema.js +3 -1
- package/dist/esm/model/positions.js +1 -1
- package/dist/esm/model/result.js +1 -8
- package/dist/esm/model/rwa.js +48 -0
- package/dist/esm/model/rwa.schema.js +18 -0
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/index.js +1 -2
- package/dist/esm/onchain/accounts/intents/guards.js +29 -52
- package/dist/esm/onchain/accounts/intents/index.js +39 -35
- package/dist/esm/onchain/accounts/intents/leverage-band.js +1 -1
- package/dist/esm/onchain/accounts/intents/math.js +18 -14
- package/dist/esm/onchain/accounts/intents/open-strategy.js +8 -6
- package/dist/esm/onchain/accounts/intents/plan.js +51 -47
- package/dist/esm/onchain/accounts/intents/realize.js +26 -24
- package/dist/esm/onchain/accounts/intents/tail.js +14 -11
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +7 -0
- package/dist/esm/onchain/accounts/intents/tests/finish-withdraw.fixtures.js +6 -6
- package/dist/esm/onchain/accounts/intents/tests/withdraw.fixtures.js +12 -12
- package/dist/esm/onchain/accounts/intents/view.js +1 -1
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +3 -3
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/index.js +0 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/index.js +64 -11
- package/dist/esm/onchain/market/MarketSuite.js +10 -4
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/index.js +1 -0
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditSuite.js +77 -15
- package/dist/esm/onchain/market/index.js +6 -6
- package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
- package/dist/esm/onchain/market/oracle/index.js +1 -2
- package/dist/esm/onchain/market/pool/PoolQuotaKeeperV310Contract.js +8 -0
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/onchain/market/rwa/RWARegistry.js +2 -1
- package/dist/esm/onchain/market/rwa/createDegenNFT.js +52 -0
- package/dist/esm/onchain/market/rwa/index.js +6 -5
- package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +55 -0
- package/dist/esm/onchain/market/rwa/midas/constants.js +2 -1
- package/dist/esm/onchain/market/rwa/midas/index.js +3 -2
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +20 -2
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +4 -4
- package/dist/esm/onchain/market/rwa/securitize/constants.js +2 -2
- package/dist/esm/onchain/market/rwa/securitize/index.js +4 -3
- package/dist/esm/onchain/market/rwa/securitize/types.js +1 -29
- package/dist/esm/onchain/market/rwa/types.js +1 -7
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/index.js +0 -1
- package/dist/esm/onchain/opportunities/MultichainOpportunitiesService.js +2 -2
- package/dist/esm/onchain/opportunities/OpportunitiesService.js +11 -3
- package/dist/esm/onchain/pools/PoolService.js +10 -16
- package/dist/esm/onchain/preview/index.js +20 -0
- package/dist/esm/{preview → onchain/preview}/parse/classifyInnerOperations.js +2 -3
- package/dist/esm/{preview → onchain/preview}/parse/index.js +0 -1
- package/dist/esm/{preview → onchain/preview}/parse/parseFacadeOperationCalldata.js +1 -1
- package/dist/esm/{preview → onchain/preview}/parse/parseOperationCalldata.js +10 -11
- package/dist/esm/{preview → onchain/preview}/parse/parsePoolOperationCalldata.js +3 -3
- package/dist/esm/{preview → onchain/preview}/parse/parseRWAFactoryOperationCalldata.js +8 -9
- package/dist/esm/{preview → onchain/preview}/parse/types.js +1 -1
- package/dist/esm/{preview → onchain/preview}/preview/CreditAccountState.js +3 -4
- package/dist/esm/{preview → onchain/preview}/preview/buildDelayedStrategyPositionOperationPreview.js +10 -11
- package/dist/esm/{preview → onchain/preview}/preview/detectCloseOrRepay.js +2 -3
- package/dist/esm/{preview → onchain/preview}/preview/detectDelayedClaim.js +4 -5
- package/dist/esm/{preview → onchain/preview}/preview/detectDelayedOperation.js +5 -6
- package/dist/esm/{preview → onchain/preview}/preview/estimateClaimableAt.js +1 -1
- package/dist/esm/{preview → onchain/preview}/preview/index.js +3 -4
- package/dist/esm/{preview → onchain/preview}/preview/previewAdjustStrategyPosition.js +17 -21
- package/dist/esm/{preview → onchain/preview}/preview/previewExitOrRepayStrategyPosition.js +20 -26
- package/dist/esm/{preview → onchain/preview}/preview/previewOpenStrategyPosition.js +25 -15
- package/dist/esm/{preview → onchain/preview}/preview/previewOperation.js +54 -35
- package/dist/esm/{preview/simulate/simulatePoolOperation.js → onchain/preview/preview/previewPoolPositionOperation.js} +46 -30
- package/dist/esm/onchain/preview/preview/replayInnerOperations.js +107 -0
- package/dist/esm/onchain/preview/preview/replayMulticall.js +21 -0
- package/dist/esm/{preview → onchain/preview}/preview/unwrapNativeCollateral.js +11 -14
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/onchain/validation/bundles/checkAccountQuotas.js +19 -0
- package/dist/esm/onchain/validation/bundles/checkCollateralFunding.js +58 -0
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +64 -0
- package/dist/esm/onchain/validation/bundles/checkDraw.js +27 -0
- package/dist/esm/onchain/validation/bundles/checkHealthFactors.js +26 -0
- package/dist/esm/onchain/validation/bundles/checkLiquidationEligibility.js +32 -0
- package/dist/esm/onchain/validation/bundles/checkLiquidationFunding.js +28 -0
- package/dist/esm/onchain/validation/bundles/checkMarket.js +23 -0
- package/dist/esm/onchain/validation/bundles/checkObtained.js +12 -0
- package/dist/esm/onchain/validation/bundles/checkPoolFunding.js +21 -0
- package/dist/esm/onchain/validation/bundles/checkPoolOperation.js +34 -0
- package/dist/esm/onchain/validation/bundles/checkQuotasAsked.js +19 -0
- package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +32 -0
- package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +23 -0
- package/dist/esm/onchain/validation/bundles/checkWallet.js +21 -0
- package/dist/esm/onchain/validation/bundles/checkWalletAllowance.js +31 -0
- package/dist/esm/onchain/validation/bundles/checkWalletBalance.js +40 -0
- package/dist/esm/onchain/validation/bundles/index.js +18 -0
- package/dist/esm/onchain/validation/checkLiquidation.js +21 -0
- package/dist/esm/onchain/validation/checkOperation.js +61 -0
- package/dist/esm/onchain/validation/checkSimulation.js +59 -0
- package/dist/esm/onchain/validation/checks/checkBorrowLimit.js +24 -0
- package/dist/esm/onchain/validation/checks/checkCollateralised.js +25 -0
- package/dist/esm/onchain/validation/checks/checkCreditAccountFrozen.js +9 -0
- package/dist/esm/onchain/validation/checks/checkCreditManagerPaused.js +9 -0
- package/dist/esm/onchain/validation/checks/checkDebtLimits.js +17 -0
- package/dist/esm/onchain/validation/checks/checkEmergencyLiquidator.js +12 -0
- package/dist/esm/onchain/validation/checks/checkForbiddenToken.js +9 -0
- package/dist/esm/onchain/validation/checks/checkLeverage.js +12 -0
- package/dist/esm/onchain/validation/checks/checkLiquidatorEligible.js +9 -0
- package/dist/esm/onchain/validation/checks/checkMarketExpired.js +9 -0
- package/dist/esm/onchain/validation/checks/checkPoolLiquidity.js +24 -0
- package/dist/esm/onchain/validation/checks/checkPoolPaused.js +9 -0
- package/dist/esm/onchain/validation/checks/checkPoolSunset.js +9 -0
- package/dist/esm/onchain/validation/checks/checkQuotaCount.js +9 -0
- package/dist/esm/onchain/validation/checks/checkQuotaLimit.js +17 -0
- package/dist/esm/onchain/validation/checks/index.js +16 -0
- package/dist/esm/onchain/validation/helpers/amount.js +11 -0
- package/dist/esm/onchain/validation/helpers/health-factor-limits.js +21 -0
- package/dist/esm/onchain/validation/helpers/index.js +4 -0
- package/dist/esm/onchain/validation/{token.js → helpers/token.js} +3 -3
- package/dist/esm/onchain/validation/index.js +43 -4
- package/dist/esm/onchain/validation/raise.js +31 -0
- package/dist/esm/sdk/index.js +2 -3
- package/dist/esm/sdk/liquidations/LiquidationsNamespace.js +9 -0
- package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +19 -4
- package/dist/esm/sdk/prepare/PrepareApi.js +25 -35
- package/dist/esm/sdk/prepare/index.js +3 -3
- package/dist/esm/sdk/prepare/types.js +1 -2
- package/dist/esm/sdk/preview/PreviewNamespace.js +24 -13
- package/dist/types/abi/rwa/iMidasAccessControl.d.ts +22 -0
- package/dist/types/abi/rwa/iMidasDegenNFT.d.ts +82 -0
- package/dist/types/history/assembleOperations.d.ts +4 -5
- package/dist/types/history/classifyMulticallOperations.d.ts +3 -4
- package/dist/types/history/index.d.ts +8 -2
- package/dist/types/history/mapOperations.d.ts +1 -1
- package/dist/types/{preview → history}/trace/errors.d.ts +1 -1
- package/dist/types/{preview → history}/trace/extractAdapterCallTraces.d.ts +1 -1
- package/dist/types/{preview → history}/trace/extractTransfers.d.ts +2 -3
- package/dist/types/{preview → history}/trace/findFacadeCalls.d.ts +1 -1
- package/dist/types/{preview → history}/trace/types.d.ts +1 -1
- package/dist/types/history/types.d.ts +2 -3
- package/dist/types/model/errors/base.d.ts +28 -0
- package/dist/types/model/errors/index.d.ts +7 -0
- package/dist/types/model/errors/liquidation-errors.d.ts +45 -0
- package/dist/types/model/errors/operation-errors.d.ts +216 -0
- package/dist/types/{onchain/market/oracle/errors.d.ts → model/errors/oracle-errors.d.ts} +3 -5
- package/dist/types/model/errors/prepare-errors.d.ts +131 -0
- package/dist/types/model/errors/preview-errors.d.ts +72 -0
- package/dist/types/model/index.d.ts +12 -4
- package/dist/types/model/opportunities.d.ts +12 -2
- package/dist/types/model/opportunities.schema.d.ts +30 -0
- package/dist/types/model/positions.d.ts +2 -2
- package/dist/types/model/previews.d.ts +52 -113
- package/dist/types/model/result.d.ts +4 -8
- package/dist/types/model/rwa.d.ts +167 -0
- package/dist/types/model/rwa.schema.d.ts +29 -0
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +2 -1
- package/dist/types/offchain/opportunities/types.d.ts +4 -1
- package/dist/types/onchain/accounts/CreditAccountsServiceV310.d.ts +3 -1
- package/dist/types/onchain/accounts/index.d.ts +2 -4
- package/dist/types/onchain/accounts/intents/guards.d.ts +8 -18
- package/dist/types/onchain/accounts/intents/index.d.ts +20 -19
- package/dist/types/onchain/accounts/intents/leverage-band.d.ts +1 -1
- package/dist/types/onchain/accounts/intents/math.d.ts +6 -6
- package/dist/types/onchain/accounts/intents/operations.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/plan.d.ts +9 -9
- package/dist/types/onchain/accounts/intents/tail.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/testing/expect.d.ts +3 -3
- package/dist/types/onchain/accounts/intents/tests/finish-withdraw.fixtures.d.ts +6 -6
- package/dist/types/onchain/accounts/intents/tests/withdraw.fixtures.d.ts +12 -12
- package/dist/types/onchain/accounts/intents/types.d.ts +32 -30
- package/dist/types/onchain/accounts/types.d.ts +2 -1
- package/dist/types/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.d.ts +1 -1
- package/dist/types/onchain/accounts/withdrawal-compressor/index.d.ts +1 -2
- package/dist/types/onchain/accounts/withdrawal-compressor/types.d.ts +1 -1
- package/dist/types/onchain/index.d.ts +73 -16
- package/dist/types/onchain/market/MarketSuite.d.ts +5 -1
- package/dist/types/onchain/market/adapters/index.d.ts +2 -1
- package/dist/types/onchain/market/adapters/transfers.d.ts +0 -7
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +30 -8
- package/dist/types/onchain/market/credit/index.d.ts +2 -2
- package/dist/types/onchain/market/credit/types.d.ts +11 -1
- package/dist/types/onchain/market/index.d.ts +11 -10
- package/dist/types/onchain/market/oracle/PriceOracleBaseContract.d.ts +1 -1
- package/dist/types/onchain/market/oracle/index.d.ts +1 -2
- package/dist/types/onchain/market/oracle/types.d.ts +1 -1
- package/dist/types/onchain/market/pool/PoolQuotaKeeperV310Contract.d.ts +5 -0
- package/dist/types/onchain/market/rwa/RWARegistry.d.ts +1 -1
- package/dist/types/onchain/market/rwa/createDegenNFT.d.ts +12 -0
- package/dist/types/onchain/market/rwa/index.d.ts +10 -8
- package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +98 -0
- package/dist/types/onchain/market/rwa/midas/constants.d.ts +2 -1
- package/dist/types/onchain/market/rwa/midas/index.d.ts +3 -2
- package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +8 -2
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +4 -3
- package/dist/types/onchain/market/rwa/securitize/constants.d.ts +2 -2
- package/dist/types/onchain/market/rwa/securitize/index.d.ts +5 -4
- package/dist/types/onchain/market/rwa/securitize/types.d.ts +4 -110
- package/dist/types/onchain/market/rwa/types.d.ts +24 -32
- package/dist/types/onchain/market/zapper/ZapperContract.d.ts +1 -1
- package/dist/types/onchain/market/zapper/index.d.ts +1 -2
- package/dist/types/onchain/market/zapper/types.d.ts +1 -1
- package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +2 -1
- package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +5 -1
- package/dist/types/onchain/opportunities/types.d.ts +3 -2
- package/dist/types/onchain/pools/types.d.ts +2 -2
- package/dist/types/onchain/preview/index.d.ts +24 -0
- package/dist/types/{preview → onchain/preview}/parse/classifyInnerOperations.d.ts +4 -4
- package/dist/types/{preview → onchain/preview}/parse/index.d.ts +2 -4
- package/dist/types/{preview → onchain/preview}/parse/parseFacadeOperationCalldata.d.ts +4 -4
- package/dist/types/onchain/preview/parse/parseOperationCalldata.d.ts +18 -0
- package/dist/types/{preview → onchain/preview}/parse/parsePoolOperationCalldata.d.ts +7 -7
- package/dist/types/{preview → onchain/preview}/parse/parseRWAFactoryOperationCalldata.d.ts +4 -4
- package/dist/types/{preview → onchain/preview}/parse/types-adapters.d.ts +5 -16
- package/dist/types/{preview → onchain/preview}/parse/types-facades.d.ts +3 -3
- package/dist/types/{preview → onchain/preview}/parse/types-pools.d.ts +1 -1
- package/dist/types/{preview → onchain/preview}/parse/types-rwa.d.ts +3 -3
- package/dist/types/{preview → onchain/preview}/parse/types.d.ts +3 -3
- package/dist/types/{preview → onchain/preview}/preview/CreditAccountState.d.ts +5 -5
- package/dist/types/{preview → onchain/preview}/preview/buildDelayedStrategyPositionOperationPreview.d.ts +5 -5
- package/dist/types/{preview → onchain/preview}/preview/detectCloseOrRepay.d.ts +1 -1
- package/dist/types/{preview → onchain/preview}/preview/detectDelayedClaim.d.ts +8 -8
- package/dist/types/{preview → onchain/preview}/preview/detectDelayedOperation.d.ts +9 -9
- package/dist/types/{preview → onchain/preview}/preview/estimateClaimableAt.d.ts +6 -6
- package/dist/types/{preview → onchain/preview}/preview/index.d.ts +3 -4
- package/dist/types/onchain/preview/preview/previewAdjustStrategyPosition.d.ts +20 -0
- package/dist/types/onchain/preview/preview/previewExitOrRepayStrategyPosition.d.ts +21 -0
- package/dist/types/onchain/preview/preview/previewOpenStrategyPosition.d.ts +14 -0
- package/dist/types/onchain/preview/preview/previewOperation.d.ts +32 -0
- package/dist/types/onchain/preview/preview/previewPoolPositionOperation.d.ts +13 -0
- package/dist/types/{preview → onchain/preview}/preview/replayInnerOperations.d.ts +11 -11
- package/dist/types/{preview → onchain/preview}/preview/replayMulticall.d.ts +10 -10
- package/dist/types/{preview → onchain/preview}/preview/unwrapNativeCollateral.d.ts +10 -20
- package/dist/types/onchain/validation/bundles/checkAccountQuotas.d.ts +16 -0
- package/dist/types/onchain/validation/bundles/checkCollateralFunding.d.ts +22 -0
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +31 -0
- package/dist/types/onchain/validation/bundles/checkDraw.d.ts +20 -0
- package/dist/types/onchain/validation/bundles/checkHealthFactors.d.ts +39 -0
- package/dist/types/onchain/validation/bundles/checkLiquidationEligibility.d.ts +20 -0
- package/dist/types/onchain/validation/bundles/checkLiquidationFunding.d.ts +18 -0
- package/dist/types/onchain/validation/bundles/checkMarket.d.ts +15 -0
- package/dist/types/onchain/validation/bundles/checkObtained.d.ts +9 -0
- package/dist/types/onchain/validation/bundles/checkPoolFunding.d.ts +19 -0
- package/dist/types/onchain/validation/bundles/checkPoolOperation.d.ts +31 -0
- package/dist/types/onchain/validation/bundles/checkQuotasAsked.d.ts +10 -0
- package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +21 -0
- package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +19 -0
- package/dist/types/onchain/validation/bundles/checkWallet.d.ts +23 -0
- package/dist/types/onchain/validation/bundles/checkWalletAllowance.d.ts +18 -0
- package/dist/types/onchain/validation/bundles/checkWalletBalance.d.ts +17 -0
- package/dist/types/onchain/validation/bundles/index.d.ts +18 -0
- package/dist/types/onchain/validation/checkLiquidation.d.ts +23 -0
- package/dist/types/onchain/validation/checkOperation.d.ts +32 -0
- package/dist/types/onchain/validation/checkSimulation.d.ts +56 -0
- package/dist/types/onchain/validation/checks/checkBorrowLimit.d.ts +21 -0
- package/dist/types/onchain/validation/checks/checkCollateralised.d.ts +25 -0
- package/dist/types/onchain/validation/checks/checkCreditAccountFrozen.d.ts +12 -0
- package/dist/types/onchain/validation/checks/checkCreditManagerPaused.d.ts +12 -0
- package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +21 -0
- package/dist/types/onchain/validation/checks/checkEmergencyLiquidator.d.ts +17 -0
- package/dist/types/onchain/validation/checks/checkForbiddenToken.d.ts +12 -0
- package/dist/types/onchain/validation/checks/checkLeverage.d.ts +12 -0
- package/dist/types/onchain/validation/checks/checkLiquidatorEligible.d.ts +13 -0
- package/dist/types/onchain/validation/checks/checkMarketExpired.d.ts +14 -0
- package/dist/types/onchain/validation/checks/checkPoolLiquidity.d.ts +20 -0
- package/dist/types/onchain/validation/checks/checkPoolPaused.d.ts +12 -0
- package/dist/types/onchain/validation/checks/checkPoolSunset.d.ts +13 -0
- package/dist/types/onchain/validation/checks/checkQuotaCount.d.ts +11 -0
- package/dist/types/onchain/validation/checks/checkQuotaLimit.d.ts +18 -0
- package/dist/types/onchain/validation/checks/index.d.ts +16 -0
- package/dist/types/onchain/validation/helpers/amount.d.ts +7 -0
- package/dist/types/onchain/validation/helpers/health-factor-limits.d.ts +21 -0
- package/dist/types/onchain/validation/helpers/index.d.ts +4 -0
- package/dist/types/onchain/validation/{token.d.ts → helpers/token.d.ts} +4 -4
- package/dist/types/onchain/validation/index.d.ts +43 -4
- package/dist/types/onchain/validation/raise.d.ts +33 -0
- package/dist/types/sdk/execute/types.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +5 -6
- package/dist/types/sdk/liquidations/LiquidationsNamespace.d.ts +5 -0
- package/dist/types/sdk/liquidations/types.d.ts +8 -0
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +2 -1
- package/dist/types/sdk/opportunities/types.d.ts +8 -2
- package/dist/types/sdk/prepare/PrepareApi.d.ts +5 -4
- package/dist/types/sdk/prepare/index.d.ts +5 -5
- package/dist/types/sdk/prepare/types.d.ts +41 -22
- package/dist/types/sdk/preview/PreviewNamespace.d.ts +13 -3
- package/dist/types/sdk/preview/index.d.ts +2 -2
- package/dist/types/sdk/preview/types.d.ts +30 -7
- package/package.json +1 -6
- package/dist/cjs/onchain/accounts/withdrawal-compressor/errors.js +0 -1
- package/dist/cjs/onchain/market/zapper/errors.js +0 -1
- package/dist/cjs/onchain/validation/checks.js +0 -258
- package/dist/cjs/onchain/validation/refusal.js +0 -39
- package/dist/cjs/preview/index.js +0 -86
- package/dist/cjs/preview/package.json +0 -1
- package/dist/cjs/preview/parse/errors.js +0 -1
- package/dist/cjs/preview/parse/index.js +0 -15
- package/dist/cjs/preview/prerequisites/AllowancePrerequisite.js +0 -38
- package/dist/cjs/preview/prerequisites/BalancePrerequisite.js +0 -52
- package/dist/cjs/preview/prerequisites/Prerequisite.js +0 -52
- package/dist/cjs/preview/prerequisites/RWAOpenRequirementsPrerequisite.js +0 -53
- package/dist/cjs/preview/prerequisites/buildCollateralPrerequisites.js +0 -63
- package/dist/cjs/preview/prerequisites/buildPartialLiquidationPrerequisites.js +0 -19
- package/dist/cjs/preview/prerequisites/buildPoolPrerequisites.js +0 -76
- package/dist/cjs/preview/prerequisites/buildRWAPrerequisites.js +0 -39
- package/dist/cjs/preview/prerequisites/checkPrerequisites.js +0 -74
- package/dist/cjs/preview/prerequisites/helpers.js +0 -23
- package/dist/cjs/preview/prerequisites/index.js +0 -12
- package/dist/cjs/preview/preview/errors.js +0 -85
- package/dist/cjs/preview/preview/index.js +0 -33
- package/dist/cjs/preview/preview/previewOpenStrategyPosition.js +0 -50
- package/dist/cjs/preview/preview/previewOperation.js +0 -100
- package/dist/cjs/preview/preview/previewPoolPositionOperation.js +0 -49
- package/dist/cjs/preview/preview/replayInnerOperations.js +0 -109
- package/dist/cjs/preview/preview/replayMulticall.js +0 -19
- package/dist/cjs/preview/simulate/errors.js +0 -73
- package/dist/cjs/preview/simulate/index.js +0 -11
- package/dist/cjs/preview/simulate/simulateFacadeOperation.js +0 -15
- package/dist/cjs/preview/simulate/simulateOperation.js +0 -29
- package/dist/cjs/preview/simulate/simulateRWAOperation.js +0 -15
- package/dist/cjs/preview/simulate/types.js +0 -1
- package/dist/cjs/preview/trace/index.js +0 -14
- package/dist/cjs/preview/trace/types.js +0 -1
- package/dist/cjs/preview/types.js +0 -1
- package/dist/cjs/preview/validate/checkOperation.js +0 -187
- package/dist/cjs/preview/validate/checkSimulation.js +0 -39
- package/dist/cjs/preview/validate/index.js +0 -8
- package/dist/cjs/sdk/prepare/errors.js +0 -114
- package/dist/esm/onchain/accounts/withdrawal-compressor/errors.js +0 -1
- package/dist/esm/onchain/market/zapper/errors.js +0 -1
- package/dist/esm/onchain/validation/checks.js +0 -238
- package/dist/esm/onchain/validation/refusal.js +0 -36
- package/dist/esm/preview/index.js +0 -38
- package/dist/esm/preview/package.json +0 -1
- package/dist/esm/preview/parse/errors.js +0 -1
- package/dist/esm/preview/prerequisites/AllowancePrerequisite.js +0 -37
- package/dist/esm/preview/prerequisites/BalancePrerequisite.js +0 -51
- package/dist/esm/preview/prerequisites/Prerequisite.js +0 -51
- package/dist/esm/preview/prerequisites/RWAOpenRequirementsPrerequisite.js +0 -52
- package/dist/esm/preview/prerequisites/buildCollateralPrerequisites.js +0 -62
- package/dist/esm/preview/prerequisites/buildPartialLiquidationPrerequisites.js +0 -18
- package/dist/esm/preview/prerequisites/buildPoolPrerequisites.js +0 -75
- package/dist/esm/preview/prerequisites/buildRWAPrerequisites.js +0 -38
- package/dist/esm/preview/prerequisites/checkPrerequisites.js +0 -73
- package/dist/esm/preview/prerequisites/helpers.js +0 -22
- package/dist/esm/preview/prerequisites/index.js +0 -7
- package/dist/esm/preview/preview/errors.js +0 -79
- package/dist/esm/preview/preview/previewPoolPositionOperation.js +0 -48
- package/dist/esm/preview/preview/replayInnerOperations.js +0 -107
- package/dist/esm/preview/preview/replayMulticall.js +0 -18
- package/dist/esm/preview/simulate/errors.js +0 -71
- package/dist/esm/preview/simulate/index.js +0 -6
- package/dist/esm/preview/simulate/simulateFacadeOperation.js +0 -14
- package/dist/esm/preview/simulate/simulateOperation.js +0 -28
- package/dist/esm/preview/simulate/simulateRWAOperation.js +0 -14
- package/dist/esm/preview/simulate/types.js +0 -1
- package/dist/esm/preview/trace/types.js +0 -1
- package/dist/esm/preview/types.js +0 -1
- package/dist/esm/preview/validate/checkOperation.js +0 -183
- package/dist/esm/preview/validate/checkSimulation.js +0 -38
- package/dist/esm/preview/validate/index.js +0 -3
- package/dist/esm/sdk/prepare/errors.js +0 -108
- package/dist/types/model/errors.d.ts +0 -46
- package/dist/types/onchain/accounts/withdrawal-compressor/errors.d.ts +0 -20
- package/dist/types/onchain/market/zapper/errors.d.ts +0 -18
- package/dist/types/onchain/validation/checks.d.ts +0 -164
- package/dist/types/onchain/validation/refusal.d.ts +0 -242
- package/dist/types/preview/index.d.ts +0 -47
- package/dist/types/preview/parse/errors.d.ts +0 -29
- package/dist/types/preview/parse/parseOperationCalldata.d.ts +0 -18
- package/dist/types/preview/prerequisites/AllowancePrerequisite.d.ts +0 -26
- package/dist/types/preview/prerequisites/BalancePrerequisite.d.ts +0 -29
- package/dist/types/preview/prerequisites/Prerequisite.d.ts +0 -26
- package/dist/types/preview/prerequisites/RWAOpenRequirementsPrerequisite.d.ts +0 -55
- package/dist/types/preview/prerequisites/buildCollateralPrerequisites.d.ts +0 -20
- package/dist/types/preview/prerequisites/buildPartialLiquidationPrerequisites.d.ts +0 -12
- package/dist/types/preview/prerequisites/buildPoolPrerequisites.d.ts +0 -12
- package/dist/types/preview/prerequisites/buildRWAPrerequisites.d.ts +0 -26
- package/dist/types/preview/prerequisites/checkPrerequisites.d.ts +0 -28
- package/dist/types/preview/prerequisites/helpers.d.ts +0 -10
- package/dist/types/preview/prerequisites/index.d.ts +0 -7
- package/dist/types/preview/prerequisites/types.d.ts +0 -53
- package/dist/types/preview/preview/errors.d.ts +0 -44
- package/dist/types/preview/preview/previewAdjustStrategyPosition.d.ts +0 -19
- package/dist/types/preview/preview/previewExitOrRepayStrategyPosition.d.ts +0 -18
- package/dist/types/preview/preview/previewOpenStrategyPosition.d.ts +0 -12
- package/dist/types/preview/preview/previewOperation.d.ts +0 -32
- package/dist/types/preview/preview/previewPoolPositionOperation.d.ts +0 -13
- package/dist/types/preview/simulate/errors.d.ts +0 -52
- package/dist/types/preview/simulate/index.d.ts +0 -7
- package/dist/types/preview/simulate/simulateFacadeOperation.d.ts +0 -16
- package/dist/types/preview/simulate/simulateOperation.d.ts +0 -12
- package/dist/types/preview/simulate/simulatePoolOperation.d.ts +0 -42
- package/dist/types/preview/simulate/simulateRWAOperation.d.ts +0 -16
- package/dist/types/preview/simulate/types.d.ts +0 -48
- package/dist/types/preview/types.d.ts +0 -65
- package/dist/types/preview/validate/checkOperation.d.ts +0 -71
- package/dist/types/preview/validate/checkSimulation.d.ts +0 -32
- package/dist/types/preview/validate/index.d.ts +0 -3
- package/dist/types/sdk/prepare/errors.d.ts +0 -343
- /package/dist/cjs/{preview/prerequisites → history/trace}/types.js +0 -0
- /package/dist/cjs/model/{errors.js → errors/base.js} +0 -0
- /package/dist/cjs/{preview → onchain/preview}/parse/types-adapters.js +0 -0
- /package/dist/cjs/{preview → onchain/preview}/parse/types-facades.js +0 -0
- /package/dist/cjs/{preview → onchain/preview}/parse/types-pools.js +0 -0
- /package/dist/cjs/{preview → onchain/preview}/parse/types-rwa.js +0 -0
- /package/dist/esm/{preview → history}/trace/index.js +0 -0
- /package/dist/esm/{preview/prerequisites → history/trace}/types.js +0 -0
- /package/dist/esm/model/{errors.js → errors/base.js} +0 -0
- /package/dist/esm/{preview → onchain/preview}/parse/types-adapters.js +0 -0
- /package/dist/esm/{preview → onchain/preview}/parse/types-facades.js +0 -0
- /package/dist/esm/{preview → onchain/preview}/parse/types-pools.js +0 -0
- /package/dist/esm/{preview → onchain/preview}/parse/types-rwa.js +0 -0
- /package/dist/types/{preview → history}/trace/index.d.ts +0 -0
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IGearboxError } from "../../../model/errors.js";
|
|
2
|
-
import "../../../model/index.js";
|
|
3
|
-
import { Address } from "viem";
|
|
4
|
-
//#region src/onchain/market/zapper/errors.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Refusal 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`.
|
|
9
|
-
*/
|
|
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;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { UnsupportedZapperFunctionError };
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { Bps, Token, TokenAmount } from "../../model/primitives.js";
|
|
2
|
-
import { IGearboxError } from "../../model/errors.js";
|
|
3
|
-
import { MalformedPreviewError } from "../../model/previews.js";
|
|
4
|
-
import "../../model/index.js";
|
|
5
|
-
import { BorrowLimitBinding, PreviewIssue } from "./refusal.js";
|
|
6
|
-
import { Address } from "viem";
|
|
7
|
-
//#region src/onchain/validation/checks.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Every refusal the protocol can pass on an operation, as values.
|
|
10
|
-
*
|
|
11
|
-
* Each check is handed the numbers it compares — never a suite, a market or an
|
|
12
|
-
* SDK — so the engine, `checkOperation` and the strategy lists share one
|
|
13
|
-
* implementation.
|
|
14
|
-
*
|
|
15
|
-
* Ladders stay with the caller because they differ deliberately: the engine
|
|
16
|
-
* reports the tightest ceiling it found, the account-opening path the first one
|
|
17
|
-
* exceeded in its own order.
|
|
18
|
-
*/
|
|
19
|
-
/** A factor at or below this is refused; kept for the callers that size on it. */
|
|
20
|
-
declare const MIN_HF_LIMITED = 10100n;
|
|
21
|
-
/** The same bar as a `required` argument — the lowest factor that passes. */
|
|
22
|
-
declare const MIN_HEALTH_FACTOR_FORM = 10101;
|
|
23
|
-
/** The bar the facade itself enforces: an account may end exactly at 1.0. */
|
|
24
|
-
declare const MIN_HEALTH_FACTOR_FACADE = 10000;
|
|
25
|
-
/**
|
|
26
|
-
* The safe-price bar a form holds an account to. A step above the facade's,
|
|
27
|
-
* because a factor of exactly 1.0 at safe prices is already a refusal.
|
|
28
|
-
*/
|
|
29
|
-
declare const MIN_SAFE_HEALTH_FACTOR_FORM = 10001;
|
|
30
|
-
/** A refusal names what a limit was measured in, never what it is worth. */
|
|
31
|
-
declare function amountOf(token: Token, value: bigint): TokenAmount;
|
|
32
|
-
/** The credit manager takes no multicall while it is paused. */
|
|
33
|
-
declare function checkCreditManagerPaused(args: {
|
|
34
|
-
isPaused: boolean;
|
|
35
|
-
creditManager: Address;
|
|
36
|
-
}): PreviewIssue | null;
|
|
37
|
-
/** Past its expiration date the facade takes no more multicalls. */
|
|
38
|
-
declare function checkMarketExpired(args: {
|
|
39
|
-
isExpired: boolean;
|
|
40
|
-
creditManager: Address;
|
|
41
|
-
/** Unix seconds, as the facade reports it. */
|
|
42
|
-
expirationDate: number;
|
|
43
|
-
}): PreviewIssue | null;
|
|
44
|
-
/** A paused pool neither takes deposits nor pays out. */
|
|
45
|
-
declare function checkPoolPaused(args: {
|
|
46
|
-
isPaused: boolean;
|
|
47
|
-
pool: Address;
|
|
48
|
-
}): PreviewIssue | null;
|
|
49
|
-
/**
|
|
50
|
-
* A pool winding down still pays out, so only what puts money in is refused.
|
|
51
|
-
*/
|
|
52
|
-
declare function checkPoolSunset(args: {
|
|
53
|
-
isSunset: boolean;
|
|
54
|
-
isDeposit: boolean;
|
|
55
|
-
pool: Address;
|
|
56
|
-
}): PreviewIssue | null;
|
|
57
|
-
/**
|
|
58
|
-
* What the pool will hand over, against what is asked for.
|
|
59
|
-
*
|
|
60
|
-
* `binding` and `available` are the caller's answer to "which ceiling stands in
|
|
61
|
-
* the way", not this check's: see the ladder note above. `solutionAmount` is
|
|
62
|
-
* the largest position still openable, left out when none is.
|
|
63
|
-
*/
|
|
64
|
-
declare function checkBorrowLimit(args: {
|
|
65
|
-
requested: bigint;
|
|
66
|
-
available: bigint;
|
|
67
|
-
binding: BorrowLimitBinding;
|
|
68
|
-
underlying: Token;
|
|
69
|
-
solutionAmount?: bigint;
|
|
70
|
-
}): PreviewIssue | null;
|
|
71
|
-
/**
|
|
72
|
-
* What the pool can pay out, against what is being taken out.
|
|
73
|
-
*
|
|
74
|
-
* The operator is not `checkBorrowLimit`'s: a pool holding exactly the amount
|
|
75
|
-
* asked for still cannot serve it, so equality is already a refusal. That is
|
|
76
|
-
* the rule the legacy withdrawal validator enforced and it is preserved to the
|
|
77
|
-
* unit.
|
|
78
|
-
*/
|
|
79
|
-
declare function checkPoolPayout(args: {
|
|
80
|
-
requested: bigint;
|
|
81
|
-
available: bigint;
|
|
82
|
-
underlying: Token;
|
|
83
|
-
}): PreviewIssue | null;
|
|
84
|
-
/**
|
|
85
|
-
* A debt the facade would revert on.
|
|
86
|
-
*
|
|
87
|
-
* `allowZero` is the one place the two callers genuinely disagree: an account
|
|
88
|
-
* being adjusted may end owing nothing, while one being opened may not — so the
|
|
89
|
-
* exemption is stated rather than assumed.
|
|
90
|
-
*/
|
|
91
|
-
declare function checkDebtInBand(args: {
|
|
92
|
-
debt: bigint;
|
|
93
|
-
minDebt: bigint;
|
|
94
|
-
maxDebt: bigint;
|
|
95
|
-
underlying: Token;
|
|
96
|
-
allowZero: boolean;
|
|
97
|
-
}): PreviewIssue | null;
|
|
98
|
-
/** Leverage below 1x is not a position, it is a withdrawal. */
|
|
99
|
-
declare function checkLeverageAtLeastOne(args: {
|
|
100
|
-
leverage: bigint;
|
|
101
|
-
min: bigint;
|
|
102
|
-
}): PreviewIssue | null;
|
|
103
|
-
/**
|
|
104
|
-
* The account against its debt, at whichever bar the caller holds it to.
|
|
105
|
-
*
|
|
106
|
-
* An unread factor counts as failing: a check that cannot see the number is not
|
|
107
|
-
* evidence that the number is fine.
|
|
108
|
-
*/
|
|
109
|
-
declare function checkCollateralised(args: {
|
|
110
|
-
healthFactor: Bps | undefined;
|
|
111
|
-
/** The lowest acceptable factor — a factor equal to it passes. */
|
|
112
|
-
required: Bps;
|
|
113
|
-
safePrices: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* The factor the account stands at now. Given, an operation that raises it
|
|
116
|
-
* passes even from under the bar: an account already below is rescued by
|
|
117
|
-
* exactly the top-ups a flat bar would refuse.
|
|
118
|
-
*/
|
|
119
|
-
improvesFrom?: Bps;
|
|
120
|
-
}): PreviewIssue | null;
|
|
121
|
-
/** A token the market will not let the account hold. */
|
|
122
|
-
declare function checkForbiddenToken(args: {
|
|
123
|
-
token: Token;
|
|
124
|
-
isForbidden: boolean;
|
|
125
|
-
}): PreviewIssue | null;
|
|
126
|
-
/**
|
|
127
|
-
* The room the keeper still has for a token's quota, in the underlying.
|
|
128
|
-
*
|
|
129
|
-
* `requested` is absent for a token the market opened no quota for at all —
|
|
130
|
-
* nothing was weighed against a limit, the token simply counts as no collateral.
|
|
131
|
-
*/
|
|
132
|
-
declare function checkQuotaLimit(args: {
|
|
133
|
-
token: Token;
|
|
134
|
-
requested: bigint | undefined;
|
|
135
|
-
available: bigint;
|
|
136
|
-
underlying: Token;
|
|
137
|
-
}): PreviewIssue | null;
|
|
138
|
-
/** How many quoted tokens the facade enables at once. */
|
|
139
|
-
declare function checkQuotaCount(args: {
|
|
140
|
-
count: number;
|
|
141
|
-
max: number;
|
|
142
|
-
}): PreviewIssue | null;
|
|
143
|
-
/** What the operation is funded from, against what is there. */
|
|
144
|
-
declare function checkFunding(args: {
|
|
145
|
-
token: Token;
|
|
146
|
-
required: bigint;
|
|
147
|
-
held: bigint;
|
|
148
|
-
}): PreviewIssue | null;
|
|
149
|
-
/**
|
|
150
|
-
* The SDK could not replay the transaction.
|
|
151
|
-
*
|
|
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.
|
|
156
|
-
*/
|
|
157
|
-
declare function checkPreviewError(warning: IGearboxError | undefined): PreviewIssue | null;
|
|
158
|
-
/**
|
|
159
|
-
* Whether the preview warning means the transaction itself is malformed,
|
|
160
|
-
* rather than that only the evaluation was incomplete.
|
|
161
|
-
*/
|
|
162
|
-
declare function isMalformedPreviewError(warning: IGearboxError): warning is MalformedPreviewError;
|
|
163
|
-
//#endregion
|
|
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,242 +0,0 @@
|
|
|
1
|
-
import { Bps, Token, TokenAmount } from "../../model/primitives.js";
|
|
2
|
-
import { MalformedPreviewError } from "../../model/previews.js";
|
|
3
|
-
import "../../model/index.js";
|
|
4
|
-
import { Address } from "viem";
|
|
5
|
-
//#region src/onchain/validation/refusal.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Why a preview could not be produced.
|
|
8
|
-
*
|
|
9
|
-
* Every member is raised by the engine as an {@link IntentPreviewError}, with
|
|
10
|
-
* the exception of `unsupportedTokenPair` and `noRecordedIntent`, which the
|
|
11
|
-
* prepare namespace reports for a request it can refuse before planning.
|
|
12
|
-
*/
|
|
13
|
-
type PreviewErrorReason =
|
|
14
|
-
/** The debt the request implies falls outside the facade's band. */
|
|
15
|
-
"debtOutOfRange" |
|
|
16
|
-
/** The leverage asked for cannot be expressed as a plan at all. */
|
|
17
|
-
"leverageOutOfRange" |
|
|
18
|
-
/** Nothing on the account or in the wallet can fund what was asked. */
|
|
19
|
-
"insufficientSourceBalance" |
|
|
20
|
-
/** Input token is not accepted by the flow (e.g. deposit of a non-underlying). */
|
|
21
|
-
"unsupportedCollateralToken" |
|
|
22
|
-
/**
|
|
23
|
-
* No route for the trade the plan needs: no pool pair between the tokens
|
|
24
|
-
* requested, several and none was picked, or the pathfinder itself found no
|
|
25
|
-
* path for the amounts involved.
|
|
26
|
-
*/
|
|
27
|
-
"unsupportedTokenPair" |
|
|
28
|
-
/**
|
|
29
|
-
* The intent cannot settle with a delay: the source has no redemption config,
|
|
30
|
-
* the chain has no compressor, or the payout is one the tail cannot serve.
|
|
31
|
-
*/
|
|
32
|
-
"noDelayedRoute" |
|
|
33
|
-
/** Several redemption venues for the source, and nothing says which. */
|
|
34
|
-
"multipleDelayedWithdrawals" |
|
|
35
|
-
/** A redemption of the same asset is already in flight. */
|
|
36
|
-
"withdrawalInProgress" |
|
|
37
|
-
/**
|
|
38
|
-
* The claim names no operation to resume: requested without an intent, or
|
|
39
|
-
* read through a compressor too old to report one.
|
|
40
|
-
*/
|
|
41
|
-
"noRecordedIntent" |
|
|
42
|
-
/** The facade or the pool behind it is paused: nothing can be done at all. */
|
|
43
|
-
"marketPaused" |
|
|
44
|
-
/** The facade is past its expiration date and takes no more multicalls. */
|
|
45
|
-
"marketExpired" |
|
|
46
|
-
/**
|
|
47
|
-
* The pool cannot lend what the plan draws right now — its free liquidity,
|
|
48
|
-
* the manager's debt limit or the per-block cap stands in the way.
|
|
49
|
-
*/
|
|
50
|
-
"insufficientPoolLiquidity" |
|
|
51
|
-
/** The market takes no more quota for a token the plan wants to hold. */
|
|
52
|
-
"quotaLimitReached" |
|
|
53
|
-
/** The plan would increase the balance of a token the market forbids. */
|
|
54
|
-
"forbiddenToken" |
|
|
55
|
-
/**
|
|
56
|
-
* The account would end the transaction owing more than its collateral is
|
|
57
|
-
* worth under liquidation thresholds, which the facade refuses to allow.
|
|
58
|
-
*/
|
|
59
|
-
"insufficientCollateral" |
|
|
60
|
-
/** The pool is winding down: it still pays out, but takes no more deposits. */
|
|
61
|
-
"poolSunset" |
|
|
62
|
-
/**
|
|
63
|
-
* The account would end up with more quoted tokens than the facade enables
|
|
64
|
-
* at once. A count, not an amount — unlike `quotaLimitReached`.
|
|
65
|
-
*/
|
|
66
|
-
"quotaCountExceeded" |
|
|
67
|
-
/**
|
|
68
|
-
* The transaction could not be replayed: it is malformed, and every field
|
|
69
|
-
* derived from replayed balances is guesswork.
|
|
70
|
-
*/
|
|
71
|
-
"malformedTransaction";
|
|
72
|
-
/**
|
|
73
|
-
* The numbers behind each refusal, so a caller reads the limit that was missed
|
|
74
|
-
* instead of re-deriving it.
|
|
75
|
-
*
|
|
76
|
-
* Anything with a token and an amount is a {@link TokenAmount}; ratios carry
|
|
77
|
-
* no token. `undefined` marks a reason raised from several places, only some of
|
|
78
|
-
* which hold the numbers.
|
|
79
|
-
*/
|
|
80
|
-
interface PreviewErrorDetails {
|
|
81
|
-
/** All three in the market's underlying. */
|
|
82
|
-
debtOutOfRange: {
|
|
83
|
-
requested: TokenAmount;
|
|
84
|
-
minDebt: TokenAmount;
|
|
85
|
-
maxDebt: TokenAmount;
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Scaled by `LEVERAGE_DECIMALS` (`100n` = 1x), as the intent states it — not
|
|
89
|
-
* the read model's `Leverage`. `undefined` where the floor is not fixed: the
|
|
90
|
-
* deposit planner's is a function of the deposit.
|
|
91
|
-
*/
|
|
92
|
-
leverageOutOfRange: {
|
|
93
|
-
requested: bigint;
|
|
94
|
-
min: bigint;
|
|
95
|
-
} | undefined;
|
|
96
|
-
/** `undefined` where the request never got as far as naming an amount. */
|
|
97
|
-
insufficientSourceBalance: {
|
|
98
|
-
required: TokenAmount;
|
|
99
|
-
held: TokenAmount;
|
|
100
|
-
} | undefined;
|
|
101
|
-
unsupportedCollateralToken: {
|
|
102
|
-
token: Token;
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* `to` is absent where the market named no output for `from`. The whole
|
|
106
|
-
* detail is absent only when the pathfinder reverted rather than answered.
|
|
107
|
-
*/
|
|
108
|
-
unsupportedTokenPair: {
|
|
109
|
-
from: Token;
|
|
110
|
-
to: Token | undefined;
|
|
111
|
-
} | undefined;
|
|
112
|
-
noDelayedRoute: {
|
|
113
|
-
token: Token;
|
|
114
|
-
} | undefined;
|
|
115
|
-
multipleDelayedWithdrawals: {
|
|
116
|
-
token: Token;
|
|
117
|
-
venues: number;
|
|
118
|
-
};
|
|
119
|
-
/** The phantom token standing for the redemption already in flight. */
|
|
120
|
-
withdrawalInProgress: {
|
|
121
|
-
inFlight: TokenAmount;
|
|
122
|
-
};
|
|
123
|
-
noRecordedIntent: undefined;
|
|
124
|
-
/**
|
|
125
|
-
* Which contract is paused. A credit account operation names the manager, an
|
|
126
|
-
* LP operation the pool — the two are never both present.
|
|
127
|
-
*/
|
|
128
|
-
marketPaused: {
|
|
129
|
-
creditManager: Address;
|
|
130
|
-
} | {
|
|
131
|
-
pool: Address;
|
|
132
|
-
};
|
|
133
|
-
/** `expirationDate` is unix seconds, as the facade reports it. */
|
|
134
|
-
marketExpired: {
|
|
135
|
-
creditManager: Address;
|
|
136
|
-
expirationDate: number;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Both in the market's underlying. `binding` names which of the four ceilings
|
|
140
|
-
* ran out first, so a caller can say what would fix it — waiting for lenders
|
|
141
|
-
* and asking governance are opposite answers. `solutionAmount` is the largest
|
|
142
|
-
* position still openable, absent when even the minimum debt does not fit.
|
|
143
|
-
*/
|
|
144
|
-
insufficientPoolLiquidity: {
|
|
145
|
-
requested: TokenAmount;
|
|
146
|
-
available: TokenAmount;
|
|
147
|
-
binding: BorrowLimitBinding;
|
|
148
|
-
solutionAmount?: TokenAmount;
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
151
|
-
* `token` is the one whose quota is asked for; the amounts are in the
|
|
152
|
-
* **underlying**, which is what a quota is measured in. `requested` is absent
|
|
153
|
-
* for a token the market opened no quota for at all — nothing was weighed
|
|
154
|
-
* against a limit.
|
|
155
|
-
*/
|
|
156
|
-
quotaLimitReached: {
|
|
157
|
-
token: Token;
|
|
158
|
-
requested: TokenAmount | undefined;
|
|
159
|
-
available: TokenAmount;
|
|
160
|
-
};
|
|
161
|
-
forbiddenToken: {
|
|
162
|
-
token: Token;
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* `required` is the bar the factor was weighed against — the facade's own
|
|
166
|
-
* `1.0` for a check that asks whether the transaction lands, a form's higher
|
|
167
|
-
* bar for one that asks whether it is wise. `healthFactor` is the factor
|
|
168
|
-
* compared, which for a call that hands funds over is the safe-price one;
|
|
169
|
-
* `safePrices` says which, since a preview always reports main prices.
|
|
170
|
-
*/
|
|
171
|
-
insufficientCollateral: {
|
|
172
|
-
healthFactor: Bps;
|
|
173
|
-
required: Bps;
|
|
174
|
-
safePrices: boolean;
|
|
175
|
-
};
|
|
176
|
-
poolSunset: {
|
|
177
|
-
pool: Address;
|
|
178
|
-
};
|
|
179
|
-
/** How many quoted tokens the account would end with, against the cap. */
|
|
180
|
-
quotaCountExceeded: {
|
|
181
|
-
count: number;
|
|
182
|
-
max: number;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* The malformed-preview warning the SDK recorded, and its human-readable
|
|
186
|
-
* detail.
|
|
187
|
-
*/
|
|
188
|
-
malformedTransaction: MalformedPreviewError;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Which ceiling ran out when a borrow could not be served.
|
|
192
|
-
*
|
|
193
|
-
* The names are the expressions, not the legacy labels, because the two do not
|
|
194
|
-
* line up: the legacy `insufficientDebtLimit` was the manager's own headroom
|
|
195
|
-
* (`managerDebtAvailable`), `insufficientPoolDebtLimit` was `poolDebtLimit`,
|
|
196
|
-
* and `insufficientPoolLiquidity` was what the manager could still draw
|
|
197
|
-
* (`poolAvailableLiquidity`).
|
|
198
|
-
*
|
|
199
|
-
* `borrowable()` weighs only three of these — the pool's free liquidity, the
|
|
200
|
-
* manager's remaining allowance and the facade's per-block cap. `poolDebtLimit`
|
|
201
|
-
* is read by the account-opening path alone, which is why it is not among them.
|
|
202
|
-
*/
|
|
203
|
-
type BorrowLimitBinding = "poolAvailableLiquidity" | "poolDebtLimit" | "managerDebtAvailable" | "facadePerBlockCap";
|
|
204
|
-
/**
|
|
205
|
-
* The failure half every simulation shares.
|
|
206
|
-
*
|
|
207
|
-
* Distributed over the reasons rather than written as `{ reason; detail }`, so
|
|
208
|
-
* that narrowing on `reason` narrows `detail` with it.
|
|
209
|
-
*/
|
|
210
|
-
type PreviewIssue = { [R in PreviewErrorReason]: {
|
|
211
|
-
reason: R;
|
|
212
|
-
detail: PreviewErrorDetails[R];
|
|
213
|
-
}; }[PreviewErrorReason];
|
|
214
|
-
/**
|
|
215
|
-
* The failure half every simulation shares: an issue, plus the `ok: false`
|
|
216
|
-
* that tells it apart from a preview.
|
|
217
|
-
*/
|
|
218
|
-
type PreviewRefusal = {
|
|
219
|
-
ok: false;
|
|
220
|
-
} & PreviewIssue;
|
|
221
|
-
/** Builds the refusal a caller sees. */
|
|
222
|
-
declare function refuse<R extends PreviewErrorReason>(reason: R, detail: PreviewErrorDetails[R]): PreviewRefusal;
|
|
223
|
-
/**
|
|
224
|
-
* Validation failure that maps onto {@link PreviewErrorReason} rather than
|
|
225
|
-
* crashing the caller: raised by the planners and the guards, turned into
|
|
226
|
-
* `{ ok: false }` by `CreditAccountOperationsService`.
|
|
227
|
-
*/
|
|
228
|
-
declare class IntentPreviewError<R extends PreviewErrorReason = PreviewErrorReason> extends Error {
|
|
229
|
-
readonly reason: R;
|
|
230
|
-
readonly detail: PreviewErrorDetails[R];
|
|
231
|
-
constructor(reason: R, detail: PreviewErrorDetails[R], message?: string);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Throws the issue a check found, with the sentence the engine logs for it.
|
|
235
|
-
*
|
|
236
|
-
* Returns normally when there is nothing to raise, so it cannot narrow a type
|
|
237
|
-
* the way a bare `throw` does — a site that guards a value for the code below
|
|
238
|
-
* it keeps throwing directly.
|
|
239
|
-
*/
|
|
240
|
-
declare function raise(issue: PreviewIssue | null, message: string): void;
|
|
241
|
-
//#endregion
|
|
242
|
-
export { BorrowLimitBinding, IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { InvalidDelayedIntentError } from "../onchain/accounts/withdrawal-compressor/errors.js";
|
|
2
|
-
import { UnsupportedZapperFunctionError } from "../onchain/market/zapper/errors.js";
|
|
3
|
-
import { BorrowLimitBinding, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewRefusal, raise, refuse } from "../onchain/validation/refusal.js";
|
|
4
|
-
import { AdapterOperation, AdapterOperationBase, TokenTransfer, TraceAdapterExt } from "./parse/types-adapters.js";
|
|
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";
|
|
6
|
-
import { PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation } from "./parse/types-pools.js";
|
|
7
|
-
import { RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOperation, RWAOperationMetadata } from "./parse/types-rwa.js";
|
|
8
|
-
import { Operation, isPoolOperation, isRWAOperation } from "./parse/types.js";
|
|
9
|
-
import { ClassifyInnerOperationsProps, classifyInnerOperations } from "./parse/classifyInnerOperations.js";
|
|
10
|
-
import { UnsupportedPoolFunctionError, UnsupportedTargetError } from "./parse/errors.js";
|
|
11
|
-
import { parseFacadeOperationCalldata } from "./parse/parseFacadeOperationCalldata.js";
|
|
12
|
-
import { PreviewOperationInput, PreviewOperationOptions } from "./types.js";
|
|
13
|
-
import { parseOperationCalldata } from "./parse/parseOperationCalldata.js";
|
|
14
|
-
import { parsePoolOperationCalldata } from "./parse/parsePoolOperationCalldata.js";
|
|
15
|
-
import { parseRWAFactoryOperationCalldata } from "./parse/parseRWAFactoryOperationCalldata.js";
|
|
16
|
-
import "./parse/index.js";
|
|
17
|
-
import { TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, WithdrawCollateralAlignmentError } from "./trace/errors.js";
|
|
18
|
-
import { extractAdapterCallTraces } from "./trace/extractAdapterCallTraces.js";
|
|
19
|
-
import { ExtractTransfersResult, WithdrawCollateralEventInfo, extractTransfers } from "./trace/extractTransfers.js";
|
|
20
|
-
import { FacadeCallType, FacadeParsedCall } from "./trace/types.js";
|
|
21
|
-
import { findFacadeCalls } from "./trace/findFacadeCalls.js";
|
|
22
|
-
import "./trace/index.js";
|
|
23
|
-
import { BalanceDetail, BalancePrerequisite, BalanceResult } from "./prerequisites/BalancePrerequisite.js";
|
|
24
|
-
import { RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult } from "./prerequisites/RWAOpenRequirementsPrerequisite.js";
|
|
25
|
-
import { PrerequisiteContext, PrerequisiteError, PrerequisiteKind, PrerequisiteOutcome, PrerequisiteResult } from "./prerequisites/types.js";
|
|
26
|
-
import { Prerequisite } from "./prerequisites/Prerequisite.js";
|
|
27
|
-
import { AllowanceDetail, AllowancePrerequisite, AllowanceResult } from "./prerequisites/AllowancePrerequisite.js";
|
|
28
|
-
import { checkPrerequisites } from "./prerequisites/checkPrerequisites.js";
|
|
29
|
-
import "./prerequisites/index.js";
|
|
30
|
-
import { CreditAccountState, CreditAccountStateProps } from "./preview/CreditAccountState.js";
|
|
31
|
-
import { DetectedDelayedOperation, detectDelayedOperation } from "./preview/detectDelayedOperation.js";
|
|
32
|
-
import { buildDelayedStrategyPositionOperationPreview } from "./preview/buildDelayedStrategyPositionOperationPreview.js";
|
|
33
|
-
import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRepay.js";
|
|
34
|
-
import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./preview/detectDelayedClaim.js";
|
|
35
|
-
import { UnsupportedOperationError, adapterCallOutsideBracketError, invalidTransactionValueError, malformedBracketError, nonAdapterCallInBracketError, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError } from "./preview/errors.js";
|
|
36
|
-
import { estimateClaimableAt } from "./preview/estimateClaimableAt.js";
|
|
37
|
-
import { previewAdjustStrategyPosition } from "./preview/previewAdjustStrategyPosition.js";
|
|
38
|
-
import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./preview/previewExitOrRepayStrategyPosition.js";
|
|
39
|
-
import { PreviewSimulationError, SimulationError, SimulationFlowFailure, SimulationFlowSource, asPreviewSimulationError } from "./simulate/errors.js";
|
|
40
|
-
import { PreviewOperationError, previewOperation } from "./preview/previewOperation.js";
|
|
41
|
-
import { ReplayState, makeReplayState, replayInnerOperations } from "./preview/replayInnerOperations.js";
|
|
42
|
-
import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./preview/replayMulticall.js";
|
|
43
|
-
import "./preview/index.js";
|
|
44
|
-
import { CheckOperationOptions, WeighedFactors, checkOperation, collateralIssue, marketIssues, quotaCountIssue } from "./validate/checkOperation.js";
|
|
45
|
-
import { checkSimulation } from "./validate/checkSimulation.js";
|
|
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, 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 };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { IGearboxError } from "../../model/errors.js";
|
|
2
|
-
import "../../model/index.js";
|
|
3
|
-
import { UnsupportedZapperFunctionError } from "../../onchain/market/zapper/errors.js";
|
|
4
|
-
import { Address } from "viem";
|
|
5
|
-
//#region src/preview/parse/errors.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Refusal 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`.
|
|
10
|
-
*/
|
|
11
|
-
interface UnsupportedTargetError extends IGearboxError {
|
|
12
|
-
code: "unsupportedTarget";
|
|
13
|
-
/** Target address no known Gearbox contract answers for. */
|
|
14
|
-
target: Address;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Refusal answered when a pool call uses a function other than ERC4626
|
|
18
|
-
* `deposit`/`redeem`. A plain returned object per the SDK's refusal
|
|
19
|
-
* vocabulary — not a thrown `Error`.
|
|
20
|
-
*/
|
|
21
|
-
interface UnsupportedPoolFunctionError extends IGearboxError {
|
|
22
|
-
code: "unsupportedPoolFunction";
|
|
23
|
-
/** Pool the call targets. */
|
|
24
|
-
pool: Address;
|
|
25
|
-
/** Decoded function name the SDK cannot preview. */
|
|
26
|
-
functionName: string;
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { UnsupportedPoolFunctionError, UnsupportedTargetError, type UnsupportedZapperFunctionError };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SDKReturn } from "../../model/result.js";
|
|
2
|
-
import "../../model/index.js";
|
|
3
|
-
import { UnsupportedZapperFunctionError } from "../../onchain/market/zapper/errors.js";
|
|
4
|
-
import { PluginsMap } from "../../onchain/plugins/types.js";
|
|
5
|
-
import "../../onchain/index.js";
|
|
6
|
-
import { Operation } from "./types.js";
|
|
7
|
-
import { UnsupportedPoolFunctionError, UnsupportedTargetError } from "./errors.js";
|
|
8
|
-
import { PreviewOperationInput } from "../types.js";
|
|
9
|
-
//#region src/preview/parse/parseOperationCalldata.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* Decodes raw operation calldata into an {@link Operation}.
|
|
12
|
-
*
|
|
13
|
-
* Support parsing of pool operations (including via zappers),
|
|
14
|
-
* credit facade operations and RWA factory operations.
|
|
15
|
-
*/
|
|
16
|
-
declare function parseOperationCalldata<P extends PluginsMap>(input: PreviewOperationInput<P>): SDKReturn<Operation, UnsupportedTargetError | UnsupportedPoolFunctionError | UnsupportedZapperFunctionError>;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { parseOperationCalldata };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PrerequisiteContext, PrerequisiteError, PrerequisiteOutcome } from "./types.js";
|
|
2
|
-
import { Prerequisite } from "./Prerequisite.js";
|
|
3
|
-
import { Address } from "viem";
|
|
4
|
-
//#region src/preview/prerequisites/AllowancePrerequisite.d.ts
|
|
5
|
-
/** ERC-20 allowance from `owner` to `spender` must cover `required`. */
|
|
6
|
-
interface AllowanceDetail {
|
|
7
|
-
token: Address;
|
|
8
|
-
owner: Address;
|
|
9
|
-
spender: Address;
|
|
10
|
-
required: bigint;
|
|
11
|
-
/** On-chain allowance read; only present when the read succeeded. */
|
|
12
|
-
actual?: bigint;
|
|
13
|
-
}
|
|
14
|
-
type AllowanceResult = PrerequisiteOutcome & {
|
|
15
|
-
kind: "allowance";
|
|
16
|
-
detail: AllowanceDetail;
|
|
17
|
-
};
|
|
18
|
-
/** Checks that `owner` granted `spender` an ERC-20 allowance >= `required`. */
|
|
19
|
-
declare class AllowancePrerequisite extends Prerequisite {
|
|
20
|
-
#private;
|
|
21
|
-
constructor(detail: Omit<AllowanceDetail, "actual">);
|
|
22
|
-
protected check(ctx: PrerequisiteContext): Promise<AllowanceResult>;
|
|
23
|
-
protected errorResult(error: PrerequisiteError): AllowanceResult;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { AllowanceDetail, AllowancePrerequisite, AllowanceResult };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PrerequisiteContext, PrerequisiteError, PrerequisiteOutcome } from "./types.js";
|
|
2
|
-
import { Prerequisite } from "./Prerequisite.js";
|
|
3
|
-
import { Address } from "viem";
|
|
4
|
-
//#region src/preview/prerequisites/BalancePrerequisite.d.ts
|
|
5
|
-
/** ERC-20 balance of `owner` must cover `required`. */
|
|
6
|
-
interface BalanceDetail {
|
|
7
|
-
token: Address;
|
|
8
|
-
owner: Address;
|
|
9
|
-
required: bigint;
|
|
10
|
-
/** On-chain balance read; only present when the read succeeded. */
|
|
11
|
-
actual?: bigint;
|
|
12
|
-
}
|
|
13
|
-
type BalanceResult = PrerequisiteOutcome & {
|
|
14
|
-
kind: "balance";
|
|
15
|
-
detail: BalanceDetail;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Checks that `owner` holds a token balance >= `required`. The token is read
|
|
19
|
-
* as an ERC-20, except for the native pseudo-address ({@link NATIVE_ADDRESS},
|
|
20
|
-
* e.g. ETH-zapper deposits) whose balance is read via `getBalance`.
|
|
21
|
-
*/
|
|
22
|
-
declare class BalancePrerequisite extends Prerequisite {
|
|
23
|
-
#private;
|
|
24
|
-
constructor(detail: Omit<BalanceDetail, "actual">);
|
|
25
|
-
protected check(ctx: PrerequisiteContext): Promise<BalanceResult>;
|
|
26
|
-
protected errorResult(error: PrerequisiteError): BalanceResult;
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { BalanceDetail, BalancePrerequisite, BalanceResult };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PrerequisiteContext, PrerequisiteError, PrerequisiteResult } from "./types.js";
|
|
2
|
-
//#region src/preview/prerequisites/Prerequisite.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* A single verifiable prerequisite for a transaction. Subclasses implement
|
|
5
|
-
* {@link check} to perform whatever async reads they need (an ERC-20
|
|
6
|
-
* `readContract`, a compressor call, ...) and map the outcome into a
|
|
7
|
-
* {@link PrerequisiteResult}.
|
|
8
|
-
*/
|
|
9
|
-
declare abstract class Prerequisite {
|
|
10
|
-
/**
|
|
11
|
-
* Verifies this prerequisite. Never rejects: any error thrown by
|
|
12
|
-
* {@link check} (revert, RPC/network failure, compressor error) is
|
|
13
|
-
* normalized into an `error` result.
|
|
14
|
-
*/
|
|
15
|
-
verify(ctx: PrerequisiteContext): Promise<PrerequisiteResult>;
|
|
16
|
-
/**
|
|
17
|
-
* Performs the reads this prerequisite needs and maps them into a result.
|
|
18
|
-
* May throw on read failure; {@link verify} converts throws into `error`
|
|
19
|
-
* results.
|
|
20
|
-
*/
|
|
21
|
-
protected abstract check(ctx: PrerequisiteContext): Promise<PrerequisiteResult>;
|
|
22
|
-
/** Builds this prerequisite's failed result from a normalized read error. */
|
|
23
|
-
protected abstract errorResult(error: PrerequisiteError): PrerequisiteResult;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { Prerequisite };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs } from "../../onchain/market/rwa/types.js";
|
|
2
|
-
import "../../onchain/index.js";
|
|
3
|
-
import { PrerequisiteContext, PrerequisiteError, PrerequisiteOutcome } from "./types.js";
|
|
4
|
-
import { Prerequisite } from "./Prerequisite.js";
|
|
5
|
-
import { Address } from "viem";
|
|
6
|
-
//#region src/preview/prerequisites/RWAOpenRequirementsPrerequisite.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* RWA (e.g. Securitize) open-account requirements: off-chain token
|
|
9
|
-
* registration and/or EIP-712 signatures the borrower must provide before
|
|
10
|
-
* opening a credit account in an RWA market.
|
|
11
|
-
*/
|
|
12
|
-
interface RWAOpenRequirementsDetail {
|
|
13
|
-
/** RWA token (e.g. Securitize DSToken) the requirements are checked for. */
|
|
14
|
-
token: Address;
|
|
15
|
-
/** Credit manager of the RWA market. */
|
|
16
|
-
creditManager: Address;
|
|
17
|
-
/** RWA factory that gates the token. */
|
|
18
|
-
factory: Address;
|
|
19
|
-
/**
|
|
20
|
-
* Full requirements fetched at verify time via
|
|
21
|
-
* `sdk.accounts.getOpenAccountRequirements`; only present when the read
|
|
22
|
-
* succeeded and the factory gates the token.
|
|
23
|
-
*/
|
|
24
|
-
requirements?: RWAOpenAccountRequirements;
|
|
25
|
-
/**
|
|
26
|
-
* Subset of `requirements` still unfulfilled, computed by the RWA
|
|
27
|
-
* factory at verify time (`IRWAFactory.getMissingRequirements`);
|
|
28
|
-
* `undefined` when everything is satisfied.
|
|
29
|
-
*/
|
|
30
|
-
missing?: RWAMissingOpenAccountRequirements;
|
|
31
|
-
}
|
|
32
|
-
type RWAOpenRequirementsResult = PrerequisiteOutcome & {
|
|
33
|
-
kind: "rwaOpenRequirements";
|
|
34
|
-
detail: RWAOpenRequirementsDetail;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Checks that the borrower has fulfilled the RWA factory's open-account
|
|
38
|
-
* requirements (issuer-side token registration, EIP-712 signatures).
|
|
39
|
-
*
|
|
40
|
-
* The requirements are fetched at verify time via
|
|
41
|
-
* `sdk.accounts.getOpenAccountRequirements`, so re-running verification picks
|
|
42
|
-
* up off-chain progress (the borrower registering on the issuer's website or
|
|
43
|
-
* signing the factory's message) without rebuilding the prerequisites. The
|
|
44
|
-
* unfulfilled subset is computed by the factory itself
|
|
45
|
-
* (`IRWAFactory.getMissingRequirements`) and exposed on the result's
|
|
46
|
-
* `detail.missing`; the full requirements are kept on `detail.requirements`.
|
|
47
|
-
*/
|
|
48
|
-
declare class RWAOpenRequirementsPrerequisite extends Prerequisite {
|
|
49
|
-
#private;
|
|
50
|
-
constructor(detail: Omit<RWAOpenRequirementsDetail, "requirements" | "missing">, providedArgs?: RWAOperationArgs);
|
|
51
|
-
protected check(ctx: PrerequisiteContext): Promise<RWAOpenRequirementsResult>;
|
|
52
|
-
protected errorResult(error: PrerequisiteError): RWAOpenRequirementsResult;
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
export { RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult };
|