@morpho-org/morpho-sdk 10.5.0 → 10.6.0-next.0

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 (192) hide show
  1. package/README.md +44 -1
  2. package/lib/cjs/abis.d.ts +794 -1
  3. package/lib/cjs/abis.js +815 -1
  4. package/lib/cjs/actions/blue/close.d.ts +169 -0
  5. package/lib/cjs/actions/blue/close.js +270 -0
  6. package/lib/cjs/actions/blue/common.js +2 -2
  7. package/lib/cjs/actions/blue/delever.d.ts +156 -0
  8. package/lib/cjs/actions/blue/delever.js +223 -0
  9. package/lib/cjs/actions/blue/index.d.ts +3 -0
  10. package/lib/cjs/actions/blue/index.js +3 -0
  11. package/lib/cjs/actions/blue/lever.d.ts +184 -0
  12. package/lib/cjs/actions/blue/lever.js +272 -0
  13. package/lib/cjs/actions/blue/leverageIntent.d.ts +65 -0
  14. package/lib/cjs/actions/blue/leverageIntent.js +103 -0
  15. package/lib/cjs/actions/requirements/blue/encodeLeverageAuthorization.d.ts +39 -0
  16. package/lib/cjs/actions/requirements/blue/encodeLeverageAuthorization.js +59 -0
  17. package/lib/cjs/actions/requirements/blue/getLeverageRequirements.d.ts +104 -0
  18. package/lib/cjs/actions/requirements/blue/getLeverageRequirements.js +193 -0
  19. package/lib/cjs/actions/requirements/blue/getLeverageRequirementsApproval.d.ts +45 -0
  20. package/lib/cjs/actions/requirements/blue/getLeverageRequirementsApproval.js +66 -0
  21. package/lib/cjs/actions/requirements/blue/index.d.ts +3 -0
  22. package/lib/cjs/actions/requirements/blue/index.js +17 -0
  23. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +2 -2
  24. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +3 -2
  25. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +11 -6
  26. package/lib/cjs/actions/requirements/getRequirementsApproval.js +29 -5
  27. package/lib/cjs/addresses.d.ts +1 -1
  28. package/lib/cjs/addresses.js +6 -1
  29. package/lib/cjs/blue/abis.d.ts +1 -1
  30. package/lib/cjs/blue/abis.js +5 -1
  31. package/lib/cjs/blue/addresses.d.ts +1 -1
  32. package/lib/cjs/blue/addresses.js +6 -1
  33. package/lib/cjs/blue/entities.d.ts +4 -4
  34. package/lib/cjs/blue/entities.js +3 -1
  35. package/lib/cjs/blue/errors.d.ts +2 -2
  36. package/lib/cjs/blue/errors.js +5 -1
  37. package/lib/cjs/blue/fetch.d.ts +2 -2
  38. package/lib/cjs/blue/fetch.js +3 -1
  39. package/lib/cjs/blue/utils.d.ts +1 -1
  40. package/lib/cjs/blue/utils.js +2 -1
  41. package/lib/cjs/constants.d.ts +1 -1
  42. package/lib/cjs/constants.js +6 -2
  43. package/lib/cjs/entities/blue/blue.d.ts +486 -2
  44. package/lib/cjs/entities/blue/blue.js +529 -34
  45. package/lib/cjs/entities/index.d.ts +5 -5
  46. package/lib/cjs/entities/index.js +3 -1
  47. package/lib/cjs/entities/requirements/assertContractCode.d.ts +0 -23
  48. package/lib/cjs/entities/requirements/assertContractCode.js +3 -28
  49. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +34 -8
  50. package/lib/cjs/entities/vaultV2/vaultV2.js +39 -1
  51. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +120 -2
  52. package/lib/cjs/entities/vaultV2BlueReallocationData.js +232 -4
  53. package/lib/cjs/errors.d.ts +4 -4
  54. package/lib/cjs/errors.js +7 -5
  55. package/lib/cjs/fetch.d.ts +2 -2
  56. package/lib/cjs/fetch.js +3 -1
  57. package/lib/cjs/helpers/constant.d.ts +34 -0
  58. package/lib/cjs/helpers/constant.js +35 -1
  59. package/lib/cjs/helpers/deadShares.js +3 -0
  60. package/lib/cjs/helpers/getZeroExLeverageBundle.d.ts +13 -0
  61. package/lib/cjs/helpers/getZeroExLeverageBundle.js +27 -0
  62. package/lib/cjs/helpers/index.d.ts +4 -1
  63. package/lib/cjs/helpers/index.js +28 -1
  64. package/lib/cjs/helpers/leverage/index.d.ts +1 -0
  65. package/lib/cjs/helpers/leverage/index.js +11 -0
  66. package/lib/cjs/helpers/leverage/limits.d.ts +472 -0
  67. package/lib/cjs/helpers/leverage/limits.js +715 -0
  68. package/lib/cjs/helpers/leverage/positionMarket.d.ts +17 -0
  69. package/lib/cjs/helpers/leverage/positionMarket.js +28 -0
  70. package/lib/cjs/helpers/leverage/reallocations.d.ts +159 -0
  71. package/lib/cjs/helpers/leverage/reallocations.js +276 -0
  72. package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
  73. package/lib/cjs/helpers/validateRequirementSpender.js +4 -0
  74. package/lib/cjs/helpers/zeroExQuote.d.ts +250 -0
  75. package/lib/cjs/helpers/zeroExQuote.js +763 -0
  76. package/lib/cjs/index.d.ts +1 -0
  77. package/lib/cjs/index.js +5 -2
  78. package/lib/cjs/midnight/errors.d.ts +2 -1
  79. package/lib/cjs/midnight/errors.js +5 -4
  80. package/lib/cjs/reads/assertContractCode.d.ts +25 -0
  81. package/lib/cjs/reads/assertContractCode.js +30 -0
  82. package/lib/cjs/reads/fetchZeroExQuote.d.ts +123 -0
  83. package/lib/cjs/reads/fetchZeroExQuote.js +330 -0
  84. package/lib/cjs/types/action.d.ts +130 -1
  85. package/lib/cjs/types/error.d.ts +59 -0
  86. package/lib/cjs/types/error.js +82 -3
  87. package/lib/cjs/types/index.d.ts +2 -0
  88. package/lib/cjs/types/index.js +2 -0
  89. package/lib/cjs/types/leverageError.d.ts +1552 -0
  90. package/lib/cjs/types/leverageError.js +1711 -0
  91. package/lib/cjs/types/zeroEx.d.ts +171 -0
  92. package/lib/cjs/types/zeroEx.js +2 -0
  93. package/lib/cjs/utils.d.ts +2 -2
  94. package/lib/cjs/utils.js +4 -2
  95. package/lib/cjs/version.d.ts +1 -1
  96. package/lib/cjs/version.js +1 -1
  97. package/lib/esm/abis.d.ts +794 -1
  98. package/lib/esm/abis.js +810 -1
  99. package/lib/esm/actions/blue/close.d.ts +169 -0
  100. package/lib/esm/actions/blue/close.js +266 -0
  101. package/lib/esm/actions/blue/common.js +3 -3
  102. package/lib/esm/actions/blue/delever.d.ts +156 -0
  103. package/lib/esm/actions/blue/delever.js +219 -0
  104. package/lib/esm/actions/blue/index.d.ts +3 -0
  105. package/lib/esm/actions/blue/index.js +3 -0
  106. package/lib/esm/actions/blue/lever.d.ts +184 -0
  107. package/lib/esm/actions/blue/lever.js +268 -0
  108. package/lib/esm/actions/blue/leverageIntent.d.ts +65 -0
  109. package/lib/esm/actions/blue/leverageIntent.js +96 -0
  110. package/lib/esm/actions/requirements/blue/encodeLeverageAuthorization.d.ts +39 -0
  111. package/lib/esm/actions/requirements/blue/encodeLeverageAuthorization.js +55 -0
  112. package/lib/esm/actions/requirements/blue/getLeverageRequirements.d.ts +104 -0
  113. package/lib/esm/actions/requirements/blue/getLeverageRequirements.js +189 -0
  114. package/lib/esm/actions/requirements/blue/getLeverageRequirementsApproval.d.ts +45 -0
  115. package/lib/esm/actions/requirements/blue/getLeverageRequirementsApproval.js +62 -0
  116. package/lib/esm/actions/requirements/blue/index.d.ts +3 -0
  117. package/lib/esm/actions/requirements/blue/index.js +3 -0
  118. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +2 -2
  119. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +3 -2
  120. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +11 -6
  121. package/lib/esm/actions/requirements/getRequirementsApproval.js +29 -5
  122. package/lib/esm/addresses.d.ts +1 -1
  123. package/lib/esm/addresses.js +1 -1
  124. package/lib/esm/blue/abis.d.ts +1 -1
  125. package/lib/esm/blue/abis.js +1 -1
  126. package/lib/esm/blue/addresses.d.ts +1 -1
  127. package/lib/esm/blue/addresses.js +1 -1
  128. package/lib/esm/blue/entities.d.ts +4 -4
  129. package/lib/esm/blue/entities.js +2 -2
  130. package/lib/esm/blue/errors.d.ts +2 -2
  131. package/lib/esm/blue/errors.js +2 -2
  132. package/lib/esm/blue/fetch.d.ts +2 -2
  133. package/lib/esm/blue/fetch.js +2 -2
  134. package/lib/esm/blue/utils.d.ts +1 -1
  135. package/lib/esm/blue/utils.js +1 -1
  136. package/lib/esm/constants.d.ts +1 -1
  137. package/lib/esm/constants.js +1 -1
  138. package/lib/esm/entities/blue/blue.d.ts +486 -2
  139. package/lib/esm/entities/blue/blue.js +501 -6
  140. package/lib/esm/entities/index.d.ts +5 -5
  141. package/lib/esm/entities/index.js +2 -2
  142. package/lib/esm/entities/requirements/assertContractCode.d.ts +0 -23
  143. package/lib/esm/entities/requirements/assertContractCode.js +1 -25
  144. package/lib/esm/entities/vaultV2/vaultV2.d.ts +34 -8
  145. package/lib/esm/entities/vaultV2/vaultV2.js +40 -2
  146. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +120 -2
  147. package/lib/esm/entities/vaultV2BlueReallocationData.js +233 -5
  148. package/lib/esm/errors.d.ts +4 -4
  149. package/lib/esm/errors.js +4 -4
  150. package/lib/esm/fetch.d.ts +2 -2
  151. package/lib/esm/fetch.js +2 -2
  152. package/lib/esm/helpers/constant.d.ts +34 -0
  153. package/lib/esm/helpers/constant.js +34 -0
  154. package/lib/esm/helpers/deadShares.js +4 -1
  155. package/lib/esm/helpers/getZeroExLeverageBundle.d.ts +13 -0
  156. package/lib/esm/helpers/getZeroExLeverageBundle.js +23 -0
  157. package/lib/esm/helpers/index.d.ts +4 -1
  158. package/lib/esm/helpers/index.js +4 -1
  159. package/lib/esm/helpers/leverage/index.d.ts +1 -0
  160. package/lib/esm/helpers/leverage/index.js +1 -0
  161. package/lib/esm/helpers/leverage/limits.d.ts +472 -0
  162. package/lib/esm/helpers/leverage/limits.js +705 -0
  163. package/lib/esm/helpers/leverage/positionMarket.d.ts +17 -0
  164. package/lib/esm/helpers/leverage/positionMarket.js +24 -0
  165. package/lib/esm/helpers/leverage/reallocations.d.ts +159 -0
  166. package/lib/esm/helpers/leverage/reallocations.js +271 -0
  167. package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
  168. package/lib/esm/helpers/validateRequirementSpender.js +5 -1
  169. package/lib/esm/helpers/zeroExQuote.d.ts +250 -0
  170. package/lib/esm/helpers/zeroExQuote.js +754 -0
  171. package/lib/esm/index.d.ts +1 -0
  172. package/lib/esm/index.js +1 -0
  173. package/lib/esm/midnight/errors.d.ts +2 -1
  174. package/lib/esm/midnight/errors.js +2 -1
  175. package/lib/esm/reads/assertContractCode.d.ts +25 -0
  176. package/lib/esm/reads/assertContractCode.js +26 -0
  177. package/lib/esm/reads/fetchZeroExQuote.d.ts +123 -0
  178. package/lib/esm/reads/fetchZeroExQuote.js +326 -0
  179. package/lib/esm/types/action.d.ts +130 -1
  180. package/lib/esm/types/error.d.ts +59 -0
  181. package/lib/esm/types/error.js +76 -0
  182. package/lib/esm/types/index.d.ts +2 -0
  183. package/lib/esm/types/index.js +2 -0
  184. package/lib/esm/types/leverageError.d.ts +1552 -0
  185. package/lib/esm/types/leverageError.js +1660 -0
  186. package/lib/esm/types/zeroEx.d.ts +171 -0
  187. package/lib/esm/types/zeroEx.js +1 -0
  188. package/lib/esm/utils.d.ts +2 -2
  189. package/lib/esm/utils.js +2 -2
  190. package/lib/esm/version.d.ts +1 -1
  191. package/lib/esm/version.js +1 -1
  192. package/package.json +7 -7
