@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.3
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/MIGRATION-v5-to-v6.md +199 -34
- package/README.md +23 -15
- package/lib/cjs/abis.d.ts +3 -2829
- package/lib/cjs/abis.js +1 -1938
- package/lib/cjs/actions/blue/borrow.d.ts +3 -2
- package/lib/cjs/actions/blue/borrow.js +3 -2
- package/lib/cjs/actions/blue/common.js +6 -35
- package/lib/cjs/actions/blue/refinance.d.ts +2 -2
- package/lib/cjs/actions/blue/refinance.js +2 -2
- package/lib/cjs/actions/blue/repay.d.ts +1 -1
- package/lib/cjs/actions/blue/repay.js +1 -1
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/cjs/actions/blue/supply.d.ts +2 -2
- package/lib/cjs/actions/blue/supply.js +4 -9
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
- package/lib/cjs/actions/blue/withdraw.js +3 -3
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
- package/lib/cjs/actions/bundles/common.d.ts +38 -4
- package/lib/cjs/actions/bundles/common.js +91 -35
- package/lib/cjs/actions/index.d.ts +0 -1
- package/lib/cjs/actions/index.js +0 -1
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +17 -26
- package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/blue/index.js +0 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +24 -25
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -38
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/encode/index.js +0 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/cjs/actions/requirements/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/index.js +0 -1
- package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV1/deposit.js +1 -2
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV2/deposit.js +1 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/cjs/augment.d.ts +0 -1
- package/lib/cjs/augment.js +0 -1
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +1 -5
- package/lib/cjs/blue/entities.d.ts +2 -2
- package/lib/cjs/blue/entities.js +1 -2
- package/lib/cjs/blue/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +2 -1
- package/lib/cjs/blue/fetch.d.ts +1 -1
- package/lib/cjs/blue/fetch.js +1 -2
- package/lib/cjs/blue/types.d.ts +2 -4
- package/lib/cjs/blue/utils.d.ts +1 -3
- package/lib/cjs/blue/utils.js +1 -3
- package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
- package/lib/cjs/client/morphoViemExtension.js +1 -1
- package/lib/cjs/constants.d.ts +3 -37
- package/lib/cjs/constants.js +1 -39
- package/lib/cjs/entities/blue/blue.d.ts +38 -264
- package/lib/cjs/entities/blue/blue.js +2 -203
- package/lib/cjs/entities/index.d.ts +3 -60
- package/lib/cjs/entities/index.js +1 -20
- package/lib/cjs/entities/midnight/midnight.js +20 -24
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +19 -14
- package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +1 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +18 -6
- package/lib/cjs/entities/vaultV1/vaultV1.js +25 -8
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/cjs/entities/vaultV2/vaultV2.js +249 -23
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +50 -34
- package/lib/cjs/errors.d.ts +2 -46
- package/lib/cjs/errors.js +2 -46
- package/lib/cjs/fetch.d.ts +1 -15
- package/lib/cjs/fetch.js +1 -16
- package/lib/cjs/helpers/constant.d.ts +0 -2
- package/lib/cjs/helpers/constant.js +0 -2
- package/lib/cjs/helpers/index.d.ts +4 -3
- package/lib/cjs/helpers/index.js +10 -9
- package/lib/cjs/helpers/metadata.d.ts +3 -5
- package/lib/cjs/helpers/metadata.js +4 -6
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/cjs/helpers/slippage.d.ts +34 -90
- package/lib/cjs/helpers/slippage.js +52 -137
- package/lib/cjs/helpers/utilization.d.ts +12 -10
- package/lib/cjs/helpers/utilization.js +27 -12
- package/lib/cjs/helpers/validate.d.ts +66 -32
- package/lib/cjs/helpers/validate.js +84 -57
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
- package/lib/cjs/types/action.d.ts +102 -68
- package/lib/cjs/types/action.js +11 -4
- package/lib/cjs/types/error.d.ts +332 -385
- package/lib/cjs/types/error.js +369 -412
- package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
- package/lib/cjs/types.d.ts +2 -18
- package/lib/cjs/utils.d.ts +8 -35
- package/lib/cjs/utils.js +11 -36
- package/lib/esm/abis.d.ts +3 -2829
- package/lib/esm/abis.js +3 -1935
- package/lib/esm/actions/blue/borrow.d.ts +3 -2
- package/lib/esm/actions/blue/borrow.js +3 -2
- package/lib/esm/actions/blue/common.js +8 -37
- package/lib/esm/actions/blue/refinance.d.ts +2 -2
- package/lib/esm/actions/blue/refinance.js +2 -2
- package/lib/esm/actions/blue/repay.d.ts +1 -1
- package/lib/esm/actions/blue/repay.js +1 -1
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/esm/actions/blue/supply.d.ts +2 -2
- package/lib/esm/actions/blue/supply.js +6 -11
- package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/supplyCollateral.js +2 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/esm/actions/blue/withdraw.d.ts +3 -3
- package/lib/esm/actions/blue/withdraw.js +3 -3
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
- package/lib/esm/actions/bundles/common.d.ts +38 -4
- package/lib/esm/actions/bundles/common.js +91 -36
- package/lib/esm/actions/index.d.ts +0 -1
- package/lib/esm/actions/index.js +0 -1
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +20 -29
- package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
- package/lib/esm/actions/requirements/blue/index.js +0 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +25 -26
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -39
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
- package/lib/esm/actions/requirements/encode/index.js +0 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/esm/actions/requirements/index.d.ts +0 -1
- package/lib/esm/actions/requirements/index.js +0 -1
- package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV1/deposit.js +1 -2
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV2/deposit.js +1 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/esm/augment.d.ts +0 -1
- package/lib/esm/augment.js +0 -1
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/entities.d.ts +2 -2
- package/lib/esm/blue/entities.js +1 -1
- package/lib/esm/blue/errors.d.ts +1 -1
- package/lib/esm/blue/errors.js +1 -1
- package/lib/esm/blue/fetch.d.ts +1 -1
- package/lib/esm/blue/fetch.js +1 -1
- package/lib/esm/blue/types.d.ts +2 -4
- package/lib/esm/blue/utils.d.ts +1 -3
- package/lib/esm/blue/utils.js +1 -3
- package/lib/esm/client/morphoViemExtension.d.ts +1 -1
- package/lib/esm/client/morphoViemExtension.js +1 -1
- package/lib/esm/constants.d.ts +3 -37
- package/lib/esm/constants.js +3 -37
- package/lib/esm/entities/blue/blue.d.ts +38 -264
- package/lib/esm/entities/blue/blue.js +5 -206
- package/lib/esm/entities/index.d.ts +3 -60
- package/lib/esm/entities/index.js +1 -16
- package/lib/esm/entities/midnight/midnight.js +20 -24
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +20 -15
- package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/esm/entities/requirements/index.d.ts +1 -0
- package/lib/esm/entities/requirements/index.js +1 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +18 -6
- package/lib/esm/entities/vaultV1/vaultV1.js +29 -12
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/esm/entities/vaultV2/vaultV2.js +256 -30
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.js +48 -32
- package/lib/esm/errors.d.ts +2 -46
- package/lib/esm/errors.js +2 -46
- package/lib/esm/fetch.d.ts +1 -15
- package/lib/esm/fetch.js +1 -15
- package/lib/esm/helpers/constant.d.ts +0 -2
- package/lib/esm/helpers/constant.js +0 -2
- package/lib/esm/helpers/index.d.ts +4 -3
- package/lib/esm/helpers/index.js +4 -3
- package/lib/esm/helpers/metadata.d.ts +3 -5
- package/lib/esm/helpers/metadata.js +4 -6
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/esm/helpers/slippage.d.ts +34 -90
- package/lib/esm/helpers/slippage.js +52 -134
- package/lib/esm/helpers/utilization.d.ts +12 -10
- package/lib/esm/helpers/utilization.js +26 -11
- package/lib/esm/helpers/validate.d.ts +66 -32
- package/lib/esm/helpers/validate.js +83 -57
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +1 -3
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
- package/lib/esm/types/action.d.ts +102 -68
- package/lib/esm/types/action.js +12 -5
- package/lib/esm/types/error.d.ts +332 -385
- package/lib/esm/types/error.js +355 -392
- package/lib/esm/types/sharedLiquidity.d.ts +1 -117
- package/lib/esm/types.d.ts +2 -18
- package/lib/esm/utils.d.ts +8 -35
- package/lib/esm/utils.js +7 -34
- package/package.json +7 -15
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -83
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -151
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -50
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
- package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -43
- package/lib/cjs/actions/signatures/index.d.ts +0 -3
- package/lib/cjs/actions/signatures/index.js +0 -19
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
- package/lib/cjs/bundler/actions.d.ts +0 -797
- package/lib/cjs/bundler/actions.js +0 -1371
- package/lib/cjs/bundler/index.d.ts +0 -2
- package/lib/cjs/bundler/index.js +0 -18
- package/lib/cjs/bundler/types.d.ts +0 -235
- package/lib/cjs/bundler/types.js +0 -2
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/cjs/entities/vaultV1ReallocationData.js +0 -542
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -243
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -79
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -147
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -46
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
- package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -39
- package/lib/esm/actions/signatures/index.d.ts +0 -3
- package/lib/esm/actions/signatures/index.js +0 -3
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -5
- package/lib/esm/bundler/actions.d.ts +0 -797
- package/lib/esm/bundler/actions.js +0 -1368
- package/lib/esm/bundler/index.d.ts +0 -2
- package/lib/esm/bundler/index.js +0 -2
- package/lib/esm/bundler/types.d.ts +0 -235
- package/lib/esm/bundler/types.js +0 -1
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/esm/entities/vaultV1ReallocationData.js +0 -544
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -239
- /package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
- /package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
|
@@ -34,7 +34,7 @@ export interface BlueBorrowParams {
|
|
|
34
34
|
* Encodes a pure borrow through BlueBundlesV1.
|
|
35
35
|
*
|
|
36
36
|
* Delegates to {@link blueSupplyCollateralBorrow} with a zero collateral leg. Vault V2 allocator
|
|
37
|
-
* penalties and referral fees reduce the assets received
|
|
37
|
+
* penalties and referral fees reduce the assets received.
|
|
38
38
|
*
|
|
39
39
|
* @param params - Borrow encoding parameters.
|
|
40
40
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -53,8 +53,9 @@ export interface BlueBorrowParams {
|
|
|
53
53
|
* @throws {NegativeInputError} when an amount, LTV, fee, or reallocation penalty is negative.
|
|
54
54
|
* @throws {NonPositiveInputError} when the borrow, deadline, or reallocation amount is not positive.
|
|
55
55
|
* @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its bound.
|
|
56
|
-
* @throws {
|
|
56
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
57
57
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
58
|
+
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
|
|
58
59
|
* @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
|
|
59
60
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
60
61
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
|
|
@@ -7,7 +7,7 @@ const supplyCollateralBorrow_js_1 = require("./supplyCollateralBorrow.js");
|
|
|
7
7
|
* Encodes a pure borrow through BlueBundlesV1.
|
|
8
8
|
*
|
|
9
9
|
* Delegates to {@link blueSupplyCollateralBorrow} with a zero collateral leg. Vault V2 allocator
|
|
10
|
-
* penalties and referral fees reduce the assets received
|
|
10
|
+
* penalties and referral fees reduce the assets received.
|
|
11
11
|
*
|
|
12
12
|
* @param params - Borrow encoding parameters.
|
|
13
13
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -26,8 +26,9 @@ const supplyCollateralBorrow_js_1 = require("./supplyCollateralBorrow.js");
|
|
|
26
26
|
* @throws {NegativeInputError} when an amount, LTV, fee, or reallocation penalty is negative.
|
|
27
27
|
* @throws {NonPositiveInputError} when the borrow, deadline, or reallocation amount is not positive.
|
|
28
28
|
* @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its bound.
|
|
29
|
-
* @throws {
|
|
29
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
30
30
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
31
|
+
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
|
|
31
32
|
* @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
|
|
32
33
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
33
34
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
|
|
@@ -97,33 +97,12 @@ const getBlueBundlesV1SignedAuthorization = (params) => {
|
|
|
97
97
|
actual: String(authorizationSignature.action.args.deadline),
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
(0, viem_1.size)(serializedSignature) === 64
|
|
105
|
-
? (0, viem_1.compactSignatureToSignature)((0, viem_1.parseCompactSignature)(serializedSignature))
|
|
106
|
-
: (0, viem_1.parseSignature)(serializedSignature);
|
|
107
|
-
}
|
|
108
|
-
catch (cause) {
|
|
109
|
-
throw new index_js_2.BundlesRequirementSignatureMismatchError({
|
|
110
|
-
field: "signature",
|
|
111
|
-
expected: "a 64-byte compact or 65-byte serialized ECDSA signature",
|
|
112
|
-
actual: serializedSignature,
|
|
113
|
-
cause,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
const v = parsed.v ??
|
|
117
|
-
(parsed.yParity == null ? undefined : BigInt(parsed.yParity + 27));
|
|
118
|
-
if (v == null) {
|
|
119
|
-
throw new index_js_2.BundlesRequirementSignatureMismatchError({
|
|
120
|
-
field: "signature",
|
|
121
|
-
expected: "a signature containing v or yParity",
|
|
122
|
-
actual: serializedSignature,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
100
|
+
const signature = (0, common_js_1.normalizeBundlesSignature)(authorizationSignature.args.signature, (details) => new index_js_2.BundlesRequirementSignatureMismatchError({
|
|
101
|
+
field: "signature",
|
|
102
|
+
...details,
|
|
103
|
+
}));
|
|
125
104
|
return {
|
|
126
|
-
signature
|
|
105
|
+
signature,
|
|
127
106
|
nonce: authorizationSignature.args.nonce,
|
|
128
107
|
deadline: authorizationSignature.args.deadline,
|
|
129
108
|
};
|
|
@@ -173,19 +152,11 @@ const selectBlueBundlesV1RequirementSignatures = (signatures, accepts) => {
|
|
|
173
152
|
permit2SignatureTransfer: accepts.token,
|
|
174
153
|
authorization: accepts.authorization,
|
|
175
154
|
});
|
|
176
|
-
if (permit?.action.type === "permit2") {
|
|
177
|
-
throw new index_js_2.BundlesRequirementSignatureMismatchError({
|
|
178
|
-
field: "type",
|
|
179
|
-
expected: "permit or permit2SignatureTransfer",
|
|
180
|
-
actual: permit.action.type,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
155
|
if (permit != null && permit2SignatureTransfer != null) {
|
|
184
156
|
throw new index_js_2.AmbiguousRequirementSignaturesError("permit", 2);
|
|
185
157
|
}
|
|
186
158
|
return {
|
|
187
|
-
token: permit ??
|
|
188
|
-
permit2SignatureTransfer,
|
|
159
|
+
token: permit ?? permit2SignatureTransfer,
|
|
189
160
|
authorization,
|
|
190
161
|
};
|
|
191
162
|
};
|
|
@@ -61,9 +61,9 @@ export interface BlueRefinanceParams {
|
|
|
61
61
|
* @throws {NegativeInputError} when `maxLtv`, a referral fee, or a reallocation penalty is negative.
|
|
62
62
|
* @throws {NonPositiveInputError} when the deadline or a reallocation amount is not positive.
|
|
63
63
|
* @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its ABI bound.
|
|
64
|
-
* @throws {
|
|
64
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
65
65
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
66
|
-
* @throws {
|
|
66
|
+
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
|
|
67
67
|
* @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
|
|
68
68
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
69
69
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the destination market.
|
|
@@ -34,9 +34,9 @@ const common_js_1 = require("./common.js");
|
|
|
34
34
|
* @throws {NegativeInputError} when `maxLtv`, a referral fee, or a reallocation penalty is negative.
|
|
35
35
|
* @throws {NonPositiveInputError} when the deadline or a reallocation amount is not positive.
|
|
36
36
|
* @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its ABI bound.
|
|
37
|
-
* @throws {
|
|
37
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
38
38
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
39
|
-
* @throws {
|
|
39
|
+
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
|
|
40
40
|
* @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
|
|
41
41
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
42
42
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the destination market.
|
|
@@ -67,7 +67,7 @@ export interface BlueRepayParams {
|
|
|
67
67
|
* @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
|
|
68
68
|
* @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
|
|
69
69
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
70
|
-
* @throws {
|
|
70
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
71
71
|
* @throws {UnsupportedChainIdError} when the chain is absent from the registry.
|
|
72
72
|
* @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
|
|
73
73
|
* @example
|
|
@@ -39,7 +39,7 @@ const repayWithdrawCollateral_js_1 = require("./repayWithdrawCollateral.js");
|
|
|
39
39
|
* @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
|
|
40
40
|
* @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
|
|
41
41
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
42
|
-
* @throws {
|
|
42
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
43
43
|
* @throws {UnsupportedChainIdError} when the chain is absent from the registry.
|
|
44
44
|
* @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
|
|
45
45
|
* @example
|
|
@@ -43,7 +43,7 @@ export interface BlueRepayWithdrawCollateralParams {
|
|
|
43
43
|
*
|
|
44
44
|
* `maxRepayAssets` funds the live repayment plus fee and BlueBundlesV1 refunds the unused amount.
|
|
45
45
|
* A saturated `repayShares = maxUint256` closes the live remaining debt. This route has no
|
|
46
|
-
*
|
|
46
|
+
* share-price bound or `slippageTolerance` input.
|
|
47
47
|
*
|
|
48
48
|
* @param params - Combined-operation encoding parameters.
|
|
49
49
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -68,7 +68,7 @@ export interface BlueRepayWithdrawCollateralParams {
|
|
|
68
68
|
* @throws {NonPositiveInputError} when both operation legs are zero, repay funding is absent, or the deadline is invalid.
|
|
69
69
|
* @throws {MaxRepayAssetsBelowRepayAssetsError} when exact-asset funding cannot cover the repayment and referral fee.
|
|
70
70
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
71
|
-
* @throws {
|
|
71
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
72
72
|
* @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
|
|
73
73
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
74
74
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
@@ -11,7 +11,7 @@ const common_js_1 = require("./common.js");
|
|
|
11
11
|
*
|
|
12
12
|
* `maxRepayAssets` funds the live repayment plus fee and BlueBundlesV1 refunds the unused amount.
|
|
13
13
|
* A saturated `repayShares = maxUint256` closes the live remaining debt. This route has no
|
|
14
|
-
*
|
|
14
|
+
* share-price bound or `slippageTolerance` input.
|
|
15
15
|
*
|
|
16
16
|
* @param params - Combined-operation encoding parameters.
|
|
17
17
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -36,7 +36,7 @@ const common_js_1 = require("./common.js");
|
|
|
36
36
|
* @throws {NonPositiveInputError} when both operation legs are zero, repay funding is absent, or the deadline is invalid.
|
|
37
37
|
* @throws {MaxRepayAssetsBelowRepayAssetsError} when exact-asset funding cannot cover the repayment and referral fee.
|
|
38
38
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
39
|
-
* @throws {
|
|
39
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
40
40
|
* @throws {NativeFundingAmountMismatchError} when native funding is partial or mixed.
|
|
41
41
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
42
42
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
@@ -32,7 +32,7 @@ export interface BlueSupplyParams {
|
|
|
32
32
|
* Encodes a direct BlueBundlesV1 loan-asset supply transaction.
|
|
33
33
|
*
|
|
34
34
|
* `assets` is the gross funded amount; BlueBundlesV1 deducts the referral fee before supplying.
|
|
35
|
-
* This route has no
|
|
35
|
+
* This route has no share-price bound or `slippageTolerance` input.
|
|
36
36
|
*
|
|
37
37
|
* @param params - Supply encoding parameters.
|
|
38
38
|
* @param params.market.chainId - Chain containing the BlueBundlesV1 deployment.
|
|
@@ -50,7 +50,7 @@ export interface BlueSupplyParams {
|
|
|
50
50
|
* @throws {NonPositiveInputError} when `assets` or `deadline` is not positive.
|
|
51
51
|
* @throws {NegativeInputError} when `nativeAmount` or `referralFeePct` is negative.
|
|
52
52
|
* @throws {InputExceedsMaxError} when `assets` exceeds `uint256` or `referralFeePct` is at least WAD.
|
|
53
|
-
* @throws {
|
|
53
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
54
54
|
* @throws {NativeFundingAmountMismatchError} when native funding does not equal `assets`.
|
|
55
55
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
56
56
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.blueSupply = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const abis_js_1 = require("../../abis.js");
|
|
6
|
+
const validate_js_1 = require("../../helpers/validate.js");
|
|
6
7
|
const index_js_1 = require("../../types/index.js");
|
|
7
8
|
const common_js_1 = require("./common.js");
|
|
8
9
|
/**
|
|
9
10
|
* Encodes a direct BlueBundlesV1 loan-asset supply transaction.
|
|
10
11
|
*
|
|
11
12
|
* `assets` is the gross funded amount; BlueBundlesV1 deducts the referral fee before supplying.
|
|
12
|
-
* This route has no
|
|
13
|
+
* This route has no share-price bound or `slippageTolerance` input.
|
|
13
14
|
*
|
|
14
15
|
* @param params - Supply encoding parameters.
|
|
15
16
|
* @param params.market.chainId - Chain containing the BlueBundlesV1 deployment.
|
|
@@ -27,7 +28,7 @@ const common_js_1 = require("./common.js");
|
|
|
27
28
|
* @throws {NonPositiveInputError} when `assets` or `deadline` is not positive.
|
|
28
29
|
* @throws {NegativeInputError} when `nativeAmount` or `referralFeePct` is negative.
|
|
29
30
|
* @throws {InputExceedsMaxError} when `assets` exceeds `uint256` or `referralFeePct` is at least WAD.
|
|
30
|
-
* @throws {
|
|
31
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
31
32
|
* @throws {NativeFundingAmountMismatchError} when native funding does not equal `assets`.
|
|
32
33
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
33
34
|
* @throws {NativeAmountOnNonWNativeAssetError} when native funding targets another token.
|
|
@@ -64,13 +65,7 @@ const blueSupply = (params) => {
|
|
|
64
65
|
if (assets <= 0n) {
|
|
65
66
|
throw new index_js_1.NonPositiveInputError("assets", assets);
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
throw new index_js_1.InputExceedsMaxError({
|
|
69
|
-
field: "assets",
|
|
70
|
-
value: assets,
|
|
71
|
-
max: viem_1.maxUint256,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
68
|
+
(0, validate_js_1.validateUint256Field)("assets", assets);
|
|
74
69
|
const common = {
|
|
75
70
|
chainId,
|
|
76
71
|
userAddress,
|
|
@@ -32,7 +32,7 @@ export interface BlueSupplyCollateralParams {
|
|
|
32
32
|
* Encodes a pure collateral supply through BlueBundlesV1.
|
|
33
33
|
*
|
|
34
34
|
* Delegates to {@link blueSupplyCollateralBorrow} with a zero borrow leg and an unrestricted LTV
|
|
35
|
-
* cap. Native funding is exclusive with ERC-20 funding
|
|
35
|
+
* cap. Native funding is exclusive with ERC-20 funding.
|
|
36
36
|
*
|
|
37
37
|
* @param params - Collateral-supply encoding parameters.
|
|
38
38
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -59,7 +59,7 @@ export interface BlueSupplyCollateralParams {
|
|
|
59
59
|
* @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
|
|
60
60
|
* @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
|
|
61
61
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
62
|
-
* @throws {
|
|
62
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
63
63
|
* @throws {UnsupportedChainIdError} when the chain is absent from the registry.
|
|
64
64
|
* @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
|
|
65
65
|
* @example
|
|
@@ -8,7 +8,7 @@ const supplyCollateralBorrow_js_1 = require("./supplyCollateralBorrow.js");
|
|
|
8
8
|
* Encodes a pure collateral supply through BlueBundlesV1.
|
|
9
9
|
*
|
|
10
10
|
* Delegates to {@link blueSupplyCollateralBorrow} with a zero borrow leg and an unrestricted LTV
|
|
11
|
-
* cap. Native funding is exclusive with ERC-20 funding
|
|
11
|
+
* cap. Native funding is exclusive with ERC-20 funding.
|
|
12
12
|
*
|
|
13
13
|
* @param params - Collateral-supply encoding parameters.
|
|
14
14
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -35,7 +35,7 @@ const supplyCollateralBorrow_js_1 = require("./supplyCollateralBorrow.js");
|
|
|
35
35
|
* @throws {DepositSpenderMismatchError} when the signed spender is not BlueBundlesV1.
|
|
36
36
|
* @throws {BundlesRequirementSignatureMismatchError} when a signature cannot be encoded safely.
|
|
37
37
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
38
|
-
* @throws {
|
|
38
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
39
39
|
* @throws {UnsupportedChainIdError} when the chain is absent from the registry.
|
|
40
40
|
* @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
|
|
41
41
|
* @example
|
|
@@ -40,7 +40,7 @@ export interface BlueSupplyCollateralBorrowParams {
|
|
|
40
40
|
* Encodes a direct BlueBundlesV1 collateral supply and/or borrow transaction.
|
|
41
41
|
*
|
|
42
42
|
* Reallocations are Vault V2-only and require a borrow leg. Penalties and referral fees reduce
|
|
43
|
-
* borrow proceeds. This route has no
|
|
43
|
+
* borrow proceeds. This route has no share-price bound or `slippageTolerance` input.
|
|
44
44
|
*
|
|
45
45
|
* @param params - Combined-operation encoding parameters.
|
|
46
46
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -64,8 +64,9 @@ export interface BlueSupplyCollateralBorrowParams {
|
|
|
64
64
|
* or a reallocation amount is not positive.
|
|
65
65
|
* @throws {ReallocationsRequireBorrowError} when reallocations accompany no borrow.
|
|
66
66
|
* @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its ABI bound.
|
|
67
|
-
* @throws {
|
|
67
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
68
68
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
69
|
+
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
|
|
69
70
|
* @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
|
|
70
71
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
71
72
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
|
|
@@ -10,7 +10,7 @@ const common_js_1 = require("./common.js");
|
|
|
10
10
|
* Encodes a direct BlueBundlesV1 collateral supply and/or borrow transaction.
|
|
11
11
|
*
|
|
12
12
|
* Reallocations are Vault V2-only and require a borrow leg. Penalties and referral fees reduce
|
|
13
|
-
* borrow proceeds. This route has no
|
|
13
|
+
* borrow proceeds. This route has no share-price bound or `slippageTolerance` input.
|
|
14
14
|
*
|
|
15
15
|
* @param params - Combined-operation encoding parameters.
|
|
16
16
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -34,8 +34,9 @@ const common_js_1 = require("./common.js");
|
|
|
34
34
|
* or a reallocation amount is not positive.
|
|
35
35
|
* @throws {ReallocationsRequireBorrowError} when reallocations accompany no borrow.
|
|
36
36
|
* @throws {InputExceedsMaxError} when a fee, reallocation amount, or penalty exceeds its ABI bound.
|
|
37
|
-
* @throws {
|
|
37
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
38
38
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
39
|
+
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
|
|
39
40
|
* @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
|
|
40
41
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
41
42
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
|
|
@@ -35,7 +35,7 @@ export interface BlueWithdrawParams {
|
|
|
35
35
|
*
|
|
36
36
|
* Vault V2 allocator penalties and referral fees reduce the assets received. Shares mode has no
|
|
37
37
|
* saturated full-close sentinel or onchain minimum-assets guarantee, and this route has no
|
|
38
|
-
*
|
|
38
|
+
* share-price bound or `slippageTolerance` input.
|
|
39
39
|
*
|
|
40
40
|
* @param params - Withdrawal encoding parameters.
|
|
41
41
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -56,9 +56,9 @@ export interface BlueWithdrawParams {
|
|
|
56
56
|
* @throws {NonPositiveInputError} when neither mode, no valid deadline, or a non-positive
|
|
57
57
|
* reallocation amount is provided.
|
|
58
58
|
* @throws {InputExceedsMaxError} when a withdraw amount, fee, reallocation amount, or penalty exceeds its ABI bound.
|
|
59
|
-
* @throws {
|
|
59
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
60
60
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
61
|
-
* @throws {
|
|
61
|
+
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
|
|
62
62
|
* @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
|
|
63
63
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
64
64
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
|
|
@@ -11,7 +11,7 @@ const common_js_1 = require("./common.js");
|
|
|
11
11
|
*
|
|
12
12
|
* Vault V2 allocator penalties and referral fees reduce the assets received. Shares mode has no
|
|
13
13
|
* saturated full-close sentinel or onchain minimum-assets guarantee, and this route has no
|
|
14
|
-
*
|
|
14
|
+
* share-price bound or `slippageTolerance` input.
|
|
15
15
|
*
|
|
16
16
|
* @param params - Withdrawal encoding parameters.
|
|
17
17
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -32,9 +32,9 @@ const common_js_1 = require("./common.js");
|
|
|
32
32
|
* @throws {NonPositiveInputError} when neither mode, no valid deadline, or a non-positive
|
|
33
33
|
* reallocation amount is provided.
|
|
34
34
|
* @throws {InputExceedsMaxError} when a withdraw amount, fee, reallocation amount, or penalty exceeds its ABI bound.
|
|
35
|
-
* @throws {
|
|
35
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
36
36
|
* @throws {InvalidReallocationAddressError} when a vault or adapter address is malformed.
|
|
37
|
-
* @throws {
|
|
37
|
+
* @throws {InvalidVaultV2BlueReallocationShapeError} when a reallocation entry is not a valid Vault V2 reallocation.
|
|
38
38
|
* @throws {InvalidReallocationSourceTypeError} when a reallocation source is malformed.
|
|
39
39
|
* @throws {InconsistentReallocationPenaltyError} when one vault uses different penalties.
|
|
40
40
|
* @throws {ReallocationWithdrawalOnTargetMarketError} when a source is the target market.
|
|
@@ -32,7 +32,7 @@ export interface BlueWithdrawCollateralParams {
|
|
|
32
32
|
* Encodes a pure collateral withdrawal through BlueBundlesV1.
|
|
33
33
|
*
|
|
34
34
|
* Delegates to {@link blueRepayWithdrawCollateral} with a zero repay leg. BlueBundlesV1 enforces
|
|
35
|
-
* the supplied post-operation LTV, and no standalone Morpho
|
|
35
|
+
* the supplied post-operation LTV, and no standalone Morpho call is encoded.
|
|
36
36
|
*
|
|
37
37
|
* @param params - Collateral-withdrawal encoding parameters.
|
|
38
38
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -50,7 +50,7 @@ export interface BlueWithdrawCollateralParams {
|
|
|
50
50
|
* @throws {NegativeInputError} when collateral, LTV, or fee is negative.
|
|
51
51
|
* @throws {NonPositiveInputError} when collateral or deadline is not positive.
|
|
52
52
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
53
|
-
* @throws {
|
|
53
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
54
54
|
* @throws {DepositOwnerMismatchError} when the signed authorization owner differs from `userAddress`.
|
|
55
55
|
* @throws {BundlesRequirementSignatureMismatchError} when authorization cannot be bound safely.
|
|
56
56
|
* @throws {UnsupportedChainIdError} when the chain is absent from the registry.
|
|
@@ -7,7 +7,7 @@ const repayWithdrawCollateral_js_1 = require("./repayWithdrawCollateral.js");
|
|
|
7
7
|
* Encodes a pure collateral withdrawal through BlueBundlesV1.
|
|
8
8
|
*
|
|
9
9
|
* Delegates to {@link blueRepayWithdrawCollateral} with a zero repay leg. BlueBundlesV1 enforces
|
|
10
|
-
* the supplied post-operation LTV, and no standalone Morpho
|
|
10
|
+
* the supplied post-operation LTV, and no standalone Morpho call is encoded.
|
|
11
11
|
*
|
|
12
12
|
* @param params - Collateral-withdrawal encoding parameters.
|
|
13
13
|
* @param params.market.chainId - Chain containing BlueBundlesV1.
|
|
@@ -25,7 +25,7 @@ const repayWithdrawCollateral_js_1 = require("./repayWithdrawCollateral.js");
|
|
|
25
25
|
* @throws {NegativeInputError} when collateral, LTV, or fee is negative.
|
|
26
26
|
* @throws {NonPositiveInputError} when collateral or deadline is not positive.
|
|
27
27
|
* @throws {InputExceedsMaxError} when the referral fee is at least WAD.
|
|
28
|
-
* @throws {
|
|
28
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no recipient.
|
|
29
29
|
* @throws {DepositOwnerMismatchError} when the signed authorization owner differs from `userAddress`.
|
|
30
30
|
* @throws {BundlesRequirementSignatureMismatchError} when authorization cannot be bound safely.
|
|
31
31
|
* @throws {UnsupportedChainIdError} when the chain is absent from the registry.
|
|
@@ -96,11 +96,12 @@ export declare const resolveBundlesFunding: (params: BundlesFundingArgs) => {
|
|
|
96
96
|
* @param params.amount - Exact pull amount in the token's smallest unit; must match both signed amount fields.
|
|
97
97
|
* @param params.requirementSignature - Optional signed ERC-2612 or Permit2 SignatureTransfer requirement; omit for allowance funding.
|
|
98
98
|
* @returns An empty, ERC-2612, or Permit2 SignatureTransfer token permit.
|
|
99
|
-
* @throws {UnexpectedRequirementSignatureError} when Permit2 AllowanceTransfer is supplied.
|
|
100
99
|
* @throws {DepositOwnerMismatchError} when the signature owner differs from `userAddress`.
|
|
101
100
|
* @throws {DepositAssetMismatchError} when the signed token differs from `token`.
|
|
102
101
|
* @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
|
|
103
102
|
* @throws {DepositSpenderMismatchError} when the signed spender differs from `spender`.
|
|
103
|
+
* @throws {UnsupportedRequirementSignatureError} when the signature's action type is neither
|
|
104
|
+
* "permit" nor "permit2SignatureTransfer".
|
|
104
105
|
* @throws {BundlesRequirementSignatureMismatchError} when signature metadata is malformed.
|
|
105
106
|
* @example
|
|
106
107
|
* ```ts
|
|
@@ -123,8 +124,21 @@ export declare const getBundlesTokenPermit: (params: {
|
|
|
123
124
|
readonly amount: bigint;
|
|
124
125
|
readonly requirementSignature?: TokenRequirementSignature;
|
|
125
126
|
}) => BundlesTokenPermit;
|
|
126
|
-
/**
|
|
127
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Normalizes a compact or serialized ECDSA signature for bundles permit tuples.
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
*
|
|
132
|
+
* @param serializedSignature - Compact or serialized ECDSA signature.
|
|
133
|
+
* @param onInvalid - Error factory used when parsing or extracting the recovery identifier fails.
|
|
134
|
+
* @returns The normalized signature tuple.
|
|
135
|
+
* @throws {BundlesPermitMismatchError} when the signature is malformed.
|
|
136
|
+
*/
|
|
137
|
+
export declare const normalizeBundlesSignature: (serializedSignature: Hex, onInvalid?: (details: {
|
|
138
|
+
readonly expected: string;
|
|
139
|
+
readonly actual: Hex;
|
|
140
|
+
readonly cause?: unknown;
|
|
141
|
+
}) => Error) => {
|
|
128
142
|
readonly v: number;
|
|
129
143
|
readonly r: Hex;
|
|
130
144
|
readonly s: Hex;
|
|
@@ -140,7 +154,10 @@ export declare const normalizeBundlesSignature: (serializedSignature: Hex) => {
|
|
|
140
154
|
* @param params.amount - Optional exact share allowance in the vault share token's smallest unit.
|
|
141
155
|
* @param params.requirementSignature - Optional signed ERC-2612 share requirement; omit for the empty-permit sentinel.
|
|
142
156
|
* @returns The signed share permit or the contract's empty-permit sentinel.
|
|
143
|
-
* @throws {
|
|
157
|
+
* @throws {NonPositiveInputError} when a bundle or permit deadline is not positive.
|
|
158
|
+
* @throws {InputExceedsMaxError} when a bundle or permit deadline exceeds uint256.
|
|
159
|
+
* @throws {BundlesPermitMismatchError} when the requirement kind, token, owner, spender, amount or
|
|
160
|
+
* deadline, or signature is invalid.
|
|
144
161
|
* @example
|
|
145
162
|
* ```ts
|
|
146
163
|
* import { getBundlesSharesPermit } from "@morpho-org/morpho-sdk";
|
|
@@ -188,6 +205,23 @@ export declare const selectBundlesSharesRequirementSignature: (signatures: reado
|
|
|
188
205
|
readonly requiredShareAllowance: bigint | undefined;
|
|
189
206
|
readonly expectedRequirement?: PermitAction;
|
|
190
207
|
}) => Erc2612RequirementSignature | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Selects the ERC-2612 vault-share permit for one exit from its immutable operation fields alone.
|
|
210
|
+
*
|
|
211
|
+
* @internal
|
|
212
|
+
*
|
|
213
|
+
* @param signatures - Signatures passed to the operation's `buildTx` function.
|
|
214
|
+
* @param expected - Immutable spender, amount, and deadline required by the operation.
|
|
215
|
+
* @returns The matching ERC-2612 signature, or `undefined` when no signature is supplied.
|
|
216
|
+
* @throws {BundlesPermitMismatchError} when the signature is not ERC-2612 or its spender, amount or
|
|
217
|
+
* deadline differ from the operation's. The nonce is not checked here: it is onchain state the
|
|
218
|
+
* vault's `permit` verifies at execution.
|
|
219
|
+
*/
|
|
220
|
+
export declare const selectBundlesSharesPermitSignature: (signatures: readonly RequirementSignature[] | undefined, expected: {
|
|
221
|
+
readonly spender: Address;
|
|
222
|
+
readonly amount: bigint;
|
|
223
|
+
readonly deadline: bigint;
|
|
224
|
+
}) => Erc2612RequirementSignature | undefined;
|
|
191
225
|
/** @internal Returns the exact referral fee deducted from a fixed gross asset amount. */
|
|
192
226
|
export declare const getBundlesReferralFeeAssets: (assets: bigint, referralFeePct: bigint) => bigint;
|
|
193
227
|
/** @internal Finalizes a direct VaultBundlesV1 transaction with metadata and immutable action data. */
|