@morpho-org/morpho-sdk 4.2.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +16 -16
  2. package/lib/cjs/actions/blue/borrow.d.ts +12 -2
  3. package/lib/cjs/actions/blue/borrow.js +7 -1
  4. package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +47 -0
  5. package/lib/cjs/actions/blue/buildAssetFundingActions.js +63 -0
  6. package/lib/cjs/actions/blue/refinance.d.ts +13 -3
  7. package/lib/cjs/actions/blue/refinance.js +8 -2
  8. package/lib/cjs/actions/blue/repay.d.ts +44 -43
  9. package/lib/cjs/actions/blue/repay.js +70 -59
  10. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +50 -41
  11. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +75 -54
  12. package/lib/cjs/actions/blue/resolveRepayFunding.d.ts +69 -0
  13. package/lib/cjs/actions/blue/resolveRepayFunding.js +82 -0
  14. package/lib/cjs/actions/blue/supply.d.ts +8 -8
  15. package/lib/cjs/actions/blue/supply.js +11 -35
  16. package/lib/cjs/actions/blue/supplyCollateral.d.ts +9 -9
  17. package/lib/cjs/actions/blue/supplyCollateral.js +12 -36
  18. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +19 -7
  19. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +17 -32
  20. package/lib/cjs/actions/blue/withdraw.d.ts +10 -2
  21. package/lib/cjs/actions/blue/withdraw.js +7 -1
  22. package/lib/cjs/actions/index.d.ts +1 -0
  23. package/lib/cjs/actions/index.js +1 -0
  24. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +49 -0
  25. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +111 -0
  26. package/lib/cjs/actions/requirements/blue/index.d.ts +1 -0
  27. package/lib/cjs/actions/requirements/blue/index.js +17 -0
  28. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +55 -0
  29. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +89 -0
  30. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +6 -5
  31. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +17 -5
  32. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +9 -7
  33. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +18 -4
  34. package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2.d.ts → encodeErc20Permit2Approve.d.ts} +11 -13
  35. package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2.js → encodeErc20Permit2Approve.js} +10 -14
  36. package/lib/cjs/actions/requirements/encode/index.d.ts +2 -1
  37. package/lib/cjs/actions/requirements/encode/index.js +2 -1
  38. package/lib/cjs/actions/requirements/{getRequirements.d.ts → generalAdapter/getGeneralAdapterRequirements.d.ts} +34 -20
  39. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +151 -0
  40. package/lib/{esm/actions/requirements/getRequirementsPermit.d.ts → cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts} +6 -14
  41. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +50 -0
  42. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +57 -0
  43. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +74 -0
  44. package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +3 -0
  45. package/lib/cjs/actions/requirements/generalAdapter/index.js +19 -0
  46. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +3 -2
  47. package/lib/cjs/actions/requirements/getRequirementsApproval.js +3 -2
  48. package/lib/cjs/actions/requirements/index.d.ts +2 -5
  49. package/lib/cjs/actions/requirements/index.js +2 -5
  50. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +29 -0
  51. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +48 -0
  52. package/lib/{esm/actions/requirements/getRequirementsAction.d.ts → cjs/actions/signatures/getTokenRequirementActions.d.ts} +17 -17
  53. package/lib/cjs/actions/{requirements/getRequirementsAction.js → signatures/getTokenRequirementActions.js} +26 -13
  54. package/lib/cjs/actions/signatures/index.d.ts +2 -0
  55. package/lib/cjs/actions/signatures/index.js +18 -0
  56. package/lib/cjs/actions/vaultV1/deposit.d.ts +6 -8
  57. package/lib/cjs/actions/vaultV1/deposit.js +11 -21
  58. package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +6 -6
  59. package/lib/cjs/actions/vaultV1/migrateToV2.js +12 -20
  60. package/lib/cjs/actions/vaultV2/deposit.d.ts +6 -8
  61. package/lib/cjs/actions/vaultV2/deposit.js +11 -21
  62. package/lib/cjs/addresses.d.ts +2 -2
  63. package/lib/cjs/addresses.js +2 -1
  64. package/lib/cjs/bundler/actions.d.ts +44 -4
  65. package/lib/cjs/bundler/actions.js +75 -2
  66. package/lib/cjs/bundler/types.d.ts +6 -0
  67. package/lib/cjs/constants.d.ts +2 -2
  68. package/lib/cjs/constants.js +3 -3
  69. package/lib/cjs/entities/blue/blue.d.ts +58 -33
  70. package/lib/cjs/entities/blue/blue.js +309 -189
  71. package/lib/cjs/entities/reallocationData.d.ts +0 -44
  72. package/lib/cjs/entities/reallocationData.js +3 -50
  73. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -9
  74. package/lib/cjs/entities/vaultV1/vaultV1.js +44 -34
  75. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +6 -6
  76. package/lib/cjs/entities/vaultV2/vaultV2.js +21 -16
  77. package/lib/cjs/errors.d.ts +3 -2
  78. package/lib/cjs/errors.js +5 -2
  79. package/lib/cjs/helpers/index.d.ts +1 -1
  80. package/lib/cjs/helpers/index.js +1 -2
  81. package/lib/cjs/helpers/validate.d.ts +2 -20
  82. package/lib/cjs/helpers/validate.js +2 -39
  83. package/lib/cjs/types/action.d.ts +164 -12
  84. package/lib/cjs/types/action.js +79 -5
  85. package/lib/cjs/types/error.d.ts +97 -2
  86. package/lib/cjs/types/error.js +113 -7
  87. package/lib/cjs/types.d.ts +2 -1
  88. package/lib/cjs/utils.d.ts +2 -2
  89. package/lib/cjs/utils.js +2 -4
  90. package/lib/esm/actions/blue/borrow.d.ts +12 -2
  91. package/lib/esm/actions/blue/borrow.js +7 -1
  92. package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +47 -0
  93. package/lib/esm/actions/blue/buildAssetFundingActions.js +59 -0
  94. package/lib/esm/actions/blue/refinance.d.ts +13 -3
  95. package/lib/esm/actions/blue/refinance.js +8 -2
  96. package/lib/esm/actions/blue/repay.d.ts +44 -43
  97. package/lib/esm/actions/blue/repay.js +71 -60
  98. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +50 -41
  99. package/lib/esm/actions/blue/repayWithdrawCollateral.js +76 -55
  100. package/lib/esm/actions/blue/resolveRepayFunding.d.ts +69 -0
  101. package/lib/esm/actions/blue/resolveRepayFunding.js +78 -0
  102. package/lib/esm/actions/blue/supply.d.ts +8 -8
  103. package/lib/esm/actions/blue/supply.js +12 -36
  104. package/lib/esm/actions/blue/supplyCollateral.d.ts +9 -9
  105. package/lib/esm/actions/blue/supplyCollateral.js +13 -37
  106. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +19 -7
  107. package/lib/esm/actions/blue/supplyCollateralBorrow.js +18 -33
  108. package/lib/esm/actions/blue/withdraw.d.ts +10 -2
  109. package/lib/esm/actions/blue/withdraw.js +7 -1
  110. package/lib/esm/actions/index.d.ts +1 -0
  111. package/lib/esm/actions/index.js +1 -0
  112. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +49 -0
  113. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +107 -0
  114. package/lib/esm/actions/requirements/blue/index.d.ts +1 -0
  115. package/lib/esm/actions/requirements/blue/index.js +1 -0
  116. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +55 -0
  117. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +85 -0
  118. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +6 -5
  119. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +19 -7
  120. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +9 -7
  121. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +20 -6
  122. package/lib/esm/actions/requirements/encode/{encodeErc20Permit2.d.ts → encodeErc20Permit2Approve.d.ts} +11 -13
  123. package/lib/esm/actions/requirements/encode/{encodeErc20Permit2.js → encodeErc20Permit2Approve.js} +8 -12
  124. package/lib/esm/actions/requirements/encode/index.d.ts +2 -1
  125. package/lib/esm/actions/requirements/encode/index.js +2 -1
  126. package/lib/esm/actions/requirements/{getRequirements.d.ts → generalAdapter/getGeneralAdapterRequirements.d.ts} +34 -20
  127. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +147 -0
  128. package/lib/{cjs/actions/requirements/getRequirementsPermit.d.ts → esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts} +6 -14
  129. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +46 -0
  130. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +57 -0
  131. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +70 -0
  132. package/lib/esm/actions/requirements/generalAdapter/index.d.ts +3 -0
  133. package/lib/esm/actions/requirements/generalAdapter/index.js +3 -0
  134. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +3 -2
  135. package/lib/esm/actions/requirements/getRequirementsApproval.js +3 -2
  136. package/lib/esm/actions/requirements/index.d.ts +2 -5
  137. package/lib/esm/actions/requirements/index.js +2 -5
  138. package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +29 -0
  139. package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +44 -0
  140. package/lib/{cjs/actions/requirements/getRequirementsAction.d.ts → esm/actions/signatures/getTokenRequirementActions.d.ts} +17 -17
  141. package/lib/esm/actions/{requirements/getRequirementsAction.js → signatures/getTokenRequirementActions.js} +24 -11
  142. package/lib/esm/actions/signatures/index.d.ts +2 -0
  143. package/lib/esm/actions/signatures/index.js +2 -0
  144. package/lib/esm/actions/vaultV1/deposit.d.ts +6 -8
  145. package/lib/esm/actions/vaultV1/deposit.js +11 -21
  146. package/lib/esm/actions/vaultV1/migrateToV2.d.ts +6 -6
  147. package/lib/esm/actions/vaultV1/migrateToV2.js +12 -20
  148. package/lib/esm/actions/vaultV2/deposit.d.ts +6 -8
  149. package/lib/esm/actions/vaultV2/deposit.js +11 -21
  150. package/lib/esm/addresses.d.ts +2 -2
  151. package/lib/esm/addresses.js +1 -1
  152. package/lib/esm/bundler/actions.d.ts +44 -4
  153. package/lib/esm/bundler/actions.js +77 -4
  154. package/lib/esm/bundler/types.d.ts +6 -0
  155. package/lib/esm/constants.d.ts +2 -2
  156. package/lib/esm/constants.js +2 -2
  157. package/lib/esm/entities/blue/blue.d.ts +58 -33
  158. package/lib/esm/entities/blue/blue.js +311 -191
  159. package/lib/esm/entities/reallocationData.d.ts +0 -44
  160. package/lib/esm/entities/reallocationData.js +2 -49
  161. package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -9
  162. package/lib/esm/entities/vaultV1/vaultV1.js +46 -36
  163. package/lib/esm/entities/vaultV2/vaultV2.d.ts +6 -6
  164. package/lib/esm/entities/vaultV2/vaultV2.js +23 -18
  165. package/lib/esm/errors.d.ts +3 -2
  166. package/lib/esm/errors.js +2 -1
  167. package/lib/esm/helpers/index.d.ts +1 -1
  168. package/lib/esm/helpers/index.js +1 -1
  169. package/lib/esm/helpers/validate.d.ts +2 -20
  170. package/lib/esm/helpers/validate.js +2 -38
  171. package/lib/esm/types/action.d.ts +164 -12
  172. package/lib/esm/types/action.js +75 -4
  173. package/lib/esm/types/error.d.ts +97 -2
  174. package/lib/esm/types/error.js +107 -5
  175. package/lib/esm/types.d.ts +2 -1
  176. package/lib/esm/utils.d.ts +2 -2
  177. package/lib/esm/utils.js +2 -2
  178. package/package.json +22 -21
  179. package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.d.ts +0 -37
  180. package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.js +0 -71
  181. package/lib/cjs/actions/requirements/getRequirements.js +0 -112
  182. package/lib/cjs/actions/requirements/getRequirementsPermit.js +0 -57
  183. package/lib/cjs/actions/requirements/getRequirementsPermit2.d.ts +0 -63
  184. package/lib/cjs/actions/requirements/getRequirementsPermit2.js +0 -85
  185. package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.d.ts +0 -37
  186. package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.js +0 -67
  187. package/lib/esm/actions/requirements/getRequirements.js +0 -108
  188. package/lib/esm/actions/requirements/getRequirementsPermit.js +0 -53
  189. package/lib/esm/actions/requirements/getRequirementsPermit2.d.ts +0 -63
  190. package/lib/esm/actions/requirements/getRequirementsPermit2.js +0 -81
  191. package/src/index.ts +0 -4