@@ -0,0 +1,189 @@
1
+ import { getChainAddresses } from "@morpho-org/blue-sdk";
2
+ import { blueAbi } from "@morpho-org/blue-sdk-viem";
3
+ import { isShippedZeroExLeverageBundle } from "@morpho-org/morpho-ts";
4
+ import { erc20Abi, isAddress, isAddressEqual, publicActions, } from "viem";
5
+ import { validateChainId, validateUint256Field, } from "../../../helpers/validate.js";
6
+ import { getZeroExLeverageBundle } from "../../../helpers/zeroExQuote.js";
7
+ import { assertContractCode } from "../../../reads/assertContractCode.js";
8
+ import { InvalidLeverageOperationError, } from "../../../types/index.js";
9
+ import { validateClientChainId } from "../validateClientChainId.js";
10
+ import { encodeLeverageAuthorization } from "./encodeLeverageAuthorization.js";
11
+ import { getLeverageRequirementsApproval } from "./getLeverageRequirementsApproval.js";
12
+ const LEVERAGE_OPERATION_TYPES = [
13
+ "lever",
14
+ "delever",
15
+ "close",
16
+ ];
17
+ const LEVER_AMOUNT_FIELDS = [
18
+ "collateralAssets",
19
+ "loanAssets",
20
+ "maxBorrowAssets",
21
+ ];
22
+ const getTokenPulls = (marketParams, operation) => {
23
+ if (operation.type !== "lever") {
24
+ return [];
25
+ }
26
+ validateUint256Field("collateralAssets", operation.collateralAssets);
27
+ validateUint256Field("loanAssets", operation.loanAssets);
28
+ if (isAddressEqual(marketParams.collateralToken, marketParams.loanToken)) {
29
+ const amount = operation.collateralAssets + operation.loanAssets;
30
+ validateUint256Field("amount", amount);
31
+ return [{ token: marketParams.loanToken, amount }];
32
+ }
33
+ return [
34
+ {
35
+ token: marketParams.collateralToken,
36
+ amount: operation.collateralAssets,
37
+ },
38
+ { token: marketParams.loanToken, amount: operation.loanAssets },
39
+ ];
40
+ };
41
+ const needsAuthorization = (operation) => {
42
+ if (operation.type !== "lever") {
43
+ return true;
44
+ }
45
+ validateUint256Field("maxBorrowAssets", operation.maxBorrowAssets);
46
+ return operation.maxBorrowAssets > 0n;
47
+ };
48
+ /**
49
+ * Resolves the transactions a user submits before a ZeroExLeverageBundlesV1 action: ERC-20
50
+ * approvals for the tokens it pulls, then the Morpho Blue authorization when its entry point
51
+ * needs one.
52
+ *
53
+ * Reads the user's allowance for each pulled token and `Morpho.isAuthorized(user, bundle)` on the
54
+ * target chain. For the leverage bundle the SDK ships it reads no contract code: `MorphoBlue.lever`, `delever` and
55
+ * `close` check Morpho Blue's code before calling it, and the shipped bundle's code check is waived
56
+ * (`docs/EXCEPTIONS.md`). A bundle registered with `registerCustomAddresses` falls back to the default rules: its code
57
+ * is checked before any read or grant, and its approvals are exact.
58
+ *
59
+ * - **Lever** pulls `collateralAssets` of the collateral token and `loanAssets` of the loan token
60
+ * from the user; when the allowance is short, each gets an unlimited approval (`maxUint256`,
61
+ * capped per token by `MAX_TOKEN_APPROVALS`), as for the other bundles, or an approval of exactly the pulled
62
+ * amount for a bundle the SDK does not ship. It borrows on Blue only
63
+ * when `maxBorrowAssets > 0`, so only then does it need the authorization.
64
+ * - **Delever** and **Close** pull nothing from the user and always withdraw collateral on Blue,
65
+ * so they need the authorization and no approval.
66
+ *
67
+ * The allowance and authorization reads run in parallel, each at the latest block its request sees; they are not
68
+ * pinned to one block, so a block landing between them can mix two states. The result is a snapshot of those
69
+ * reads: a requirement missed that way makes the action revert, and a returned approval still calls `approve` and
70
+ * replaces the allowance, with the zero reset of an approve-once token such as USDT planned from the allowance
71
+ * read. If the allowance or the authorization may have changed before submission, resolve the requirements again.
72
+ *
73
+ * The authorization is global over the user's Blue positions and persists after the action, like
74
+ * the unlimited approvals. The bundle takes no signed authorization, so no signature requirement
75
+ * is returned.
76
+ *
77
+ * @param params.viemClient - Connected viem `Client` whose `chain.id` matches `params.chainId`.
78
+ * @param params.chainId - Target chain id.
79
+ * @param params.userAddress - The account that sends the leverage transaction.
80
+ * @param params.marketParams - The market's loan and collateral tokens.
81
+ * @param params.operation - The leverage entry point and, for Lever, its pulled amounts.
82
+ * @returns Deep-frozen transactions in submission order: approvals (each optionally preceded by a
83
+ * reset to zero), then the authorization grant. Empty when nothing is missing.
84
+ * @throws {InvalidLeverageOperationError} when `operation` is missing or not an object, its `type` is
85
+ * not `lever`, `delever` or `close`, a Lever amount is not a bigint, or `userAddress` or a market token is
86
+ * not an address, before any read.
87
+ * @throws {ChainIdMismatchError} when the client declares, or its RPC reports via `eth_chainId`, a
88
+ * chain other than `params.chainId`.
89
+ * @throws {LeverageUnsupportedChainError} when the chain has no usable leverage bundle; a chain absent from the
90
+ * address registry reports `noAllowanceHolder`.
91
+ * @throws {MissingContractCodeError} when the chain's leverage bundle is not the one the SDK ships and has no code.
92
+ * @throws {NegativeInputError} when a Lever amount is negative.
93
+ * @throws {InputExceedsMaxError} when a Lever amount exceeds `uint256`; before any read,
94
+ * with `field: "amount"`, when the sum of both amounts on a market whose loan and collateral
95
+ * tokens are equal exceeds `uint256`.
96
+ * @throws {viem.BaseError} when the `eth_chainId` request or an allowance or authorization read
97
+ * fails.
98
+ * @example
99
+ * ```ts
100
+ * import { createPublicClient, http } from "viem";
101
+ * import { base } from "viem/chains";
102
+ * import { getLeverageRequirements } from "@morpho-org/morpho-sdk";
103
+ *
104
+ * const client = createPublicClient({ chain: base, transport: http() });
105
+ * // `leverTx`: the built Lever transaction; its args carry the amounts the Lever signs.
106
+ * const { collateralAssets, loanAssets, maxBorrowAssets } = leverTx.action.args;
107
+ * // None ships yet: register a verified zeroExLeverageBundlesV1 address with `registerCustomAddresses` first,
108
+ * // otherwise it throws `LeverageUnsupportedChainError` with `reason: "noBundle"`.
109
+ * const requirements = await getLeverageRequirements({
110
+ * viemClient: client,
111
+ * chainId: base.id,
112
+ * userAddress,
113
+ * marketParams,
114
+ * // Here collateralAssets is 1_000000000000000000n and loanAssets 0n.
115
+ * operation: { type: "lever", collateralAssets, loanAssets, maxBorrowAssets },
116
+ * });
117
+ * // requirements: [approve(bundle, 1_000000000000000000n), setAuthorization(bundle, true)] when both are
118
+ * // missing: a registered bundle is approved exactly the pull; the bundle morpho-ts ships gets maxUint256.
119
+ * ```
120
+ */
121
+ export const getLeverageRequirements = async (params) => {
122
+ const { viemClient, chainId, userAddress, marketParams, operation } = params;
123
+ // A JavaScript caller can pass any shape; only well-formed known entry points may get a grant.
124
+ if (operation == null || typeof operation !== "object") {
125
+ throw new InvalidLeverageOperationError("operation", operation);
126
+ }
127
+ if (!LEVERAGE_OPERATION_TYPES.includes(operation.type)) {
128
+ throw new InvalidLeverageOperationError("type", operation.type);
129
+ }
130
+ if (operation.type === "lever") {
131
+ for (const field of LEVER_AMOUNT_FIELDS) {
132
+ if (typeof operation[field] !== "bigint") {
133
+ throw new InvalidLeverageOperationError(field, operation[field]);
134
+ }
135
+ }
136
+ }
137
+ // A JavaScript caller can pass any value; a malformed address must never reach a read or a grant.
138
+ for (const [field, address] of [
139
+ ["userAddress", userAddress],
140
+ ["marketParams.loanToken", marketParams?.loanToken],
141
+ ["marketParams.collateralToken", marketParams?.collateralToken],
142
+ ]) {
143
+ if (typeof address !== "string" || !isAddress(address, { strict: false })) {
144
+ throw new InvalidLeverageOperationError(field, address);
145
+ }
146
+ }
147
+ validateChainId(viemClient.chain?.id, chainId);
148
+ const bundle = getZeroExLeverageBundle(chainId);
149
+ const pulls = getTokenPulls(marketParams, operation).filter(({ amount }) => amount > 0n);
150
+ const authorize = needsAuthorization(operation);
151
+ await validateClientChainId(viemClient, chainId);
152
+ const pc = viemClient.extend(publicActions);
153
+ if (!isShippedZeroExLeverageBundle(chainId, bundle)) {
154
+ // The leverage exceptions cover only the shipped bundle: another one is never granted anything without code.
155
+ await assertContractCode(pc, {
156
+ address: bundle,
157
+ chainId,
158
+ role: "bundles.zeroExLeverageBundlesV1",
159
+ });
160
+ }
161
+ const [approvals, isAuthorized] = await Promise.all([
162
+ Promise.all(pulls.map(async ({ token, amount }) => getLeverageRequirementsApproval({
163
+ chainId,
164
+ token,
165
+ amount,
166
+ allowance: await pc.readContract({
167
+ address: token,
168
+ abi: erc20Abi,
169
+ functionName: "allowance",
170
+ args: [userAddress, bundle],
171
+ }),
172
+ }))),
173
+ authorize
174
+ ? pc.readContract({
175
+ address: getChainAddresses(chainId).blue,
176
+ abi: blueAbi,
177
+ functionName: "isAuthorized",
178
+ args: [userAddress, bundle],
179
+ })
180
+ : true,
181
+ ]);
182
+ if (isAuthorized) {
183
+ return approvals.flat();
184
+ }
185
+ return [
186
+ ...approvals.flat(),
187
+ encodeLeverageAuthorization({ chainId, isAuthorized: true }),
188
+ ];
189
+ };
@@ -0,0 +1,45 @@
1
+ import type { Address } from "viem";
2
+ import { type ERC20ApprovalAction, type Transaction } from "../../../types/index.js";
3
+ /**
4
+ * Computes the ERC-20 approvals a user gives ZeroExLeverageBundlesV1 so it can pull `amount` of
5
+ * `token`, given the existing allowance.
6
+ *
7
+ * For the leverage bundle the SDK ships (`isShippedZeroExLeverageBundle`), a short allowance is raised to
8
+ * `maxUint256`, capped per token by `MAX_TOKEN_APPROVALS`, like the other bundles' approvals, so one approval per token
9
+ * covers later leverage actions. A bundle registered with `registerCustomAddresses` gets an approval of exactly
10
+ * `amount` instead. For tokens in `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) with a non-zero allowance, a reset to zero
11
+ * precedes it. The spender is always the chain's registered bundle, refused on chains where it cannot run.
12
+ *
13
+ * @param params.chainId - The chain the transaction targets.
14
+ * @param params.token - ERC-20 token the bundle pulls.
15
+ * @param params.amount - Amount the bundle pulls.
16
+ * @param params.allowance - The user's current allowance of `token` for the bundle.
17
+ * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
18
+ * followed by the unlimited approval, or the exact one for a bundle the SDK does not ship. Empty when
19
+ * `allowance >= amount`.
20
+ * @throws {InvalidLeverageOperationError} when `amount` or `allowance` is not a bigint.
21
+ * @throws {NegativeInputError} when `amount` or `allowance` is negative.
22
+ * @throws {InputExceedsMaxError} when `amount` or `allowance` exceeds `uint256`.
23
+ * @throws {LeverageUnsupportedChainError} when the chain has no usable leverage bundle; a chain absent from the
24
+ * address registry reports `noAllowanceHolder`.
25
+ * @example
26
+ * ```ts
27
+ * import { getLeverageRequirementsApproval } from "@morpho-org/morpho-sdk";
28
+ *
29
+ * // None ships yet: register a verified zeroExLeverageBundlesV1 address with `registerCustomAddresses` first.
30
+ * const txs = getLeverageRequirementsApproval({
31
+ * chainId: 8453,
32
+ * token: USDC,
33
+ * amount: 1_000_000n,
34
+ * allowance: 0n,
35
+ * });
36
+ * // txs: [approve(zeroExLeverageBundlesV1, 1_000_000n)], exactly the pull, for a registered bundle;
37
+ * // the bundle morpho-ts ships gets approve(zeroExLeverageBundlesV1, maxUint256) instead.
38
+ * ```
39
+ */
40
+ export declare const getLeverageRequirementsApproval: (params: {
41
+ readonly chainId: number;
42
+ readonly token: Address;
43
+ readonly amount: bigint;
44
+ readonly allowance: bigint;
45
+ }) => readonly Readonly<Transaction<ERC20ApprovalAction>>[];
@@ -0,0 +1,62 @@
1
+ import { validateUint256Field } from "../../../helpers/validate.js";
2
+ import { getZeroExLeverageBundle } from "../../../helpers/zeroExQuote.js";
3
+ import { InvalidLeverageOperationError, } from "../../../types/index.js";
4
+ import { getRequirementsApproval } from "../getRequirementsApproval.js";
5
+ /**
6
+ * Computes the ERC-20 approvals a user gives ZeroExLeverageBundlesV1 so it can pull `amount` of
7
+ * `token`, given the existing allowance.
8
+ *
9
+ * For the leverage bundle the SDK ships (`isShippedZeroExLeverageBundle`), a short allowance is raised to
10
+ * `maxUint256`, capped per token by `MAX_TOKEN_APPROVALS`, like the other bundles' approvals, so one approval per token
11
+ * covers later leverage actions. A bundle registered with `registerCustomAddresses` gets an approval of exactly
12
+ * `amount` instead. For tokens in `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) with a non-zero allowance, a reset to zero
13
+ * precedes it. The spender is always the chain's registered bundle, refused on chains where it cannot run.
14
+ *
15
+ * @param params.chainId - The chain the transaction targets.
16
+ * @param params.token - ERC-20 token the bundle pulls.
17
+ * @param params.amount - Amount the bundle pulls.
18
+ * @param params.allowance - The user's current allowance of `token` for the bundle.
19
+ * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
20
+ * followed by the unlimited approval, or the exact one for a bundle the SDK does not ship. Empty when
21
+ * `allowance >= amount`.
22
+ * @throws {InvalidLeverageOperationError} when `amount` or `allowance` is not a bigint.
23
+ * @throws {NegativeInputError} when `amount` or `allowance` is negative.
24
+ * @throws {InputExceedsMaxError} when `amount` or `allowance` exceeds `uint256`.
25
+ * @throws {LeverageUnsupportedChainError} when the chain has no usable leverage bundle; a chain absent from the
26
+ * address registry reports `noAllowanceHolder`.
27
+ * @example
28
+ * ```ts
29
+ * import { getLeverageRequirementsApproval } from "@morpho-org/morpho-sdk";
30
+ *
31
+ * // None ships yet: register a verified zeroExLeverageBundlesV1 address with `registerCustomAddresses` first.
32
+ * const txs = getLeverageRequirementsApproval({
33
+ * chainId: 8453,
34
+ * token: USDC,
35
+ * amount: 1_000_000n,
36
+ * allowance: 0n,
37
+ * });
38
+ * // txs: [approve(zeroExLeverageBundlesV1, 1_000_000n)], exactly the pull, for a registered bundle;
39
+ * // the bundle morpho-ts ships gets approve(zeroExLeverageBundlesV1, maxUint256) instead.
40
+ * ```
41
+ */
42
+ export const getLeverageRequirementsApproval = (params) => {
43
+ const { chainId, token, amount, allowance } = params;
44
+ // A JavaScript caller can omit a field; an unknown pull or allowance must never get an approval.
45
+ for (const [field, value] of [
46
+ ["amount", amount],
47
+ ["allowance", allowance],
48
+ ]) {
49
+ if (typeof value !== "bigint") {
50
+ throw new InvalidLeverageOperationError(field, value);
51
+ }
52
+ }
53
+ validateUint256Field("amount", amount);
54
+ validateUint256Field("allowance", allowance);
55
+ const spender = getZeroExLeverageBundle(chainId);
56
+ return getRequirementsApproval({
57
+ address: token,
58
+ chainId,
59
+ args: { spendAmount: amount, spender },
60
+ allowances: allowance,
61
+ });
62
+ };
@@ -1 +1,4 @@
1
+ export * from "./encodeLeverageAuthorization.js";
1
2
  export { getBlueAuthorizationRequirement } from "./getBlueAuthorizationRequirement.js";
