@gearbox-protocol/sdk 14.12.0-next.1 → 14.12.0-next.11
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/iZapper.js +62 -24
- package/dist/cjs/dev/AccountOpener.js +7 -13
- package/dist/cjs/history/classifyMulticallOperations.js +2 -0
- package/dist/cjs/history/mapOperations.js +7 -0
- package/dist/cjs/plugins/adapters/abi/iConvexV1BoosterAdapter.js +143 -0
- package/dist/cjs/plugins/adapters/abi/index.js +2 -0
- package/dist/cjs/plugins/adapters/contracts/AbstractAdapter.js +36 -0
- package/dist/cjs/plugins/adapters/contracts/AbstractCurveAdapter.js +66 -0
- package/dist/cjs/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +19 -0
- package/dist/cjs/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/CamelotV3AdapterContract.js +20 -0
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +18 -0
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +28 -2
- package/dist/cjs/plugins/adapters/contracts/Curve2AssetsAdapterContract.js +2 -7
- package/dist/cjs/plugins/adapters/contracts/Curve3AssetsAdapterContract.js +2 -7
- package/dist/cjs/plugins/adapters/contracts/Curve4AssetsAdapterContract.js +2 -7
- package/dist/cjs/plugins/adapters/contracts/CurveV1AdapterDeposit.js +2 -2
- package/dist/cjs/plugins/adapters/contracts/CurveV1AdapterStETHContract.js +2 -7
- package/dist/cjs/plugins/adapters/contracts/CurveV1StableNGAdapterContract.js +2 -7
- package/dist/cjs/plugins/adapters/contracts/DaiUsdsAdapterContract.js +14 -0
- package/dist/cjs/plugins/adapters/contracts/ERC4626AdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +14 -0
- package/dist/cjs/plugins/adapters/contracts/FluidDexAdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +21 -0
- package/dist/cjs/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +10 -0
- package/dist/cjs/plugins/adapters/contracts/LidoV1AdapterContract.js +11 -0
- package/dist/cjs/plugins/adapters/contracts/MellowDVVAdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/MellowWrapperAdapterContract.js +11 -0
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +10 -0
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +12 -0
- package/dist/cjs/plugins/adapters/contracts/PendleRouterAdapterContract.js +58 -0
- package/dist/cjs/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +11 -0
- package/dist/cjs/plugins/adapters/contracts/SecuritizeSwapAdapterContract.js +22 -1
- package/dist/cjs/plugins/adapters/contracts/StakingRewardsAdapterContract.js +17 -0
- package/dist/cjs/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +10 -0
- package/dist/cjs/plugins/adapters/contracts/UniswapV2AdapterContract.js +10 -0
- package/dist/cjs/plugins/adapters/contracts/UniswapV3AdapterContract.js +20 -0
- package/dist/cjs/plugins/adapters/contracts/UniswapV4AdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +14 -0
- package/dist/cjs/plugins/adapters/contracts/VelodromeV2AdapterContract.js +10 -0
- package/dist/cjs/plugins/adapters/contracts/WstETHV1AdapterContract.js +15 -0
- package/dist/cjs/preview/index.js +2 -4
- package/dist/cjs/preview/parse/classifyInnerOperations.js +14 -1
- package/dist/cjs/preview/parse/errors.js +5 -2
- package/dist/cjs/preview/parse/index.js +2 -2
- package/dist/cjs/preview/parse/parseFacadeOperationCalldata.js +5 -12
- package/dist/cjs/preview/parse/parseOperationCalldata.js +40 -1
- package/dist/cjs/preview/parse/parsePoolOperationCalldata.js +14 -2
- package/dist/cjs/preview/parse/parseRWAFactoryOperationCalldata.js +104 -0
- package/dist/cjs/preview/parse/types-rwa.js +16 -0
- package/dist/cjs/preview/parse/types.js +9 -2
- package/dist/cjs/preview/prerequisites/AllowancePrerequisite.js +13 -13
- package/dist/cjs/preview/prerequisites/BalancePrerequisite.js +32 -14
- package/dist/cjs/preview/prerequisites/RWAOpenRequirementsPrerequisite.js +66 -0
- package/dist/cjs/preview/prerequisites/buildPrerequisites.js +124 -14
- package/dist/cjs/preview/prerequisites/index.js +2 -0
- package/dist/cjs/preview/preview/applyInnerOperations.js +130 -0
- package/dist/cjs/preview/preview/errors.js +52 -0
- package/dist/cjs/preview/preview/index.js +30 -0
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +90 -0
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +67 -0
- package/dist/cjs/preview/preview/previewOperation.js +45 -0
- package/dist/cjs/preview/preview/previewPoolOperation.js +75 -0
- package/dist/cjs/preview/preview/types.js +16 -0
- package/dist/cjs/{sdk/market/zapper/Zapper.js → preview/preview/unwrapNativeCollateral.js} +20 -22
- package/dist/cjs/preview/simulate/errors.js +0 -7
- package/dist/cjs/preview/simulate/index.js +5 -5
- package/dist/cjs/preview/simulate/simulateOperation.js +4 -0
- package/dist/cjs/preview/simulate/simulatePoolOperation.js +60 -31
- package/dist/cjs/preview/simulate/{constants.js → simulateRWAOperation.js} +8 -6
- package/dist/cjs/sdk/MultichainSDK.js +1 -0
- package/dist/cjs/sdk/OnchainSDK.js +7 -3
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +53 -23
- package/dist/cjs/sdk/base/BaseContract.js +4 -2
- package/dist/cjs/sdk/base/ChainContractsRegister.js +1 -0
- package/dist/cjs/sdk/market/MarketRegister.js +10 -5
- package/dist/cjs/sdk/market/ZapperRegister.js +54 -0
- package/dist/cjs/sdk/market/rwa/securitize/SecuritizeRWAFactory.js +30 -0
- package/dist/cjs/sdk/market/rwa/types.js +5 -2
- package/dist/cjs/sdk/market/zapper/IERC20ZapperContract.js +3 -38
- package/dist/cjs/sdk/market/zapper/IETHZapperContract.js +3 -38
- package/dist/cjs/sdk/market/zapper/ZapperContract.js +106 -0
- package/dist/cjs/sdk/market/zapper/createZapper.js +12 -4
- package/dist/cjs/{preview/simulate/holders.js → sdk/market/zapper/errors.js} +13 -21
- package/dist/cjs/sdk/market/zapper/index.js +6 -2
- package/dist/cjs/sdk/market/zapper/types.js +16 -0
- package/dist/cjs/sdk/options.js +41 -17
- package/dist/cjs/sdk/router/AbstractRouterContract.js +21 -27
- package/dist/cjs/sdk/router/RouterV310Contract.js +11 -12
- package/dist/cjs/sdk/router/helpers.js +0 -5
- package/dist/cjs/sdk/utils/AddressMap.js +6 -0
- package/dist/cjs/sdk/utils/AssetsMap.js +97 -0
- package/dist/cjs/sdk/utils/index.js +2 -0
- package/dist/esm/abi/iZapper.js +62 -24
- package/dist/esm/dev/AccountOpener.js +8 -13
- package/dist/esm/history/classifyMulticallOperations.js +2 -0
- package/dist/esm/history/mapOperations.js +7 -0
- package/dist/esm/plugins/adapters/abi/iConvexV1BoosterAdapter.js +119 -0
- package/dist/esm/plugins/adapters/abi/index.js +1 -0
- package/dist/esm/plugins/adapters/contracts/AbstractAdapter.js +36 -0
- package/dist/esm/plugins/adapters/contracts/AbstractCurveAdapter.js +42 -0
- package/dist/esm/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +22 -1
- package/dist/esm/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/CamelotV3AdapterContract.js +23 -1
- package/dist/esm/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +22 -1
- package/dist/esm/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +30 -2
- package/dist/esm/plugins/adapters/contracts/Curve2AssetsAdapterContract.js +2 -7
- package/dist/esm/plugins/adapters/contracts/Curve3AssetsAdapterContract.js +2 -7
- package/dist/esm/plugins/adapters/contracts/Curve4AssetsAdapterContract.js +2 -7
- package/dist/esm/plugins/adapters/contracts/CurveV1AdapterDeposit.js +2 -2
- package/dist/esm/plugins/adapters/contracts/CurveV1AdapterStETHContract.js +2 -7
- package/dist/esm/plugins/adapters/contracts/CurveV1StableNGAdapterContract.js +2 -7
- package/dist/esm/plugins/adapters/contracts/DaiUsdsAdapterContract.js +17 -1
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +19 -1
- package/dist/esm/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +17 -1
- package/dist/esm/plugins/adapters/contracts/FluidDexAdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +24 -1
- package/dist/esm/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +13 -1
- package/dist/esm/plugins/adapters/contracts/LidoV1AdapterContract.js +14 -1
- package/dist/esm/plugins/adapters/contracts/MellowDVVAdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/MellowWrapperAdapterContract.js +14 -1
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +13 -1
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +15 -1
- package/dist/esm/plugins/adapters/contracts/PendleRouterAdapterContract.js +61 -1
- package/dist/esm/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +14 -1
- package/dist/esm/plugins/adapters/contracts/SecuritizeSwapAdapterContract.js +25 -2
- package/dist/esm/plugins/adapters/contracts/StakingRewardsAdapterContract.js +20 -1
- package/dist/esm/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +13 -1
- package/dist/esm/plugins/adapters/contracts/UniswapV2AdapterContract.js +10 -0
- package/dist/esm/plugins/adapters/contracts/UniswapV3AdapterContract.js +20 -0
- package/dist/esm/plugins/adapters/contracts/UniswapV4AdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +17 -1
- package/dist/esm/plugins/adapters/contracts/VelodromeV2AdapterContract.js +13 -1
- package/dist/esm/plugins/adapters/contracts/WstETHV1AdapterContract.js +18 -1
- package/dist/esm/preview/index.js +1 -2
- package/dist/esm/preview/parse/classifyInnerOperations.js +14 -1
- package/dist/esm/preview/parse/errors.js +3 -1
- package/dist/esm/preview/parse/index.js +1 -1
- package/dist/esm/preview/parse/parseFacadeOperationCalldata.js +5 -12
- package/dist/esm/preview/parse/parseOperationCalldata.js +43 -2
- package/dist/esm/preview/parse/parsePoolOperationCalldata.js +14 -2
- package/dist/esm/preview/parse/parseRWAFactoryOperationCalldata.js +85 -0
- package/dist/esm/preview/parse/types-rwa.js +0 -0
- package/dist/esm/preview/parse/types.js +6 -1
- package/dist/esm/preview/prerequisites/AllowancePrerequisite.js +13 -13
- package/dist/esm/preview/prerequisites/BalancePrerequisite.js +32 -14
- package/dist/esm/preview/prerequisites/RWAOpenRequirementsPrerequisite.js +42 -0
- package/dist/esm/preview/prerequisites/buildPrerequisites.js +130 -14
- package/dist/esm/preview/prerequisites/index.js +1 -0
- package/dist/esm/preview/preview/applyInnerOperations.js +108 -0
- package/dist/esm/preview/preview/errors.js +27 -0
- package/dist/esm/preview/preview/index.js +5 -0
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +74 -0
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +49 -0
- package/dist/esm/preview/preview/previewOperation.js +21 -0
- package/dist/esm/preview/preview/previewPoolOperation.js +53 -0
- package/dist/esm/preview/preview/types.js +0 -0
- package/dist/esm/preview/preview/unwrapNativeCollateral.js +21 -0
- package/dist/esm/preview/simulate/errors.js +0 -6
- package/dist/esm/preview/simulate/index.js +3 -3
- package/dist/esm/preview/simulate/simulateOperation.js +8 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +61 -35
- package/dist/esm/preview/simulate/simulateRWAOperation.js +6 -0
- package/dist/esm/sdk/MultichainSDK.js +1 -0
- package/dist/esm/sdk/OnchainSDK.js +7 -3
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +54 -24
- package/dist/esm/sdk/base/BaseContract.js +4 -2
- package/dist/esm/sdk/base/ChainContractsRegister.js +1 -0
- package/dist/esm/sdk/market/MarketRegister.js +10 -5
- package/dist/esm/sdk/market/ZapperRegister.js +54 -0
- package/dist/esm/sdk/market/rwa/securitize/SecuritizeRWAFactory.js +33 -1
- package/dist/esm/sdk/market/rwa/types.js +5 -2
- package/dist/esm/sdk/market/zapper/IERC20ZapperContract.js +3 -38
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +3 -38
- package/dist/esm/sdk/market/zapper/ZapperContract.js +82 -0
- package/dist/esm/sdk/market/zapper/createZapper.js +12 -4
- package/dist/esm/sdk/market/zapper/errors.js +13 -0
- package/dist/esm/sdk/market/zapper/index.js +3 -1
- package/dist/esm/sdk/market/zapper/types.js +0 -0
- package/dist/esm/sdk/options.js +39 -15
- package/dist/esm/sdk/router/AbstractRouterContract.js +25 -29
- package/dist/esm/sdk/router/RouterV310Contract.js +11 -12
- package/dist/esm/sdk/router/helpers.js +0 -4
- package/dist/esm/sdk/utils/AddressMap.js +6 -0
- package/dist/esm/sdk/utils/AssetsMap.js +73 -0
- package/dist/esm/sdk/utils/index.js +1 -0
- package/dist/types/abi/iERC20Zapper.d.ts +91 -23
- package/dist/types/abi/iETHZapper.d.ts +91 -23
- package/dist/types/abi/iZapper.d.ts +91 -23
- package/dist/types/common-utils/utils/strategies/assets/assets.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-apy.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-points.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/tokens/add-amount-in-target.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.d.ts +1 -1
- package/dist/types/common-utils/utils/strategies/types/strategy-earnings.d.ts +1 -1
- package/dist/types/common-utils/utils/validation/validate-balances.d.ts +1 -1
- package/dist/types/common-utils/utils/validation/validate-open-account.d.ts +1 -1
- package/dist/types/common-utils/utils/validation/validate-quota.d.ts +1 -1
- package/dist/types/common-utils/utils/validation/validate-token-to-obtain.d.ts +1 -1
- package/dist/types/history/types.d.ts +4 -4
- package/dist/types/plugins/adapters/abi/iConvexV1BoosterAdapter.d.ts +204 -0
- package/dist/types/plugins/adapters/abi/index.d.ts +1 -0
- package/dist/types/plugins/adapters/contracts/AbstractAdapter.d.ts +21 -3
- package/dist/types/plugins/adapters/contracts/AbstractCurveAdapter.d.ts +18 -0
- package/dist/types/plugins/adapters/contracts/BalancerV3RouterAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/CamelotV3AdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.d.ts +8 -6
- package/dist/types/plugins/adapters/contracts/Curve2AssetsAdapterContract.d.ts +3 -6
- package/dist/types/plugins/adapters/contracts/Curve3AssetsAdapterContract.d.ts +3 -6
- package/dist/types/plugins/adapters/contracts/Curve4AssetsAdapterContract.d.ts +3 -6
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterDeposit.d.ts +2 -2
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterStETHContract.d.ts +3 -6
- package/dist/types/plugins/adapters/contracts/CurveV1StableNGAdapterContract.d.ts +3 -6
- package/dist/types/plugins/adapters/contracts/DaiUsdsAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/ERC4626AdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/ERC4626ReferralAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/FluidDexAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/InfinifiGatewayAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/LidoV1AdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/MellowDVVAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/MellowWrapperAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/PendleRouterAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/SecuritizeSwapAdapterContract.d.ts +15 -3
- package/dist/types/plugins/adapters/contracts/StakingRewardsAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/TraderJoeRouterAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/UniswapV2AdapterContract.d.ts +3 -1
- package/dist/types/plugins/adapters/contracts/UniswapV3AdapterContract.d.ts +3 -1
- package/dist/types/plugins/adapters/contracts/UniswapV4AdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/UpshiftVaultAdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/VelodromeV2AdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/contracts/WstETHV1AdapterContract.d.ts +4 -2
- package/dist/types/plugins/adapters/types.d.ts +10 -0
- package/dist/types/preview/index.d.ts +1 -2
- package/dist/types/preview/parse/classifyInnerOperations.d.ts +0 -2
- package/dist/types/preview/parse/errors.d.ts +1 -0
- package/dist/types/preview/parse/index.d.ts +1 -1
- package/dist/types/preview/parse/parseOperationCalldata.d.ts +3 -3
- package/dist/types/preview/parse/parseRWAFactoryOperationCalldata.d.ts +22 -0
- package/dist/types/preview/parse/types-adapters.d.ts +5 -1
- package/dist/types/preview/parse/types-facades.d.ts +23 -34
- package/dist/types/preview/parse/types-pools.d.ts +90 -2
- package/dist/types/preview/parse/types-rwa.d.ts +48 -0
- package/dist/types/preview/parse/types.d.ts +11 -6
- package/dist/types/preview/prerequisites/AllowancePrerequisite.d.ts +1 -3
- package/dist/types/preview/prerequisites/BalancePrerequisite.d.ts +9 -6
- package/dist/types/preview/prerequisites/RWAOpenRequirementsPrerequisite.d.ts +36 -0
- package/dist/types/preview/prerequisites/buildPrerequisites.d.ts +15 -6
- package/dist/types/preview/prerequisites/index.d.ts +1 -0
- package/dist/types/preview/prerequisites/types.d.ts +10 -8
- package/dist/types/preview/preview/applyInnerOperations.d.ts +77 -0
- package/dist/types/preview/preview/errors.d.ts +21 -0
- package/dist/types/preview/preview/index.d.ts +5 -0
- package/dist/types/preview/preview/previewAdjustCreditAccount.d.ts +11 -0
- package/dist/types/preview/preview/previewOpenCreditAccount.d.ts +4 -0
- package/dist/types/preview/preview/previewOperation.d.ts +7 -0
- package/dist/types/preview/preview/previewPoolOperation.d.ts +5 -0
- package/dist/types/preview/preview/types.d.ts +177 -0
- package/dist/types/preview/preview/unwrapNativeCollateral.d.ts +20 -0
- package/dist/types/preview/simulate/errors.d.ts +6 -12
- package/dist/types/preview/simulate/index.d.ts +3 -2
- package/dist/types/preview/simulate/simulateFacadeOperation.d.ts +0 -2
- package/dist/types/preview/simulate/simulateOperation.d.ts +0 -2
- package/dist/types/preview/simulate/simulatePoolOperation.d.ts +9 -3
- package/dist/types/preview/simulate/simulateRWAOperation.d.ts +23 -0
- package/dist/types/preview/simulate/types.d.ts +12 -39
- package/dist/types/sdk/MultichainSDK.d.ts +5 -0
- package/dist/types/sdk/OnchainSDK.d.ts +4 -0
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +11 -3
- package/dist/types/sdk/accounts/types.d.ts +66 -8
- package/dist/types/sdk/base/BaseContract.d.ts +1 -1
- package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
- package/dist/types/sdk/base/types.d.ts +18 -0
- package/dist/types/sdk/market/MarketRegister.d.ts +15 -6
- package/dist/types/sdk/market/ZapperRegister.d.ts +25 -4
- package/dist/types/sdk/market/rwa/securitize/SecuritizeRWAFactory.d.ts +6 -1
- package/dist/types/sdk/market/rwa/types.d.ts +13 -5
- package/dist/types/sdk/market/zapper/IERC20ZapperContract.d.ts +93 -39
- package/dist/types/sdk/market/zapper/IETHZapperContract.d.ts +93 -39
- package/dist/types/sdk/market/zapper/ZapperContract.d.ts +35 -0
- package/dist/types/sdk/market/zapper/createZapper.d.ts +2 -4
- package/dist/types/sdk/market/zapper/errors.d.ts +10 -0
- package/dist/types/sdk/market/zapper/index.d.ts +3 -1
- package/dist/types/sdk/market/zapper/types.d.ts +64 -0
- package/dist/types/sdk/options.d.ts +10 -5
- package/dist/types/sdk/pools/types.d.ts +4 -4
- package/dist/types/sdk/router/AbstractRouterContract.d.ts +5 -5
- package/dist/types/sdk/router/helpers.d.ts +1 -2
- package/dist/types/sdk/router/types.d.ts +1 -15
- package/dist/types/sdk/types/state-human.d.ts +9 -0
- package/dist/types/sdk/types/state.d.ts +7 -0
- package/dist/types/sdk/utils/AddressMap.d.ts +4 -0
- package/dist/types/sdk/utils/AssetsMap.d.ts +44 -0
- package/dist/types/sdk/utils/index.d.ts +1 -0
- package/package.json +3 -3
- package/dist/cjs/preview/parse/extractExpectedBalanceChanges.js +0 -48
- package/dist/cjs/preview/simulate/extractERC20Transfers.js +0 -47
- package/dist/cjs/preview/simulate/simulatePoolOpMulticall.js +0 -155
- package/dist/cjs/preview/simulate/simulatePoolOpV1.js +0 -106
- package/dist/esm/preview/parse/extractExpectedBalanceChanges.js +0 -24
- package/dist/esm/preview/simulate/constants.js +0 -4
- package/dist/esm/preview/simulate/extractERC20Transfers.js +0 -23
- package/dist/esm/preview/simulate/holders.js +0 -21
- package/dist/esm/preview/simulate/simulatePoolOpMulticall.js +0 -130
- package/dist/esm/preview/simulate/simulatePoolOpV1.js +0 -82
- package/dist/esm/sdk/market/zapper/Zapper.js +0 -23
- package/dist/types/preview/parse/extractExpectedBalanceChanges.d.ts +0 -22
- package/dist/types/preview/simulate/constants.d.ts +0 -6
- package/dist/types/preview/simulate/extractERC20Transfers.d.ts +0 -11
- package/dist/types/preview/simulate/holders.d.ts +0 -7
- package/dist/types/preview/simulate/simulatePoolOpMulticall.d.ts +0 -28
- package/dist/types/preview/simulate/simulatePoolOpV1.d.ts +0 -14
- package/dist/types/sdk/market/zapper/Zapper.d.ts +0 -13
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
/**
|
|
3
3
|
* ERC4626 `deposit` into a Gearbox pool.
|
|
4
|
+
*
|
|
5
|
+
* A deposit can reach the pool directly (an ERC4626 call sent straight to the
|
|
6
|
+
* pool contract) or through a zapper (e.g. RWA-default pools and classic zapper
|
|
7
|
+
* pools). When routed through a zapper, `zapper` is the call target and
|
|
8
|
+
* `tokenIn` is the zapper's input token rather than the pool underlying.
|
|
4
9
|
*/
|
|
5
10
|
export interface PoolDepositOperation {
|
|
11
|
+
/** ERC4626 operation kind. */
|
|
6
12
|
operation: "Deposit";
|
|
13
|
+
/** Destination pool the assets are deposited into. */
|
|
7
14
|
pool: Address;
|
|
15
|
+
/** Address credited with the minted pool shares. */
|
|
8
16
|
receiver: Address;
|
|
9
|
-
/**
|
|
17
|
+
/** Amount of underlying assets supplied to the pool. */
|
|
10
18
|
assets: bigint;
|
|
19
|
+
/** Underlying token of the destination pool. */
|
|
11
20
|
underlying: Address;
|
|
21
|
+
/**
|
|
22
|
+
* Token actually supplied by the caller: the pool underlying for direct
|
|
23
|
+
* deposits, or the zapper's input token for zapper-routed deposits.
|
|
24
|
+
*/
|
|
25
|
+
tokenIn: Address;
|
|
26
|
+
/**
|
|
27
|
+
* Token minted to the receiver: the pool's diesel token for direct
|
|
28
|
+
* deposits, or the zapper's output token (e.g. a farmed/staked diesel
|
|
29
|
+
* wrapper) for zapper-routed deposits.
|
|
30
|
+
*/
|
|
31
|
+
tokenOut: Address;
|
|
32
|
+
/** Zapper contract the call is sent to; `undefined` for direct deposits. */
|
|
33
|
+
zapper?: Address;
|
|
12
34
|
/** Referral code, present only for `depositWithReferral` calls. */
|
|
13
35
|
referralCode?: bigint;
|
|
14
36
|
}
|
|
@@ -17,12 +39,28 @@ export interface PoolDepositOperation {
|
|
|
17
39
|
* amount of shares to mint; the assets pulled are resolved by the pool.
|
|
18
40
|
*/
|
|
19
41
|
export interface PoolMintOperation {
|
|
42
|
+
/** ERC4626 operation kind. */
|
|
20
43
|
operation: "Mint";
|
|
44
|
+
/** Destination pool the shares are minted from. */
|
|
21
45
|
pool: Address;
|
|
46
|
+
/** Address credited with the minted pool shares. */
|
|
22
47
|
receiver: Address;
|
|
23
48
|
/** Pool shares (diesel) minted to the receiver. */
|
|
24
49
|
shares: bigint;
|
|
50
|
+
/** Underlying token of the destination pool. */
|
|
25
51
|
underlying: Address;
|
|
52
|
+
/**
|
|
53
|
+
* Token actually supplied by the caller: the pool underlying for direct
|
|
54
|
+
* mints, or the zapper's input token for zapper-routed mints.
|
|
55
|
+
*/
|
|
56
|
+
tokenIn: Address;
|
|
57
|
+
/**
|
|
58
|
+
* Token minted to the receiver: the pool's diesel token for direct mints,
|
|
59
|
+
* or the zapper's output token for zapper-routed mints.
|
|
60
|
+
*/
|
|
61
|
+
tokenOut: Address;
|
|
62
|
+
/** Zapper contract the call is sent to; `undefined` for direct mints. */
|
|
63
|
+
zapper?: Address;
|
|
26
64
|
/** Referral code, present only for `mintWithReferral` calls. */
|
|
27
65
|
referralCode?: bigint;
|
|
28
66
|
}
|
|
@@ -32,24 +70,74 @@ export interface PoolMintOperation {
|
|
|
32
70
|
* the pool.
|
|
33
71
|
*/
|
|
34
72
|
export interface PoolWithdrawOperation {
|
|
73
|
+
/** ERC4626 operation kind. */
|
|
35
74
|
operation: "Withdraw";
|
|
75
|
+
/** Source pool the assets are withdrawn from. */
|
|
36
76
|
pool: Address;
|
|
77
|
+
/** Address that receives the withdrawn tokens. */
|
|
37
78
|
receiver: Address;
|
|
79
|
+
/** Address whose pool shares are burned. */
|
|
38
80
|
owner: Address;
|
|
39
81
|
/** Underlying assets withdrawn to the receiver. */
|
|
40
82
|
assets: bigint;
|
|
83
|
+
/** Underlying token of the source pool. */
|
|
41
84
|
underlying: Address;
|
|
85
|
+
/**
|
|
86
|
+
* Token burned from `owner`: the pool's diesel token for direct
|
|
87
|
+
* withdrawals, or the zapper's share-side token for zapper-routed
|
|
88
|
+
* withdrawals.
|
|
89
|
+
*/
|
|
90
|
+
tokenIn: Address;
|
|
91
|
+
/**
|
|
92
|
+
* Token actually returned to the receiver: the pool underlying for direct
|
|
93
|
+
* withdrawals, or the zapper's output token for zapper-routed withdrawals.
|
|
94
|
+
*/
|
|
95
|
+
tokenOut: Address;
|
|
96
|
+
/** Zapper contract the call is sent to; `undefined` for direct withdrawals. */
|
|
97
|
+
zapper?: Address;
|
|
42
98
|
}
|
|
43
99
|
/**
|
|
44
100
|
* ERC4626 `redeem` from a Gearbox pool.
|
|
101
|
+
*
|
|
102
|
+
* A redeem can reach the pool directly or through a zapper. When routed through
|
|
103
|
+
* a zapper, `zapper` is the call target and `tokenOut` is the zapper's output
|
|
104
|
+
* token rather than the pool underlying.
|
|
45
105
|
*/
|
|
46
106
|
export interface PoolRedeemOperation {
|
|
107
|
+
/** ERC4626 operation kind. */
|
|
47
108
|
operation: "Redeem";
|
|
109
|
+
/** Source pool the shares are redeemed from. */
|
|
48
110
|
pool: Address;
|
|
111
|
+
/** Address that receives the redeemed tokens. */
|
|
49
112
|
receiver: Address;
|
|
113
|
+
/** Address whose pool shares are burned. */
|
|
50
114
|
owner: Address;
|
|
51
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Amount of {@link PoolRedeemOperation.tokenIn} burned: pool shares
|
|
117
|
+
* (diesel) for direct redeems, or the zapper's share-side token amount for
|
|
118
|
+
* zapper-routed redeems.
|
|
119
|
+
*/
|
|
52
120
|
shares: bigint;
|
|
121
|
+
/** Underlying token of the source pool. */
|
|
53
122
|
underlying: Address;
|
|
123
|
+
/**
|
|
124
|
+
* Token burned from `owner`: the pool's diesel token for direct redeems, or
|
|
125
|
+
* the zapper's share-side token (e.g. a farmed/staked diesel wrapper) for
|
|
126
|
+
* zapper-routed redeems.
|
|
127
|
+
*/
|
|
128
|
+
tokenIn: Address;
|
|
129
|
+
/**
|
|
130
|
+
* Token actually returned to the receiver: the pool underlying for direct
|
|
131
|
+
* redeems, or the zapper's output token for zapper-routed redeems.
|
|
132
|
+
*/
|
|
133
|
+
tokenOut: Address;
|
|
134
|
+
/** Zapper contract the call is sent to; `undefined` for direct redeems. */
|
|
135
|
+
zapper?: Address;
|
|
54
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* ERC4626 pool operations. Each operation may be sent directly to the pool
|
|
139
|
+
* contract or routed through a zapper (indicated by the optional `zapper`
|
|
140
|
+
* field).
|
|
141
|
+
*/
|
|
55
142
|
export type PoolOperation = PoolDepositOperation | PoolMintOperation | PoolWithdrawOperation | PoolRedeemOperation;
|
|
143
|
+
export type PoolOperationType = PoolOperation["operation"];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { SecuritizeRegisterMessage } from "../../sdk/index.js";
|
|
3
|
+
import type { InnerOperation } from "./types-facades.js";
|
|
4
|
+
/**
|
|
5
|
+
* Metadata shared by all RWA factory operations. RWA credit accounts are
|
|
6
|
+
* opened and managed through the market's RWA factory rather than the credit
|
|
7
|
+
* facade, but the inner `calls` still target the facade/adapters, so the
|
|
8
|
+
* credit suite is known.
|
|
9
|
+
*/
|
|
10
|
+
export interface RWAOperationMetadata {
|
|
11
|
+
/** RWA factory contract the transaction is sent to. */
|
|
12
|
+
factory: Address;
|
|
13
|
+
creditManager: Address;
|
|
14
|
+
creditFacade: Address;
|
|
15
|
+
}
|
|
16
|
+
export interface SecuritizeOpenCreditAccountOperation<Ext extends object = {}> extends RWAOperationMetadata {
|
|
17
|
+
operation: "SecuritizeOpenCreditAccount";
|
|
18
|
+
multicall: InnerOperation<Ext>[];
|
|
19
|
+
/**
|
|
20
|
+
* DSToken addresses to register, decoded from calldata. Empty in the
|
|
21
|
+
* template flow, where the real value comes from the factory's open-account
|
|
22
|
+
* requirements.
|
|
23
|
+
*/
|
|
24
|
+
tokensToRegister: Address[];
|
|
25
|
+
/**
|
|
26
|
+
* EIP-712 registration signatures to store on-chain, decoded from calldata.
|
|
27
|
+
* Empty in the template flow.
|
|
28
|
+
*/
|
|
29
|
+
signaturesToCache: SecuritizeRegisterMessage[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `SecuritizeRWAFactory.multicall` call: like the facade's `multicall`, plus
|
|
33
|
+
* the factory-specific registration args.
|
|
34
|
+
*/
|
|
35
|
+
export interface SecuritizeMulticallOperation<Ext extends object = {}> extends RWAOperationMetadata {
|
|
36
|
+
operation: "SecuritizeMulticall";
|
|
37
|
+
creditAccount: Address;
|
|
38
|
+
multicall: InnerOperation<Ext>[];
|
|
39
|
+
/** DSToken addresses to register, decoded from calldata. */
|
|
40
|
+
tokensToRegister: Address[];
|
|
41
|
+
/** EIP-712 registration signatures to store on-chain, decoded from calldata. */
|
|
42
|
+
signaturesToCache: SecuritizeRegisterMessage[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Discriminated union of all RWA factory operation types. Extend it when
|
|
46
|
+
* adding support for a new RWA factory type.
|
|
47
|
+
*/
|
|
48
|
+
export type RWAOperation<Ext extends object = {}> = SecuritizeOpenCreditAccountOperation<Ext> | SecuritizeMulticallOperation<Ext>;
|
|
@@ -2,9 +2,11 @@ import type { AdaptersPlugin } from "../../plugins/adapters/index.js";
|
|
|
2
2
|
import type { OnchainSDK, PluginsMap } from "../../sdk/index.js";
|
|
3
3
|
import type { OuterFacadeOperation } from "./types-facades.js";
|
|
4
4
|
import type { PoolOperation } from "./types-pools.js";
|
|
5
|
+
import type { RWAOperation } from "./types-rwa.js";
|
|
5
6
|
export * from "./types-adapters.js";
|
|
6
7
|
export * from "./types-facades.js";
|
|
7
8
|
export * from "./types-pools.js";
|
|
9
|
+
export * from "./types-rwa.js";
|
|
8
10
|
/**
|
|
9
11
|
* True when the plugin map `P` contains the {@link AdaptersPlugin} under any
|
|
10
12
|
* key. Matched nominally (the plugin's private fields make it non-structural),
|
|
@@ -29,16 +31,19 @@ export type RequireAdaptersPlugin<P extends PluginsMap> = HasAdaptersPlugin<P> e
|
|
|
29
31
|
*/
|
|
30
32
|
export type SdkWithAdapters<P extends PluginsMap = PluginsMap> = OnchainSDK<P> & RequireAdaptersPlugin<P>;
|
|
31
33
|
/**
|
|
32
|
-
* Result of decoding a single raw operation calldata:
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* Calldata-only parse produces base (descriptor) adapter operations, so the
|
|
36
|
-
* facade operations are used with the default `Ext = {}`.
|
|
34
|
+
* Result of decoding a single raw operation calldata: a pool deposit/redeem,
|
|
35
|
+
* one of the credit-facade operations, or an RWA-factory operation.
|
|
37
36
|
*/
|
|
38
|
-
export type Operation = PoolOperation | OuterFacadeOperation;
|
|
37
|
+
export type Operation = PoolOperation | OuterFacadeOperation | RWAOperation;
|
|
39
38
|
/**
|
|
40
39
|
* Narrows an {@link Operation} to a {@link PoolOperation} (deposit, mint,
|
|
41
40
|
* withdraw or redeem). Used by the UI to decide whether a custom view exists for
|
|
42
41
|
* the parsed result; everything else falls back to the raw JSON view.
|
|
43
42
|
*/
|
|
44
43
|
export declare function isPoolOperation(tx: Operation): tx is PoolOperation;
|
|
44
|
+
/**
|
|
45
|
+
* Narrows an {@link Operation} to an {@link RWAOperation} (an RWA-factory
|
|
46
|
+
* open-account or multicall). Used to route parsed operations to the
|
|
47
|
+
* RWA-specific simulation path.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isRWAOperation(tx: Operation): tx is RWAOperation;
|
|
@@ -11,9 +11,7 @@ export interface AllowancePrerequisiteProps {
|
|
|
11
11
|
}
|
|
12
12
|
/** Checks that `owner` granted `spender` an ERC-20 allowance >= `required`. */
|
|
13
13
|
export declare class AllowancePrerequisite extends Prerequisite<"allowance"> {
|
|
14
|
-
private
|
|
15
|
-
private readonly _title;
|
|
16
|
-
private readonly _detail;
|
|
14
|
+
#private;
|
|
17
15
|
constructor(props: AllowancePrerequisiteProps);
|
|
18
16
|
get id(): string;
|
|
19
17
|
get kind(): "allowance";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address, type ContractFunctionParameters } from "viem";
|
|
2
2
|
import { type MulticallCallResult, Prerequisite } from "./Prerequisite.js";
|
|
3
|
-
import type { PrerequisiteDetail, PrerequisiteResult } from "./types.js";
|
|
3
|
+
import type { PrerequisiteContext, PrerequisiteDetail, PrerequisiteResult } from "./types.js";
|
|
4
4
|
export interface BalancePrerequisiteProps {
|
|
5
5
|
token: Address;
|
|
6
6
|
owner: Address;
|
|
@@ -8,16 +8,19 @@ export interface BalancePrerequisiteProps {
|
|
|
8
8
|
title?: string;
|
|
9
9
|
id?: string;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Checks that `owner` holds a token balance >= `required`. The token is read
|
|
13
|
+
* as an ERC-20, except for the native pseudo-address ({@link NATIVE_ADDRESS},
|
|
14
|
+
* e.g. ETH-zapper deposits) whose balance is read via multicall3's
|
|
15
|
+
* `getEthBalance`.
|
|
16
|
+
*/
|
|
12
17
|
export declare class BalancePrerequisite extends Prerequisite<"balance"> {
|
|
13
|
-
private
|
|
14
|
-
private readonly _title;
|
|
15
|
-
private readonly _detail;
|
|
18
|
+
#private;
|
|
16
19
|
constructor(props: BalancePrerequisiteProps);
|
|
17
20
|
get id(): string;
|
|
18
21
|
get kind(): "balance";
|
|
19
22
|
get title(): string;
|
|
20
23
|
get detail(): PrerequisiteDetail<"balance">;
|
|
21
|
-
calls(): ContractFunctionParameters[];
|
|
24
|
+
calls(ctx: PrerequisiteContext): ContractFunctionParameters[];
|
|
22
25
|
resolve(slice: MulticallCallResult[]): PrerequisiteResult<"balance">;
|
|
23
26
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Address, ContractFunctionParameters } from "viem";
|
|
2
|
+
import type { RWAOpenAccountRequirements } from "../../sdk/index.js";
|
|
3
|
+
import { Prerequisite } from "./Prerequisite.js";
|
|
4
|
+
import type { PrerequisiteDetail, PrerequisiteResult } from "./types.js";
|
|
5
|
+
export interface RWAOpenRequirementsPrerequisiteProps {
|
|
6
|
+
/** Requirements already resolved via `sdk.accounts.getOpenAccountRequirements`. */
|
|
7
|
+
requirements: RWAOpenAccountRequirements;
|
|
8
|
+
/** RWA token (e.g. Securitize DSToken) the requirements were computed for. */
|
|
9
|
+
token: Address;
|
|
10
|
+
/** RWA factory that produced the requirements. */
|
|
11
|
+
factory: Address;
|
|
12
|
+
title?: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Checks that the borrower has fulfilled the RWA factory's open-account
|
|
17
|
+
* requirements (issuer-side token registration, EIP-712 signatures).
|
|
18
|
+
*
|
|
19
|
+
* Unlike `allowance`/`balance`, the requirements cannot be derived from plain
|
|
20
|
+
* ERC-20 multicall reads: they come from an async compressor read performed by
|
|
21
|
+
* `sdk.accounts.getOpenAccountRequirements`. The prerequisite is therefore
|
|
22
|
+
* *pre-resolved*: it is constructed with the requirements already computed,
|
|
23
|
+
* contributes no calls to the verification multicall, and `resolve` only
|
|
24
|
+
* interprets the stored payload.
|
|
25
|
+
*/
|
|
26
|
+
export declare class RWAOpenRequirementsPrerequisite extends Prerequisite<"rwaOpenRequirements"> {
|
|
27
|
+
#private;
|
|
28
|
+
constructor(props: RWAOpenRequirementsPrerequisiteProps);
|
|
29
|
+
get id(): string;
|
|
30
|
+
get kind(): "rwaOpenRequirements";
|
|
31
|
+
get title(): string;
|
|
32
|
+
get detail(): PrerequisiteDetail<"rwaOpenRequirements">;
|
|
33
|
+
/** Pre-resolved: no on-chain reads to contribute. */
|
|
34
|
+
calls(): ContractFunctionParameters[];
|
|
35
|
+
resolve(): PrerequisiteResult<"rwaOpenRequirements">;
|
|
36
|
+
}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PluginsMap } from "../../sdk/index.js";
|
|
2
|
+
import { type ParseOperationCalldataInput } from "../parse/parseOperationCalldata.js";
|
|
2
3
|
import type { AnyPrerequisite } from "./Prerequisite.js";
|
|
3
|
-
import type { PrerequisiteContext } from "./types.js";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
5
|
+
* Input of {@link buildPrerequisites}: the same raw-calldata input as the
|
|
6
|
+
* internal calldata parser, plus an optional block to read at.
|
|
7
|
+
*/
|
|
8
|
+
export type BuildPrerequisitesInput<P extends PluginsMap = PluginsMap> = ParseOperationCalldataInput<P> & {
|
|
9
|
+
/** Block to read at; defaults to latest. Only set for testnet forks. */
|
|
10
|
+
blockNumber?: bigint;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Derives the on-chain prerequisites for an operation given its raw calldata:
|
|
14
|
+
* the conditions that must hold for the call not to revert and that we can
|
|
15
|
+
* verify with the SDK (token approvals, wallet balances). The calldata is
|
|
16
|
+
* decoded internally via `parseOperationCalldata`.
|
|
8
17
|
*
|
|
9
18
|
* Only *sender-actionable* prerequisites belong here: conditions the LP
|
|
10
19
|
* provider or borrower can fix themselves before retrying (e.g. approve a
|
|
@@ -13,4 +22,4 @@ import type { PrerequisiteContext } from "./types.js";
|
|
|
13
22
|
* bot permissions) is intentionally out of scope, since the user cannot
|
|
14
23
|
* resolve it. New {@link AnyPrerequisite} subclasses must follow the same rule.
|
|
15
24
|
*/
|
|
16
|
-
export declare function buildPrerequisites
|
|
25
|
+
export declare function buildPrerequisites<P extends PluginsMap>(input: BuildPrerequisitesInput<P>): Promise<AnyPrerequisite[]>;
|
|
@@ -3,5 +3,6 @@ export * from "./BalancePrerequisite.js";
|
|
|
3
3
|
export * from "./buildPrerequisites.js";
|
|
4
4
|
export * from "./Prerequisite.js";
|
|
5
5
|
export * from "./prepareAction.js";
|
|
6
|
+
export * from "./RWAOpenRequirementsPrerequisite.js";
|
|
6
7
|
export * from "./runPrerequisites.js";
|
|
7
8
|
export * from "./types.js";
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type { OnchainSDK } from "../../sdk/index.js";
|
|
2
|
+
import type { OnchainSDK, RWAOpenAccountRequirements } from "../../sdk/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Extension point that ties each prerequisite kind to its detail payload.
|
|
5
5
|
*
|
|
6
|
-
* Adding a new prerequisite kind only requires a new entry here: the generic
|
|
7
|
-
* machinery below and the UI renderer registry both key off this map, so TS
|
|
8
|
-
* forces every consumer to handle the new kind.
|
|
9
|
-
*
|
|
10
6
|
* IMPORTANT: only add prerequisites that are *actionable by the transaction
|
|
11
7
|
* sender* (the LP provider or borrower). A valid prerequisite is one the user
|
|
12
8
|
* can resolve themselves before retrying, e.g. approve a token (`allowance`)
|
|
13
|
-
* or
|
|
14
|
-
*
|
|
15
|
-
*
|
|
9
|
+
* or perform offchain KYC verification.
|
|
10
|
+
*
|
|
11
|
+
* Do NOT add protocol- or admin-level state the user cannot change.
|
|
16
12
|
*/
|
|
17
13
|
export interface PrerequisiteDetailMap {
|
|
18
14
|
/** ERC-20 allowance from `owner` to `spender` must cover `required`. */
|
|
@@ -32,6 +28,12 @@ export interface PrerequisiteDetailMap {
|
|
|
32
28
|
/** On-chain balance read; only present when the read succeeded. */
|
|
33
29
|
actual?: bigint;
|
|
34
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* RWA (e.g. Securitize) open-account requirements: off-chain token
|
|
33
|
+
* registration and/or EIP-712 signatures the borrower must provide before
|
|
34
|
+
* opening a credit account in an RWA market.
|
|
35
|
+
*/
|
|
36
|
+
rwaOpenRequirements: RWAOpenAccountRequirements;
|
|
35
37
|
}
|
|
36
38
|
export type PrerequisiteKind = keyof PrerequisiteDetailMap;
|
|
37
39
|
export type PrerequisiteDetail<K extends PrerequisiteKind = PrerequisiteKind> = PrerequisiteDetailMap[K];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type Asset, AssetsMap, type PluginsMap } from "../../sdk/index.js";
|
|
2
|
+
import type { InnerOperation, SdkWithAdapters } from "../parse/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Running state threaded through a credit-facade multicall by
|
|
5
|
+
* {@link applyInnerOperations}. Seeded by the caller:
|
|
6
|
+
* - account opening: everything zero/empty (the account doesn't exist yet);
|
|
7
|
+
* - account adjustment: `balances` from the account's current token balances,
|
|
8
|
+
* `debt` from the principal, `totalDebt` from principal + accrued interest +
|
|
9
|
+
* accrued fees.
|
|
10
|
+
*/
|
|
11
|
+
export interface InnerOperationsState {
|
|
12
|
+
/**
|
|
13
|
+
* Cumulative credit-account balances, mutated in facade execution order.
|
|
14
|
+
*/
|
|
15
|
+
balances: AssetsMap;
|
|
16
|
+
/**
|
|
17
|
+
* Debt principal
|
|
18
|
+
*/
|
|
19
|
+
debt: bigint;
|
|
20
|
+
/**
|
|
21
|
+
* Total debt: principal + accrued interest + accrued fees.
|
|
22
|
+
* `decreaseDebt` amounts operate on total debt (interest and fees are repaid
|
|
23
|
+
* before principal), so principal alone is not enough to resolve either the
|
|
24
|
+
* underlying balance decrement or the final principal.
|
|
25
|
+
*/
|
|
26
|
+
totalDebt: bigint;
|
|
27
|
+
/**
|
|
28
|
+
* Cumulative amounts added via `addCollateral`.
|
|
29
|
+
*/
|
|
30
|
+
collateralAdded: AssetsMap;
|
|
31
|
+
/**
|
|
32
|
+
* Cumulative amounts withdrawn via `withdrawCollateral`, with `MAX_UINT256`
|
|
33
|
+
* resolved against the running balance at the point of the call.
|
|
34
|
+
*/
|
|
35
|
+
collateralWithdrawn: AssetsMap;
|
|
36
|
+
/**
|
|
37
|
+
* Raw `updateQuota` changes, one entry per op. Entries are relative signed
|
|
38
|
+
* changes (with the `MIN_INT96` "disable" sentinel kept as-is), not final
|
|
39
|
+
* quotas: folding them requires pre-state quotas, see
|
|
40
|
+
* {@link applyQuotaChanges}.
|
|
41
|
+
*/
|
|
42
|
+
quotaChanges: Asset[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates an all-zero {@link InnerOperationsState} (the account-opening seed).
|
|
46
|
+
*/
|
|
47
|
+
export declare function makeInnerOperationsState(): InnerOperationsState;
|
|
48
|
+
/**
|
|
49
|
+
* Replays a credit-facade multicall over `state`, mutating it in place in
|
|
50
|
+
* facade execution order. The result is the *minimal guaranteed* post-state:
|
|
51
|
+
* exact deltas for explicit facade calls, exact leftovers for diff-style
|
|
52
|
+
* adapter calls inside `storeExpectedBalances`/`compareBalances` brackets and
|
|
53
|
+
* enforced minimums for bracket targets. Adapter calls outside a bracket are
|
|
54
|
+
* ignored: nothing enforces their outcome on-chain (e.g. reward claims and RWA
|
|
55
|
+
* wrap/unwrap calls emitted by `CreditAccountsServiceV310`), so their
|
|
56
|
+
* guaranteed balance change is zero.
|
|
57
|
+
*
|
|
58
|
+
* @throws On malformed `storeExpectedBalances`/`compareBalances` brackets and
|
|
59
|
+
* on bracketed calls to non-adapter targets.
|
|
60
|
+
*/
|
|
61
|
+
export declare function applyInnerOperations<P extends PluginsMap>(sdk: SdkWithAdapters<P>, multicall: InnerOperation[], state: InnerOperationsState): void;
|
|
62
|
+
/**
|
|
63
|
+
* Applies raw `updateQuota` changes to the account's initial quotas.
|
|
64
|
+
*
|
|
65
|
+
* Each change is applied sequentially: `MIN_INT96` disables the quota, other
|
|
66
|
+
* changes are added to the running quota with the result clamped at zero
|
|
67
|
+
* (quotas cannot go negative on-chain).
|
|
68
|
+
*
|
|
69
|
+
* @param initialQuotas - Per-token quotas before the operation.
|
|
70
|
+
* @param changes - Raw changes recorded by {@link applyInnerOperations}.
|
|
71
|
+
* @returns `quotas` - final non-zero per-token quotas; `quotasChange` -
|
|
72
|
+
* applied (post-clamp) per-token deltas, non-zero entries only.
|
|
73
|
+
*/
|
|
74
|
+
export declare function applyQuotaChanges(initialQuotas: AssetsMap, changes: Asset[]): {
|
|
75
|
+
quotas: Asset[];
|
|
76
|
+
quotasChange: Asset[];
|
|
77
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when a transaction's attached native value (`msg.value`) does not fit
|
|
3
|
+
* into the WETH collateral declared by the multicall: such a transaction is
|
|
4
|
+
* malformed and would not execute successfully.
|
|
5
|
+
*/
|
|
6
|
+
export declare class InvalidTransactionValueError extends Error {
|
|
7
|
+
/** Transaction `msg.value`. */
|
|
8
|
+
readonly value: bigint;
|
|
9
|
+
/** Amount of wrapped native token added as collateral. */
|
|
10
|
+
readonly wethCollateral: bigint;
|
|
11
|
+
constructor(value: bigint, wethCollateral: bigint);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Thrown by `previewOperation` for parsed operations it cannot preview yet.
|
|
15
|
+
* Currently only pool operations and credit account opening are supported.
|
|
16
|
+
*/
|
|
17
|
+
export declare class UnsupportedOperationError extends Error {
|
|
18
|
+
/** The parsed operation kind (the `operation` discriminant). */
|
|
19
|
+
readonly operation: string;
|
|
20
|
+
constructor(operation: string);
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PluginsMap } from "../../sdk/index.js";
|
|
2
|
+
import type { MulticallOperation, SecuritizeMulticallOperation } from "../parse/index.js";
|
|
3
|
+
import type { AdjustCreditAccountPreview, PreviewOperationInput, PreviewOperationOptions } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Previews a `multicall`/`botMulticall` operation on an existing credit
|
|
6
|
+
* account: fetches the account's pre-state (unless provided via options),
|
|
7
|
+
* threads the multicall through {@link applyInnerOperations} and reports the
|
|
8
|
+
* minimal guaranteed post-state alongside the changes relative to the
|
|
9
|
+
* pre-state.
|
|
10
|
+
*/
|
|
11
|
+
export declare function previewAdjustCreditAccount<P extends PluginsMap>(input: PreviewOperationInput<P>, operation: MulticallOperation | SecuritizeMulticallOperation, options?: PreviewOperationOptions): Promise<AdjustCreditAccountPreview>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type PluginsMap } from "../../sdk/index.js";
|
|
2
|
+
import type { OpenCreditAccountOperation, SecuritizeOpenCreditAccountOperation } from "../parse/index.js";
|
|
3
|
+
import type { OpenCreditAccountPreview, PreviewOperationInput } from "./types.js";
|
|
4
|
+
export declare function previewOpenCreditAccount<P extends PluginsMap>(input: PreviewOperationInput<P>, operation: OpenCreditAccountOperation | SecuritizeOpenCreditAccountOperation): OpenCreditAccountPreview;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginsMap } from "../../sdk/index.js";
|
|
2
|
+
import type { OperationPreview, PreviewOperationInput, PreviewOperationOptions } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Previews a raw operation calldata: decodes it into a typed operation and
|
|
5
|
+
* assembles an operation-specific, human-displayable preview.
|
|
6
|
+
*/
|
|
7
|
+
export declare function previewOperation<P extends PluginsMap = PluginsMap>(input: PreviewOperationInput<P>, options?: PreviewOperationOptions): Promise<OperationPreview>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PluginsMap } from "../../sdk/index.js";
|
|
2
|
+
import type { PoolOperation } from "../parse/index.js";
|
|
3
|
+
import { type OperationSimulationOptions } from "../simulate/index.js";
|
|
4
|
+
import type { PoolOperationPreview, PreviewOperationInput } from "./types.js";
|
|
5
|
+
export declare function previewPoolOperation<P extends PluginsMap>(input: PreviewOperationInput<P>, operation: PoolOperation, options?: OperationSimulationOptions): Promise<PoolOperationPreview>;
|