@@ -132,6 +132,8 @@ export interface BlueRepayAction extends BaseAction<"blueRepay", {
132
132
  onBehalf: Address;
133
133
  receiver: Address;
134
134
  maxSharePrice: bigint;
135
+ /** Native token wrapped into wNative to fund the repay. Present when `> 0n`. */
136
+ nativeAmount?: bigint;
135
137
  }> {
136
138
  }
137
139
  export interface BlueWithdrawCollateralAction extends BaseAction<"blueWithdrawCollateral", {
@@ -150,6 +152,8 @@ export interface BlueRepayWithdrawCollateralAction extends BaseAction<"blueRepay
150
152
  maxSharePrice: bigint;
151
153
  onBehalf: Address;
152
154
  receiver: Address;
155
+ /** Native token wrapped into wNative to fund the repay. Present when `> 0n`. */
156
+ nativeAmount?: bigint;
153
157
  }> {
154
158
  }
155
159
  export interface BlueRefinanceAction extends BaseAction<"blueRefinance", {
@@ -171,21 +175,66 @@ export interface BlueRefinanceAction extends BaseAction<"blueRefinance", {
171
175
  * - `shares`: operate on an exact share count (typical for full position closes,
172
176
  * immune to interest accrual between tx construction and execution).
173
177
  *
174
- * Used by repay (asserts on borrow side) and withdraw (asserts on supply side).
178
+ * Used by withdraw (asserts on supply side). Repay uses {@link RepayAmountArgs},
179
+ * which additionally supports native wrapping.
175
180
  */
176
181
  export type AssetsOrSharesArgs = {
177
182
  assets: bigint;
178
183
  } | {
179
184
  shares: bigint;
180
185
  };
181
- /** @deprecated Use {@link AssetsOrSharesArgs}. Kept as an alias for back-compat. */
182
- export type RepayAmountArgs = AssetsOrSharesArgs;
183
- export interface MorphoAuthorizationAction extends BaseAction<"morphoAuthorization", {
186
+ /**
187
+ * Repay funding sources for the **entity layer** (`MorphoBlue.repay` /
188
+ * `MorphoBlue.repayWithdrawCollateral`), which computes the loan-token
189
+ * `transferAmount` itself from live market state.
190
+ *
191
+ * - **assets mode** ({@link DepositAmountArgs}): repay an exact asset total of
192
+ * `amount` (ERC-20) + `nativeAmount` (wrapped native). Additive — mirrors `blueSupply`.
193
+ * - **shares mode** (`{ shares }`): repay an exact borrow-share count (full close,
194
+ * immune to interest accrual). `nativeAmount` funds part of the transfer.
195
+ *
196
+ * `nativeAmount` requires the market's loan token to be the chain's wNative.
197
+ */
198
+ export type RepayAmountArgs = DepositAmountArgs | {
199
+ shares: bigint;
200
+ nativeAmount?: bigint;
201
+ };
202
+ /**
203
+ * Repay funding sources for the **action layer** (`blueRepay` /
204
+ * `blueRepayWithdrawCollateral`) — a flat, pre-resolved shape. The entity layer
205
+ * ({@link RepayAmountArgs}) derives these from live market state; the action does no
206
+ * amount arithmetic. The mode is discriminated on `shares`:
207
+ *
208
+ * - **assets mode** (`shares` unset/`0n`): repays `transferAmount` assets
209
+ * (`= amount + nativeAmount`, additive like `blueSupply`), pulling `amount` ERC-20
210
+ * and wrapping `nativeAmount`. No residual.
211
+ * - **shares mode** (`shares > 0n`): repays an exact borrow-share count (full close),
212
+ * pulling `transferAmount` ERC-20 (already net of native) and wrapping `nativeAmount`;
213
+ * the residual loan token is skimmed back to `receiver`.
214
+ *
215
+ * `nativeAmount` requires the market's loan token to be the chain's wNative.
216
+ */
217
+ export interface RepayActionAmountArgs {
218
+ /** Assets-mode ERC-20 loan tokens pulled from the payer. Omit (or `0n`) in shares mode. */
219
+ amount?: bigint;
220
+ /** Shares-mode borrow shares to repay (full close). Omit (or `0n`) in assets mode. */
221
+ shares?: bigint;
222
+ /** Native ETH wrapped into wNative to help fund the repay. Loan token must be wNative. */
223
+ nativeAmount?: bigint;
224
+ /**
225
+ * Loan tokens routed into `GeneralAdapter1`. Assets mode: the total repaid
226
+ * (`amount + nativeAmount`). Shares mode: the ERC-20 pulled
227
+ * (`toBorrowAssets(shares) − nativeAmount`).
228
+ */
229
+ transferAmount: bigint;
230
+ }
231
+ /** Metadata for a Blue authorization prerequisite transaction. */
232
+ export interface BlueAuthorizationAction extends BaseAction<"blueAuthorization", {
184
233
  authorized: Address;
185
234
  isAuthorized: boolean;
186
235
  }> {
187
236
  }
188
- export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueWithdrawAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueRefinanceAction | MorphoAuthorizationAction;
237
+ export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueWithdrawAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueRefinanceAction | BlueAuthorizationAction;
189
238
  export interface Transaction<TAction extends BaseAction = TransactionAction> {
190
239
  readonly to: Address;
191
240
  readonly value: bigint;
@@ -223,9 +272,36 @@ export interface Permit2Args {
223
272
  deadline: bigint;
224
273
  expiration: bigint;
225
274
  }
226
- export interface Requirement {
227
- sign: (client: WalletClient, userAddress: Address) => Promise<RequirementSignature>;
228
- action: PermitAction | Permit2Action;
275
+ /**
276
+ * Signed Morpho Blue authorization payload produced when an integrator opts into offchain
277
+ * signatures (`supportSignature: true`). Consumed by the action layer to emit a
278
+ * `setAuthorizationWithSig` bundler call in place of a standalone `setAuthorization` transaction.
279
+ */
280
+ export interface AuthorizationSignatureArgs {
281
+ /** Account granting the authorization (the position owner). */
282
+ owner: Address;
283
+ /** Account being authorized to operate on Morpho on the owner's behalf (GeneralAdapter1). */
284
+ authorized: Address;
285
+ /** Whether the authorization is granted (`true`) or revoked (`false`). */
286
+ isAuthorized: boolean;
287
+ /** Morpho authorization nonce consumed by the signature. */
288
+ nonce: bigint;
289
+ /** Signature deadline timestamp in seconds. */
290
+ deadline: bigint;
291
+ /** EIP-712 signature over the Morpho `Authorization` typed data. */
292
+ signature: Hex;
293
+ }
294
+ /**
295
+ * A signable approval / authorization requirement. `sign()` returns the matching
296
+ * {@link RequirementSignature}; `action` describes the requirement without signing.
297
+ *
298
+ * Generic over the signature it produces so permit encoders narrow to
299
+ * {@link PermitRequirementSignature} and the authorization encoder to
300
+ * {@link AuthorizationRequirementSignature}; the default keeps the broad union for mixed arrays.
301
+ */
302
+ export interface Requirement<TSignature extends RequirementSignature = RequirementSignature> {
303
+ sign: (client: WalletClient, userAddress: Address) => Promise<TSignature>;
304
+ action: TSignature["action"];
229
305
  }
230
306
  export interface PermitAction extends BaseAction<"permit", {
231
307
  spender: Address;
@@ -240,10 +316,86 @@ export interface Permit2Action extends BaseAction<"permit2", {
240
316
  expiration: bigint;
241
317
  }> {
242
318
  }
243
- export interface RequirementSignature {
319
+ /**
320
+ * Signable Morpho authorization requirement. Emitted by the entity layer when a bundled path
321
+ * needs GeneralAdapter1 authorized and the client opts into offchain signatures.
322
+ */
323
+ export interface AuthorizationAction extends BaseAction<"authorization", {
324
+ authorized: Address;
325
+ isAuthorized: boolean;
326
+ deadline: bigint;
327
+ }> {
328
+ }
329
+ /** A signed ERC-2612 permit or Permit2 approval requirement. */
330
+ export interface PermitRequirementSignature {
244
331
  args: PermitArgs | Permit2Args;
245
332
  action: PermitAction | Permit2Action;
246
333
  }
247
- export declare function isRequirementApproval(requirement: Transaction<ERC20ApprovalAction> | Transaction<MorphoAuthorizationAction> | Requirement | undefined): requirement is Transaction<ERC20ApprovalAction>;
248
- export declare function isRequirementAuthorization(requirement: Transaction<ERC20ApprovalAction> | Transaction<MorphoAuthorizationAction> | Requirement | undefined): requirement is Transaction<MorphoAuthorizationAction>;
249
- export declare function isRequirementSignature(requirement: Transaction<ERC20ApprovalAction> | Transaction<MorphoAuthorizationAction> | Requirement | undefined): requirement is Requirement;
334
+ /** A signed Morpho authorization requirement (consumed via `setAuthorizationWithSig`). */
335
+ export interface AuthorizationRequirementSignature {
336
+ args: AuthorizationSignatureArgs;
337
+ action: AuthorizationAction;
338
+ }
339
+ /**
340
+ * The deep-frozen output of `Requirement.sign()`. Discriminated on `action.type`:
341
+ * `"permit"` / `"permit2"` carry token-approval args, `"authorization"` carries the signed
342
+ * Morpho authorization. Narrow with {@link isPermitSignature} / {@link isAuthorizationSignature}.
343
+ */
344
+ export type RequirementSignature = PermitRequirementSignature | AuthorizationRequirementSignature;
345
+ /** Bundler3 token signature requirement. */
346
+ export type Bundler3TokenSignatureRequirement = Requirement<PermitRequirementSignature>;
347
+ export declare function isRequirementApproval(requirement: unknown): requirement is Transaction<ERC20ApprovalAction>;
348
+ /** Checks whether an action requirement is a Blue authorization transaction. */
349
+ export declare function isRequirementBlueAuthorization(requirement: unknown): requirement is Transaction<BlueAuthorizationAction>;
350
+ export declare function isRequirementSignature<T extends RequirementSignature = RequirementSignature>(requirement: Transaction<ERC20ApprovalAction> | Transaction<BlueAuthorizationAction> | Requirement<T> | undefined): requirement is Requirement<T>;
351
+ /**
352
+ * Narrows a {@link RequirementSignature} to a permit / Permit2 token-approval signature.
353
+ *
354
+ * @param signature - The signed requirement to test.
355
+ * @returns `true` when `signature.action.type` is `"permit"` or `"permit2"`.
356
+ */
357
+ export declare function isPermitSignature(signature: RequirementSignature): signature is PermitRequirementSignature;
358
+ /**
359
+ * Narrows a {@link RequirementSignature} to a signed Morpho authorization.
360
+ *
361
+ * @param signature - The signed requirement to test.
362
+ * @returns `true` when `signature.action.type` is `"authorization"`.
363
+ */
364
+ export declare function isAuthorizationSignature(signature: RequirementSignature): signature is AuthorizationRequirementSignature;
365
+ /** The typed permit / authorization slots a bundled path consumes, split from a `buildTx` array. */
366
+ export interface SelectedRequirementSignatures {
367
+ /** The single permit / Permit2 signature, when present. */
368
+ permit?: PermitRequirementSignature;
369
+ /** The single Morpho authorization signature, when present. */
370
+ authorization?: AuthorizationRequirementSignature;
371
+ }
372
+ /**
373
+ * Splits a `buildTx` signature array into its typed permit / authorization slots, rejecting
374
+ * ambiguous or unexpected input so a path never silently consumes the wrong signature.
375
+ *
376
+ * A bundled path consumes at most one permit and one authorization signature. Passing several of
377
+ * the same kind, or a kind the path does not consume, is rejected with a typed error rather than
378
+ * silently dropping the extras — the latter could otherwise leave a required authorization or
379
+ * permit unsigned (and the bundle reverting on-chain) or apply the wrong signature.
380
+ *
381
+ * @param signatures - The signatures passed to `buildTx`.
382
+ * @param accepts - Which signature kinds this operation consumes.
383
+ * @param accepts.permit - Whether a permit / Permit2 signature is consumed.
384
+ * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
385
+ * @returns The single permit and/or authorization signature, when present.
386
+ * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
387
+ * @throws {UnexpectedRequirementSignatureError} when a signature of a kind the operation does not consume is present.
388
+ * @example
389
+ * ```ts
390
+ * import { selectRequirementSignatures } from "@morpho-org/morpho-sdk";
391
+ *
392
+ * const { permit, authorization } = selectRequirementSignatures(signatures, {
393
+ * permit: true,
394
+ * authorization: true,
395
+ * });
396
+ * ```
397
+ */
398
+ export declare function selectRequirementSignatures(signatures: readonly RequirementSignature[] | undefined, accepts: {
399
+ permit?: boolean;
400
+ authorization?: boolean;
401
+ }): SelectedRequirementSignatures;
@@ -1,21 +1,92 @@
1
+ import { AmbiguousRequirementSignaturesError, UnexpectedRequirementSignatureError, } from "./error.js";
1
2
  export function isRequirementApproval(requirement) {
2
- return (requirement !== undefined &&
3
+ return (typeof requirement === "object" &&
4
+ requirement !== null &&
3
5
  "to" in requirement &&
4
6
  "value" in requirement &&
5
7
  "data" in requirement &&
6
8
  "action" in requirement &&
9
+ typeof requirement.action === "object" &&
10
+ requirement.action !== null &&
11
+ "type" in requirement.action &&
7
12
  requirement.action.type === "erc20Approval");
8
13
  }
9
- export function isRequirementAuthorization(requirement) {
10
- return (requirement !== undefined &&
14
+ /** Checks whether an action requirement is a Blue authorization transaction. */
15
+ export function isRequirementBlueAuthorization(requirement) {
16
+ return (typeof requirement === "object" &&
17
+ requirement !== null &&
11
18
  "to" in requirement &&
12
19
  "value" in requirement &&
13
20
  "data" in requirement &&
14
21
  "action" in requirement &&
15
- requirement.action.type === "morphoAuthorization");
22
+ typeof requirement.action === "object" &&
23
+ requirement.action !== null &&
24
+ "type" in requirement.action &&
25
+ requirement.action.type === "blueAuthorization");
16
26
  }
17
27
  export function isRequirementSignature(requirement) {
18
28
  return (requirement !== undefined &&
29
+ typeof requirement === "object" &&
30
+ requirement !== null &&
19
31
  "sign" in requirement &&
20
32
  typeof requirement.sign === "function");
21
33
  }
34
+ /**
35
+ * Narrows a {@link RequirementSignature} to a permit / Permit2 token-approval signature.
36
+ *
37
+ * @param signature - The signed requirement to test.
38
+ * @returns `true` when `signature.action.type` is `"permit"` or `"permit2"`.
39
+ */
40
+ export function isPermitSignature(signature) {
41
+ return (signature.action.type === "permit" || signature.action.type === "permit2");
42
+ }
43
+ /**
44
+ * Narrows a {@link RequirementSignature} to a signed Morpho authorization.
45
+ *
46
+ * @param signature - The signed requirement to test.
47
+ * @returns `true` when `signature.action.type` is `"authorization"`.
48
+ */
49
+ export function isAuthorizationSignature(signature) {
50
+ return signature.action.type === "authorization";
51
+ }
52
+ /**
53
+ * Splits a `buildTx` signature array into its typed permit / authorization slots, rejecting
54
+ * ambiguous or unexpected input so a path never silently consumes the wrong signature.
55
+ *
56
+ * A bundled path consumes at most one permit and one authorization signature. Passing several of
57
+ * the same kind, or a kind the path does not consume, is rejected with a typed error rather than
58
+ * silently dropping the extras — the latter could otherwise leave a required authorization or
59
+ * permit unsigned (and the bundle reverting on-chain) or apply the wrong signature.
60
+ *
61
+ * @param signatures - The signatures passed to `buildTx`.
62
+ * @param accepts - Which signature kinds this operation consumes.
63
+ * @param accepts.permit - Whether a permit / Permit2 signature is consumed.
64
+ * @param accepts.authorization - Whether a Morpho authorization signature is consumed.
65
+ * @returns The single permit and/or authorization signature, when present.
66
+ * @throws {AmbiguousRequirementSignaturesError} when more than one signature of an accepted kind is present.
67
+ * @throws {UnexpectedRequirementSignatureError} when a signature of a kind the operation does not consume is present.
68
+ * @example
69
+ * ```ts
70
+ * import { selectRequirementSignatures } from "@morpho-org/morpho-sdk";
71
+ *
72
+ * const { permit, authorization } = selectRequirementSignatures(signatures, {
73
+ * permit: true,
74
+ * authorization: true,
75
+ * });
76
+ * ```
77
+ */
78
+ export function selectRequirementSignatures(signatures, accepts) {
79
+ if (signatures == null)
80
+ return {};
81
+ const permits = signatures.filter(isPermitSignature);
82
+ const authorizations = signatures.filter(isAuthorizationSignature);
83
+ if (!accepts.permit && permits.length > 0)
84
+ throw new UnexpectedRequirementSignatureError("permit");
85
+ if (!accepts.authorization && authorizations.length > 0)
86
+ throw new UnexpectedRequirementSignatureError("authorization");
87
+ if (permits.length > 1)
88
+ throw new AmbiguousRequirementSignaturesError("permit", permits.length);
89
+ if (authorizations.length > 1)
90
+ throw new AmbiguousRequirementSignaturesError("authorization", authorizations.length);
91
+ return { permit: permits[0], authorization: authorizations[0] };
92
+ }
@@ -43,6 +43,67 @@ export declare namespace BundlerErrors {
43
43
  */
44
44
  constructor(type: string, chainId: number);
45
45
  }
46
+ /**
47
+ * Thrown when a Morpho authorization signature names a forbidden `authorized` account
48
+ * (for example Bundler3 itself), which would grant operator rights to an unintended address.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { BundlerErrors } from "@morpho-org/morpho-sdk";
53
+ *
54
+ * if (error instanceof BundlerErrors.UnexpectedSignature) {
55
+ * // Re-sign the authorization targeting GeneralAdapter1.
56
+ * }
57
+ * ```
58
+ */
59
+ class UnexpectedSignature extends Error {
60
+ /**
61
+ * @param authorized - The forbidden `authorized` address carried by the signature.
62
+ */
63
+ constructor(authorized: Address);
64
+ }
65
+ }
66
+ /**
67
+ * Thrown when `buildTx` receives more than one requirement signature of the same kind.
68
+ *
69
+ * A bundled path consumes at most one permit and one authorization signature; passing several of
70
+ * the same kind is ambiguous and would silently drop all but the first, so it is rejected instead.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * import { AmbiguousRequirementSignaturesError } from "@morpho-org/morpho-sdk";
75
+ *
76
+ * if (error instanceof AmbiguousRequirementSignaturesError) {
77
+ * // Pass a single permit (and at most one authorization) signature to buildTx.
78
+ * }
79
+ * ```
80
+ */
81
+ export declare class AmbiguousRequirementSignaturesError extends Error {
82
+ /**
83
+ * @param kind - The over-supplied signature kind (`"permit"` or `"authorization"`).
84
+ * @param count - How many signatures of that kind were received.
85
+ */
86
+ constructor(kind: "permit" | "authorization", count: number);
87
+ }
88
+ /**
89
+ * Thrown when `buildTx` receives a requirement signature of a kind the operation does not consume
90
+ * (for example an authorization signature on a plain supply path). Surfacing it prevents a signed
91
+ * authorization or permit from being silently ignored.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * import { UnexpectedRequirementSignatureError } from "@morpho-org/morpho-sdk";
96
+ *
97
+ * if (error instanceof UnexpectedRequirementSignatureError) {
98
+ * // Remove the signature this operation does not use from the buildTx array.
99
+ * }
100
+ * ```
101
+ */
102
+ export declare class UnexpectedRequirementSignatureError extends Error {
103
+ /**
104
+ * @param kind - The unexpected signature kind (`"permit"` or `"authorization"`).
105
+ */
106
+ constructor(kind: "permit" | "authorization");
46
107
  }
47
108
  /** Thrown when an asset amount is required to be positive but is zero or negative. */
48
109
  export declare class NonPositiveAssetAmountError extends Error {
@@ -72,6 +133,18 @@ export declare class MissingClientPropertyError extends Error {
72
133
  export declare class ApprovalAmountLessThanSpendAmountError extends Error {
73
134
  constructor();
74
135
  }
136
+ /** Thrown when a requirement encoder targets an unsupported spender. */
137
+ export declare class UnsupportedErc20ApprovalSpenderError extends Error {
138
+ constructor(params: {
139
+ readonly spender: Address;
140
+ readonly chainId: number;
141
+ readonly generalAdapter1: Address;
142
+ readonly permit2?: Address;
143
+ readonly midnight?: Address;
144
+ readonly midnightBundles?: Address;
145
+ readonly supportedSpenders?: readonly (Address | undefined)[];
146
+ });
147
+ }
75
148
  /** Thrown when a slippage tolerance is negative. */
76
149
  export declare class NegativeSlippageToleranceError extends Error {
77
150
  constructor(slippageTolerance: bigint);
@@ -171,11 +244,22 @@ export declare class ReallocationWithdrawalOnTargetMarketError extends Error {
171
244
  export declare class UnsortedReallocationWithdrawalsError extends Error {
172
245
  constructor(vault: string, marketId: string);
173
246
  }
174
- /** Thrown when a market repay's `transferAmount` is zero or negative. */
247
+ /**
248
+ * Thrown when a market repay's `transferAmount` is zero or negative.
249
+ *
250
+ * @deprecated No longer thrown. The repay action layer no longer validates `transferAmount`
251
+ * directly (assets mode uses {@link NonPositiveRepayAmountError}; shares mode allows a zero
252
+ * ERC-20 transfer for fully-native repays). Retained as exported API for back-compat; slated
253
+ * for removal in a future major.
254
+ */
175
255
  export declare class NonPositiveTransferAmountError extends Error {
176
256
  constructor(market: string);
177
257
  }
178
- /** Thrown when a market repay in assets mode has `transferAmount !== assets` (asset-mode requires exact transfer). */
258
+ /**
259
+ * Thrown when a market repay in assets mode has `transferAmount !== amount + nativeAmount` — the
260
+ * pre-resolved ERC-20 pull plus the wrapped native must equal the assets repaid, so the bundle
261
+ * neither strands over-pulled loan tokens on `GeneralAdapter1` nor under-funds the repay.
262
+ */
179
263
  export declare class TransferAmountNotEqualToAssetsError extends Error {
180
264
  constructor(params: {
181
265
  transferAmount: bigint;
@@ -183,6 +267,17 @@ export declare class TransferAmountNotEqualToAssetsError extends Error {
183
267
  market: string;
184
268
  });
185
269
  }
270
+ /**
271
+ * Thrown when a shares-mode repay's `nativeAmount` exceeds `transferAmount`, which
272
+ * would make the ERC-20 amount to pull (`transferAmount − nativeAmount`) negative.
273
+ */
274
+ export declare class NativeAmountExceedsTransferAmountError extends Error {
275
+ constructor(params: {
276
+ nativeAmount: bigint;
277
+ transferAmount: bigint;
278
+ market: string;
279
+ });
280
+ }
186
281
  /** Thrown when a market repay specifies both `assets` and `shares` as non-zero (modes are mutually exclusive). */
187
282
  export declare class MutuallyExclusiveRepayAmountsError extends Error {
188
283
  constructor(market: string);
@@ -49,7 +49,75 @@ export var BundlerErrors;
49
49
  }
50
50
  }
51
51
  BundlerErrors.UnexpectedAction = UnexpectedAction;
52
+ /**
53
+ * Thrown when a Morpho authorization signature names a forbidden `authorized` account
54
+ * (for example Bundler3 itself), which would grant operator rights to an unintended address.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * import { BundlerErrors } from "@morpho-org/morpho-sdk";
59
+ *
60
+ * if (error instanceof BundlerErrors.UnexpectedSignature) {
61
+ * // Re-sign the authorization targeting GeneralAdapter1.
62
+ * }
63
+ * ```
64
+ */
65
+ class UnexpectedSignature extends Error {
66
+ /**
67
+ * @param authorized - The forbidden `authorized` address carried by the signature.
68
+ */
69
+ constructor(authorized) {
70
+ super(`unexpected signature authorizing "${authorized}"`);
71
+ }
72
+ }
73
+ BundlerErrors.UnexpectedSignature = UnexpectedSignature;
52
74
  })(BundlerErrors || (BundlerErrors = {}));
75
+ /**
76
+ * Thrown when `buildTx` receives more than one requirement signature of the same kind.
77
+ *
78
+ * A bundled path consumes at most one permit and one authorization signature; passing several of
79
+ * the same kind is ambiguous and would silently drop all but the first, so it is rejected instead.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * import { AmbiguousRequirementSignaturesError } from "@morpho-org/morpho-sdk";
84
+ *
85
+ * if (error instanceof AmbiguousRequirementSignaturesError) {
86
+ * // Pass a single permit (and at most one authorization) signature to buildTx.
87
+ * }
88
+ * ```
89
+ */
90
+ export class AmbiguousRequirementSignaturesError extends Error {
91
+ /**
92
+ * @param kind - The over-supplied signature kind (`"permit"` or `"authorization"`).
93
+ * @param count - How many signatures of that kind were received.
94
+ */
95
+ constructor(kind, count) {
96
+ super(`Expected at most one ${kind} signature but received ${count}. Pass a single ${kind} signature to buildTx.`);
97
+ }
98
+ }
99
+ /**
100
+ * Thrown when `buildTx` receives a requirement signature of a kind the operation does not consume
101
+ * (for example an authorization signature on a plain supply path). Surfacing it prevents a signed
102
+ * authorization or permit from being silently ignored.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * import { UnexpectedRequirementSignatureError } from "@morpho-org/morpho-sdk";
107
+ *
108
+ * if (error instanceof UnexpectedRequirementSignatureError) {
109
+ * // Remove the signature this operation does not use from the buildTx array.
110
+ * }
111
+ * ```
112
+ */
113
+ export class UnexpectedRequirementSignatureError extends Error {
114
+ /**
115
+ * @param kind - The unexpected signature kind (`"permit"` or `"authorization"`).
116
+ */
117
+ constructor(kind) {
118
+ super(`Received a ${kind} signature that this operation does not consume. Remove it from the buildTx signatures array.`);
119
+ }
120
+ }
53
121
  /** Thrown when an asset amount is required to be positive but is zero or negative. */
54
122
  export class NonPositiveAssetAmountError extends Error {
55
123
  constructor(origin) {
@@ -92,6 +160,20 @@ export class ApprovalAmountLessThanSpendAmountError extends Error {
92
160
  super("Approval amount is less than spend amount");
93
161
  }
94
162
  }
163
+ /** Thrown when a requirement encoder targets an unsupported spender. */
164
+ export class UnsupportedErc20ApprovalSpenderError extends Error {
165
+ constructor(params) {
166
+ const supported = (params.supportedSpenders ?? [
167
+ params.generalAdapter1,
168
+ params.permit2,
169
+ params.midnight,
170
+ params.midnightBundles,
171
+ ])
172
+ .filter((address) => address != null)
173
+ .join('", "');
174
+ super(`Requirement spender "${params.spender}" is not supported on chain "${params.chainId}". Use "${supported}".`);
175
+ }
176
+ }
95
177
  /** Thrown when a slippage tolerance is negative. */
96
178
  export class NegativeSlippageToleranceError extends Error {
97
179
  constructor(slippageTolerance) {
@@ -119,13 +201,13 @@ export class EmptyDeallocationsError extends Error {
119
201
  /** Thrown when a deposit's amount differs from the amount the supplied permit / permit2 signature was issued for. */
120
202
  export class DepositAmountMismatchError extends Error {
121
203
  constructor(depositAmount, signatureAmount) {
122
- super(`Deposit amount ${depositAmount} does not match requirement signature amount ${signatureAmount}`);
204
+ super(`Deposit amount "${depositAmount}" does not match requirement signature amount "${signatureAmount}"`);
123
205
  }
124
206
  }
125
207
  /** Thrown when a deposit's asset differs from the asset the supplied permit / permit2 signature was issued for. */
126
208
  export class DepositAssetMismatchError extends Error {
127
209
  constructor(depositAsset, signatureAsset) {
128
- super(`Deposit asset ${depositAsset} does not match requirement signature asset ${signatureAsset}`);
210
+ super(`Deposit asset "${depositAsset}" does not match requirement signature asset "${signatureAsset}"`);
129
211
  }
130
212
  }
131
213
  /** Thrown when a `permit2` requirement signature is missing the `expiration` field. */
@@ -238,16 +320,36 @@ export class UnsortedReallocationWithdrawalsError extends Error {
238
320
  super(`Reallocation withdrawals must be strictly sorted by market ID for vault ${vault}. Market ${marketId} is out of order.`);
239
321
  }
240
322
  }
241
- /** Thrown when a market repay's `transferAmount` is zero or negative. */
323
+ /**
324
+ * Thrown when a market repay's `transferAmount` is zero or negative.
325
+ *
326
+ * @deprecated No longer thrown. The repay action layer no longer validates `transferAmount`
327
+ * directly (assets mode uses {@link NonPositiveRepayAmountError}; shares mode allows a zero
328
+ * ERC-20 transfer for fully-native repays). Retained as exported API for back-compat; slated
329
+ * for removal in a future major.
330
+ */
242
331
  export class NonPositiveTransferAmountError extends Error {
243
332
  constructor(market) {
244
333
  super(`Transfer amount must be positive for market: ${market}`);
245
334
  }
246
335
  }
247
- /** Thrown when a market repay in assets mode has `transferAmount !== assets` (asset-mode requires exact transfer). */
336
+ /**
337
+ * Thrown when a market repay in assets mode has `transferAmount !== amount + nativeAmount` — the
338
+ * pre-resolved ERC-20 pull plus the wrapped native must equal the assets repaid, so the bundle
339
+ * neither strands over-pulled loan tokens on `GeneralAdapter1` nor under-funds the repay.
340
+ */
248
341
  export class TransferAmountNotEqualToAssetsError extends Error {
249
342
  constructor(params) {
250
- super(`Transfer amount ${params.transferAmount} is not equal to repay assets ${params.assets} for market: ${params.market}`);
343
+ super(`Transfer amount ${params.transferAmount} is not equal to repay assets ${params.assets} for market: ${params.market}. In assets mode, transferAmount must equal amount + nativeAmount.`);
344
+ }
345
+ }
346
+ /**
347
+ * Thrown when a shares-mode repay's `nativeAmount` exceeds `transferAmount`, which
348
+ * would make the ERC-20 amount to pull (`transferAmount − nativeAmount`) negative.
349
+ */
350
+ export class NativeAmountExceedsTransferAmountError extends Error {
351
+ constructor(params) {
352
+ super(`Native amount ${params.nativeAmount} exceeds transfer amount ${params.transferAmount} for market: ${params.market}. Reduce nativeAmount to at most transferAmount.`);
251
353
  }
252
354
  }
253
355
  /** Thrown when a market repay specifies both `assets` and `shares` as non-zero (modes are mutually exclusive). */
@@ -1,3 +1,4 @@
1
- export type { BigIntish, ChainMetadata, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams, IPermit2Allowance, Loadable, MarketId, MaxBorrowOptions, MaxPositionCapacities, MaxWithdrawCollateralOptions, Pending, Permit2Allowance, } from "@morpho-org/blue-sdk";
1
+ export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams, IPermit2Allowance, Loadable, MarketId, MaxBorrowOptions, MaxPositionCapacities, MaxWithdrawCollateralOptions, Pending, Permit2Allowance, } from "@morpho-org/blue-sdk";
2
2
  export type { DeploylessFetchParameters, FetchParameters, } from "@morpho-org/blue-sdk-viem";
3
+ export type { ChainMetadata } from "@morpho-org/morpho-ts";
3
4
  export * from "./types/index.js";
@@ -1,9 +1,9 @@
1
1
  export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
2
2
  export { AdaptiveCurveIrmLib, CapacityLimitReason, MarketUtils, MathLib, SharesMath, VaultUtils, } from "@morpho-org/blue-sdk";
3
- export { decodeBytes32String, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
3
+ export { decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
4
4
  export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDottedKeys, WithId, WithIndex, } from "@morpho-org/morpho-ts";
5
5
  export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
6
6
  export { computeReallocations } from "./helpers/computeReallocations.js";
7
7
  export { addTransactionMetadata } from "./helpers/metadata.js";
8
8
  export { computeMaxRepaySharePrice, computeMinBorrowSharePrice, } from "./helpers/slippage.js";
9
- export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayParams, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
9
+ export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
package/lib/esm/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AdaptiveCurveIrmLib, CapacityLimitReason, MarketUtils, MathLib, SharesMath, VaultUtils, } from "@morpho-org/blue-sdk";
2
- export { decodeBytes32String, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
2
+ export { decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
3
3
  export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
4
4
  export { computeReallocations } from "./helpers/computeReallocations.js";
5
5
  export { addTransactionMetadata } from "./helpers/metadata.js";
6
6
  export { computeMaxRepaySharePrice, computeMinBorrowSharePrice, } from "./helpers/slippage.js";
7
- export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayParams, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
7
+ export { validateAccrualPosition, validateChainId, validateNativeAsset, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";