3
+ export * from "./getLeverageRequirements.js";
4
+ export * from "./getLeverageRequirementsApproval.js";
@@ -1 +1,4 @@
1
+ export * from "./encodeLeverageAuthorization.js";
1
2
  export { getBlueAuthorizationRequirement } from "./getBlueAuthorizationRequirement.js";
3
+ export * from "./getLeverageRequirements.js";
4
+ export * from "./getLeverageRequirementsApproval.js";
@@ -24,8 +24,8 @@ export declare const parseErc20Approval: (params: EncodeErc20ApprovalParams) =>
24
24
  * @param params - Encoding parameters.
25
25
  * @param params.token - ERC-20 token address to approve.
26
26
  * @param params.spender - Address granted the allowance. Must be Permit2, Midnight,
27
- * MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for
28
- * the chain.
27
+ * MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, BlueBundlesV1, or
28
+ * ZeroExLeverageBundlesV1 for the chain.
29
29
  * @param params.amount - Allowance amount before per-token cap.
30
30
  * @param params.chainId - The chain the transaction targets (used to resolve supported spenders and the per-token cap).
31
31
  * @returns A deep-frozen `Transaction<ERC20ApprovalAction>` with the capped approval amount.
@@ -21,6 +21,7 @@ export const parseErc20Approval = (params) => {
21
21
  "vaultExitBundlesV1",
22
22
  "vaultBundlesV1",
23
23
  "blueBundlesV1",
24
+ "zeroExLeverageBundlesV1",
24
25
  ],
