@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION-v5-to-v6.md +127 -16
- package/README.md +17 -11
- package/lib/cjs/abis.d.ts +17 -2
- package/lib/cjs/abis.js +14 -1
- package/lib/cjs/actions/blue/common.js +5 -26
- package/lib/cjs/actions/blue/supply.js +2 -7
- package/lib/cjs/actions/bundles/common.d.ts +32 -2
- package/lib/cjs/actions/bundles/common.js +68 -30
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +6 -10
- 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 +15 -8
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +20 -20
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +33 -27
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +15 -10
- 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/generalAdapter/getGeneralAdapterRequirements.js +1 -0
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +4 -1
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +5 -2
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +6 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +2 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +1 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +3 -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 +1 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +3 -2
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
- package/lib/cjs/blue/abis.d.ts +5 -1
- package/lib/cjs/blue/abis.js +2 -0
- package/lib/cjs/blue/entities.d.ts +8 -2
- package/lib/cjs/blue/entities.js +1 -0
- package/lib/cjs/blue/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +2 -1
- package/lib/cjs/blue/fetch.d.ts +3 -1
- package/lib/cjs/blue/fetch.js +1 -0
- package/lib/cjs/entities/blue/blue.d.ts +15 -6
- package/lib/cjs/entities/blue/blue.js +3 -0
- package/lib/cjs/entities/index.d.ts +8 -2
- package/lib/cjs/entities/index.js +1 -0
- 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 +10 -5
- package/lib/cjs/entities/vaultV1/vaultV1.js +13 -1
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +6 -0
- package/lib/cjs/entities/vaultV1ReallocationData.js +20 -5
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +140 -34
- package/lib/cjs/entities/vaultV2/vaultV2.js +229 -16
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +46 -13
- package/lib/cjs/errors.d.ts +1 -1
- package/lib/cjs/errors.js +3 -2
- package/lib/cjs/fetch.d.ts +3 -1
- package/lib/cjs/fetch.js +1 -0
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +2 -0
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +2 -0
- package/lib/cjs/helpers/index.d.ts +3 -1
- package/lib/cjs/helpers/index.js +10 -1
- 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 +46 -0
- package/lib/cjs/helpers/slippage.js +65 -0
- package/lib/cjs/helpers/validate.d.ts +65 -8
- package/lib/cjs/helpers/validate.js +83 -9
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
- package/lib/cjs/types/action.d.ts +95 -13
- package/lib/cjs/types/error.d.ts +290 -12
- package/lib/cjs/types/error.js +312 -24
- package/lib/cjs/types/sharedLiquidity.d.ts +2 -2
- package/lib/cjs/utils.d.ts +3 -1
- package/lib/cjs/utils.js +10 -1
- package/lib/esm/abis.d.ts +17 -2
- package/lib/esm/abis.js +17 -2
- package/lib/esm/actions/blue/common.js +7 -28
- package/lib/esm/actions/blue/supply.js +4 -9
- package/lib/esm/actions/bundles/common.d.ts +32 -2
- package/lib/esm/actions/bundles/common.js +68 -31
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +8 -12
- 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 +15 -8
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +21 -21
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +34 -28
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +15 -10
- 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/generalAdapter/getGeneralAdapterRequirements.js +1 -0
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +4 -1
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +5 -2
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +6 -0
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +2 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +1 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.js +3 -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 +1 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.js +3 -2
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +3 -1
- package/lib/esm/blue/abis.d.ts +5 -1
- package/lib/esm/blue/abis.js +5 -1
- package/lib/esm/blue/entities.d.ts +8 -2
- package/lib/esm/blue/entities.js +3 -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 +3 -1
- package/lib/esm/blue/fetch.js +3 -1
- package/lib/esm/entities/blue/blue.d.ts +15 -6
- package/lib/esm/entities/blue/blue.js +3 -0
- package/lib/esm/entities/index.d.ts +8 -2
- package/lib/esm/entities/index.js +3 -1
- 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 +10 -5
- package/lib/esm/entities/vaultV1/vaultV1.js +14 -2
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +6 -0
- package/lib/esm/entities/vaultV1ReallocationData.js +20 -5
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +140 -34
- package/lib/esm/entities/vaultV2/vaultV2.js +234 -21
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.js +46 -13
- package/lib/esm/errors.d.ts +1 -1
- package/lib/esm/errors.js +1 -1
- package/lib/esm/fetch.d.ts +3 -1
- package/lib/esm/fetch.js +3 -1
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +2 -0
- package/lib/esm/helpers/computeVaultV1Reallocations.js +2 -0
- package/lib/esm/helpers/index.d.ts +3 -1
- package/lib/esm/helpers/index.js +3 -1
- 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 +46 -0
- package/lib/esm/helpers/slippage.js +65 -1
- package/lib/esm/helpers/validate.d.ts +65 -8
- package/lib/esm/helpers/validate.js +82 -10
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
- package/lib/esm/types/action.d.ts +95 -13
- package/lib/esm/types/error.d.ts +290 -12
- package/lib/esm/types/error.js +301 -19
- package/lib/esm/types/sharedLiquidity.d.ts +2 -2
- package/lib/esm/utils.d.ts +3 -1
- package/lib/esm/utils.js +3 -1
- package/package.json +7 -7
- /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
package/MIGRATION-v5-to-v6.md
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
Version 6 keeps the Blue entity at `client.morpho.blue(marketParams, chainId)` and preserves its
|
|
4
4
|
write-method names while routing them through five direct BlueBundlesV1 entrypoints. Blue reads and
|
|
5
5
|
versioned reallocation-data helpers remain on the same entity. There is no parallel BlueBundlesV1
|
|
6
|
-
extension or automatic fallback to the v5 route.
|
|
6
|
+
extension or automatic fallback to the v5 route. Version 6 also reshapes Vault V2 `forceWithdraw`
|
|
7
|
+
to route through the standalone `VaultExitBundlesV1` periphery. This guide covers the Blue write
|
|
8
|
+
rerouting and the Vault V2 `forceWithdraw` route replacement alongside the other v6 breaks
|
|
9
|
+
documented in the sections below.
|
|
7
10
|
|
|
8
11
|
## Vault V1 and Vault V2 deposits
|
|
9
12
|
|
|
@@ -234,7 +237,8 @@ The destinations are different:
|
|
|
234
237
|
|
|
235
238
|
- Classic ERC-20 approvals and ERC-2612 permits now authorize BlueBundlesV1.
|
|
236
239
|
- Permit2 keeps its ERC-20 approval on canonical Permit2, but the SignatureTransfer payload names
|
|
237
|
-
BlueBundlesV1 as spender.
|
|
240
|
+
BlueBundlesV1 as spender. The SDK resolves the lowest unused Permit2 nonce by default — see the
|
|
241
|
+
subsection below.
|
|
238
242
|
- Morpho authorization now grants BlueBundlesV1 operator rights instead of GeneralAdapter1.
|
|
239
243
|
- Without signature support, saturated full-repay requirements use the token's reusable maximum
|
|
240
244
|
allowance so a later bounded debt quote remains covered; BlueBundlesV1 still refunds unused
|
|
@@ -246,23 +250,59 @@ Update simulations and analytics for the v6 action-field changes. Do not assert
|
|
|
246
250
|
Bundler3/GeneralAdapter1 destinations or inspect Bundler3 sub-actions for these
|
|
247
251
|
high-level writes.
|
|
248
252
|
|
|
249
|
-
### Permit2 SignatureTransfer
|
|
253
|
+
### Permit2 SignatureTransfer resolves the nonce automatically
|
|
250
254
|
|
|
251
|
-
SignatureTransfer consumes an owner-global unordered nonce rather than an allowance
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
SignatureTransfer consumes an owner-global unordered nonce rather than an allowance. For a client
|
|
256
|
+
with `supportSignature: true`, the default supply requirement path selects Permit2 and
|
|
257
|
+
`supply(...).getRequirements()` resolves the lowest unused nonce for `userAddress` automatically — no
|
|
258
|
+
nonce argument is required:
|
|
255
259
|
|
|
256
260
|
```ts
|
|
257
261
|
const requirements = await market
|
|
258
262
|
.supply({ userAddress, assets, deadline })
|
|
259
|
-
.getRequirements(
|
|
263
|
+
.getRequirements();
|
|
260
264
|
```
|
|
261
265
|
|
|
262
|
-
|
|
263
|
-
is single-use; a consumed one throws
|
|
264
|
-
|
|
265
|
-
ERC-2612
|
|
266
|
+
Pass `getRequirements({ permit2Nonce })` to pin an explicit `uint256` whose Permit2 `nonceBitmap` bit
|
|
267
|
+
is still unset for `userAddress` (each nonce is single-use; a consumed one throws
|
|
268
|
+
`Permit2SignatureTransferNonceAlreadyUsedError`). An owner whose every nonce at or after the scan
|
|
269
|
+
start is consumed throws `NoUnusedPermit2NonceError`. To skip Permit2 for ERC-2612 tokens, pass
|
|
270
|
+
`getRequirements({ useSimplePermit: true })`, which prefers a one-signature ERC-2612 permit and needs
|
|
271
|
+
no nonce.
|
|
272
|
+
|
|
273
|
+
### Signature requirements expose `action.typedData`; low-level encoders take `owner`
|
|
274
|
+
|
|
275
|
+
Every signable requirement action (`PermitAction`, `Permit2Action`,
|
|
276
|
+
`Permit2SignatureTransferAction`, `AuthorizationAction`, `MidnightOfferRootSignatureAction`) now
|
|
277
|
+
carries the deep-frozen EIP-712 payload that `sign()` signs, so it can be inspected or displayed
|
|
278
|
+
before signing:
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
const requirement = (await output.getRequirements()).find(isRequirementSignature);
|
|
282
|
+
if (requirement == null) return; // nothing to sign (only on-chain approvals, or none)
|
|
283
|
+
|
|
284
|
+
const typedData = requirement.action.typedData; // exact EIP-712 payload `sign()` will sign
|
|
285
|
+
const signed = await requirement.sign(walletClient, owner);
|
|
286
|
+
const tx = output.buildTx([signed]); // Midnight outputs take the single signature instead
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
`requirement.action.typedData` is typed as required on a `Requirement`, so no null check is needed.
|
|
290
|
+
It is the exact `TypedDataDefinition` that `sign()` signs; signing itself still goes through
|
|
291
|
+
`Requirement.sign(client, userAddress)`.
|
|
292
|
+
|
|
293
|
+
Because the permit and authorization payloads embed the owner and are built eagerly, two exported
|
|
294
|
+
low-level encoders take a new required `owner` parameter, and `getGeneralAdapterRequirementsPermit`
|
|
295
|
+
forwards it. Their `sign(client, userAddress)` rejects a `userAddress` different from `owner` with
|
|
296
|
+
`AddressMismatchError`.
|
|
297
|
+
|
|
298
|
+
| v5 call | v6 call |
|
|
299
|
+
| --- | --- |
|
|
300
|
+
| `encodeErc20Permit(client, { token, spender, amount, chainId, nonce })` | `encodeErc20Permit(client, { token, owner, spender, amount, chainId, nonce })` |
|
|
301
|
+
| `encodeBlueSignatureAuthorization(client, { authorized, isAuthorized, chainId, nonce })` | `encodeBlueSignatureAuthorization(client, { owner, authorized, isAuthorized, chainId, nonce })` |
|
|
302
|
+
| `getGeneralAdapterRequirementsPermit(client, { token, chainId, args, nonce })` | `getGeneralAdapterRequirementsPermit(client, { token, owner, chainId, args, nonce })` |
|
|
303
|
+
|
|
304
|
+
High-level entity flows (`client.morpho.blue(...)`, vault deposits, Midnight) already supply the
|
|
305
|
+
owner and need no changes.
|
|
266
306
|
|
|
267
307
|
## Blue refinance
|
|
268
308
|
|
|
@@ -329,6 +369,72 @@ The `BlueReallocationPlan` union is removed. High-level Blue write inputs accept
|
|
|
329
369
|
`Iterable<VaultV2BlueReallocation>` directly; for explicit low-level Vault V1 composition, use
|
|
330
370
|
`VaultV1Reallocation[]`.
|
|
331
371
|
|
|
372
|
+
## Vault V2 `forceWithdraw`
|
|
373
|
+
|
|
374
|
+
`MorphoVaultV2.forceWithdraw` and the pure `vaultV2ForceWithdraw` action now route through the
|
|
375
|
+
standalone `VaultExitBundlesV1` periphery instead of a `VaultV2.multicall` of caller-supplied
|
|
376
|
+
`forceDeallocate` calls. The contract computes its own deallocations and bounds the realized exit
|
|
377
|
+
share price. `forceRedeem` is unchanged and stays on the vault multicall.
|
|
378
|
+
|
|
379
|
+
| Was (v5) | Now (v6) |
|
|
380
|
+
| --- | --- |
|
|
381
|
+
| `forceWithdraw({ deallocations, withdraw: { amount }, userAddress })` | `forceWithdraw({ exitAssets, vaultData, userAddress, adapter?, deadline?, slippageTolerance?, minSharePriceE27?, referralFeePct?, referralFeeRecipient? })` |
|
|
382
|
+
| Returns `{ buildTx }` | Returns an `ActionOutput` — `{ getRequirements(), buildTx(signatures?) }` (`buildTx` stays synchronous) |
|
|
383
|
+
| `withdraw.amount` was the net payout | `exitAssets` is **penalty-inclusive**; quote the split with the new `previewVaultV2ForceWithdraw` |
|
|
384
|
+
| `tx.to` is the vault | `tx.to` is `VaultExitBundlesV1` |
|
|
385
|
+
| No approval needed (the vault burned `msg.sender`'s own shares) | A vault-share allowance or ERC-2612 permit **to `VaultExitBundlesV1`** is now required |
|
|
386
|
+
|
|
387
|
+
### Pure action
|
|
388
|
+
|
|
389
|
+
The pure action's call shape changes alongside the entity method:
|
|
390
|
+
|
|
391
|
+
```ts
|
|
392
|
+
// v5
|
|
393
|
+
vaultV2ForceWithdraw({
|
|
394
|
+
vault: { address: vaultAddress },
|
|
395
|
+
args: {
|
|
396
|
+
deallocations: [{ adapter, marketParams, amount: 500_000n }],
|
|
397
|
+
withdraw: { amount: 500_000n, recipient },
|
|
398
|
+
onBehalf,
|
|
399
|
+
},
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// v6
|
|
403
|
+
vaultV2ForceWithdraw({
|
|
404
|
+
vault: { chainId, address: vaultAddress },
|
|
405
|
+
args: {
|
|
406
|
+
adapter,
|
|
407
|
+
exitAssets: 500_000n,
|
|
408
|
+
minSharePriceE27,
|
|
409
|
+
userAddress,
|
|
410
|
+
deadline,
|
|
411
|
+
},
|
|
412
|
+
});
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
`chainId` is now required so the action can resolve the registered periphery address and apply
|
|
416
|
+
`chainId` validation.
|
|
417
|
+
|
|
418
|
+
Migration steps:
|
|
419
|
+
|
|
420
|
+
- Fetch a `vaultData` snapshot (`vault.getData()`) and pass it in. The vault must have exactly one
|
|
421
|
+
`MorphoMarketV1AdapterV2` and route liquidity through that same adapter or none; multi-adapter and
|
|
422
|
+
legacy-adapter vaults must use `forceRedeem` or a plain `withdraw`.
|
|
423
|
+
- Convert your net-payout amount to a penalty-inclusive `exitAssets` and drop the caller-supplied
|
|
424
|
+
`deallocations` and market ordering — the contract derives them.
|
|
425
|
+
- Resolve `getRequirements()` before `buildTx()` to obtain the new vault-share approval or permit to
|
|
426
|
+
`VaultExitBundlesV1`, and make sure the vault's `receiveAssetsGate` allows that periphery.
|
|
427
|
+
- Update `VaultV2ForceWithdrawAction` decoding: `deallocations` and `withdraw` are gone; `adapter`,
|
|
428
|
+
`exitAssets`, `minSharePriceE27`, `referralFeePct`, `referralFeeRecipient`, and `deadline` are new.
|
|
429
|
+
- Stop batching exits: only one VaultExitBundlesV1 call can execute per transaction, because its
|
|
430
|
+
`initiator` guard is transient and never cleared.
|
|
431
|
+
- `InKindRedeemRequiresSingleAdapterError` and `UnsupportedInKindAdapterError` are deprecated aliases
|
|
432
|
+
of `VaultV2SingleAdapterRequiredError` and `VaultV2UnsupportedExitAdapterError`; `instanceof` keeps
|
|
433
|
+
working for both names.
|
|
434
|
+
|
|
435
|
+
See the [`TIB-2026-08-28-vault-exit-force-withdraw`](https://github.com/morpho-org/sdks/blob/main/docs/tibs/TIB-2026-08-28-vault-exit-force-withdraw.md)
|
|
436
|
+
decision record for the full rationale.
|
|
437
|
+
|
|
332
438
|
## Update Vault V1 and Vault V2 writes
|
|
333
439
|
|
|
334
440
|
Vault V1 and Vault V2 keep their existing `deposit`, `withdraw`, and `redeem` names, while Vault V1
|
|
@@ -337,7 +443,8 @@ ERC-4626 call or Bundler3 multicall.
|
|
|
337
443
|
|
|
338
444
|
- Deposits accept exactly one of `amount` and `nativeAmount`. Split a former additive ETH + WETH
|
|
339
445
|
deposit into two transactions. Classic approvals and ERC-2612 permits now authorize
|
|
340
|
-
VaultBundlesV1; Permit2 uses SignatureTransfer
|
|
446
|
+
VaultBundlesV1; Permit2 uses SignatureTransfer with a nonce the SDK resolves by default (pass
|
|
447
|
+
`permit2Nonce` to override).
|
|
341
448
|
- Remove `recipient` from deposits and remove `recipient` and `onBehalf` from exits. VaultBundlesV1
|
|
342
449
|
always operates for and pays `msg.sender`. `userAddress` now means the account that must submit the
|
|
343
450
|
transaction. A connected builder account may prepare a transaction for a different submitter;
|
|
@@ -378,9 +485,13 @@ const transaction = withdrawal.buildTx(signatures);
|
|
|
378
485
|
- Update every Blue write call using the table above; method names remain stable.
|
|
379
486
|
- Remove Blue slippage and PublicAllocator V1 write inputs.
|
|
380
487
|
- Re-run approval and Morpho-authorization setup against the new spender/operator.
|
|
381
|
-
- Update transaction decoding, simulation fixtures, and action metadata fields;
|
|
382
|
-
|
|
488
|
+
- Update transaction decoding, simulation fixtures, and action metadata fields; the `type`
|
|
489
|
+
discriminators remain stable, including `"vaultV2ForceWithdraw"`.
|
|
383
490
|
- Test native funding, full repay, and full-position migration paths used by the application.
|
|
491
|
+
- Migrate Vault V2 `forceWithdraw` to the penalty-inclusive `exitAssets` + `vaultData` shape,
|
|
492
|
+
resolve its new `getRequirements()`, and authorize vault shares to `VaultExitBundlesV1`.
|
|
493
|
+
- Test the multi-adapter and legacy-adapter `forceWithdraw` fallbacks (`forceRedeem` / plain
|
|
494
|
+
`withdraw`) used by the application.
|
|
384
495
|
|
|
385
496
|
## Fixed-bundles token requirement APIs
|
|
386
497
|
|
|
@@ -396,7 +507,7 @@ BlueBundlesV1 and VaultBundlesV1.
|
|
|
396
507
|
| `Permit2TransferFromAction` / `Permit2TransferFromRequirementSignature` | `Permit2SignatureTransferAction` / `Permit2SignatureTransferRequirementSignature` |
|
|
397
508
|
| `isPermit2TransferFromSignature` | `isPermit2SignatureTransferSignature` |
|
|
398
509
|
| `selectRequirementSignatures` option and result field `permit2TransferFrom` | `permit2SignatureTransfer` |
|
|
399
|
-
| `MissingPermit2TransferFromNonceError` | `
|
|
510
|
+
| `MissingPermit2TransferFromNonceError` | Removed — the nonce is resolved automatically; catch `NoUnusedPermit2NonceError` only if every nonce is consumed |
|
|
400
511
|
| `Permit2TransferFromNonceAlreadyUsedError` | `Permit2SignatureTransferNonceAlreadyUsedError` (old name kept as a `@deprecated` alias) |
|
|
401
512
|
|
|
402
513
|
Update call sites and `switch`/discriminated-union checks on `action.type` to the new
|
package/README.md
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
Build transactions for Morpho's **VaultV1** (MetaMorpho), **VaultV2**, **Blue**, and **Midnight** fixed-rate markets on chains with the required protocol and periphery deployments. Custom deployments can be added with `registerCustomAddresses` from `@morpho-org/morpho-sdk/addresses`.
|
|
11
11
|
|
|
12
|
+
## Deprecated flows
|
|
13
|
+
|
|
14
|
+
All Vault V1 PublicAllocator surfaces are deprecated, including raw ABIs, addresses, configs, fetchers, planning APIs, and Bundler3 composition. Use Vault V2 BluePublicAllocator APIs: `getVaultV2BlueReallocationData()` fetches the state and `getVaultV2BlueReallocations()` prepares a plan for a Blue action.
|
|
15
|
+
|
|
16
|
+
The legacy `morphoToken` address and MORPHO wrapping entries in `ethereumGeneralAdapter1Abi` are also deprecated. Use the current MORPHO token directly. Deprecated APIs remain available until the next major release; general Vault V1 operations and other token wrapping flows remain supported.
|
|
17
|
+
|
|
12
18
|
## Installation
|
|
13
19
|
|
|
14
20
|
```bash
|
|
@@ -28,7 +34,8 @@ BlueBundlesV1, and the remaining rows identify their destination.
|
|
|
28
34
|
| **VaultV1** (MetaMorpho) | `deposit`, `withdraw`, `redeem`, `migrateToV2` | VaultBundlesV1 |
|
|
29
35
|
| | `inKindRedeem` | VaultExitBundlesV1 |
|
|
30
36
|
| **VaultV2** | `deposit`, `withdraw`, `redeem` | VaultBundlesV1 |
|
|
31
|
-
| | `forceWithdraw
|
|
37
|
+
| | `forceWithdraw` | VaultExitBundlesV1 |
|
|
38
|
+
| | `forceRedeem` | Vault multicall |
|
|
32
39
|
| | `inKindRedeem` | VaultExitBundlesV1 |
|
|
33
40
|
| **Blue** | `supply`, `withdraw`, `supplyCollateral`, `borrow`, `supplyCollateralBorrow`, `repay`, `withdrawCollateral`, `repayWithdrawCollateral`, `refinance` | BlueBundlesV1 |
|
|
34
41
|
| **Midnight** | `takeLend`, `takeBorrow`, `supplyCollateralTakeBorrow`, `repayWithdrawCollateral` | Midnight Bundles |
|
|
@@ -42,10 +49,13 @@ Robinhood Chain. Custom deployments can still be configured with `registerCustom
|
|
|
42
49
|
## How it works
|
|
43
50
|
|
|
44
51
|
Actions that pull tokens or touch a position return `{ buildTx, getRequirements }`. All Blue
|
|
45
|
-
writes use this lazy shape while still encoding one direct BlueBundlesV1 call. Vault deposits
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`
|
|
52
|
+
writes use this lazy shape while still encoding one direct BlueBundlesV1 call. Vault deposits,
|
|
53
|
+
`withdraw`, and `redeem` use the same shape for token or exact vault-share authorization to
|
|
54
|
+
VaultBundlesV1. Vault `inKindRedeem` and `forceWithdraw` use it so callers can await
|
|
55
|
+
`getRequirements()` to check share authorization to VaultExitBundlesV1 — and, for `inKindRedeem`,
|
|
56
|
+
live Blue liquidity — before invoking `buildTx()`. Calling `buildTx()` directly skips those
|
|
57
|
+
RPC-backed pre-flight checks. `forceRedeem` remains a direct Vault V2 multicall without
|
|
58
|
+
prerequisites.
|
|
49
59
|
|
|
50
60
|
- **`getRequirements()`** — async; the on-chain prerequisites to satisfy first: ERC-20 approvals, permit / Permit2 signatures, Morpho authorization, or (for Midnight) operator authorization and offer-root signatures.
|
|
51
61
|
- **`buildTx(signatures?)`** — synchronous; the final, deep-frozen viem transaction. Pass any signatures collected from the requirements.
|
|
@@ -212,10 +222,6 @@ instant liquidation. Blue writes do not accept `slippageTolerance`, `minSharePri
|
|
|
212
222
|
> low-level Bundler3 composition remain available only as deprecated compatibility surfaces and
|
|
213
223
|
> will be removed in the next major.
|
|
214
224
|
|
|
215
|
-
> All SDK surfaces for the Vault V1 shared-liquidity algorithm and its PublicAllocator Bundler3
|
|
216
|
-
> composition are deprecated and will be removed in the next major. Use Vault V2
|
|
217
|
-
> BluePublicAllocator reallocations.
|
|
218
|
-
|
|
219
225
|
### Midnight: take a fixed-rate offer
|
|
220
226
|
|
|
221
227
|
Protocol-specific names are qualified in shared facades, for example `fetchBluePosition` and `fetchMidnightPosition` from `@morpho-org/morpho-sdk/fetch`. Raw upstream names remain available under `/blue/{abis,addresses,constants,entities,errors,fetch,types,utils}` and `/midnight/{abis,constants,entities,errors,fetch,types,utils}`.
|
|
@@ -280,8 +286,8 @@ graph LR
|
|
|
280
286
|
V2W --> VBV1
|
|
281
287
|
V2R --> VBV1
|
|
282
288
|
V2IKR -->|direct call| VEB
|
|
283
|
-
V2FW -->|
|
|
284
|
-
V2FR -->|multicall| V2C
|
|
289
|
+
V2FW -->|direct call| VEB
|
|
290
|
+
V2FR -->|multicall| V2C[VaultV2 Contract]
|
|
285
291
|
end
|
|
286
292
|
|
|
287
293
|
subgraph Blue Flow
|
package/lib/cjs/abis.d.ts
CHANGED
|
@@ -7,7 +7,11 @@ adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc5267Abi, metaMorphoA
|
|
|
7
7
|
/** @deprecated Use `bluePreLiquidationAbi` or the raw `/blue/abis` subpath. */
|
|
8
8
|
preLiquidationAbi, preLiquidationFactoryAbi as bluePreLiquidationFactoryAbi,
|
|
9
9
|
/** @deprecated Use `bluePreLiquidationFactoryAbi` or the raw `/blue/abis` subpath. */
|
|
10
|
-
preLiquidationFactoryAbi,
|
|
10
|
+
preLiquidationFactoryAbi,
|
|
11
|
+
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
12
|
+
publicAllocatorAbi, vaultV1AdapterAbi, vaultV1AdapterFactoryAbi,
|
|
13
|
+
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
14
|
+
vaultV1PublicAllocatorAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
|
|
11
15
|
export { ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi,
|
|
12
16
|
/** @deprecated Use `midnightEcrecoverRatifierAbi` or the raw `/midnight/abis` subpath. */
|
|
13
17
|
ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi as midnightSetterRatifierAbi,
|
|
@@ -1374,7 +1378,12 @@ export declare const generalAdapter1Abi: readonly [{
|
|
|
1374
1378
|
readonly name: "ZeroShares";
|
|
1375
1379
|
readonly inputs: readonly [];
|
|
1376
1380
|
}];
|
|
1377
|
-
/**
|
|
1381
|
+
/**
|
|
1382
|
+
* ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension.
|
|
1383
|
+
*
|
|
1384
|
+
* MORPHO legacy token wrapping entries are deprecated and will be removed in the next major.
|
|
1385
|
+
* Use the current MORPHO token directly. Native-token and stETH wrapping remain supported.
|
|
1386
|
+
*/
|
|
1378
1387
|
export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
1379
1388
|
readonly type: "receive";
|
|
1380
1389
|
readonly stateMutability: "payable";
|
|
@@ -2043,10 +2052,12 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2043
2052
|
readonly type: "address";
|
|
2044
2053
|
readonly internalType: "address";
|
|
2045
2054
|
}, {
|
|
2055
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2046
2056
|
readonly name: "morphoToken";
|
|
2047
2057
|
readonly type: "address";
|
|
2048
2058
|
readonly internalType: "address";
|
|
2049
2059
|
}, {
|
|
2060
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2050
2061
|
readonly name: "morphoWrapper";
|
|
2051
2062
|
readonly type: "address";
|
|
2052
2063
|
readonly internalType: "address";
|
|
@@ -2054,6 +2065,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2054
2065
|
readonly stateMutability: "nonpayable";
|
|
2055
2066
|
}, {
|
|
2056
2067
|
readonly type: "function";
|
|
2068
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2057
2069
|
readonly name: "MORPHO_TOKEN";
|
|
2058
2070
|
readonly inputs: readonly [];
|
|
2059
2071
|
readonly outputs: readonly [{
|
|
@@ -2064,6 +2076,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2064
2076
|
readonly stateMutability: "view";
|
|
2065
2077
|
}, {
|
|
2066
2078
|
readonly type: "function";
|
|
2079
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2067
2080
|
readonly name: "MORPHO_WRAPPER";
|
|
2068
2081
|
readonly inputs: readonly [];
|
|
2069
2082
|
readonly outputs: readonly [{
|
|
@@ -2094,6 +2107,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2094
2107
|
readonly stateMutability: "view";
|
|
2095
2108
|
}, {
|
|
2096
2109
|
readonly type: "function";
|
|
2110
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2097
2111
|
readonly name: "morphoWrapperDepositFor";
|
|
2098
2112
|
readonly inputs: readonly [{
|
|
2099
2113
|
readonly name: "receiver";
|
|
@@ -2108,6 +2122,7 @@ export declare const ethereumGeneralAdapter1Abi: readonly [{
|
|
|
2108
2122
|
readonly stateMutability: "nonpayable";
|
|
2109
2123
|
}, {
|
|
2110
2124
|
readonly type: "function";
|
|
2125
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
2111
2126
|
readonly name: "morphoWrapperWithdrawTo";
|
|
2112
2127
|
readonly inputs: readonly [{
|
|
2113
2128
|
readonly name: "receiver";
|
package/lib/cjs/abis.js
CHANGED
|
@@ -30,9 +30,11 @@ Object.defineProperty(exports, "preLiquidationAbi", { enumerable: true, get: fun
|
|
|
30
30
|
Object.defineProperty(exports, "bluePreLiquidationFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.preLiquidationFactoryAbi; } });
|
|
31
31
|
/** @deprecated Use `bluePreLiquidationFactoryAbi` or the raw `/blue/abis` subpath. */
|
|
32
32
|
Object.defineProperty(exports, "preLiquidationFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.preLiquidationFactoryAbi; } });
|
|
33
|
+
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
33
34
|
Object.defineProperty(exports, "publicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.publicAllocatorAbi; } });
|
|
34
35
|
Object.defineProperty(exports, "vaultV1AdapterAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterAbi; } });
|
|
35
36
|
Object.defineProperty(exports, "vaultV1AdapterFactoryAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1AdapterFactoryAbi; } });
|
|
37
|
+
/** @deprecated Vault V1 PublicAllocator support will be removed in the next major. Use `vaultV2BluePublicAllocatorAbi`. */
|
|
36
38
|
Object.defineProperty(exports, "vaultV1PublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV1PublicAllocatorAbi; } });
|
|
37
39
|
Object.defineProperty(exports, "vaultV2Abi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2Abi; } });
|
|
38
40
|
Object.defineProperty(exports, "vaultV2BluePublicAllocatorAbi", { enumerable: true, get: function () { return blue_sdk_viem_1.vaultV2BluePublicAllocatorAbi; } });
|
|
@@ -1322,7 +1324,12 @@ exports.generalAdapter1Abi = [
|
|
|
1322
1324
|
inputs: [],
|
|
1323
1325
|
},
|
|
1324
1326
|
];
|
|
1325
|
-
/**
|
|
1327
|
+
/**
|
|
1328
|
+
* ABI for the Ethereum-specific Bundler3 GeneralAdapter1 extension.
|
|
1329
|
+
*
|
|
1330
|
+
* MORPHO legacy token wrapping entries are deprecated and will be removed in the next major.
|
|
1331
|
+
* Use the current MORPHO token directly. Native-token and stETH wrapping remain supported.
|
|
1332
|
+
*/
|
|
1326
1333
|
exports.ethereumGeneralAdapter1Abi = [
|
|
1327
1334
|
...exports.generalAdapter1Abi,
|
|
1328
1335
|
{
|
|
@@ -1349,11 +1356,13 @@ exports.ethereumGeneralAdapter1Abi = [
|
|
|
1349
1356
|
internalType: "address",
|
|
1350
1357
|
},
|
|
1351
1358
|
{
|
|
1359
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1352
1360
|
name: "morphoToken",
|
|
1353
1361
|
type: "address",
|
|
1354
1362
|
internalType: "address",
|
|
1355
1363
|
},
|
|
1356
1364
|
{
|
|
1365
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1357
1366
|
name: "morphoWrapper",
|
|
1358
1367
|
type: "address",
|
|
1359
1368
|
internalType: "address",
|
|
@@ -1363,6 +1372,7 @@ exports.ethereumGeneralAdapter1Abi = [
|
|
|
1363
1372
|
},
|
|
1364
1373
|
{
|
|
1365
1374
|
type: "function",
|
|
1375
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1366
1376
|
name: "MORPHO_TOKEN",
|
|
1367
1377
|
inputs: [],
|
|
1368
1378
|
outputs: [
|
|
@@ -1376,6 +1386,7 @@ exports.ethereumGeneralAdapter1Abi = [
|
|
|
1376
1386
|
},
|
|
1377
1387
|
{
|
|
1378
1388
|
type: "function",
|
|
1389
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1379
1390
|
name: "MORPHO_WRAPPER",
|
|
1380
1391
|
inputs: [],
|
|
1381
1392
|
outputs: [
|
|
@@ -1415,6 +1426,7 @@ exports.ethereumGeneralAdapter1Abi = [
|
|
|
1415
1426
|
},
|
|
1416
1427
|
{
|
|
1417
1428
|
type: "function",
|
|
1429
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1418
1430
|
name: "morphoWrapperDepositFor",
|
|
1419
1431
|
inputs: [
|
|
1420
1432
|
{
|
|
@@ -1433,6 +1445,7 @@ exports.ethereumGeneralAdapter1Abi = [
|
|
|
1433
1445
|
},
|
|
1434
1446
|
{
|
|
1435
1447
|
type: "function",
|
|
1448
|
+
/** @deprecated MORPHO legacy token wrapping will be removed in the next major. Use the current MORPHO token directly. */
|
|
1436
1449
|
name: "morphoWrapperWithdrawTo",
|
|
1437
1450
|
inputs: [
|
|
1438
1451
|
{
|
|
@@ -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
|
};
|
|
@@ -3,6 +3,7 @@ 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
|
/**
|
|
@@ -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,
|
|
@@ -123,8 +123,21 @@ export declare const getBundlesTokenPermit: (params: {
|
|
|
123
123
|
readonly amount: bigint;
|
|
124
124
|
readonly requirementSignature?: TokenRequirementSignature;
|
|
125
125
|
}) => BundlesTokenPermit;
|
|
126
|
-
/**
|
|
127
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Normalizes a compact or serialized ECDSA signature for bundles permit tuples.
|
|
128
|
+
*
|
|
129
|
+
* @internal
|
|
130
|
+
*
|
|
131
|
+
* @param serializedSignature - Compact or serialized ECDSA signature.
|
|
132
|
+
* @param onInvalid - Error factory used when parsing or extracting the recovery identifier fails.
|
|
133
|
+
* @returns The normalized signature tuple.
|
|
134
|
+
* @throws {BundlesPermitMismatchError} when the signature is malformed.
|
|
135
|
+
*/
|
|
136
|
+
export declare const normalizeBundlesSignature: (serializedSignature: Hex, onInvalid?: (details: {
|
|
137
|
+
readonly expected: string;
|
|
138
|
+
readonly actual: Hex;
|
|
139
|
+
readonly cause?: unknown;
|
|
140
|
+
}) => Error) => {
|
|
128
141
|
readonly v: number;
|
|
129
142
|
readonly r: Hex;
|
|
130
143
|
readonly s: Hex;
|
|
@@ -188,6 +201,23 @@ export declare const selectBundlesSharesRequirementSignature: (signatures: reado
|
|
|
188
201
|
readonly requiredShareAllowance: bigint | undefined;
|
|
189
202
|
readonly expectedRequirement?: PermitAction;
|
|
190
203
|
}) => Erc2612RequirementSignature | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Selects the ERC-2612 vault-share permit for one exit from its immutable operation fields alone.
|
|
206
|
+
*
|
|
207
|
+
* @internal
|
|
208
|
+
*
|
|
209
|
+
* @param signatures - Signatures passed to the operation's `buildTx` function.
|
|
210
|
+
* @param expected - Immutable spender, amount, and deadline required by the operation.
|
|
211
|
+
* @returns The matching ERC-2612 signature, or `undefined` when no signature is supplied.
|
|
212
|
+
* @throws {BundlesPermitMismatchError} when the signature is not ERC-2612 or its spender, amount or
|
|
213
|
+
* deadline differ from the operation's. The nonce is not checked here: it is onchain state the
|
|
214
|
+
* vault's `permit` verifies at execution.
|
|
215
|
+
*/
|
|
216
|
+
export declare const selectBundlesSharesPermitSignature: (signatures: readonly RequirementSignature[] | undefined, expected: {
|
|
217
|
+
readonly spender: Address;
|
|
218
|
+
readonly amount: bigint;
|
|
219
|
+
readonly deadline: bigint;
|
|
220
|
+
}) => Erc2612RequirementSignature | undefined;
|
|
191
221
|
/** @internal Returns the exact referral fee deducted from a fixed gross asset amount. */
|
|
192
222
|
export declare const getBundlesReferralFeeAssets: (assets: bigint, referralFeePct: bigint) => bigint;
|
|
193
223
|
/** @internal Finalizes a direct VaultBundlesV1 transaction with metadata and immutable action data. */
|