@gearbox-protocol/sdk 17.0.0-next.4 → 17.1.0-next.1
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/dev/abi.js +14 -15
- package/dist/cjs/dev/claimFromFaucet.js +4 -8
- package/dist/cjs/dev/createAnvilClient.js +35 -17
- package/dist/cjs/dev/index.js +7 -2
- package/dist/cjs/dev/kycUtils.js +66 -58
- package/dist/cjs/dev/midasUtils.js +113 -16
- package/dist/cjs/dev/securitizeUtils.js +82 -42
- package/dist/cjs/dev/withdrawalUtils.js +3 -6
- package/dist/cjs/model/errors/index.js +2 -0
- package/dist/cjs/model/errors/operation-errors.js +19 -1
- package/dist/cjs/model/index.js +4 -2
- package/dist/cjs/model/rwa.js +4 -4
- package/dist/cjs/model/rwa.schema.js +4 -4
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/cjs/onchain/OnchainSDK.js +3 -3
- package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +2 -17
- package/dist/cjs/onchain/accounts/intents/borrow.js +140 -0
- package/dist/cjs/onchain/accounts/intents/collateral-valuation.js +41 -0
- package/dist/cjs/onchain/accounts/intents/guards.js +15 -3
- package/dist/cjs/onchain/accounts/intents/index.js +107 -20
- package/dist/cjs/onchain/accounts/intents/leverage-band.js +2 -12
- package/dist/cjs/onchain/accounts/intents/math.js +12 -3
- package/dist/cjs/onchain/accounts/intents/maxBorrow.js +89 -0
- package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +15 -41
- package/dist/cjs/onchain/accounts/intents/open-strategy.js +8 -46
- package/dist/cjs/onchain/accounts/intents/operations.js +0 -1
- package/dist/cjs/onchain/accounts/intents/plan.js +1 -8
- package/dist/cjs/onchain/accounts/intents/realize.js +61 -4
- package/dist/cjs/onchain/accounts/intents/tail.js +1 -1
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -0
- package/dist/cjs/onchain/accounts/intents/utils/common.js +19 -0
- package/dist/cjs/onchain/accounts/intents/utils/credit-account-slice.js +21 -0
- package/dist/cjs/onchain/accounts/intents/utils/index.js +2 -0
- package/dist/cjs/onchain/accounts/intents/utils/price-impact.js +12 -9
- package/dist/cjs/onchain/accounts/intents/utils/router-path.js +4 -5
- package/dist/cjs/onchain/accounts/intents/withdraw-limits.js +97 -0
- package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/cjs/onchain/constants/address-provider.js +0 -2
- package/dist/cjs/onchain/constants/index.js +0 -1
- package/dist/cjs/onchain/core/createAddressProvider.js +2 -5
- package/dist/cjs/onchain/index.js +60 -43
- package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -2
- package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +6 -0
- package/dist/cjs/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +49 -5
- package/dist/cjs/onchain/market/credit/CreditSuite.js +26 -9
- package/dist/cjs/onchain/market/index.js +50 -38
- package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +3 -3
- package/dist/cjs/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
- package/dist/cjs/onchain/market/pricefeeds/PriceFeedRegistry.js +127 -0
- package/dist/cjs/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
- package/dist/cjs/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
- package/dist/cjs/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
- package/dist/cjs/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/feeds/index.js +35 -0
- package/dist/cjs/onchain/market/pricefeeds/index.js +51 -39
- package/dist/cjs/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +189 -0
- package/dist/cjs/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
- package/dist/cjs/onchain/market/pricefeeds/updates/index.js +8 -0
- package/dist/cjs/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
- package/dist/cjs/onchain/market/pricefeeds/updates/updatableDependencies.js +14 -0
- package/dist/cjs/onchain/market/rwa/RWARegistry.js +4 -7
- package/dist/cjs/onchain/market/rwa/index.js +1 -0
- package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +56 -12
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
- package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
- package/dist/cjs/onchain/opportunities/OpportunitiesService.js +16 -4
- package/dist/cjs/onchain/pools/PoolService.js +7 -8
- package/dist/cjs/onchain/positions/calcHealthFactor.js +3 -3
- package/dist/cjs/onchain/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
- package/dist/cjs/onchain/preview/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/midasGreenlistsAccount.js +17 -0
- package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +13 -16
- package/dist/cjs/onchain/preview/preview/previewOperation.js +19 -11
- package/dist/cjs/onchain/preview/preview/replayMulticall.js +4 -3
- package/dist/cjs/onchain/validation/bundles/checkCollateralFunding.js +3 -3
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +11 -9
- package/dist/cjs/onchain/validation/bundles/{checkDraw.js → checkIncreaseDebt.js} +10 -10
- package/dist/cjs/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
- package/dist/cjs/onchain/validation/bundles/checkMidasAccountGreenlist.js +44 -0
- package/dist/cjs/onchain/validation/bundles/checkPoolOperation.js +2 -8
- package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
- package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +18 -8
- package/dist/cjs/onchain/validation/bundles/index.js +6 -4
- package/dist/cjs/onchain/validation/checkOperation.js +0 -1
- package/dist/cjs/onchain/validation/checks/checkBorrowLimit.js +1 -1
- package/dist/cjs/onchain/validation/checks/checkPoolLiquidity.js +2 -9
- package/dist/cjs/onchain/validation/checks/checkReservePriceLimited.js +30 -0
- package/dist/cjs/onchain/validation/checks/index.js +2 -0
- package/dist/cjs/onchain/validation/index.js +8 -4
- package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +2 -2
- package/dist/cjs/permissionless/utils/price-update/get-updatable-feeds.js +2 -2
- package/dist/cjs/sdk/execute/ExecuteApi.js +67 -7
- package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +9 -3
- package/dist/cjs/sdk/prepare/PrepareApi.js +89 -14
- package/dist/esm/dev/abi.js +14 -15
- package/dist/esm/dev/claimFromFaucet.js +4 -8
- package/dist/esm/dev/createAnvilClient.js +36 -19
- package/dist/esm/dev/index.js +4 -4
- package/dist/esm/dev/kycUtils.js +66 -59
- package/dist/esm/dev/midasUtils.js +112 -18
- package/dist/esm/dev/securitizeUtils.js +84 -44
- package/dist/esm/dev/withdrawalUtils.js +3 -6
- package/dist/esm/model/errors/index.js +2 -2
- package/dist/esm/model/errors/operation-errors.js +18 -2
- package/dist/esm/model/index.js +4 -4
- package/dist/esm/model/rwa.js +4 -4
- package/dist/esm/model/rwa.schema.js +5 -5
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/esm/onchain/OnchainSDK.js +3 -3
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -17
- package/dist/esm/onchain/accounts/intents/borrow.js +138 -0
- package/dist/esm/onchain/accounts/intents/collateral-valuation.js +40 -0
- package/dist/esm/onchain/accounts/intents/guards.js +15 -3
- package/dist/esm/onchain/accounts/intents/index.js +107 -20
- package/dist/esm/onchain/accounts/intents/leverage-band.js +2 -12
- package/dist/esm/onchain/accounts/intents/math.js +13 -5
- package/dist/esm/onchain/accounts/intents/maxBorrow.js +87 -0
- package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +15 -41
- package/dist/esm/onchain/accounts/intents/open-strategy.js +8 -46
- package/dist/esm/onchain/accounts/intents/operations.js +0 -1
- package/dist/esm/onchain/accounts/intents/plan.js +1 -8
- package/dist/esm/onchain/accounts/intents/realize.js +61 -4
- package/dist/esm/onchain/accounts/intents/tail.js +1 -1
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -0
- package/dist/esm/onchain/accounts/intents/utils/common.js +19 -1
- package/dist/esm/onchain/accounts/intents/utils/credit-account-slice.js +21 -1
- package/dist/esm/onchain/accounts/intents/utils/index.js +3 -3
- package/dist/esm/onchain/accounts/intents/utils/price-impact.js +12 -9
- package/dist/esm/onchain/accounts/intents/utils/router-path.js +4 -5
- package/dist/esm/onchain/accounts/intents/withdraw-limits.js +95 -0
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/constants/address-provider.js +1 -2
- package/dist/esm/onchain/constants/index.js +2 -2
- package/dist/esm/onchain/core/createAddressProvider.js +2 -5
- package/dist/esm/onchain/index.js +32 -24
- package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -2
- package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +6 -0
- package/dist/esm/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +50 -6
- package/dist/esm/onchain/market/credit/CreditSuite.js +26 -9
- package/dist/esm/onchain/market/index.js +26 -21
- package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
- package/dist/esm/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
- package/dist/esm/onchain/market/pricefeeds/PriceFeedRegistry.js +126 -0
- package/dist/esm/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
- package/dist/esm/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
- package/dist/esm/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
- package/dist/esm/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/feeds/index.js +18 -0
- package/dist/esm/onchain/market/pricefeeds/index.js +27 -21
- package/dist/esm/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +188 -0
- package/dist/esm/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
- package/dist/esm/onchain/market/pricefeeds/updates/index.js +5 -1
- package/dist/esm/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
- package/dist/esm/onchain/market/pricefeeds/updates/updatableDependencies.js +13 -0
- package/dist/esm/onchain/market/rwa/RWARegistry.js +4 -8
- package/dist/esm/onchain/market/rwa/index.js +2 -2
- package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +55 -10
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
- package/dist/esm/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
- package/dist/esm/onchain/opportunities/OpportunitiesService.js +16 -4
- package/dist/esm/onchain/pools/PoolService.js +7 -8
- package/dist/esm/onchain/positions/calcHealthFactor.js +3 -3
- package/dist/esm/onchain/preview/index.js +2 -1
- package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
- package/dist/esm/onchain/preview/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/midasGreenlistsAccount.js +16 -0
- package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +14 -17
- package/dist/esm/onchain/preview/preview/previewOperation.js +19 -11
- package/dist/esm/onchain/preview/preview/replayMulticall.js +4 -3
- package/dist/esm/onchain/validation/bundles/checkCollateralFunding.js +3 -3
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +11 -9
- package/dist/esm/onchain/validation/bundles/checkIncreaseDebt.js +27 -0
- package/dist/esm/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
- package/dist/esm/onchain/validation/bundles/checkMidasAccountGreenlist.js +43 -0
- package/dist/esm/onchain/validation/bundles/checkPoolOperation.js +2 -8
- package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
- package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +18 -8
- package/dist/esm/onchain/validation/bundles/index.js +4 -3
- package/dist/esm/onchain/validation/checkOperation.js +0 -1
- package/dist/esm/onchain/validation/checks/checkBorrowLimit.js +1 -1
- package/dist/esm/onchain/validation/checks/checkPoolLiquidity.js +2 -9
- package/dist/esm/onchain/validation/checks/checkReservePriceLimited.js +29 -0
- package/dist/esm/onchain/validation/checks/index.js +2 -1
- package/dist/esm/onchain/validation/index.js +5 -3
- package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +1 -1
- package/dist/esm/permissionless/utils/price-update/get-updatable-feeds.js +1 -1
- package/dist/esm/sdk/execute/ExecuteApi.js +67 -7
- package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +9 -3
- package/dist/esm/sdk/prepare/PrepareApi.js +94 -19
- package/dist/types/dev/abi.d.ts +13 -15
- package/dist/types/dev/claimFromFaucet.d.ts +0 -1
- package/dist/types/dev/createAnvilClient.d.ts +10 -3
- package/dist/types/dev/index.d.ts +4 -4
- package/dist/types/dev/kycUtils.d.ts +15 -24
- package/dist/types/dev/midasUtils.d.ts +35 -4
- package/dist/types/dev/securitizeUtils.d.ts +3 -9
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +62 -7
- package/dist/types/model/index.d.ts +5 -5
- package/dist/types/model/opportunities.d.ts +6 -7
- package/dist/types/model/previews.d.ts +25 -19
- package/dist/types/model/rwa.d.ts +47 -27
- package/dist/types/model/rwa.schema.d.ts +3 -3
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -2
- package/dist/types/offchain/opportunities/types.d.ts +1 -4
- package/dist/types/onchain/OnchainSDK.d.ts +2 -2
- package/dist/types/onchain/accounts/index.d.ts +5 -4
- package/dist/types/onchain/accounts/intents/borrow.d.ts +141 -0
- package/dist/types/onchain/accounts/intents/collateral-valuation.d.ts +42 -0
- package/dist/types/onchain/accounts/intents/guards.d.ts +18 -2
- package/dist/types/onchain/accounts/intents/index.d.ts +103 -15
- package/dist/types/onchain/accounts/intents/math.d.ts +11 -3
- package/dist/types/onchain/accounts/intents/maxBorrow.d.ts +54 -0
- package/dist/types/onchain/accounts/intents/maxWithdrawCollateral.d.ts +3 -8
- package/dist/types/onchain/accounts/intents/open-strategy.d.ts +3 -17
- package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +2 -0
- package/dist/types/onchain/accounts/intents/tests/open-strategy.fixtures.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/types.d.ts +51 -6
- package/dist/types/onchain/accounts/intents/utils/common.d.ts +15 -1
- package/dist/types/onchain/accounts/intents/utils/credit-account-slice.d.ts +14 -1
- package/dist/types/onchain/accounts/intents/utils/index.d.ts +3 -3
- package/dist/types/onchain/accounts/intents/utils/price-impact.d.ts +4 -1
- package/dist/types/onchain/accounts/intents/utils/router-path.d.ts +2 -5
- package/dist/types/onchain/accounts/intents/withdraw-limits.d.ts +80 -0
- package/dist/types/onchain/accounts/types.d.ts +4 -2
- package/dist/types/onchain/constants/address-provider.d.ts +1 -2
- package/dist/types/onchain/constants/index.d.ts +2 -2
- package/dist/types/onchain/index.d.ts +40 -31
- package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +6 -0
- package/dist/types/onchain/market/adapters/contracts/MidasGatewayAdapterContract.d.ts +20 -4
- package/dist/types/onchain/market/adapters/types.d.ts +8 -0
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +13 -3
- package/dist/types/onchain/market/index.d.ts +29 -24
- package/dist/types/onchain/market/oracle/PriceOracleBaseContract.d.ts +2 -1
- package/dist/types/onchain/market/oracle/types.d.ts +2 -1
- package/dist/types/onchain/market/pool/types.d.ts +1 -1
- package/dist/types/onchain/market/pricefeeds/AbstractPriceFeed.d.ts +1 -2
- package/dist/types/onchain/market/pricefeeds/PriceFeedRegistry.d.ts +60 -0
- package/dist/types/onchain/market/pricefeeds/feeds/BalancerStablePriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.d.ts → feeds/BalancerWeightedPriceFeed.d.ts} +7 -7
- package/dist/types/onchain/market/pricefeeds/feeds/BoundedPriceFeed.d.ts +15 -0
- package/dist/types/onchain/market/pricefeeds/{CompositePriceFeed.d.ts → feeds/CompositePriceFeed.d.ts} +6 -6
- package/dist/types/onchain/market/pricefeeds/{ConstantPriceFeed.d.ts → feeds/ConstantPriceFeed.d.ts} +6 -6
- package/dist/types/onchain/market/pricefeeds/feeds/CurveCryptoPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/CurveStablePriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/CurveUSDPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/Erc4626PriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/ExternalPriceFeed.d.ts +11 -0
- package/dist/types/onchain/market/pricefeeds/feeds/MellowLRTPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.d.ts → feeds/PendleTWAPPTPriceFeed.d.ts} +3 -3
- package/dist/types/onchain/market/pricefeeds/{PythPriceFeed.d.ts → feeds/PythPriceFeed.d.ts} +3 -3
- package/dist/types/onchain/market/pricefeeds/{RedstonePriceFeed.d.ts → feeds/RedstonePriceFeed.d.ts} +9 -9
- package/dist/types/onchain/market/pricefeeds/feeds/WstETHPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/YearnPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/ZeroPriceFeed.d.ts +11 -0
- package/dist/types/onchain/market/pricefeeds/feeds/index.d.ts +18 -0
- package/dist/types/onchain/market/pricefeeds/index.d.ts +28 -22
- package/dist/types/onchain/market/pricefeeds/types.d.ts +1 -31
- package/dist/types/onchain/market/pricefeeds/updates/RedstoneUpdater.d.ts +1 -1
- package/dist/types/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.d.ts +106 -0
- package/dist/types/onchain/market/pricefeeds/updates/getRawPriceUpdates.d.ts +6 -0
- package/dist/types/onchain/market/pricefeeds/updates/index.d.ts +7 -3
- package/dist/types/onchain/market/pricefeeds/updates/isUpdatablePriceFeed.d.ts +6 -0
- package/dist/types/onchain/market/pricefeeds/updates/types.d.ts +56 -2
- package/dist/types/onchain/market/pricefeeds/updates/updatableDependencies.d.ts +10 -0
- package/dist/types/onchain/market/rwa/RWARegistry.d.ts +2 -1
- package/dist/types/onchain/market/rwa/index.d.ts +3 -3
- package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +19 -4
- package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +24 -4
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +2 -14
- package/dist/types/onchain/market/rwa/types.d.ts +39 -37
- package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +5 -1
- package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +10 -3
- package/dist/types/onchain/opportunities/types.d.ts +6 -1
- package/dist/types/onchain/pools/PoolService.d.ts +5 -0
- package/dist/types/onchain/pools/types.d.ts +9 -2
- package/dist/types/onchain/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/midasGreenlistsAccount.d.ts +13 -0
- package/dist/types/onchain/preview/preview/previewOpenStrategyPosition.d.ts +5 -3
- package/dist/types/onchain/preview/preview/replayMulticall.d.ts +8 -7
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +5 -4
- package/dist/types/onchain/validation/bundles/{checkDraw.d.ts → checkIncreaseDebt.d.ts} +7 -7
- package/dist/types/onchain/validation/bundles/{checkQuotasAsked.d.ts → checkIncreaseQuota.d.ts} +3 -3
- package/dist/types/onchain/validation/bundles/checkMidasAccountGreenlist.d.ts +22 -0
- package/dist/types/onchain/validation/bundles/checkPoolOperation.d.ts +1 -7
- package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +9 -7
- package/dist/types/onchain/validation/bundles/index.d.ts +5 -4
- package/dist/types/onchain/validation/checks/checkBorrowLimit.d.ts +1 -1
- package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +2 -2
- package/dist/types/onchain/validation/checks/checkPoolLiquidity.d.ts +1 -8
- package/dist/types/onchain/validation/checks/checkReservePriceLimited.d.ts +31 -0
- package/dist/types/onchain/validation/checks/index.d.ts +2 -1
- package/dist/types/onchain/validation/index.d.ts +6 -4
- package/dist/types/onchain/validation/raise.d.ts +2 -2
- package/dist/types/sdk/execute/index.d.ts +2 -2
- package/dist/types/sdk/execute/types.d.ts +48 -6
- package/dist/types/sdk/index.d.ts +5 -4
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +5 -1
- package/dist/types/sdk/opportunities/types.d.ts +9 -3
- package/dist/types/sdk/prepare/PrepareApi.d.ts +16 -4
- package/dist/types/sdk/prepare/index.d.ts +4 -3
- package/dist/types/sdk/prepare/types.d.ts +200 -66
- package/package.json +1 -1
- package/dist/cjs/onchain/accounts/utils/midasUtils.js +0 -70
- package/dist/cjs/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -301
- package/dist/cjs/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -61
- package/dist/cjs/plugins/degen-distributors/index.js +0 -4
- package/dist/cjs/plugins/degen-distributors/package.json +0 -1
- package/dist/cjs/plugins/degen-distributors/types.js +0 -1
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -114
- package/dist/cjs/plugins/delayed-withdrawal/index.js +0 -4
- package/dist/cjs/plugins/delayed-withdrawal/package.json +0 -1
- package/dist/cjs/plugins/delayed-withdrawal/types.js +0 -1
- package/dist/esm/onchain/accounts/utils/midasUtils.js +0 -69
- package/dist/esm/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -300
- package/dist/esm/onchain/validation/bundles/checkDraw.js +0 -27
- package/dist/esm/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -60
- package/dist/esm/plugins/degen-distributors/index.js +0 -3
- package/dist/esm/plugins/degen-distributors/package.json +0 -1
- package/dist/esm/plugins/degen-distributors/types.js +0 -1
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -113
- package/dist/esm/plugins/delayed-withdrawal/index.js +0 -3
- package/dist/esm/plugins/delayed-withdrawal/package.json +0 -1
- package/dist/esm/plugins/delayed-withdrawal/types.js +0 -1
- package/dist/types/onchain/accounts/utils/midasUtils.d.ts +0 -38
- package/dist/types/onchain/market/pricefeeds/BalancerStablePriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/BoundedPriceFeed.d.ts +0 -15
- package/dist/types/onchain/market/pricefeeds/CurveCryptoPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/CurveStablePriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/CurveUSDPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/Erc4626PriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/ExternalPriceFeed.d.ts +0 -11
- package/dist/types/onchain/market/pricefeeds/MellowLRTPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/PriceFeedsRegister.d.ts +0 -180
- package/dist/types/onchain/market/pricefeeds/WstETHPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/YearnPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/ZeroPriceFeed.d.ts +0 -11
- package/dist/types/onchain/market/pricefeeds/getRawPriceUpdates.d.ts +0 -5
- package/dist/types/onchain/market/pricefeeds/isUpdatablePriceFeed.d.ts +0 -5
- package/dist/types/plugins/degen-distributors/DegenDistributorsPlugin.d.ts +0 -25
- package/dist/types/plugins/degen-distributors/index.d.ts +0 -3
- package/dist/types/plugins/degen-distributors/types.d.ts +0 -8
- package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +0 -25
- package/dist/types/plugins/delayed-withdrawal/index.d.ts +0 -3
- package/dist/types/plugins/delayed-withdrawal/types.d.ts +0 -10
|
@@ -22,7 +22,12 @@ interface IMultichainOpportunitiesService {
|
|
|
22
22
|
/**
|
|
23
23
|
* Detailed view of one strategy opportunity.
|
|
24
24
|
**/
|
|
25
|
-
getStrategy(key: StrategyOpportunityKey
|
|
25
|
+
getStrategy(key: StrategyOpportunityKey): Promise<DataResponse<StrategyOpportunityDetail>>;
|
|
26
|
+
/**
|
|
27
|
+
* Whether `wallet` may open this strategy today. Throws when that chain
|
|
28
|
+
* cannot answer.
|
|
29
|
+
**/
|
|
30
|
+
isEligibleForStrategy(key: StrategyOpportunityKey, wallet: Address): Promise<boolean>;
|
|
26
31
|
}
|
|
27
32
|
//#endregion
|
|
28
33
|
export { IMultichainOpportunitiesService };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Amount } from "../../model/primitives.js";
|
|
1
2
|
import { PoolPosition } from "../../model/positions.js";
|
|
2
3
|
import "../../model/index.js";
|
|
3
4
|
import { AddLiquidityProps, DepositMetadata, IPoolsService, ListPoolPositionsProps, PoolServiceCallResult, PoolSimulation, RemoveLiquidityProps, SimulatePoolOperationProps, WithdrawalMetadata } from "./types.js";
|
|
@@ -55,6 +56,10 @@ declare class PoolService extends SDKConstruct implements IPoolsService {
|
|
|
55
56
|
* {@inheritDoc IPoolsService.listPositions}
|
|
56
57
|
*/
|
|
57
58
|
listPositions(props: ListPoolPositionsProps): Promise<PoolPosition[]>;
|
|
59
|
+
/**
|
|
60
|
+
* {@inheritDoc IPoolsService.withdrawableLiquidity}
|
|
61
|
+
*/
|
|
62
|
+
withdrawableLiquidity(pool: Address): Amount;
|
|
58
63
|
}
|
|
59
64
|
//#endregion
|
|
60
65
|
export { PoolService };
|
|
@@ -147,8 +147,7 @@ interface PoolSimulation {
|
|
|
147
147
|
**/
|
|
148
148
|
zapper?: Address;
|
|
149
149
|
/**
|
|
150
|
-
* Withdrawals only:
|
|
151
|
-
* trimmed slightly so a withdrawal sized against it does not fail on rounding.
|
|
150
|
+
* Withdrawals only: {@link IPoolsService.withdrawableLiquidity}.
|
|
152
151
|
*
|
|
153
152
|
* The conversion is a rate, not a promise that the pool is liquid enough, so
|
|
154
153
|
* compare `tokenOut.value` against `availableLiquidity.value` to see if the
|
|
@@ -265,6 +264,14 @@ interface IPoolsService {
|
|
|
265
264
|
* several routes exist.
|
|
266
265
|
**/
|
|
267
266
|
simulateRedeem(props: SimulatePoolOperationProps): PoolSimulation;
|
|
267
|
+
/**
|
|
268
|
+
* The most the pool can hand over right now, trimmed so a share-sized
|
|
269
|
+
* withdrawal (redeem, zapper) survives the share price accruing before it is
|
|
270
|
+
* sent.
|
|
271
|
+
*
|
|
272
|
+
* @param pool - Pool address
|
|
273
|
+
**/
|
|
274
|
+
withdrawableLiquidity(pool: Address): Amount;
|
|
268
275
|
/**
|
|
269
276
|
* Returns contract call parameters for adding liquidity to a pool
|
|
270
277
|
* Or undefined if no deposit action is required (e.g. for RWA underlying on demand)
|
|
@@ -15,10 +15,11 @@ import { buildDelayedStrategyPositionOperationPreview } from "./preview/buildDel
|
|
|
15
15
|
import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRepay.js";
|
|
16
16
|
import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./preview/detectDelayedClaim.js";
|
|
17
17
|
import { estimateClaimableAt } from "./preview/estimateClaimableAt.js";
|
|
18
|
+
import { midasGreenlistsAccount } from "./preview/midasGreenlistsAccount.js";
|
|
18
19
|
import { ReplayState, makeReplayState, replayInnerOperations } from "./preview/replayInnerOperations.js";
|
|
19
20
|
import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./preview/replayMulticall.js";
|
|
20
21
|
import { previewAdjustStrategyPosition } from "./preview/previewAdjustStrategyPosition.js";
|
|
21
22
|
import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./preview/previewExitOrRepayStrategyPosition.js";
|
|
22
23
|
import { PreviewOperationError, previewOperation } from "./preview/previewOperation.js";
|
|
23
24
|
import "./preview/index.js";
|
|
24
|
-
export { AdapterOperation, AdapterOperationBase, AddCollateralOp, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, FacadeOperationMetadata, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, PreviewOperationError, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, StoreExpectedBalancesOp, TraceAdapterExt, UpdateQuotaOp, WithdrawCollateralOp, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
|
|
25
|
+
export { AdapterOperation, AdapterOperationBase, AddCollateralOp, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, FacadeOperationMetadata, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, PreviewOperationError, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, StoreExpectedBalancesOp, TraceAdapterExt, UpdateQuotaOp, WithdrawCollateralOp, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, midasGreenlistsAccount, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
|
|
@@ -4,9 +4,10 @@ import { buildDelayedStrategyPositionOperationPreview } from "./buildDelayedStra
|
|
|
4
4
|
import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
|
|
5
5
|
import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
|
|
6
6
|
import { estimateClaimableAt } from "./estimateClaimableAt.js";
|
|
7
|
+
import { midasGreenlistsAccount } from "./midasGreenlistsAccount.js";
|
|
7
8
|
import { ReplayState, makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
|
|
8
9
|
import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./replayMulticall.js";
|
|
9
10
|
import { previewAdjustStrategyPosition } from "./previewAdjustStrategyPosition.js";
|
|
10
11
|
import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./previewExitOrRepayStrategyPosition.js";
|
|
11
12
|
import { PreviewOperationError, previewOperation } from "./previewOperation.js";
|
|
12
|
-
export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, PreviewOperationError, ReplayMulticallResult, ReplayState, ReplayableOperation, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
|
|
13
|
+
export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, PreviewOperationError, ReplayMulticallResult, ReplayState, ReplayableOperation, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, midasGreenlistsAccount, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PluginsMap } from "../../plugins/types.js";
|
|
2
|
+
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
|
+
import { InnerOperation } from "../parse/types-facades.js";
|
|
4
|
+
import "../parse/index.js";
|
|
5
|
+
import "../../index.js";
|
|
6
|
+
//#region src/onchain/preview/preview/midasGreenlistsAccount.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Whether the multicall grants the Midas greenlisted role to the credit
|
|
9
|
+
* account via `receiveGreenlist()`.
|
|
10
|
+
*/
|
|
11
|
+
declare function midasGreenlistsAccount<P extends PluginsMap>(sdk: OnchainSDK<P>, multicall: InnerOperation[]): boolean;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { midasGreenlistsAccount };
|
|
@@ -4,11 +4,13 @@ import { SDKReturn } from "../../../model/result.js";
|
|
|
4
4
|
import "../../../model/index.js";
|
|
5
5
|
import { PluginsMap } from "../../plugins/types.js";
|
|
6
6
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
7
|
-
import { OpenCreditAccountOperation } from "../parse/types-facades.js";
|
|
8
|
-
import { RWAOpenCreditAccountOperation } from "../parse/types-rwa.js";
|
|
7
|
+
import { MulticallOperation, OpenCreditAccountOperation } from "../parse/types-facades.js";
|
|
8
|
+
import { RWAMulticallOperation, RWAOpenCreditAccountOperation } from "../parse/types-rwa.js";
|
|
9
9
|
import "../parse/index.js";
|
|
10
|
+
import { ReplayMulticallResult } from "./replayMulticall.js";
|
|
10
11
|
import "../../index.js";
|
|
11
12
|
//#region src/onchain/preview/preview/previewOpenStrategyPosition.d.ts
|
|
12
|
-
|
|
13
|
+
type OpenPreviewOperation = OpenCreditAccountOperation | RWAOpenCreditAccountOperation | MulticallOperation | RWAMulticallOperation;
|
|
14
|
+
declare function previewOpenStrategyPosition<P extends PluginsMap>(sdk: OnchainSDK<P>, input: PreviewOperationInput, operation: OpenPreviewOperation, replay: ReplayMulticallResult): SDKReturn<OpenStrategyPositionPreview, MalformedTransactionError>;
|
|
13
15
|
//#endregion
|
|
14
16
|
export { previewOpenStrategyPosition };
|
|
@@ -12,12 +12,12 @@ import "../../index.js";
|
|
|
12
12
|
import { Address } from "viem";
|
|
13
13
|
//#region src/onchain/preview/preview/replayMulticall.d.ts
|
|
14
14
|
/**
|
|
15
|
-
* Parsed operation
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Parsed operation whose multicall can be replayed: a facade or RWA
|
|
16
|
+
* opening (empty seed) and close/plain/bot/RWA multicalls on an existing
|
|
17
|
+
* account all fit structurally.
|
|
18
18
|
*/
|
|
19
19
|
interface ReplayableOperation {
|
|
20
|
-
|
|
20
|
+
creditManager: Address;
|
|
21
21
|
multicall: InnerOperation[];
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
@@ -36,9 +36,10 @@ interface ReplayMulticallResult {
|
|
|
36
36
|
after: ReplayState;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Replays the operation's multicall
|
|
40
|
-
*
|
|
39
|
+
* Replays the operation's multicall via {@link replayInnerOperations}.
|
|
40
|
+
* When `creditAccount` is omitted, the seed is
|
|
41
|
+
* {@link CreditAccountState.beforeOpen} (a fresh opening).
|
|
41
42
|
*/
|
|
42
|
-
declare function replayMulticall<P extends PluginsMap>(sdk: OnchainSDK<P>, operation: ReplayableOperation, creditAccount
|
|
43
|
+
declare function replayMulticall<P extends PluginsMap>(sdk: OnchainSDK<P>, operation: ReplayableOperation, creditAccount?: CreditAccountData): SDKReturn<ReplayMulticallResult, MalformedTransactionError>;
|
|
43
44
|
//#endregion
|
|
44
45
|
export { ReplayMulticallResult, ReplayableOperation, replayMulticall };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DebtOutOfRangeError, ForbiddenTokenError, InsufficientCollateralError, InsufficientPoolLiquidityError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
1
|
+
import { AccountNotMidasGreenlistedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientCollateralError, InsufficientPoolLiquidityError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
2
2
|
import { AdjustStrategyPositionPreview, OpenStrategyPositionPreview } from "../../../model/previews.js";
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
@@ -8,7 +8,7 @@ import { MarketStateError } from "./checkMarket.js";
|
|
|
8
8
|
import { Address } from "viem";
|
|
9
9
|
//#region src/onchain/validation/bundles/checkCreditOperation.d.ts
|
|
10
10
|
/** {@inheritDoc checkCreditOperation} */
|
|
11
|
-
type CreditOperationError = MarketStateError | DebtOutOfRangeError | InsufficientPoolLiquidityError | ForbiddenTokenError | QuotaCountExceededError | QuotaLimitReachedError | InsufficientCollateralError | WalletFundingError | RWAOpenRequirementsError;
|
|
11
|
+
type CreditOperationError = MarketStateError | DebtOutOfRangeError | InsufficientPoolLiquidityError | ForbiddenTokenError | QuotaCountExceededError | QuotaLimitReachedError | InsufficientCollateralError | WalletFundingError | RWAOpenRequirementsError | AccountNotMidasGreenlistedError;
|
|
12
12
|
/** The two previews that carry a position for the thresholds to weigh. */
|
|
13
13
|
type CreditOperationPreview = OpenStrategyPositionPreview | AdjustStrategyPositionPreview;
|
|
14
14
|
interface CreditOperationArgs extends HealthFactorThresholds {
|
|
@@ -23,8 +23,9 @@ interface CreditOperationArgs extends HealthFactorThresholds {
|
|
|
23
23
|
* has to hold, approve or sign.
|
|
24
24
|
*
|
|
25
25
|
* The array is in check order, most fundamental first: the market's own state,
|
|
26
|
-
* then what the facade would revert on, then what the operation
|
|
27
|
-
*
|
|
26
|
+
* then what the facade would revert on, then what the operation borrows and the
|
|
27
|
+
* quota it increases, then the account it leaves behind, and last the wallet's
|
|
28
|
+
* side.
|
|
28
29
|
*/
|
|
29
30
|
declare function checkCreditOperation(args: CreditOperationArgs): Promise<CreditOperationError[]>;
|
|
30
31
|
//#endregion
|
|
@@ -3,18 +3,18 @@ import { InsufficientPoolLiquidityError } from "../../../model/errors/operation-
|
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { CreditSuite } from "../../market/credit/CreditSuite.js";
|
|
5
5
|
import { CreditOperationPreview } from "./checkCreditOperation.js";
|
|
6
|
-
//#region src/onchain/validation/bundles/
|
|
6
|
+
//#region src/onchain/validation/bundles/checkIncreaseDebt.d.ts
|
|
7
7
|
/**
|
|
8
|
-
* What the transaction
|
|
8
|
+
* What the transaction borrows, against what the market can lend right now.
|
|
9
9
|
*
|
|
10
|
-
* Only a
|
|
11
|
-
*
|
|
12
|
-
* `totalDebtChange`.
|
|
10
|
+
* Only a debt increase is weighed: repaying, or leaving the debt alone, can
|
|
11
|
+
* never exceed the borrow limit. Opening borrows the whole debt; adjusting
|
|
12
|
+
* borrows `totalDebtChange`.
|
|
13
13
|
*
|
|
14
14
|
* The engine holds every simulation to this already (`assertCanBorrow`), so
|
|
15
15
|
* this is here for the transactions it never saw — a pasted calldata reaches
|
|
16
16
|
* the confirm screen with nothing else standing between it and a revert.
|
|
17
17
|
*/
|
|
18
|
-
declare function
|
|
18
|
+
declare function checkIncreaseDebt(suite: CreditSuite, preview: CreditOperationPreview, underlying: Token): InsufficientPoolLiquidityError[];
|
|
19
19
|
//#endregion
|
|
20
|
-
export {
|
|
20
|
+
export { checkIncreaseDebt };
|
package/dist/types/onchain/validation/bundles/{checkQuotasAsked.d.ts → checkIncreaseQuota.d.ts}
RENAMED
|
@@ -3,8 +3,8 @@ import { QuotaLimitReachedError } from "../../../model/errors/operation-errors.j
|
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { MarketSuite } from "../../market/MarketSuite.js";
|
|
5
5
|
import { CreditOperationPreview } from "./checkCreditOperation.js";
|
|
6
|
-
//#region src/onchain/validation/bundles/
|
|
6
|
+
//#region src/onchain/validation/bundles/checkIncreaseQuota.d.ts
|
|
7
7
|
/** Every quota the operation raises, against the room the keeper has left. */
|
|
8
|
-
declare function
|
|
8
|
+
declare function checkIncreaseQuota(market: MarketSuite, preview: CreditOperationPreview, underlying: Token): QuotaLimitReachedError[];
|
|
9
9
|
//#endregion
|
|
10
|
-
export {
|
|
10
|
+
export { checkIncreaseQuota };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AccountNotMidasGreenlistedError } from "../../../model/errors/operation-errors.js";
|
|
2
|
+
import { UnexpectedFailureError } from "../../../model/errors/prepare-errors.js";
|
|
3
|
+
import { OpenStrategyPositionPreview } from "../../../model/previews.js";
|
|
4
|
+
import "../../../model/index.js";
|
|
5
|
+
import { IDegenNFT } from "../../market/rwa/types.js";
|
|
6
|
+
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/onchain/validation/bundles/checkMidasAccountGreenlist.d.ts
|
|
9
|
+
interface CheckMidasAccountGreenlistInput {
|
|
10
|
+
sdk: OnchainSDK;
|
|
11
|
+
preview: OpenStrategyPositionPreview;
|
|
12
|
+
nft: IDegenNFT;
|
|
13
|
+
/** Tokens that the degen NFT lists and that are in operation. */
|
|
14
|
+
tokens: readonly Address[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Whether the credit account already holds the Midas greenlisted role
|
|
18
|
+
* this permissioned mToken requires of its holder.
|
|
19
|
+
*/
|
|
20
|
+
declare function checkMidasAccountGreenlist(input: CheckMidasAccountGreenlistInput): Promise<(AccountNotMidasGreenlistedError | UnexpectedFailureError)[]>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { CheckMidasAccountGreenlistInput, checkMidasAccountGreenlist };
|
|
@@ -19,13 +19,7 @@ interface PoolOperationArgs {
|
|
|
19
19
|
*/
|
|
20
20
|
tokenOut: TokenAmount;
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* What the pool's own state stops, whichever side of it the wallet is on.
|
|
24
|
-
*
|
|
25
|
-
* The liquidity read is the market's rather than the trimmed figure a
|
|
26
|
-
* simulation carries: a withdrawal sized against that figure has to pass the
|
|
27
|
-
* check that follows it.
|
|
28
|
-
*/
|
|
22
|
+
/** What the pool's own state stops, whichever side of it the wallet is on. */
|
|
29
23
|
declare function checkPoolOperation(args: PoolOperationArgs): PoolOperationError[];
|
|
30
24
|
//#endregion
|
|
31
25
|
export { PoolOperationArgs, PoolOperationError, checkPoolOperation };
|
|
@@ -10,10 +10,10 @@ interface CheckRWAOpenRequirementsInput {
|
|
|
10
10
|
wallet: Address;
|
|
11
11
|
creditManager: Address;
|
|
12
12
|
token: Address;
|
|
13
|
-
providedArgs
|
|
13
|
+
providedArgs?: RWAOperationArgs;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* The
|
|
16
|
+
* The degen NFT is satisfied that `wallet` may open on `token` with the
|
|
17
17
|
* registration args already on the transaction.
|
|
18
18
|
*/
|
|
19
19
|
declare function checkRWAOpenRequirements(input: CheckRWAOpenRequirementsInput): Promise<(RWAOpenRequirementsError | UnexpectedFailureError)[]>;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
1
|
+
import { AccountNotMidasGreenlistedError, RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
2
2
|
import { UnexpectedFailureError } from "../../../model/errors/prepare-errors.js";
|
|
3
|
-
import {
|
|
3
|
+
import { OpenStrategyPositionPreview } from "../../../model/previews.js";
|
|
4
4
|
import "../../../model/index.js";
|
|
5
5
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
6
6
|
import { Address } from "viem";
|
|
7
7
|
//#region src/onchain/validation/bundles/checkRWAOpening.d.ts
|
|
8
8
|
interface CheckRWAOpeningInput {
|
|
9
9
|
sdk: OnchainSDK;
|
|
10
|
-
preview:
|
|
10
|
+
preview: OpenStrategyPositionPreview;
|
|
11
11
|
sender: Address;
|
|
12
12
|
}
|
|
13
|
+
type RWAOpeningError = RWAOpenRequirementsError | AccountNotMidasGreenlistedError | UnexpectedFailureError;
|
|
13
14
|
/**
|
|
14
|
-
* Per
|
|
15
|
-
* borrower still has to register or sign before this opening can land
|
|
15
|
+
* Per KYC-gated token among `collateralAdded ∪ quotas`, whether the
|
|
16
|
+
* borrower still has to register or sign before this opening can land,
|
|
17
|
+
* and whether a Midas credit account may hold the mToken.
|
|
16
18
|
*/
|
|
17
|
-
declare function checkRWAOpening(input: CheckRWAOpeningInput): Promise<
|
|
19
|
+
declare function checkRWAOpening(input: CheckRWAOpeningInput): Promise<RWAOpeningError[]>;
|
|
18
20
|
//#endregion
|
|
19
|
-
export { CheckRWAOpeningInput, checkRWAOpening };
|
|
21
|
+
export { CheckRWAOpeningInput, RWAOpeningError, checkRWAOpening };
|
|
@@ -4,15 +4,16 @@ import { CheckCollateralFundingInput, CollateralFundingPreview, checkCollateralF
|
|
|
4
4
|
import { HealthFactorThresholds, WeighedFactors, checkHealthFactors } from "./checkHealthFactors.js";
|
|
5
5
|
import { MarketStateError, checkMarket } from "./checkMarket.js";
|
|
6
6
|
import { CreditOperationArgs, CreditOperationError, CreditOperationPreview, checkCreditOperation } from "./checkCreditOperation.js";
|
|
7
|
-
import {
|
|
7
|
+
import { checkIncreaseDebt } from "./checkIncreaseDebt.js";
|
|
8
|
+
import { checkIncreaseQuota } from "./checkIncreaseQuota.js";
|
|
8
9
|
import { CheckLiquidationEligibilityInput, LiquidationEligibilityError, checkLiquidationEligibility } from "./checkLiquidationEligibility.js";
|
|
9
10
|
import { CheckLiquidationFundingInput, checkLiquidationFunding } from "./checkLiquidationFunding.js";
|
|
11
|
+
import { CheckMidasAccountGreenlistInput, checkMidasAccountGreenlist } from "./checkMidasAccountGreenlist.js";
|
|
10
12
|
import { checkObtained } from "./checkObtained.js";
|
|
11
13
|
import { CheckPoolFundingInput, checkPoolFunding } from "./checkPoolFunding.js";
|
|
12
14
|
import { PoolOperationArgs, PoolOperationError, checkPoolOperation } from "./checkPoolOperation.js";
|
|
13
|
-
import {
|
|
14
|
-
import { CheckRWAOpeningInput, checkRWAOpening } from "./checkRWAOpening.js";
|
|
15
|
+
import { CheckRWAOpeningInput, RWAOpeningError, checkRWAOpening } from "./checkRWAOpening.js";
|
|
15
16
|
import { CheckRWAOpenRequirementsInput, checkRWAOpenRequirements } from "./checkRWAOpenRequirements.js";
|
|
16
17
|
import { CheckWalletAllowanceInput, checkWalletAllowance } from "./checkWalletAllowance.js";
|
|
17
18
|
import { CheckWalletBalanceInput, checkWalletBalance } from "./checkWalletBalance.js";
|
|
18
|
-
export { CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CreditOperationArgs, CreditOperationError, CreditOperationPreview, HealthFactorThresholds, LiquidationEligibilityError, MarketStateError, PoolOperationArgs, PoolOperationError, WalletFundingError, WeighedFactors, checkAccountQuotas, checkCollateralFunding, checkCreditOperation,
|
|
19
|
+
export { CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckMidasAccountGreenlistInput, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CreditOperationArgs, CreditOperationError, CreditOperationPreview, HealthFactorThresholds, LiquidationEligibilityError, MarketStateError, PoolOperationArgs, PoolOperationError, RWAOpeningError, WalletFundingError, WeighedFactors, checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
|
|
@@ -10,7 +10,7 @@ interface BorrowLimitArgs {
|
|
|
10
10
|
maxBorrowAmount?: bigint;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* What the pool will hand over, against
|
|
13
|
+
* What the pool will hand over, against the amount requested.
|
|
14
14
|
*
|
|
15
15
|
* `available` and `limit` are the caller's reading of which limit is in the
|
|
16
16
|
* way; this check only compares. `maxBorrowAmount` is the largest debt still
|
|
@@ -12,8 +12,8 @@ interface DebtLimitsArgs {
|
|
|
12
12
|
/**
|
|
13
13
|
* Whether ending with no loan at all is acceptable. The one place the two
|
|
14
14
|
* callers genuinely disagree: an account being adjusted may end owing
|
|
15
|
-
* nothing, while one being opened may not — so the
|
|
16
|
-
* rather than assumed.
|
|
15
|
+
* nothing, while one being opened may not unless it is opened empty — so the
|
|
16
|
+
* exemption is stated rather than assumed.
|
|
17
17
|
*/
|
|
18
18
|
allowZero: boolean;
|
|
19
19
|
/** From the caller's suite; a caller that raises to throw advises nobody. */
|
|
@@ -7,14 +7,7 @@ interface PoolLiquidityArgs {
|
|
|
7
7
|
available: bigint;
|
|
8
8
|
underlying: Token;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* What the pool holds, against what is being taken out of it.
|
|
12
|
-
*
|
|
13
|
-
* The operator is not `checkBorrowLimit`'s: a pool holding exactly the amount
|
|
14
|
-
* asked for still cannot serve it, so equality is already a refusal. That is
|
|
15
|
-
* the rule the legacy withdrawal validator enforced and it is preserved to the
|
|
16
|
-
* unit.
|
|
17
|
-
*/
|
|
10
|
+
/** What the pool can hand over, against what is being taken out of it. */
|
|
18
11
|
declare function checkPoolLiquidity(args: PoolLiquidityArgs): InsufficientPoolLiquidityError[];
|
|
19
12
|
//#endregion
|
|
20
13
|
export { PoolLiquidityArgs, checkPoolLiquidity };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Bps, TokenAmount } from "../../../model/primitives.js";
|
|
2
|
+
import { ReservePriceLimitedError } from "../../../model/errors/operation-errors.js";
|
|
3
|
+
import "../../../model/index.js";
|
|
4
|
+
//#region src/onchain/validation/checks/checkReservePriceLimited.d.ts
|
|
5
|
+
interface ReservePriceLimitedArgs {
|
|
6
|
+
/** The safe-price factor, the one the collateral check compared. */
|
|
7
|
+
healthFactor: Bps;
|
|
8
|
+
/** The same account at the main feed. */
|
|
9
|
+
atMainPrices: Bps;
|
|
10
|
+
/** The lowest acceptable factor — a factor equal to it passes. */
|
|
11
|
+
healthFactorThreshold: Bps;
|
|
12
|
+
/** What the account can still take out, in the market's underlying. */
|
|
13
|
+
withdrawable: TokenAmount;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Whether a failed collateral check is the reserve price feed's doing.
|
|
17
|
+
*
|
|
18
|
+
* A call that hands funds over is weighed at safe prices — `min` of a token's
|
|
19
|
+
* two feeds, and nothing at all where governance registered no reserve feed —
|
|
20
|
+
* so an account that covers its debt at the main feed can still be refused.
|
|
21
|
+
* The two are worth telling apart: a position that is genuinely too small is
|
|
22
|
+
* fixed by adding collateral or requesting less, while this one is a valuation
|
|
23
|
+
* the account does not control, and requesting less only helps as far as
|
|
24
|
+
* `withdrawable` says it does.
|
|
25
|
+
*
|
|
26
|
+
* Runs after `checkCollateralised` and answers only when that one refused, so
|
|
27
|
+
* the caller keeps its own threshold rather than restating it here.
|
|
28
|
+
*/
|
|
29
|
+
declare function checkReservePriceLimited(args: ReservePriceLimitedArgs): ReservePriceLimitedError[];
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ReservePriceLimitedArgs, checkReservePriceLimited };
|
|
@@ -13,4 +13,5 @@ import { PoolPausedArgs, checkPoolPaused } from "./checkPoolPaused.js";
|
|
|
13
13
|
import { PoolSunsetArgs, checkPoolSunset } from "./checkPoolSunset.js";
|
|
14
14
|
import { QuotaCountArgs, checkQuotaCount } from "./checkQuotaCount.js";
|
|
15
15
|
import { QuotaLimitArgs, checkQuotaLimit } from "./checkQuotaLimit.js";
|
|
16
|
-
|
|
16
|
+
import { ReservePriceLimitedArgs, checkReservePriceLimited } from "./checkReservePriceLimited.js";
|
|
17
|
+
export { BorrowLimitArgs, CollateralisedArgs, CreditAccountFrozenArgs, CreditManagerPausedArgs, DebtLimitsArgs, EmergencyLiquidatorArgs, ForbiddenTokenArgs, LeverageArgs, LiquidatorEligibleArgs, MarketExpiredArgs, PoolLiquidityArgs, PoolPausedArgs, PoolSunsetArgs, QuotaCountArgs, QuotaLimitArgs, ReservePriceLimitedArgs, checkBorrowLimit, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkLeverage, checkLiquidatorEligible, checkMarketExpired, checkPoolLiquidity, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkReservePriceLimited };
|
|
@@ -5,14 +5,15 @@ import { CheckCollateralFundingInput, CollateralFundingPreview, checkCollateralF
|
|
|
5
5
|
import { HealthFactorThresholds, WeighedFactors, checkHealthFactors } from "./bundles/checkHealthFactors.js";
|
|
6
6
|
import { MarketStateError, checkMarket } from "./bundles/checkMarket.js";
|
|
7
7
|
import { CreditOperationArgs, CreditOperationError, CreditOperationPreview, checkCreditOperation } from "./bundles/checkCreditOperation.js";
|
|
8
|
-
import {
|
|
8
|
+
import { checkIncreaseDebt } from "./bundles/checkIncreaseDebt.js";
|
|
9
|
+
import { checkIncreaseQuota } from "./bundles/checkIncreaseQuota.js";
|
|
9
10
|
import { CheckLiquidationEligibilityInput, LiquidationEligibilityError, checkLiquidationEligibility } from "./bundles/checkLiquidationEligibility.js";
|
|
10
11
|
import { CheckLiquidationFundingInput, checkLiquidationFunding } from "./bundles/checkLiquidationFunding.js";
|
|
12
|
+
import { CheckMidasAccountGreenlistInput, checkMidasAccountGreenlist } from "./bundles/checkMidasAccountGreenlist.js";
|
|
11
13
|
import { checkObtained } from "./bundles/checkObtained.js";
|
|
12
14
|
import { CheckPoolFundingInput, checkPoolFunding } from "./bundles/checkPoolFunding.js";
|
|
13
15
|
import { PoolOperationArgs, PoolOperationError, checkPoolOperation } from "./bundles/checkPoolOperation.js";
|
|
14
|
-
import {
|
|
15
|
-
import { CheckRWAOpeningInput, checkRWAOpening } from "./bundles/checkRWAOpening.js";
|
|
16
|
+
import { CheckRWAOpeningInput, RWAOpeningError, checkRWAOpening } from "./bundles/checkRWAOpening.js";
|
|
16
17
|
import { CheckRWAOpenRequirementsInput, checkRWAOpenRequirements } from "./bundles/checkRWAOpenRequirements.js";
|
|
17
18
|
import { CheckWalletAllowanceInput, checkWalletAllowance } from "./bundles/checkWalletAllowance.js";
|
|
18
19
|
import { CheckWalletBalanceInput, checkWalletBalance } from "./bundles/checkWalletBalance.js";
|
|
@@ -35,9 +36,10 @@ import { PoolPausedArgs, checkPoolPaused } from "./checks/checkPoolPaused.js";
|
|
|
35
36
|
import { PoolSunsetArgs, checkPoolSunset } from "./checks/checkPoolSunset.js";
|
|
36
37
|
import { QuotaCountArgs, checkQuotaCount } from "./checks/checkQuotaCount.js";
|
|
37
38
|
import { QuotaLimitArgs, checkQuotaLimit } from "./checks/checkQuotaLimit.js";
|
|
39
|
+
import { ReservePriceLimitedArgs, checkReservePriceLimited } from "./checks/checkReservePriceLimited.js";
|
|
38
40
|
import "./checks/index.js";
|
|
39
41
|
import { amountOf } from "./helpers/amount.js";
|
|
40
42
|
import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM } from "./helpers/health-factor-limits.js";
|
|
41
43
|
import { toToken, toTokenAmount } from "./helpers/token.js";
|
|
42
44
|
import "./helpers/index.js";
|
|
43
|
-
export { BorrowLimitArgs, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckLiquidationInput, CheckLiquidationOptions, CheckOperationInput, CheckOperationOptions, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckSimulationInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CollateralisedArgs, CreditAccountFrozenArgs, CreditManagerPausedArgs, CreditOperationArgs, CreditOperationError, CreditOperationPreview, CreditSimulationInput, DebtLimitsArgs, EmergencyLiquidatorArgs, ForbiddenTokenArgs, HealthFactorThresholds, type IntentValidationError, LeverageArgs, LiquidationEligibilityError, LiquidationValidationError, LiquidatorEligibleArgs, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, MarketExpiredArgs, MarketStateError, OperationValidationError, PoolLiquidityArgs, PoolOperationArgs, PoolOperationError, PoolPausedArgs, PoolSunsetArgs, QuotaCountArgs, QuotaLimitArgs, SimulationValidationError, WalletFundingError, WeighedFactors, amountOf, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits,
|
|
45
|
+
export { BorrowLimitArgs, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckLiquidationInput, CheckLiquidationOptions, CheckMidasAccountGreenlistInput, CheckOperationInput, CheckOperationOptions, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckSimulationInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CollateralisedArgs, CreditAccountFrozenArgs, CreditManagerPausedArgs, CreditOperationArgs, CreditOperationError, CreditOperationPreview, CreditSimulationInput, DebtLimitsArgs, EmergencyLiquidatorArgs, ForbiddenTokenArgs, HealthFactorThresholds, type IntentValidationError, LeverageArgs, LiquidationEligibilityError, LiquidationValidationError, LiquidatorEligibleArgs, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, MarketExpiredArgs, MarketStateError, OperationValidationError, PoolLiquidityArgs, PoolOperationArgs, PoolOperationError, PoolPausedArgs, PoolSunsetArgs, QuotaCountArgs, QuotaLimitArgs, RWAOpeningError, ReservePriceLimitedArgs, SimulationValidationError, WalletFundingError, WeighedFactors, amountOf, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, QuotaLimitReachedError } from "../../model/errors/operation-errors.js";
|
|
1
|
+
import { CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, QuotaLimitReachedError, ReservePriceLimitedError } from "../../model/errors/operation-errors.js";
|
|
2
2
|
import { MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError } from "../../model/errors/prepare-errors.js";
|
|
3
3
|
import "../../model/index.js";
|
|
4
4
|
//#region src/onchain/validation/raise.d.ts
|
|
@@ -9,7 +9,7 @@ import "../../model/index.js";
|
|
|
9
9
|
* Not a catch-all of every SDK error — pool paused/sunset is `checkOperation`'s,
|
|
10
10
|
* a malformed transaction is `previewOperation`'s, not the engine's.
|
|
11
11
|
**/
|
|
12
|
-
type IntentValidationError = CreditManagerPausedError | MarketExpiredError | InsufficientPoolLiquidityError | DebtOutOfRangeError | LeverageOutOfRangeError | InsufficientCollateralError | ForbiddenTokenError | QuotaLimitReachedError | InsufficientBalanceError | UnsupportedCollateralTokenError | UnsupportedTokenPairError | NoDelayedRouteError | MultipleDelayedWithdrawalsError | WithdrawalInProgressError | NoRecordedIntentError;
|
|
12
|
+
type IntentValidationError = CreditManagerPausedError | MarketExpiredError | InsufficientPoolLiquidityError | DebtOutOfRangeError | LeverageOutOfRangeError | InsufficientCollateralError | ReservePriceLimitedError | ForbiddenTokenError | QuotaLimitReachedError | InsufficientBalanceError | UnsupportedCollateralTokenError | UnsupportedTokenPairError | NoDelayedRouteError | MultipleDelayedWithdrawalsError | WithdrawalInProgressError | NoRecordedIntentError;
|
|
13
13
|
/**
|
|
14
14
|
* Engine-internal throw: planners and guards raise one error object, and the
|
|
15
15
|
* service boundary turns it into {@link SDKError}.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AccountPrepareRequest, IOpportunitiesExecute, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./types.js";
|
|
1
|
+
import { AccountPrepareRequest, BorrowPrepareRequest, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./types.js";
|
|
2
2
|
import { ExecuteApi } from "./ExecuteApi.js";
|
|
3
|
-
export { AccountPrepareRequest, ExecuteApi, IOpportunitiesExecute, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest };
|
|
3
|
+
export { AccountPrepareRequest, BorrowPrepareRequest, ExecuteApi, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest };
|
|
@@ -5,7 +5,7 @@ import "../../model/index.js";
|
|
|
5
5
|
import { Asset } from "../../onchain/base/types.js";
|
|
6
6
|
import { RawTx } from "../../onchain/types/transactions.js";
|
|
7
7
|
import "../../onchain/index.js";
|
|
8
|
-
import { LpResult, OpenStrategyResult, StrategyResult } from "../prepare/types.js";
|
|
8
|
+
import { BorrowResult, EmptyCreditAccountResult, LpResult, OpenStrategyResult, StrategyResult } from "../prepare/types.js";
|
|
9
9
|
import "../prepare/index.js";
|
|
10
10
|
import { Address } from "viem";
|
|
11
11
|
//#region src/sdk/execute/types.d.ts
|
|
@@ -51,6 +51,47 @@ interface OpenPrepareRequest {
|
|
|
51
51
|
**/
|
|
52
52
|
signaturesToCache?: SecuritizeRegisterMessage[];
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Taking a loan, from a viable {@link IOpportunitiesPrepare.borrow} result.
|
|
56
|
+
*
|
|
57
|
+
* Goes through the same `openCA` as an opening, with the payout named as the
|
|
58
|
+
* token to withdraw — everything else the transaction needs, the collateral
|
|
59
|
+
* included, is already on the prepared state.
|
|
60
|
+
**/
|
|
61
|
+
interface BorrowPrepareRequest {
|
|
62
|
+
kind: "borrow";
|
|
63
|
+
chainId: ChainId;
|
|
64
|
+
creditManager: Address;
|
|
65
|
+
wallet: Address;
|
|
66
|
+
sim: SDKResult<BorrowResult>;
|
|
67
|
+
/** Native value to attach when the collateral is paid in the coin. */
|
|
68
|
+
ethAmount: bigint;
|
|
69
|
+
/**
|
|
70
|
+
* {@inheritDoc OpenPrepareRequest.signaturesToCache}
|
|
71
|
+
**/
|
|
72
|
+
signaturesToCache?: SecuritizeRegisterMessage[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Opening an account that holds nothing, from a viable
|
|
76
|
+
* {@link IOpportunitiesPrepare.openEmptyCreditAccount} result.
|
|
77
|
+
*
|
|
78
|
+
* The market and the wallet are the whole request. Nothing is put up, drawn or
|
|
79
|
+
* routed, so there is nothing for a caller to hand over and nothing for the
|
|
80
|
+
* preparation to carry — which is also why this is its own kind rather than an
|
|
81
|
+
* `open` with empty arguments: a collateral passed by mistake has nowhere to
|
|
82
|
+
* land.
|
|
83
|
+
**/
|
|
84
|
+
interface OpenEmptyPrepareRequest {
|
|
85
|
+
kind: "openEmpty";
|
|
86
|
+
chainId: ChainId;
|
|
87
|
+
creditManager: Address;
|
|
88
|
+
wallet: Address;
|
|
89
|
+
/**
|
|
90
|
+
* The preparation this is built from. It carries no numbers; what it says is
|
|
91
|
+
* that the market took the request at the block it names.
|
|
92
|
+
**/
|
|
93
|
+
sim: SDKResult<EmptyCreditAccountResult>;
|
|
94
|
+
}
|
|
54
95
|
/**
|
|
55
96
|
* Any of the five operations on an existing account, from a viable
|
|
56
97
|
* {@link StrategyResult}: the facade multicall is the result's `calls`.
|
|
@@ -67,7 +108,7 @@ interface AccountPrepareRequest {
|
|
|
67
108
|
* `prepare` result plus the few facts about the wallet the preparation does not
|
|
68
109
|
* carry.
|
|
69
110
|
**/
|
|
70
|
-
type PrepareRequest = PoolPrepareRequest | OpenPrepareRequest | AccountPrepareRequest;
|
|
111
|
+
type PrepareRequest = PoolPrepareRequest | OpenPrepareRequest | OpenEmptyPrepareRequest | BorrowPrepareRequest | AccountPrepareRequest;
|
|
71
112
|
/**
|
|
72
113
|
* The write side of the opportunities namespace: turns what `prepare`
|
|
73
114
|
* answered into the transaction to sign. Sending, and whatever the wallet has
|
|
@@ -77,9 +118,10 @@ type PrepareRequest = PoolPrepareRequest | OpenPrepareRequest | AccountPrepareRe
|
|
|
77
118
|
interface IOpportunitiesExecute {
|
|
78
119
|
/**
|
|
79
120
|
* The transaction to sign, from a `prepare` result. No second round of math:
|
|
80
|
-
* `account` requests submit the result's own multicall, `open`
|
|
81
|
-
* the state's router path and quotas to `openCA`, `
|
|
82
|
-
*
|
|
121
|
+
* `account` requests submit the result's own multicall, `open` and `borrow`
|
|
122
|
+
* requests hand the state's router path and quotas to `openCA`, `openEmpty`
|
|
123
|
+
* requests open on nothing at all, and `pool` requests encode the deposit /
|
|
124
|
+
* redeem the result priced.
|
|
83
125
|
*
|
|
84
126
|
* @throws on a refused `prepare` result; when a `pool` request names a route
|
|
85
127
|
* the pool has no metadata for, or one the pool does not accept a transaction
|
|
@@ -88,4 +130,4 @@ interface IOpportunitiesExecute {
|
|
|
88
130
|
buildTx(request: PrepareRequest): Promise<RawTx>;
|
|
89
131
|
}
|
|
90
132
|
//#endregion
|
|
91
|
-
export { AccountPrepareRequest, IOpportunitiesExecute, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest };
|
|
133
|
+
export { AccountPrepareRequest, BorrowPrepareRequest, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure } from "../model/errors/prepare-errors.js";
|
|
2
|
+
import { ExecutionCost, OperationState, PathLossRate, RouteErrors, WithdrawCeilings } from "../onchain/accounts/intents/types.js";
|
|
3
|
+
import { BorrowState } from "../onchain/accounts/intents/borrow.js";
|
|
2
4
|
import { LeverageBand } from "../onchain/accounts/intents/leverage-band.js";
|
|
3
|
-
import { OperationState, PathLossRate, RouteErrors, WithdrawCeilings } from "../onchain/accounts/intents/types.js";
|
|
4
5
|
import { PoolOperationError } from "../onchain/validation/bundles/checkPoolOperation.js";
|
|
5
6
|
import { IAnalytics, IAnalyticsByMode } from "./analytics/types.js";
|
|
6
7
|
import { ILiquidations, ILiquidationsByMode } from "./liquidations/types.js";
|
|
7
|
-
import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, DelayedStrategyResult, DepositStrategyParams, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState,
|
|
8
|
+
import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowParams, BorrowResult, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowParams, OpenFlowError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, PrepareOptions, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./prepare/types.js";
|
|
8
9
|
import { ChainOf, PrepareApi } from "./prepare/PrepareApi.js";
|
|
9
10
|
import "./prepare/index.js";
|
|
10
|
-
import { AccountPrepareRequest, IOpportunitiesExecute, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./execute/types.js";
|
|
11
|
+
import { AccountPrepareRequest, BorrowPrepareRequest, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./execute/types.js";
|
|
11
12
|
import { ExecuteApi } from "./execute/ExecuteApi.js";
|
|
12
13
|
import "./execute/index.js";
|
|
13
14
|
import { EntityMerger, FilterResult, ListMerger, MergeListResult } from "./utils/types.js";
|
|
@@ -38,4 +39,4 @@ import { SourceUnavailableError } from "./errors/SourceUnavailableError.js";
|
|
|
38
39
|
import { assertSameChains } from "./errors/assertSameChains.js";
|
|
39
40
|
import { everyChainFailed } from "./errors/everyChainFailed.js";
|
|
40
41
|
import "./errors/index.js";
|
|
41
|
-
export { AbstractNamespace, AccountFlowError, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, AnalyticsNamespace, ChainOf, ChainRef, CheckOperationProps, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedStrategyResult, DepositStrategyParams, EnsureFreshChains, type EntityMerger, ExecuteApi, type FilterResult, FinalizeParams, FinalizeResult, GearboxSDK, GearboxSDKOptions, IAnalytics, IAnalyticsByMode, IGearboxSDK, ILiquidations, ILiquidationsByMode, INotices, INoticesByMode, IOpportunities, IOpportunitiesBase, IOpportunitiesByMode, IOpportunitiesExecute, IOpportunitiesOffchainBranch, IOpportunitiesOffchainOnly, IOpportunitiesOnchainBranch, IOpportunitiesOnchainOnly, IOpportunitiesPrepare, IOpportunityMergers, IPositionMergers, IPositions, IPositionsBase, IPositionsByMode, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOnchainOnly, IPreview, IPreviewByMode, type LeverageBand, LiquidationsNamespace, type ListMerger, LpParams, LpRedeemParams, LpResult, LpState, type MergeListResult, MergedQuery, MissingSourceError, Mode, type MultipleDelayedWithdrawalsError, NamespaceOptions, type NoDelayedRouteError, type NoRecordedIntentError, NoSourceServedError, type NoStrategyTargetCollateralError, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenFlowError, OpenPrepareRequest,
|
|
42
|
+
export { AbstractNamespace, AccountFlowError, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, AnalyticsNamespace, BorrowParams, BorrowPrepareRequest, BorrowResult, type BorrowState, ChainOf, ChainRef, CheckOperationProps, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, EnsureFreshChains, type EntityMerger, ExecuteApi, type ExecutionCost, type FilterResult, FinalizeParams, FinalizeResult, GearboxSDK, GearboxSDKOptions, IAnalytics, IAnalyticsByMode, IGearboxSDK, ILiquidations, ILiquidationsByMode, INotices, INoticesByMode, IOpportunities, IOpportunitiesBase, IOpportunitiesByMode, IOpportunitiesExecute, IOpportunitiesOffchainBranch, IOpportunitiesOffchainOnly, IOpportunitiesOnchainBranch, IOpportunitiesOnchainOnly, IOpportunitiesPrepare, IOpportunityMergers, IPositionMergers, IPositions, IPositionsBase, IPositionsByMode, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOnchainOnly, IPreview, IPreviewByMode, type LeverageBand, LiquidationsNamespace, type ListMerger, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowParams, type MergeListResult, MergedQuery, MissingSourceError, Mode, type MultipleDelayedWithdrawalsError, NamespaceOptions, type NoDelayedRouteError, type NoRecordedIntentError, NoSourceServedError, type NoStrategyTargetCollateralError, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenEmptyPrepareRequest, OpenFlowError, OpenPrepareRequest, OpenStrategyParams, OpenStrategyResult, type OperationState, OpportunitiesNamespace, type PathLossRate, PlainMultichainSDKOptions, PoolInput, type PoolOperationError, PoolPrepareRequest, PositionInput, PositionsNamespace, PrepareApi, PrepareOptions, PrepareRequest, PreviewNamespace, RepayStrategyParams, type RouteErrors, SourceChainMismatchError, SourceUnavailableError, StrategyInput, StrategyResult, StrategyRoutesResult, type UnexpectedFailureError, type UnsupportedCollateralTokenError, type UnsupportedTokenPairError, WithRouteErrors, type WithdrawCeilings, WithdrawCollateralParams, WithdrawStrategyParams, type WithdrawalInProgressError, assertSameChains, creditAccountNotEmpty, creditAccountNotFound, everyChainFailed, filterResponse, mergeChainList, mergeChainOne, noStrategyTargetCollateral, unexpectedFailure };
|