25
26
  });
26
27
  return {
@@ -37,8 +38,8 @@ export const parseErc20Approval = (params) => {
37
38
  * @param params - Encoding parameters.
38
39
  * @param params.token - ERC-20 token address to approve.
39
40
  * @param params.spender - Address granted the allowance. Must be Permit2, Midnight,
40
- * MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for
41
- * the chain.
41
+ * MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, BlueBundlesV1, or
42
+ * ZeroExLeverageBundlesV1 for the chain.
42
43
  * @param params.amount - Allowance amount before per-token cap.
43
44
  * @param params.chainId - The chain the transaction targets (used to resolve supported spenders and the per-token cap).
44
45
  * @returns A deep-frozen `Transaction<ERC20ApprovalAction>` with the capped approval amount.
@@ -1,5 +1,5 @@
1
- import type { Address } from "@morpho-org/blue-sdk";
2
- import type { ERC20ApprovalAction, Transaction } from "../../types/index.js";
1
+ import { type Address } from "@morpho-org/blue-sdk";
2
+ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js";
3
3
  import { type Erc20ApprovalInput } from "./encode/encodeErc20Approval.js";
4
4
  /** Complete raw approval requirement invocation. @internal */
5
5
  interface RequirementsApprovalParams {
@@ -25,11 +25,12 @@ export declare const parseRequirementsApproval: (params: RequirementsApprovalPar
25
25
  * allowance.
26
26
  *
27
27
  * The operation constructor validates the spender before constructing approval inputs. Supported
28
- * spenders are the chain's Permit2, Midnight, MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, and BlueBundlesV1
29
- * addresses when configured.
28
+ * spenders are the chain's Permit2, Midnight, MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, BlueBundlesV1, and
29
+ * ZeroExLeverageBundlesV1 addresses when configured.
30
30
  *
31
31
  * When `allowances < spendAmount`, requests an approval for `maxUint256`, capped per token by
32
- * `MAX_TOKEN_APPROVALS`. For tokens in `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) with a non-zero
32
+ * `MAX_TOKEN_APPROVALS`. A ZeroExLeverageBundlesV1 the SDK does not ship, one registered with
33
+ * `registerCustomAddresses`, falls back to the default rule and is approved exactly `spendAmount`. For tokens in `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) with a non-zero
33
34
  * allowance, prepends an `approve(spender, 0)` reset before re-approving. No approval is emitted
34
35
  * when `allowances >= spendAmount`.
35
36
  *
@@ -38,12 +39,16 @@ export declare const parseRequirementsApproval: (params: RequirementsApprovalPar
38
39
  * and token approval caps.
39
40
  * @param params.args.spendAmount - The amount the bundle will actually pull.
40
41
  * @param params.args.spender - Address that will be granted the approval. Must be Permit2,
41
- * Midnight, MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for `chainId`.
42
+ * Midnight, MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, BlueBundlesV1, or
43
+ * ZeroExLeverageBundlesV1 for `chainId`.
42
44
  * @param params.allowances - The user's current allowance of `address` for `spender`.
43
45
  * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
44
46
  * followed by the new approval. Empty when `allowances >= spendAmount`.
45
47
  * @throws {UnsupportedChainIdError} when `chainId` is absent from the address registry.
46
48
  * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not a supported SDK spender for `chainId`.
49
+ * @throws {InvalidBigIntInputError} when an exact approval is due and `spendAmount` is not a bigint.
50
+ * @throws {NegativeInputError} when an exact approval is due and `spendAmount` is negative.
51
+ * @throws {InputExceedsMaxError} when an exact approval is due and `spendAmount` exceeds `uint256`.
47
52
  * @example
48
53
  * ```ts
49
54
  * import { getRequirementsApproval } from "@morpho-org/morpho-sdk";
@@ -1,4 +1,9 @@
1
+ import { getChainAddresses, isZeroExLeverageChain, } from "@morpho-org/blue-sdk";
2
+ import { isShippedZeroExLeverageBundle } from "@morpho-org/morpho-ts";
3
+ import { isAddressEqual } from "viem";
1
4
  import { getTokenApprovalAmounts } from "../../helpers/tokenApproval.js";
5
+ import { validateUint256Field } from "../../helpers/validate.js";
6
+ import { InvalidBigIntInputError, } from "../../types/index.js";
2
7
  import { encodeParsedErc20Approval, parseErc20Approval, } from "./encode/encodeErc20Approval.js";
3
8
  const requirementsApprovalInput = Symbol("RequirementsApprovalInput");
4
9
  /** Owns no-op and token/spender error precedence for direct callers. @internal */
@@ -19,11 +24,25 @@ export const parseRequirementsApproval = (params) => {
19
24
  allowance: input.allowances,
20
25
  spendAmount: input.args.spendAmount,
21
26
  });
27
+ const leverageBundle = amounts.length > 0 && isZeroExLeverageChain(input.chainId)
28
+ ? getChainAddresses(input.chainId).bundles?.zeroExLeverageBundlesV1
29
+ : undefined;
30
+ // The unlimited-approval exception covers only the leverage bundle the SDK ships.
31
+ const exact = leverageBundle != null &&
32
+ isAddressEqual(input.args.spender, leverageBundle) &&
33
+ !isShippedZeroExLeverageBundle(input.chainId, input.args.spender);
34
+ if (exact) {
35
+ // The exact approval is spendAmount itself, so it must be a uint256 the token can hold, not a capped maximum.
36
+ if (typeof input.args.spendAmount !== "bigint") {
37
+ throw new InvalidBigIntInputError("spendAmount", input.args.spendAmount);
38
+ }
39
+ validateUint256Field("spendAmount", input.args.spendAmount);
40
+ }
22
41
  const approvals = amounts.map((amount) => parseErc20Approval({
23
42
  token: input.address,
24
43
  spender: input.args.spender,
25
44
  chainId: input.chainId,
26
- amount,
45
+ amount: exact && amount !== 0n ? input.args.spendAmount : amount,
27
46
  }));
28
47
  return {
29
48
  ...input,
@@ -37,11 +56,12 @@ export const parseRequirementsApproval = (params) => {
37
56
  * allowance.
38
57
  *
39
58
  * The operation constructor validates the spender before constructing approval inputs. Supported
40
- * spenders are the chain's Permit2, Midnight, MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, and BlueBundlesV1
41
- * addresses when configured.
59
+ * spenders are the chain's Permit2, Midnight, MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, BlueBundlesV1, and
60
+ * ZeroExLeverageBundlesV1 addresses when configured.
42
61
  *
43
62
  * When `allowances < spendAmount`, requests an approval for `maxUint256`, capped per token by
44
- * `MAX_TOKEN_APPROVALS`. For tokens in `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) with a non-zero
63
+ * `MAX_TOKEN_APPROVALS`. A ZeroExLeverageBundlesV1 the SDK does not ship, one registered with
64
+ * `registerCustomAddresses`, falls back to the default rule and is approved exactly `spendAmount`. For tokens in `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) with a non-zero
45
65
  * allowance, prepends an `approve(spender, 0)` reset before re-approving. No approval is emitted
46
66
  * when `allowances >= spendAmount`.
47
67
  *
@@ -50,12 +70,16 @@ export const parseRequirementsApproval = (params) => {
50
70
  * and token approval caps.
51
71
  * @param params.args.spendAmount - The amount the bundle will actually pull.
52
72
  * @param params.args.spender - Address that will be granted the approval. Must be Permit2,
53
- * Midnight, MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for `chainId`.
73
+ * Midnight, MidnightBundlesV2, VaultExitBundlesV1, VaultBundlesV1, BlueBundlesV1, or
74
+ * ZeroExLeverageBundlesV1 for `chainId`.
54
75
  * @param params.allowances - The user's current allowance of `address` for `spender`.
55
76
  * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
56
77
  * followed by the new approval. Empty when `allowances >= spendAmount`.
57
78
  * @throws {UnsupportedChainIdError} when `chainId` is absent from the address registry.
58
79
  * @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not a supported SDK spender for `chainId`.
80
+ * @throws {InvalidBigIntInputError} when an exact approval is due and `spendAmount` is not a bigint.
81
+ * @throws {NegativeInputError} when an exact approval is due and `spendAmount` is negative.
82
+ * @throws {InputExceedsMaxError} when an exact approval is due and `spendAmount` exceeds `uint256`.
59
83
  * @example
60
84
  * ```ts
61
85
  * import { getRequirementsApproval } from "@morpho-org/morpho-sdk";
@@ -1,2 +1,2 @@
1
1
  export type { AddressLabel, AddressRegistry, ChainAddresses, ChainDeployments, DeploymentRegistry, } from "@morpho-org/blue-sdk";
2
- export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
2
+ export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, isZeroExLeverageChain as isBlueZeroExLeverageChain, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, ZERO_EX_ALLOWANCE_HOLDER_ADDRESS, ZERO_EX_ALLOWANCE_HOLDER_CHAIN_IDS, ZERO_EX_SETTLER_REGISTRY_ADDRESS, ZERO_EX_TAKER_SUBMITTED_SETTLER_FEATURE, } from "@morpho-org/blue-sdk";
@@ -1 +1 @@
1
- export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
1
+ export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, isZeroExLeverageChain as isBlueZeroExLeverageChain, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, ZERO_EX_ALLOWANCE_HOLDER_ADDRESS, ZERO_EX_ALLOWANCE_HOLDER_CHAIN_IDS, ZERO_EX_SETTLER_REGISTRY_ADDRESS, ZERO_EX_TAKER_SUBMITTED_SETTLER_FEATURE, } from "@morpho-org/blue-sdk";
@@ -1,5 +1,5 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, midnightAdapterAbi, midnightAdapterFactoryAbi, midnightAdapterPriceRatifierV1Abi, midnightAdapterRateRatifierV1Abi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  preLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
@@ -1,5 +1,5 @@
1
1
  export { marketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
2
+ export { adaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, midnightAdapterAbi, midnightAdapterFactoryAbi, midnightAdapterPriceRatifierV1Abi, midnightAdapterRateRatifierV1Abi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  preLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
@@ -1,2 +1,2 @@
1
1
  export type { AddressLabel, AddressRegistry, ChainAddresses, ChainDeployments, DeploymentRegistry, } from "@morpho-org/blue-sdk";
2
- export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
2
+ export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, isZeroExLeverageChain, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, ZERO_EX_ALLOWANCE_HOLDER_ADDRESS, ZERO_EX_ALLOWANCE_HOLDER_CHAIN_IDS, ZERO_EX_SETTLER_REGISTRY_ADDRESS, ZERO_EX_TAKER_SUBMITTED_SETTLER_FEATURE, } from "@morpho-org/blue-sdk";
@@ -1 +1 @@
1
- export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
1
+ export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddress, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, isZeroExLeverageChain, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, ZERO_EX_ALLOWANCE_HOLDER_ADDRESS, ZERO_EX_ALLOWANCE_HOLDER_CHAIN_IDS, ZERO_EX_SETTLER_REGISTRY_ADDRESS, ZERO_EX_TAKER_SUBMITTED_SETTLER_FEATURE, } from "@morpho-org/blue-sdk";
@@ -1,10 +1,10 @@
1
- export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
1
+ export type { IAccrualPosition, IAccrualVault, IAccrualVaultV2, IAccrualVaultV2Adapter, IAccrualVaultV2MidnightAdapter, IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2MorphoVaultV1Adapter, IAssetBalances, IEip5267Domain, IHolding, IMarket, IMarketParams, IPosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  IPreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, } from "@morpho-org/blue-sdk";
6
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
5
+ IPreLiquidationPosition, IToken, IVault, IVaultConfig, IVaultMarketAllocation, IVaultMarketConfig, IVaultToken, IVaultUser, IVaultV2, IVaultV2Adapter, IVaultV2Allocation, IVaultV2BlueMarketPublicAllocatorConfig, IVaultV2BluePublicAllocatorConfig, IVaultV2MidnightAdapter, IVaultV2MidnightAdapterAccrualMarket, IVaultV2MidnightAdapterCollateralParams, IVaultV2MidnightAdapterMarket, IVaultV2MidnightAdapterMarketData, IVaultV2MidnightAdapterMarketState, IVaultV2MidnightAdapterMidnightMarket, IVaultV2MidnightAdapterPosition, IVaultV2MorphoMarketV1Adapter, IVaultV2MorphoMarketV1AdapterV2, IVaultV2MorphoVaultV1Adapter, PeripheralBalance, PeripheralBalanceType, VaultV2MidnightAdapterAccrualMarket, VaultV2MidnightAdapterMarketData, } from "@morpho-org/blue-sdk";
6
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MidnightAdapter, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
7
7
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
8
8
  PreLiquidationParams,
