@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,12 +1,11 @@
|
|
|
1
1
|
import { AddressMap } from "../onchain/utils/AddressMap.js";
|
|
2
2
|
import { ParsedCallV2 } from "../onchain/base/types.js";
|
|
3
3
|
import { CallTrace } from "../onchain/utils/trace.js";
|
|
4
|
+
import { TokenTransfer } from "../onchain/market/adapters/transfers.js";
|
|
4
5
|
import { ChainContractsRegister } from "../onchain/base/ChainContractsRegister.js";
|
|
5
6
|
import "../onchain/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import "
|
|
8
|
-
import { WithdrawCollateralEventInfo } from "../preview/trace/extractTransfers.js";
|
|
9
|
-
import "../preview/trace/index.js";
|
|
7
|
+
import { WithdrawCollateralEventInfo } from "./trace/extractTransfers.js";
|
|
8
|
+
import "./trace/index.js";
|
|
10
9
|
import { InnerOperation } from "./types.js";
|
|
11
10
|
import { Address } from "viem";
|
|
12
11
|
//#region src/history/classifyMulticallOperations.d.ts
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { AddCollateralOp, DecreaseDebtOp, FacadeOperationMetadata, IncreaseDebtOp, InnerFacadeOperation, OperationMetadata, UpdateQuotaOp, WithdrawCollateralOp } from "../preview/parse/types-facades.js";
|
|
1
|
+
import { AddCollateralOp, DecreaseDebtOp, FacadeOperationMetadata, IncreaseDebtOp, InnerFacadeOperation, OperationMetadata, UpdateQuotaOp, WithdrawCollateralOp } from "../onchain/preview/parse/types-facades.js";
|
|
2
|
+
import { TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, WithdrawCollateralAlignmentError } from "./trace/errors.js";
|
|
3
|
+
import { extractAdapterCallTraces } from "./trace/extractAdapterCallTraces.js";
|
|
4
|
+
import { ExtractTransfersResult, WithdrawCollateralEventInfo, extractTransfers } from "./trace/extractTransfers.js";
|
|
5
|
+
import { FacadeCallType, FacadeParsedCall } from "./trace/types.js";
|
|
6
|
+
import { findFacadeCalls } from "./trace/findFacadeCalls.js";
|
|
7
|
+
import "./trace/index.js";
|
|
2
8
|
import { AdapterOperation, CloseCreditAccountOperation, CreditAccountOperation, DirectTokenTransferOperation, HistoryAdapterExt, HistoryFacadeMetadata, InnerOperation, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, OuterFacadeOperation, PartialLiquidationOperation } from "./types.js";
|
|
3
9
|
import { OperationVisitor, mapOperations } from "./mapOperations.js";
|
|
4
10
|
import { parseCreditAccountTransaction } from "./parseCreditAccountTransaction.js";
|
|
5
11
|
import { DeploymentLike, PopulateContractsRegisterOptions, populateContractsRegister } from "./populateContractsRegister.js";
|
|
6
12
|
import { LegacyApiOperation, LegacyMulticallOp, LegacyVisitorParams, createLegacyVisitor, toLegacyOperations } from "./toLegacyOperation.js";
|
|
7
|
-
export { AdapterOperation, type AddCollateralOp, CloseCreditAccountOperation, CreditAccountOperation, type DecreaseDebtOp, DeploymentLike, DirectTokenTransferOperation, type FacadeOperationMetadata, HistoryAdapterExt, HistoryFacadeMetadata, type IncreaseDebtOp, type InnerFacadeOperation, InnerOperation, LegacyApiOperation, LegacyMulticallOp, LegacyVisitorParams, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, type OperationMetadata, OperationVisitor, OuterFacadeOperation, PartialLiquidationOperation, PopulateContractsRegisterOptions, type UpdateQuotaOp, type WithdrawCollateralOp, createLegacyVisitor, mapOperations, parseCreditAccountTransaction, populateContractsRegister, toLegacyOperations };
|
|
13
|
+
export { AdapterOperation, type AddCollateralOp, CloseCreditAccountOperation, CreditAccountOperation, type DecreaseDebtOp, DeploymentLike, DirectTokenTransferOperation, ExtractTransfersResult, FacadeCallType, type FacadeOperationMetadata, FacadeParsedCall, HistoryAdapterExt, HistoryFacadeMetadata, type IncreaseDebtOp, type InnerFacadeOperation, InnerOperation, LegacyApiOperation, LegacyMulticallOp, LegacyVisitorParams, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, type OperationMetadata, OperationVisitor, OuterFacadeOperation, PartialLiquidationOperation, PopulateContractsRegisterOptions, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, type UpdateQuotaOp, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, type WithdrawCollateralOp, createLegacyVisitor, extractAdapterCallTraces, extractTransfers, findFacadeCalls, mapOperations, parseCreditAccountTransaction, populateContractsRegister, toLegacyOperations };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddCollateralOp, DecreaseDebtOp, IncreaseDebtOp, UpdateQuotaOp, WithdrawCollateralOp } from "../preview/parse/types-facades.js";
|
|
1
|
+
import { AddCollateralOp, DecreaseDebtOp, IncreaseDebtOp, UpdateQuotaOp, WithdrawCollateralOp } from "../onchain/preview/parse/types-facades.js";
|
|
2
2
|
import { AdapterOperation, CloseCreditAccountOperation, CreditAccountOperation, DirectTokenTransferOperation, HistoryFacadeMetadata, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, PartialLiquidationOperation } from "./types.js";
|
|
3
3
|
//#region src/history/mapOperations.d.ts
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CallTrace } from "../../onchain/utils/trace.js";
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/history/trace/extractAdapterCallTraces.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Extracts the user multicall's adapter-level call traces from a single facade
|
|
5
5
|
* call trace.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AddressMap } from "../../onchain/utils/AddressMap.js";
|
|
2
|
+
import { TokenTransfer } from "../../onchain/market/adapters/transfers.js";
|
|
2
3
|
import "../../onchain/index.js";
|
|
3
|
-
import { TokenTransfer } from "../parse/types-adapters.js";
|
|
4
|
-
import "../parse/index.js";
|
|
5
4
|
import { Address, Log } from "viem";
|
|
6
|
-
//#region src/
|
|
5
|
+
//#region src/history/trace/extractTransfers.d.ts
|
|
7
6
|
type RawLog = Log<bigint | number, number, false>;
|
|
8
7
|
/**
|
|
9
8
|
* Effective `withdrawCollateral` outcome decoded from the facade's
|
|
@@ -3,7 +3,7 @@ import { ChainContractsRegister } from "../../onchain/base/ChainContractsRegiste
|
|
|
3
3
|
import "../../onchain/index.js";
|
|
4
4
|
import { FacadeParsedCall } from "./types.js";
|
|
5
5
|
import { Address } from "viem";
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/history/trace/findFacadeCalls.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Walks a `debug_traceTransaction` callTracer tree, finds all non-reverted
|
|
9
9
|
* calls to the credit facade, parses them via the register, and returns
|
|
@@ -2,7 +2,7 @@ import { ParsedCallV2 } from "../../onchain/base/types.js";
|
|
|
2
2
|
import { CallTrace } from "../../onchain/utils/trace.js";
|
|
3
3
|
import "../../onchain/index.js";
|
|
4
4
|
import { Address } from "viem";
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/history/trace/types.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* The set of credit facade entry-point functions that produce history operations.
|
|
8
8
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { LegacyAdapterOperation } from "../onchain/market/adapters/legacyAdapterOperations.js";
|
|
2
|
+
import { AdapterOperation as AdapterOperation$1, TraceAdapterExt } from "../onchain/preview/parse/types-adapters.js";
|
|
3
|
+
import { AddCollateralOp, CloseCreditAccountOperation as CloseCreditAccountOperation$1, DecreaseDebtOp, DirectTokenTransferOperation as DirectTokenTransferOperation$1, FacadeOperationMetadata, IncreaseDebtOp, InnerFacadeOperation, InnerOperation as InnerOperation$1, LiquidateCreditAccountOperation as LiquidateCreditAccountOperation$1, MulticallOperation as MulticallOperation$1, OpenCreditAccountOperation as OpenCreditAccountOperation$1, OperationMetadata, PartialLiquidationOperation as PartialLiquidationOperation$1, UpdateQuotaOp, WithdrawCollateralOp } from "../onchain/preview/parse/types-facades.js";
|
|
2
4
|
import "../onchain/index.js";
|
|
3
|
-
import { AdapterOperation as AdapterOperation$1, TraceAdapterExt } from "../preview/parse/types-adapters.js";
|
|
4
|
-
import { AddCollateralOp, CloseCreditAccountOperation as CloseCreditAccountOperation$1, DecreaseDebtOp, DirectTokenTransferOperation as DirectTokenTransferOperation$1, FacadeOperationMetadata, IncreaseDebtOp, InnerFacadeOperation, InnerOperation as InnerOperation$1, LiquidateCreditAccountOperation as LiquidateCreditAccountOperation$1, MulticallOperation as MulticallOperation$1, OpenCreditAccountOperation as OpenCreditAccountOperation$1, OperationMetadata, PartialLiquidationOperation as PartialLiquidationOperation$1, UpdateQuotaOp, WithdrawCollateralOp } from "../preview/parse/types-facades.js";
|
|
5
|
-
import "../preview/parse/index.js";
|
|
6
5
|
//#region src/history/types.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* History-specific adapter-operation extension: trace-derived data
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/model/errors/base.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* What every error the SDK reports has.
|
|
4
|
+
*
|
|
5
|
+
* `code` is the discriminant: switch on it and the error narrows to the shape
|
|
6
|
+
* carrying that failure's own numbers.
|
|
7
|
+
**/
|
|
8
|
+
interface IGearboxError {
|
|
9
|
+
/**
|
|
10
|
+
* Machine-readable identity of the failure, and the discriminant of the
|
|
11
|
+
* union a method returns.
|
|
12
|
+
**/
|
|
13
|
+
code: string;
|
|
14
|
+
/**
|
|
15
|
+
* One sentence naming what was refused, in English, safe to log. Not a
|
|
16
|
+
* message to show a user as-is: a screen renders the code and the numbers
|
|
17
|
+
* beside it in its own words and its own language.
|
|
18
|
+
**/
|
|
19
|
+
message: string;
|
|
20
|
+
/**
|
|
21
|
+
* The failure this one was raised for, where one error stands in front of
|
|
22
|
+
* another. Absent for a refusal that is its own reason, which is most of
|
|
23
|
+
* them.
|
|
24
|
+
**/
|
|
25
|
+
cause?: IGearboxError | Error;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { IGearboxError };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IGearboxError } from "./base.js";
|
|
2
|
+
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./liquidation-errors.js";
|
|
3
|
+
import { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet } from "./operation-errors.js";
|
|
4
|
+
import { UnpriceableTokenError, unpriceableTokenError } from "./oracle-errors.js";
|
|
5
|
+
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, EmptyOpenTakesNothingError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, emptyOpenTakesNothing, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./prepare-errors.js";
|
|
6
|
+
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./preview-errors.js";
|
|
7
|
+
export { BorrowLimitCause, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, EmptyOpenTakesNothingError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, PoolOperationPreviewError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, emptyOpenTakesNothing, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Token } from "../primitives.js";
|
|
2
|
+
import { IGearboxError } from "./base.js";
|
|
3
|
+
import { Address } from "viem";
|
|
4
|
+
//#region src/model/errors/liquidation-errors.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The RWA factory has frozen this credit account, so its RWA collateral
|
|
7
|
+
* cannot move and a liquidation cannot run.
|
|
8
|
+
**/
|
|
9
|
+
interface CreditAccountFrozenError extends IGearboxError {
|
|
10
|
+
code: "creditAccountFrozen";
|
|
11
|
+
creditAccount: Address;
|
|
12
|
+
}
|
|
13
|
+
/** {@inheritDoc CreditAccountFrozenError} */
|
|
14
|
+
declare function creditAccountFrozen(creditAccount: Address): CreditAccountFrozenError;
|
|
15
|
+
/**
|
|
16
|
+
* The market is paused and `liquidator` is not one of its emergency liquidators,
|
|
17
|
+
* so a liquidation would revert.
|
|
18
|
+
**/
|
|
19
|
+
interface NotEmergencyLiquidatorError extends IGearboxError {
|
|
20
|
+
code: "notEmergencyLiquidator";
|
|
21
|
+
creditManager: Address;
|
|
22
|
+
liquidator: Address;
|
|
23
|
+
}
|
|
24
|
+
/** {@inheritDoc NotEmergencyLiquidatorError} */
|
|
25
|
+
declare function notEmergencyLiquidator(creditManager: Address, liquidator: Address): NotEmergencyLiquidatorError;
|
|
26
|
+
/**
|
|
27
|
+
* The liquidator does not pass the KYC check of the liquidated assets.
|
|
28
|
+
**/
|
|
29
|
+
interface LiquidatorNotEligibleError extends IGearboxError {
|
|
30
|
+
code: "liquidatorNotEligible";
|
|
31
|
+
/**
|
|
32
|
+
* KYC protocol the liquidator must be whitelisted in (e.g. `"securitize"`).
|
|
33
|
+
* Absent when the compressor did not name one.
|
|
34
|
+
**/
|
|
35
|
+
kycProtocol?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Token the liquidator must be whitelisted for in {@link kycProtocol}.
|
|
38
|
+
* Absent when the liquidation is not KYC-gated, or the token is unknown.
|
|
39
|
+
**/
|
|
40
|
+
kycToken?: Token;
|
|
41
|
+
}
|
|
42
|
+
/** {@inheritDoc LiquidatorNotEligibleError} */
|
|
43
|
+
declare function liquidatorNotEligible(kycProtocol?: string, kycToken?: Token): LiquidatorNotEligibleError;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator };
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { Bps, Token, TokenAmount } from "../primitives.js";
|
|
2
|
+
import { IGearboxError } from "./base.js";
|
|
3
|
+
import { RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements } from "../rwa.js";
|
|
4
|
+
import { Address } from "viem";
|
|
5
|
+
//#region src/model/errors/operation-errors.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Which limit stopped a borrow.
|
|
8
|
+
*
|
|
9
|
+
* - `poolAvailableLiquidity` — the pool's available liquidity
|
|
10
|
+
* - `managerDebtAvailable` — this credit manager's remaining debt allowance
|
|
11
|
+
* - `maxDebt` — the facade's per-account `debtLimits.maxDebt`
|
|
12
|
+
* - `debtPerBlockLimit` — facade takes no new debt this block; in practice
|
|
13
|
+
* `maxDebtPerBlockMultiplier == 0` after a with-loss liquidation
|
|
14
|
+
* - `poolDebtLimit` — pool-wide debt cap; used on account-opening only
|
|
15
|
+
**/
|
|
16
|
+
type BorrowLimitCause = "poolAvailableLiquidity" | "managerDebtAvailable" | "maxDebt" | "debtPerBlockLimit" | "poolDebtLimit";
|
|
17
|
+
/**
|
|
18
|
+
* The credit manager is paused and takes no multicall at all.
|
|
19
|
+
**/
|
|
20
|
+
interface CreditManagerPausedError extends IGearboxError {
|
|
21
|
+
code: "creditManagerPaused";
|
|
22
|
+
creditManager: Address;
|
|
23
|
+
}
|
|
24
|
+
/** {@inheritDoc CreditManagerPausedError} */
|
|
25
|
+
declare function creditManagerPaused(creditManager: Address): CreditManagerPausedError;
|
|
26
|
+
/**
|
|
27
|
+
* The pool is paused: it neither takes deposits nor serves withdrawals.
|
|
28
|
+
**/
|
|
29
|
+
interface PoolPausedError extends IGearboxError {
|
|
30
|
+
code: "poolPaused";
|
|
31
|
+
pool: Address;
|
|
32
|
+
}
|
|
33
|
+
/** {@inheritDoc PoolPausedError} */
|
|
34
|
+
declare function poolPaused(pool: Address): PoolPausedError;
|
|
35
|
+
/**
|
|
36
|
+
* The facade is past its expiration date and takes no more multicalls.
|
|
37
|
+
**/
|
|
38
|
+
interface MarketExpiredError extends IGearboxError {
|
|
39
|
+
code: "marketExpired";
|
|
40
|
+
creditManager: Address;
|
|
41
|
+
/** Unix seconds, as the facade reports it. */
|
|
42
|
+
expirationDate: number;
|
|
43
|
+
}
|
|
44
|
+
/** {@inheritDoc MarketExpiredError} */
|
|
45
|
+
declare function marketExpired(creditManager: Address, expirationDate: number): MarketExpiredError;
|
|
46
|
+
/**
|
|
47
|
+
* The pool is winding down: it still serves withdrawals, but takes no more deposits.
|
|
48
|
+
**/
|
|
49
|
+
interface PoolSunsetError extends IGearboxError {
|
|
50
|
+
code: "poolSunset";
|
|
51
|
+
pool: Address;
|
|
52
|
+
}
|
|
53
|
+
/** {@inheritDoc PoolSunsetError} */
|
|
54
|
+
declare function poolSunset(pool: Address): PoolSunsetError;
|
|
55
|
+
/**
|
|
56
|
+
* The pool cannot lend what the operation asks for.
|
|
57
|
+
**/
|
|
58
|
+
interface InsufficientPoolLiquidityError extends IGearboxError {
|
|
59
|
+
code: "insufficientPoolLiquidity";
|
|
60
|
+
/** Both in the market's underlying. */
|
|
61
|
+
requested: TokenAmount;
|
|
62
|
+
available: TokenAmount;
|
|
63
|
+
/**
|
|
64
|
+
* Which limit ran out. See {@link BorrowLimitCause}.
|
|
65
|
+
**/
|
|
66
|
+
limit: BorrowLimitCause;
|
|
67
|
+
/**
|
|
68
|
+
* Largest debt a new position can still take, omitted when even `minDebt`
|
|
69
|
+
* does not fit.
|
|
70
|
+
**/
|
|
71
|
+
maxBorrowAmount?: TokenAmount;
|
|
72
|
+
}
|
|
73
|
+
/** {@inheritDoc InsufficientPoolLiquidityError} */
|
|
74
|
+
declare function insufficientPoolLiquidity(args: Omit<InsufficientPoolLiquidityError, "code" | "message">): InsufficientPoolLiquidityError;
|
|
75
|
+
/**
|
|
76
|
+
* The debt the operation implies falls outside the facade's `debtLimits`
|
|
77
|
+
* (`minDebt`/`maxDebt`).
|
|
78
|
+
**/
|
|
79
|
+
interface DebtOutOfRangeError extends IGearboxError {
|
|
80
|
+
code: "debtOutOfRange";
|
|
81
|
+
/** All three in the market's underlying. */
|
|
82
|
+
requested: TokenAmount;
|
|
83
|
+
minDebt: TokenAmount;
|
|
84
|
+
maxDebt: TokenAmount;
|
|
85
|
+
}
|
|
86
|
+
/** {@inheritDoc DebtOutOfRangeError} */
|
|
87
|
+
declare function debtOutOfRange(args: Omit<DebtOutOfRangeError, "code" | "message">): DebtOutOfRangeError;
|
|
88
|
+
/**
|
|
89
|
+
* The leverage asked for cannot be expressed as a plan at all.
|
|
90
|
+
**/
|
|
91
|
+
interface LeverageOutOfRangeError extends IGearboxError {
|
|
92
|
+
code: "leverageOutOfRange";
|
|
93
|
+
/**
|
|
94
|
+
* Scaled by `LEVERAGE_DECIMALS` (`100n` = 1x), as the intent states it — not
|
|
95
|
+
* the read model's `Leverage`. Both are absent where the floor is not fixed:
|
|
96
|
+
* the deposit planner's is a function of the deposit.
|
|
97
|
+
**/
|
|
98
|
+
requested?: bigint;
|
|
99
|
+
min?: bigint;
|
|
100
|
+
}
|
|
101
|
+
/** {@inheritDoc LeverageOutOfRangeError} */
|
|
102
|
+
declare function leverageOutOfRange(args?: Omit<LeverageOutOfRangeError, "code" | "message">): LeverageOutOfRangeError;
|
|
103
|
+
/**
|
|
104
|
+
* The account would end the operation owing more than its collateral is worth
|
|
105
|
+
* under liquidation thresholds, which the facade refuses to allow.
|
|
106
|
+
**/
|
|
107
|
+
interface InsufficientCollateralError extends IGearboxError {
|
|
108
|
+
code: "insufficientCollateral";
|
|
109
|
+
/**
|
|
110
|
+
* The factor that was compared, which for a call that hands funds over is
|
|
111
|
+
* the safe-price one; `safePrices` says which, since a projection always
|
|
112
|
+
* reports main prices.
|
|
113
|
+
**/
|
|
114
|
+
healthFactor: Bps;
|
|
115
|
+
/**
|
|
116
|
+
* The threshold it was weighed against — the facade's own `1.0` for a check
|
|
117
|
+
* that asks whether the transaction lands, a form's higher threshold for one
|
|
118
|
+
* that asks whether it is wise.
|
|
119
|
+
**/
|
|
120
|
+
healthFactorThreshold: Bps;
|
|
121
|
+
safePrices: boolean;
|
|
122
|
+
}
|
|
123
|
+
/** {@inheritDoc InsufficientCollateralError} */
|
|
124
|
+
declare function insufficientCollateral(args: Omit<InsufficientCollateralError, "code" | "message">): InsufficientCollateralError;
|
|
125
|
+
/**
|
|
126
|
+
* The operation would increase the balance of a token the market forbids.
|
|
127
|
+
**/
|
|
128
|
+
interface ForbiddenTokenError extends IGearboxError {
|
|
129
|
+
code: "forbiddenToken";
|
|
130
|
+
token: Token;
|
|
131
|
+
}
|
|
132
|
+
/** {@inheritDoc ForbiddenTokenError} */
|
|
133
|
+
declare function forbiddenToken(token: Token): ForbiddenTokenError;
|
|
134
|
+
/**
|
|
135
|
+
* The market takes no more quota for a token the operation wants to hold.
|
|
136
|
+
**/
|
|
137
|
+
interface QuotaLimitReachedError extends IGearboxError {
|
|
138
|
+
code: "quotaLimitReached";
|
|
139
|
+
/** The token whose quota is asked for. */
|
|
140
|
+
token: Token;
|
|
141
|
+
/**
|
|
142
|
+
* In the **underlying**, which is what a quota is measured in. Absent for a
|
|
143
|
+
* token the market opened no quota for at all — nothing was weighed against
|
|
144
|
+
* a limit, the token simply counts as no collateral.
|
|
145
|
+
**/
|
|
146
|
+
requested: TokenAmount | undefined;
|
|
147
|
+
available: TokenAmount;
|
|
148
|
+
}
|
|
149
|
+
/** {@inheritDoc QuotaLimitReachedError} */
|
|
150
|
+
declare function quotaLimitReached(args: Omit<QuotaLimitReachedError, "code" | "message">): QuotaLimitReachedError;
|
|
151
|
+
/**
|
|
152
|
+
* The account would end up with more quoted tokens than the facade enables at
|
|
153
|
+
* once. A count, not an amount — unlike {@link QuotaLimitReachedError}.
|
|
154
|
+
**/
|
|
155
|
+
interface QuotaCountExceededError extends IGearboxError {
|
|
156
|
+
code: "quotaCountExceeded";
|
|
157
|
+
count: number;
|
|
158
|
+
max: number;
|
|
159
|
+
}
|
|
160
|
+
/** {@inheritDoc QuotaCountExceededError} */
|
|
161
|
+
declare function quotaCountExceeded(count: number, max: number): QuotaCountExceededError;
|
|
162
|
+
/**
|
|
163
|
+
* A balance is too small to fund the operation's step.
|
|
164
|
+
*
|
|
165
|
+
* One error for both sides of the question, since both state the same fact —
|
|
166
|
+
* holder H lacks amount X of token T — and differ only in whose balance is
|
|
167
|
+
* short.
|
|
168
|
+
**/
|
|
169
|
+
interface InsufficientBalanceError extends IGearboxError {
|
|
170
|
+
code: "insufficientBalance";
|
|
171
|
+
/**
|
|
172
|
+
* Both absent where the operation was refused before any pair of amounts
|
|
173
|
+
* existed, which is most of the sites that raise this. The `message` carries
|
|
174
|
+
* the explanation in that case.
|
|
175
|
+
**/
|
|
176
|
+
required?: TokenAmount;
|
|
177
|
+
held?: TokenAmount;
|
|
178
|
+
/** Who is short of funds. Absent when planning never resolved one. */
|
|
179
|
+
holderKind?: "wallet" | "creditAccount";
|
|
180
|
+
/** The address short of funds, when known. */
|
|
181
|
+
holder?: Address;
|
|
182
|
+
}
|
|
183
|
+
/** {@inheritDoc InsufficientBalanceError} */
|
|
184
|
+
declare function insufficientBalance(args?: Omit<InsufficientBalanceError, "code" | "message">): InsufficientBalanceError;
|
|
185
|
+
/**
|
|
186
|
+
* `owner` has not approved `spender` for what the operation pulls.
|
|
187
|
+
**/
|
|
188
|
+
interface InsufficientAllowanceError extends IGearboxError {
|
|
189
|
+
code: "insufficientAllowance";
|
|
190
|
+
owner: Address;
|
|
191
|
+
spender: Address;
|
|
192
|
+
/** The token rides inside, as on {@link InsufficientBalanceError}. */
|
|
193
|
+
required: TokenAmount;
|
|
194
|
+
/** What is approved today. */
|
|
195
|
+
allowed: TokenAmount;
|
|
196
|
+
}
|
|
197
|
+
/** {@inheritDoc InsufficientAllowanceError} */
|
|
198
|
+
declare function insufficientAllowance(args: Omit<InsufficientAllowanceError, "code" | "message">): InsufficientAllowanceError;
|
|
199
|
+
/**
|
|
200
|
+
* The RWA factory still wants something from the borrower before this token
|
|
201
|
+
* can be opened on.
|
|
202
|
+
**/
|
|
203
|
+
interface RWAOpenRequirementsError extends IGearboxError {
|
|
204
|
+
code: "rwaOpenRequirementsNotMet";
|
|
205
|
+
token: Token;
|
|
206
|
+
creditManager: Address;
|
|
207
|
+
factory: Address;
|
|
208
|
+
/** Always present on the error. */
|
|
209
|
+
requirements: RWAOpenAccountRequirements;
|
|
210
|
+
/** Absent when only issuer-side registration is pending. */
|
|
211
|
+
missing?: RWAMissingOpenAccountRequirements;
|
|
212
|
+
}
|
|
213
|
+
/** {@inheritDoc RWAOpenRequirementsError} */
|
|
214
|
+
declare function rwaOpenRequirementsNotMet(args: Omit<RWAOpenRequirementsError, "code" | "message">): RWAOpenRequirementsError;
|
|
215
|
+
//#endregion
|
|
216
|
+
export { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { IGearboxError } from "
|
|
1
|
+
import { IGearboxError } from "./base.js";
|
|
2
2
|
import { Address } from "viem";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/model/errors/oracle-errors.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* The oracle has no price for
|
|
6
|
-
* `warning ??=` so a malformed-transaction warning already recorded keeps
|
|
7
|
-
* precedence.
|
|
5
|
+
* The oracle has no price for token
|
|
8
6
|
**/
|
|
9
7
|
interface UnpriceableTokenError extends IGearboxError {
|
|
10
8
|
code: "unpriceableToken";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Token, TokenAmount } from "../primitives.js";
|
|
2
|
+
import { IGearboxError } from "./base.js";
|
|
3
|
+
import { Address } from "viem";
|
|
4
|
+
//#region src/model/errors/prepare-errors.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Input token is not accepted by the flow (e.g. deposit of a non-underlying).
|
|
7
|
+
**/
|
|
8
|
+
interface UnsupportedCollateralTokenError extends IGearboxError {
|
|
9
|
+
code: "unsupportedCollateralToken";
|
|
10
|
+
token: Token;
|
|
11
|
+
}
|
|
12
|
+
/** {@inheritDoc UnsupportedCollateralTokenError} */
|
|
13
|
+
declare function unsupportedCollateralToken(token: Token): UnsupportedCollateralTokenError;
|
|
14
|
+
/**
|
|
15
|
+
* No route for the trade the plan needs: no pool pair between the tokens,
|
|
16
|
+
* several and none was picked, or the pathfinder found no path.
|
|
17
|
+
**/
|
|
18
|
+
interface UnsupportedTokenPairError extends IGearboxError {
|
|
19
|
+
code: "unsupportedTokenPair";
|
|
20
|
+
/**
|
|
21
|
+
* `to` is absent where the market named no output for `from`; both are absent
|
|
22
|
+
* when the pathfinder reverted rather than answered.
|
|
23
|
+
**/
|
|
24
|
+
from?: Token;
|
|
25
|
+
to?: Token;
|
|
26
|
+
}
|
|
27
|
+
/** {@inheritDoc UnsupportedTokenPairError} */
|
|
28
|
+
declare function unsupportedTokenPair(args?: Omit<UnsupportedTokenPairError, "code" | "message">): UnsupportedTokenPairError;
|
|
29
|
+
/**
|
|
30
|
+
* The intent cannot settle with a delay: the source has no redemption config,
|
|
31
|
+
* the chain has no compressor, or the tail cannot serve the token asked for.
|
|
32
|
+
**/
|
|
33
|
+
interface NoDelayedRouteError extends IGearboxError {
|
|
34
|
+
code: "noDelayedRoute";
|
|
35
|
+
/** Absent where the error is the intent's, not the token's. */
|
|
36
|
+
token?: Token;
|
|
37
|
+
}
|
|
38
|
+
/** {@inheritDoc NoDelayedRouteError} */
|
|
39
|
+
declare function noDelayedRoute(token?: Token): NoDelayedRouteError;
|
|
40
|
+
/** Several redemption venues for the source, and nothing says which. */
|
|
41
|
+
interface MultipleDelayedWithdrawalsError extends IGearboxError {
|
|
42
|
+
code: "multipleDelayedWithdrawals";
|
|
43
|
+
token: Token;
|
|
44
|
+
venues: number;
|
|
45
|
+
}
|
|
46
|
+
/** {@inheritDoc MultipleDelayedWithdrawalsError} */
|
|
47
|
+
declare function multipleDelayedWithdrawals(token: Token, venues: number): MultipleDelayedWithdrawalsError;
|
|
48
|
+
/** A redemption of the same asset is already in flight. */
|
|
49
|
+
interface WithdrawalInProgressError extends IGearboxError {
|
|
50
|
+
code: "withdrawalInProgress";
|
|
51
|
+
/** The phantom token standing for the redemption already in flight. */
|
|
52
|
+
inFlight: TokenAmount;
|
|
53
|
+
}
|
|
54
|
+
/** {@inheritDoc WithdrawalInProgressError} */
|
|
55
|
+
declare function withdrawalInProgress(inFlight: TokenAmount): WithdrawalInProgressError;
|
|
56
|
+
/**
|
|
57
|
+
* The claim names no operation to resume: requested without an intent, or read
|
|
58
|
+
* through a compressor too old to report one.
|
|
59
|
+
**/
|
|
60
|
+
interface NoRecordedIntentError extends IGearboxError {
|
|
61
|
+
code: "noRecordedIntent";
|
|
62
|
+
}
|
|
63
|
+
/** {@inheritDoc NoRecordedIntentError} */
|
|
64
|
+
declare function noRecordedIntent(): NoRecordedIntentError;
|
|
65
|
+
/**
|
|
66
|
+
* Opening asked for no target token and the market names none of its own, so
|
|
67
|
+
* there is nothing to put the position into.
|
|
68
|
+
*
|
|
69
|
+
* A market fact, not a bad argument: pass a `targetToken` to open against a
|
|
70
|
+
* manager that has no default one.
|
|
71
|
+
**/
|
|
72
|
+
interface NoStrategyTargetCollateralError extends IGearboxError {
|
|
73
|
+
code: "noStrategyTargetCollateral";
|
|
74
|
+
creditManager: Address;
|
|
75
|
+
}
|
|
76
|
+
/** {@inheritDoc NoStrategyTargetCollateralError} */
|
|
77
|
+
declare function noStrategyTargetCollateral(creditManager: Address): NoStrategyTargetCollateralError;
|
|
78
|
+
/**
|
|
79
|
+
* No account at that address in the markets this SDK is connected to — closed
|
|
80
|
+
* since it was listed, or read on the wrong chain.
|
|
81
|
+
**/
|
|
82
|
+
interface CreditAccountNotFoundError extends IGearboxError {
|
|
83
|
+
code: "creditAccountNotFound";
|
|
84
|
+
creditAccount: Address;
|
|
85
|
+
}
|
|
86
|
+
/** {@inheritDoc CreditAccountNotFoundError} */
|
|
87
|
+
declare function creditAccountNotFound(creditAccount: Address): CreditAccountNotFoundError;
|
|
88
|
+
/**
|
|
89
|
+
* The account named to open a position on carries debt or quotas.
|
|
90
|
+
*
|
|
91
|
+
* Growing a position that already exists is `depositStrategy`.
|
|
92
|
+
**/
|
|
93
|
+
interface CreditAccountNotEmptyError extends IGearboxError {
|
|
94
|
+
code: "creditAccountNotEmpty";
|
|
95
|
+
creditAccount: Address;
|
|
96
|
+
}
|
|
97
|
+
/** {@inheritDoc CreditAccountNotEmptyError} */
|
|
98
|
+
declare function creditAccountNotEmpty(creditAccount: Address): CreditAccountNotEmptyError;
|
|
99
|
+
/**
|
|
100
|
+
* An empty opening was asked for with something to open it with: collateral to
|
|
101
|
+
* spend, an account to reuse, or a leverage to reach.
|
|
102
|
+
**/
|
|
103
|
+
interface EmptyOpenTakesNothingError extends IGearboxError {
|
|
104
|
+
code: "emptyOpenTakesNothing";
|
|
105
|
+
}
|
|
106
|
+
/** {@inheritDoc EmptyOpenTakesNothingError} */
|
|
107
|
+
declare function emptyOpenTakesNothing(): EmptyOpenTakesNothingError;
|
|
108
|
+
/**
|
|
109
|
+
* The SDK could not answer at all: a read that failed, a chain it is not
|
|
110
|
+
* connected to, a market or token address it knows nothing about, a contract
|
|
111
|
+
* that reverted where nothing should, a bug of ours.
|
|
112
|
+
*
|
|
113
|
+
* The one code that is not a verdict on the request — everything above says
|
|
114
|
+
* "this cannot be done", this one says "we do not know". It exists so that a
|
|
115
|
+
* prepare method or a check always answers: what used to escape as an
|
|
116
|
+
* exception arrives here instead, whole, under `cause`.
|
|
117
|
+
**/
|
|
118
|
+
interface UnexpectedFailureError extends IGearboxError {
|
|
119
|
+
code: "unexpectedFailure";
|
|
120
|
+
/** What actually went wrong, for a log and a bug report. */
|
|
121
|
+
cause: Error;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* {@inheritDoc UnexpectedFailureError}
|
|
125
|
+
*
|
|
126
|
+
* Takes what was thrown, whatever that is: a `throw` is not obliged to raise an
|
|
127
|
+
* `Error`, and `cause` promises one.
|
|
128
|
+
**/
|
|
129
|
+
declare function unexpectedFailure(thrown: unknown, action?: string): UnexpectedFailureError;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { CreditAccountNotEmptyError, CreditAccountNotFoundError, EmptyOpenTakesNothingError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, emptyOpenTakesNothing, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { IGearboxError } from "./base.js";
|
|
2
|
+
import { Address, Hex } from "viem";
|
|
3
|
+
//#region src/model/errors/preview-errors.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Target of a transaction is not a known Gearbox contract
|
|
6
|
+
* (pool/facade/etc.)
|
|
7
|
+
*/
|
|
8
|
+
interface UnsupportedTargetError extends IGearboxError {
|
|
9
|
+
code: "unsupportedTarget";
|
|
10
|
+
/** Target address no known Gearbox contract answers for. */
|
|
11
|
+
target: Address;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Pool call uses a function other than ERC4626 `deposit`/`redeem`.
|
|
15
|
+
*/
|
|
16
|
+
interface UnsupportedPoolFunctionError extends IGearboxError {
|
|
17
|
+
code: "unsupportedPoolFunction";
|
|
18
|
+
/** Pool the call targets. */
|
|
19
|
+
pool: Address;
|
|
20
|
+
/** Decoded function name the SDK cannot preview. */
|
|
21
|
+
functionName: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Zapper call uses a function other than a known `deposit`/`redeem` variant.
|
|
25
|
+
*/
|
|
26
|
+
interface UnsupportedZapperFunctionError extends IGearboxError {
|
|
27
|
+
code: "unsupportedZapperFunction";
|
|
28
|
+
/** Zapper contract the call targets. */
|
|
29
|
+
zapper: Address;
|
|
30
|
+
/** Decoded function name the SDK cannot preview. */
|
|
31
|
+
functionName: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Refusal answered by `previewOperation` for parsed operations it cannot
|
|
35
|
+
* preview yet.
|
|
36
|
+
*/
|
|
37
|
+
interface UnsupportedOperationError extends IGearboxError {
|
|
38
|
+
code: "unsupportedOperation";
|
|
39
|
+
/** The parsed operation kind (the `operation` discriminant). */
|
|
40
|
+
operation: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Delayed-withdrawal request or redemption log carries
|
|
44
|
+
* non-empty `extraData` that cannot be decoded as a `DelayedIntent`.
|
|
45
|
+
*/
|
|
46
|
+
interface InvalidDelayedIntentError extends IGearboxError {
|
|
47
|
+
code: "invalidDelayedIntent";
|
|
48
|
+
/** Raw `extraData` that failed to decode. */
|
|
49
|
+
extraData: Hex;
|
|
50
|
+
/** The decoding failure this refusal stands in front of. */
|
|
51
|
+
cause?: Error;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Pool operation preview read (ERC4626 preview/`balanceOf`) fails.
|
|
55
|
+
*/
|
|
56
|
+
interface PoolOperationPreviewError extends IGearboxError {
|
|
57
|
+
code: "poolOperationPreviewError";
|
|
58
|
+
/** Pool the operation targeted. */
|
|
59
|
+
pool: Address;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The transaction could not be replayed: it is malformed.
|
|
63
|
+
* Facade multicalls theoretically allow many more combinations of calls,
|
|
64
|
+
* but sdk generates and parses only certain combinations.
|
|
65
|
+
*/
|
|
66
|
+
interface MalformedTransactionError extends IGearboxError {
|
|
67
|
+
code: "malformedTransaction";
|
|
68
|
+
}
|
|
69
|
+
/** {@inheritDoc MalformedTransactionError} */
|
|
70
|
+
declare function malformedTransaction(detail: string, cause?: Error): MalformedTransactionError;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction };
|