9
9
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
10
- PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
10
+ PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MidnightAdapter, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1,5 +1,5 @@
1
- export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
1
+ export { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MidnightAdapter, AccrualVaultV2MorphoMarketV1Adapter, AccrualVaultV2MorphoMarketV1AdapterV2, AccrualVaultV2MorphoVaultV1Adapter, AssetBalances, ConstantWrappedToken, Eip5267Domain, ExchangeRateWrappedToken, Holding, Market, MarketParams, Position,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  PreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
5
+ PreLiquidationPosition, Token, User, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MidnightAdapter, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
@@ -1,4 +1,4 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, InvalidPositionAccrualStateError, InvalidPositionLossFactorError, InvalidVaultV2MidnightAdapterMarketsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
- export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnresolvedBlockNumberError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,4 +1,4 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, InvalidPositionAccrualStateError, InvalidPositionLossFactorError, InvalidVaultV2MidnightAdapterMarketsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
- export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnresolvedBlockNumberError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,5 +1,5 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MidnightAdapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  fetchPreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
5
+ fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MidnightAdapter, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -1,5 +1,5 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MidnightAdapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  fetchPreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
5
+ fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MidnightAdapter, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -3,5 +3,5 @@ export { AdaptiveCurveIrmLib, CapacityLimitReason,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  defaultPreLiquidationParamsRegistry,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
- getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
6
+ getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2MidnightAdapterUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
7
7
  export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -2,5 +2,5 @@ export { AdaptiveCurveIrmLib, CapacityLimitReason,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  defaultPreLiquidationParamsRegistry,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
5
+ getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2MidnightAdapterUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
6
6
  export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -1,4 +1,4 @@
1
1
  export { DEAD_ADDRESS, DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId as isBlueMarketId, LIQUIDATION_CURSOR as BLUE_LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR as BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType as BlueTransactionType, } from "@morpho-org/blue-sdk";
2
2
  export { CBP as MIDNIGHT_CBP, COLLATERAL_PARAMS_TYPEHASH as MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING as MIDNIGHT_DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH as MIDNIGHT_EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH as MIDNIGHT_MARKET_TYPEHASH, MAX_COLLATERALS as MIDNIGHT_MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER as MIDNIGHT_MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE as MIDNIGHT_MAX_CONTINUOUS_FEE, MAX_OFFER_CAP as MIDNIGHT_MAX_OFFER_CAP, MAX_SETTLEMENT_FEES as MIDNIGHT_MAX_SETTLEMENT_FEES, MAX_TICK as MIDNIGHT_MAX_TICK, MAX_TREE_HEIGHT as MIDNIGHT_MAX_TREE_HEIGHT, OFFER_TYPEHASH as MIDNIGHT_OFFER_TYPEHASH, PRICE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH, PRICE_ROUNDING_STEP as MIDNIGHT_PRICE_ROUNDING_STEP, RATE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH, SETTLEMENT_FEE_BREAKPOINTS as MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF as MIDNIGHT_TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
3
3
  export { BLUE_API_BASE_URL, BLUE_API_GRAPHQL_URL, ChainId, ChainUtils, DOCS_BASE_URL, MORPHO_DOMAIN, REWARDS_BASE_URL, ZERO_ADDRESS, } from "@morpho-org/morpho-ts";
4
- export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_MIN_BORROW_TIME_TO_MATURITY, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, MIN_DEAD_SHARES, MIN_VAULT_V2_DEAD_ASSETS, VAULT_DEPOSIT_MAX_DEADLINE_SECONDS, } from "./helpers/constant.js";
4
+ export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, LEVERAGE_CLOSE_INTEREST_BUFFER_FACTOR, LEVERAGE_DEADLINE_WINDOW, LEVERAGE_MAX_EXECUTION_LOSS, LEVERAGE_MAX_ORACLE_DEVIATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_MIN_BORROW_TIME_TO_MATURITY, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, MIN_DEAD_SHARES, MIN_VAULT_V2_DEAD_ASSETS, VAULT_DEPOSIT_MAX_DEADLINE_SECONDS, } from "./helpers/constant.js";
@@ -1,4 +1,4 @@
1
1
  export { DEAD_ADDRESS, DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId as isBlueMarketId, LIQUIDATION_CURSOR as BLUE_LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR as BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType as BlueTransactionType, } from "@morpho-org/blue-sdk";
2
2
  export { CBP as MIDNIGHT_CBP, COLLATERAL_PARAMS_TYPEHASH as MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING as MIDNIGHT_DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH as MIDNIGHT_EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH as MIDNIGHT_MARKET_TYPEHASH, MAX_COLLATERALS as MIDNIGHT_MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER as MIDNIGHT_MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE as MIDNIGHT_MAX_CONTINUOUS_FEE, MAX_OFFER_CAP as MIDNIGHT_MAX_OFFER_CAP, MAX_SETTLEMENT_FEES as MIDNIGHT_MAX_SETTLEMENT_FEES, MAX_TICK as MIDNIGHT_MAX_TICK, MAX_TREE_HEIGHT as MIDNIGHT_MAX_TREE_HEIGHT, OFFER_TYPEHASH as MIDNIGHT_OFFER_TYPEHASH, PRICE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH, PRICE_ROUNDING_STEP as MIDNIGHT_PRICE_ROUNDING_STEP, RATE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH, SETTLEMENT_FEE_BREAKPOINTS as MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF as MIDNIGHT_TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
3
3
  export { BLUE_API_BASE_URL, BLUE_API_GRAPHQL_URL, ChainId, ChainUtils, DOCS_BASE_URL, MORPHO_DOMAIN, REWARDS_BASE_URL, ZERO_ADDRESS, } from "@morpho-org/morpho-ts";
4
- export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_MIN_BORROW_TIME_TO_MATURITY, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, MIN_DEAD_SHARES, MIN_VAULT_V2_DEAD_ASSETS, VAULT_DEPOSIT_MAX_DEADLINE_SECONDS, } from "./helpers/constant.js";
4
+ export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, LEVERAGE_CLOSE_INTEREST_BUFFER_FACTOR, LEVERAGE_DEADLINE_WINDOW, LEVERAGE_MAX_EXECUTION_LOSS, LEVERAGE_MAX_ORACLE_DEVIATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_MIN_BORROW_TIME_TO_MATURITY, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, MIN_DEAD_SHARES, MIN_VAULT_V2_DEAD_ASSETS, VAULT_DEPOSIT_MAX_DEADLINE_SECONDS, } from "./helpers/constant.js";