@morpho-org/midnight-sdk 0.1.0 → 1.0.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 (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -46
  3. package/lib/cjs/abis.d.ts +1185 -996
  4. package/lib/cjs/abis.js +1445 -1211
  5. package/lib/cjs/api/MidnightApi.d.ts +22 -16
  6. package/lib/cjs/api/MidnightApi.js +22 -16
  7. package/lib/cjs/api/helpers.js +6 -3
  8. package/lib/cjs/api/types.d.ts +35 -9
  9. package/lib/cjs/constants.d.ts +12 -11
  10. package/lib/cjs/constants.js +14 -12
  11. package/lib/cjs/errors.d.ts +74 -1
  12. package/lib/cjs/errors.js +94 -3
  13. package/lib/cjs/fetch/Market.js +0 -1
  14. package/lib/cjs/fetch/index.d.ts +0 -1
  15. package/lib/cjs/fetch/index.js +0 -1
  16. package/lib/cjs/index.d.ts +1 -1
  17. package/lib/cjs/index.js +2 -23
  18. package/lib/cjs/market/Market.d.ts +99 -33
  19. package/lib/cjs/market/Market.js +137 -28
  20. package/lib/cjs/market/MarketUtils.d.ts +61 -41
  21. package/lib/cjs/market/MarketUtils.js +108 -48
  22. package/lib/cjs/market/Position.d.ts +16 -11
  23. package/lib/cjs/market/Position.js +18 -12
  24. package/lib/cjs/market/PositionUtils.d.ts +6 -4
  25. package/lib/cjs/market/PositionUtils.js +9 -6
  26. package/lib/cjs/math/TickLib.d.ts +22 -0
  27. package/lib/cjs/math/TickLib.js +30 -0
  28. package/lib/cjs/math/index.d.ts +0 -1
  29. package/lib/cjs/math/index.js +0 -1
  30. package/lib/cjs/offers/Offer.d.ts +217 -11
  31. package/lib/cjs/offers/Offer.js +215 -7
  32. package/lib/cjs/offers/OfferUtils.d.ts +245 -139
  33. package/lib/cjs/offers/OfferUtils.js +304 -36
  34. package/lib/cjs/queries/GetPosition.d.ts +1 -1
  35. package/lib/cjs/queries/GetPosition.js +1 -1
  36. package/lib/cjs/signatures/EcrecoverRatifierUtils.d.ts +66 -38
  37. package/lib/cjs/signatures/EcrecoverRatifierUtils.js +147 -79
  38. package/lib/cjs/signatures/Group.d.ts +12 -4
  39. package/lib/cjs/signatures/Group.js +12 -4
  40. package/lib/cjs/signatures/GroupUtils.d.ts +12 -4
  41. package/lib/cjs/signatures/GroupUtils.js +6 -2
  42. package/lib/cjs/signatures/Payload.d.ts +277 -277
  43. package/lib/cjs/signatures/Payload.js +517 -534
  44. package/lib/cjs/signatures/RatifierUtils.d.ts +57 -0
  45. package/lib/cjs/signatures/RatifierUtils.js +94 -0
  46. package/lib/cjs/signatures/SetterRatifierUtils.d.ts +21 -13
  47. package/lib/cjs/signatures/SetterRatifierUtils.js +25 -20
  48. package/lib/cjs/signatures/Tree.d.ts +28 -16
  49. package/lib/cjs/signatures/Tree.js +25 -13
  50. package/lib/cjs/signatures/TreeUtils.d.ts +181 -62
  51. package/lib/cjs/signatures/TreeUtils.js +73 -76
  52. package/lib/cjs/signatures/index.d.ts +1 -0
  53. package/lib/cjs/signatures/index.js +3 -0
  54. package/lib/cjs/signatures/offerStructInternal.d.ts +14 -0
  55. package/lib/cjs/signatures/offerStructInternal.js +72 -0
  56. package/lib/esm/abis.d.ts +1185 -996
  57. package/lib/esm/abis.js +1445 -1211
  58. package/lib/esm/api/MidnightApi.d.ts +22 -16
  59. package/lib/esm/api/MidnightApi.js +23 -17
  60. package/lib/esm/api/helpers.js +6 -3
  61. package/lib/esm/api/types.d.ts +35 -9
  62. package/lib/esm/constants.d.ts +12 -11
  63. package/lib/esm/constants.js +13 -11
  64. package/lib/esm/errors.d.ts +74 -1
  65. package/lib/esm/errors.js +89 -2
  66. package/lib/esm/fetch/Market.js +0 -1
  67. package/lib/esm/fetch/index.d.ts +0 -1
  68. package/lib/esm/fetch/index.js +0 -1
  69. package/lib/esm/index.d.ts +1 -1
  70. package/lib/esm/index.js +1 -1
  71. package/lib/esm/market/Market.d.ts +99 -33
  72. package/lib/esm/market/Market.js +137 -28
  73. package/lib/esm/market/MarketUtils.d.ts +61 -41
  74. package/lib/esm/market/MarketUtils.js +109 -49
  75. package/lib/esm/market/Position.d.ts +16 -11
  76. package/lib/esm/market/Position.js +19 -13
  77. package/lib/esm/market/PositionUtils.d.ts +6 -4
  78. package/lib/esm/market/PositionUtils.js +9 -6
  79. package/lib/esm/math/TickLib.d.ts +22 -0
  80. package/lib/esm/math/TickLib.js +31 -1
  81. package/lib/esm/math/index.d.ts +0 -1
  82. package/lib/esm/math/index.js +0 -1
  83. package/lib/esm/offers/Offer.d.ts +217 -11
  84. package/lib/esm/offers/Offer.js +216 -8
  85. package/lib/esm/offers/OfferUtils.d.ts +245 -139
  86. package/lib/esm/offers/OfferUtils.js +306 -38
  87. package/lib/esm/queries/GetPosition.d.ts +1 -1
  88. package/lib/esm/queries/GetPosition.js +1 -1
  89. package/lib/esm/signatures/EcrecoverRatifierUtils.d.ts +66 -38
  90. package/lib/esm/signatures/EcrecoverRatifierUtils.js +149 -81
  91. package/lib/esm/signatures/Group.d.ts +12 -4
  92. package/lib/esm/signatures/Group.js +12 -4
  93. package/lib/esm/signatures/GroupUtils.d.ts +12 -4
  94. package/lib/esm/signatures/GroupUtils.js +6 -2
  95. package/lib/esm/signatures/Payload.d.ts +277 -277
  96. package/lib/esm/signatures/Payload.js +517 -531
  97. package/lib/esm/signatures/RatifierUtils.d.ts +57 -0
  98. package/lib/esm/signatures/RatifierUtils.js +94 -0
  99. package/lib/esm/signatures/SetterRatifierUtils.d.ts +21 -13
  100. package/lib/esm/signatures/SetterRatifierUtils.js +25 -20
  101. package/lib/esm/signatures/Tree.d.ts +28 -16
  102. package/lib/esm/signatures/Tree.js +25 -13
  103. package/lib/esm/signatures/TreeUtils.d.ts +181 -62
  104. package/lib/esm/signatures/TreeUtils.js +75 -78
  105. package/lib/esm/signatures/index.d.ts +1 -0
  106. package/lib/esm/signatures/index.js +1 -0
  107. package/lib/esm/signatures/offerStructInternal.d.ts +14 -0
  108. package/lib/esm/signatures/offerStructInternal.js +67 -0
  109. package/package.json +28 -32
  110. package/src/index.ts +1 -1
  111. package/lib/cjs/fetch/Offer.d.ts +0 -74
  112. package/lib/cjs/fetch/Offer.js +0 -119
  113. package/lib/cjs/math/ConsumableUnitsLib.d.ts +0 -57
  114. package/lib/cjs/math/ConsumableUnitsLib.js +0 -77
  115. package/lib/esm/fetch/Offer.d.ts +0 -74
  116. package/lib/esm/fetch/Offer.js +0 -116
  117. package/lib/esm/math/ConsumableUnitsLib.d.ts +0 -57
  118. package/lib/esm/math/ConsumableUnitsLib.js +0 -74
@@ -1,8 +1,7 @@
1
1
  import { type BigIntish } from "@morpho-org/morpho-ts";
2
2
  import { type Account, type Address, type Chain, type Client, type Hash, type Hex, type Signature, type Transport } from "viem";
3
- import type { Item as PayloadItem } from "./Payload.js";
4
- import type { Tree } from "./Tree.js";
5
- import type { TreeProof } from "./TreeUtils.js";
3
+ import type { Payload } from "./Payload.js";
4
+ import { type RatifierTreeInput, type TreeProof } from "./TreeUtils.js";
6
5
  declare const typedDataTypes: {
7
6
  readonly EIP712Domain: readonly [{
8
7
  readonly name: "chainId";
@@ -18,13 +17,19 @@ declare const typedDataTypes: {
18
17
  readonly name: "lltv";
19
18
  readonly type: "uint256";
20
19
  }, {
21
- readonly name: "maxLif";
20
+ readonly name: "liquidationCursor";
22
21
  readonly type: "uint256";
23
22
  }, {
24
23
  readonly name: "oracle";
25
24
  readonly type: "address";
26
25
  }];
27
26
  readonly Market: readonly [{
27
+ readonly name: "chainId";
28
+ readonly type: "uint256";
29
+ }, {
30
+ readonly name: "midnight";
31
+ readonly type: "address";
32
+ }, {
28
33
  readonly name: "loanToken";
29
34
  readonly type: "address";
30
35
  }, {
@@ -81,10 +86,10 @@ declare const typedDataTypes: {
81
86
  readonly type: "bool";
82
87
  }, {
83
88
  readonly name: "maxUnits";
84
- readonly type: "uint256";
89
+ readonly type: "uint128";
85
90
  }, {
86
91
  readonly name: "maxAssets";
87
- readonly type: "uint256";
92
+ readonly type: "uint128";
88
93
  }, {
89
94
  readonly name: "continuousFeeCap";
90
95
  readonly type: "uint256";
@@ -132,12 +137,14 @@ export interface DecodedEcrecoverRatifierData extends TreeProof {
132
137
  *
133
138
  * const offer = Offer.create({
134
139
  * market: {
140
+ * chainId: 8453,
141
+ * midnight: "0x0000000000000000000000000000000000001000",
135
142
  * loanToken: "0x0000000000000000000000000000000000006000",
136
143
  * collateralParams: [
137
144
  * {
138
145
  * token: "0x0000000000000000000000000000000000007000",
139
146
  * lltv: 770000000000000000n,
140
- * maxLif: 1061007957559681697n,
147
+ * liquidationCursor: 250000000000000000n,
141
148
  * oracle: "0x0000000000000000000000000000000000008000",
142
149
  * },
143
150
  * ],
@@ -208,12 +215,14 @@ export type EcrecoverSignatureInput = Hex | Signature | Signature<number, number
208
215
  *
209
216
  * const offer = Offer.create({
210
217
  * market: {
218
+ * chainId: 8453,
219
+ * midnight: "0x0000000000000000000000000000000000001000",
211
220
  * loanToken: "0x0000000000000000000000000000000000006000",
212
221
  * collateralParams: [
213
222
  * {
214
223
  * token: "0x0000000000000000000000000000000000007000",
215
224
  * lltv: 770000000000000000n,
216
- * maxLif: 1061007957559681697n,
225
+ * liquidationCursor: 250000000000000000n,
217
226
  * oracle: "0x0000000000000000000000000000000000008000",
218
227
  * },
219
228
  * ],
@@ -237,8 +246,8 @@ export type EcrecoverSignatureInput = Hex | Signature | Signature<number, number
237
246
  * ```
238
247
  */
239
248
  export interface EcrecoverRatifierTypedDataParams {
240
- /** Tree being ratified. */
241
- readonly tree: Tree;
249
+ /** Tree-like input being ratified. Existing `Tree` instances reuse cached hashes and proofs. */
250
+ readonly tree: RatifierTreeInput;
242
251
  /** Chain id used by the EIP-712 domain. */
243
252
  readonly chainId: BigIntish;
244
253
  }
@@ -246,7 +255,7 @@ export interface EcrecoverRatifierTypedDataParams {
246
255
  * Parameters for {@link EcrecoverRatifierUtils.ratify}.
247
256
  *
248
257
  * Use this after tree validation. Provide either a signing client plus account
249
- * or a signature that was produced from `typedData`.
258
+ * or a precomputed signature plus the account that produced it.
250
259
  *
251
260
  * @example
252
261
  * ```ts
@@ -255,12 +264,14 @@ export interface EcrecoverRatifierTypedDataParams {
255
264
  *
256
265
  * const offer = Offer.create({
257
266
  * market: {
267
+ * chainId: 8453,
268
+ * midnight: "0x0000000000000000000000000000000000001000",
258
269
  * loanToken: "0x0000000000000000000000000000000000006000",
259
270
  * collateralParams: [
260
271
  * {
261
272
  * token: "0x0000000000000000000000000000000000007000",
262
273
  * lltv: 770000000000000000n,
263
- * maxLif: 1061007957559681697n,
274
+ * liquidationCursor: 250000000000000000n,
264
275
  * oracle: "0x0000000000000000000000000000000000008000",
265
276
  * },
266
277
  * ],
@@ -278,14 +289,15 @@ export interface EcrecoverRatifierTypedDataParams {
278
289
  * });
279
290
  * const params: EcrecoverRatifierRatifyParams = {
280
291
  * tree: Tree.create([offer]),
292
+ * account: "0x0000000000000000000000000000000000009000",
281
293
  * signature: { v: 27, r: zeroHash, s: zeroHash },
282
294
  * };
283
295
  * console.log(params.tree);
284
296
  * ```
285
297
  */
286
298
  export type EcrecoverRatifierRatifyParams = {
287
- /** Tree being ratified. */
288
- readonly tree: Tree;
299
+ /** Tree-like input being ratified. */
300
+ readonly tree: RatifierTreeInput;
289
301
  /** Viem client whose transport signs the typed data built from `tree`. */
290
302
  readonly client: Client<Transport, Chain, Account | undefined>;
291
303
  /** Account that signs the tree root. It may be the maker or an address authorized by each maker. */
@@ -293,15 +305,15 @@ export type EcrecoverRatifierRatifyParams = {
293
305
  /** Omit when the SDK should request the signature through `client`. */
294
306
  readonly signature?: undefined;
295
307
  } | {
296
- /** Tree being ratified. */
297
- readonly tree: Tree;
308
+ /** Tree-like input being ratified. */
309
+ readonly tree: RatifierTreeInput;
298
310
  /** Precomputed signature for this tree root. */
299
311
  readonly signature: EcrecoverSignatureInput;
312
+ /** Account that produced the signature. It may be the maker or an address authorized by each maker. */
313
+ readonly account: Account | Address;
300
314
  /** Omit when a precomputed signature is supplied. */
301
315
  readonly client?: undefined;
302
316
  /** Omit when a precomputed signature is supplied. */
303
- readonly account?: undefined;
304
- /** Omit when a precomputed signature is supplied. */
305
317
  readonly chainId?: undefined;
306
318
  };
307
319
  /**
@@ -314,12 +326,14 @@ export type EcrecoverRatifierRatifyParams = {
314
326
  *
315
327
  * const offer = Offer.create({
316
328
  * market: {
329
+ * chainId: 8453,
330
+ * midnight: "0x0000000000000000000000000000000000001000",
317
331
  * loanToken: "0x0000000000000000000000000000000000006000",
318
332
  * collateralParams: [
319
333
  * {
320
334
  * token: "0x0000000000000000000000000000000000007000",
321
335
  * lltv: 770000000000000000n,
322
- * maxLif: 1061007957559681697n,
336
+ * liquidationCursor: 250000000000000000n,
323
337
  * oracle: "0x0000000000000000000000000000000000008000",
324
338
  * },
325
339
  * ],
@@ -344,8 +358,8 @@ export type EcrecoverRatifierRatifyParams = {
344
358
  * ```
345
359
  */
346
360
  export interface EcrecoverRatifierDataParams {
347
- /** Tree that produced the proof. */
348
- readonly tree: Tree;
361
+ /** Tree-like input that produced the proof. Existing `Tree` instances reuse cached hashes and proofs. */
362
+ readonly tree: RatifierTreeInput;
349
363
  /** Leaf index to prove. */
350
364
  readonly leafIndex: BigIntish;
351
365
  /** Ecrecover signature for the tree root. */
@@ -359,7 +373,10 @@ export interface EcrecoverRatifierDataParams {
359
373
  * validate the tree, sign the typed data, call `ratify`, then pass the returned
360
374
  * items to `Payload.encode`. Ecrecover trees must contain one ratifier; split
361
375
  * trees by ratifier before signing. The signer may be the maker or an address
362
- * authorized by every maker in the tree.
376
+ * authorized by every maker in the tree. Ratifier helpers accept tree-like
377
+ * inputs rather than requiring the `Tree` class. Passing an existing `Tree`
378
+ * remains the optimal path because its cached offers, leaves, root, and height
379
+ * are reused for typed data and per-leaf proofs.
363
380
  *
364
381
  * @example
365
382
  * ```ts
@@ -382,16 +399,16 @@ export declare namespace EcrecoverRatifierUtils {
382
399
  * console.log(EcrecoverRatifierUtils.treeTypeHash(0));
383
400
  * ```
384
401
  */
385
- function treeTypeHash(height: number): "0xc27c38e446b48c820ab9c4373dc63a4a750a08165cb4bb488206ebabe045d650" | "0x4e15d8736f4406e07bf9844b1653474472a827130c61e899bf1f574a88b8d987" | "0x46d107447b480c38ef5b7f54603dba0cb23b887f302b01a998b9d8a80320dd53" | "0xd1f3607a8e81454bb3baf5f898274ab47541fffc690278a74f13e174e116be72" | "0xb2d98adca9d116c9bc02ce59ec599ac3c2d33db1c0d1217c7e411d9198d427be" | "0x5931e0597fcf986027f3118b2495a9ac22139d133f9ad2c2198e6738dc3886c5" | "0x3967d37928614a085b47e8758fbc3869a8aed63bdf60ccee8536ff2b5064da06" | "0xd6b9f5f45915a260f6e521d9b40f86c385730b6bc330590fcde212e2fea64263" | "0x080caa519dbd5328c119d9907e0fa3d9a50dc2ae4bf6dd42c93c100dbc89b51a" | "0x45da471048924165ea2ad1855ba940e454b486e71dcf1666c71a928c8844c419" | "0xa49a9434fc1836bd08097368325b31039b6a0fd44919f53e4d8f4bf814084cb0" | "0xd3e93e4525132f0187a6964dc01fef33fde414538ffd212e9f2f478c3263e0a0" | "0x25990db2d26547f92c711988300df317af57bad5cd5d9d8e787a82f95c929474" | "0x8e0c648afa977572ead40a1d10a6db2c425b8099545006d834a7b849c6166643" | "0x4b635250efa6243e277fdd0cf6df993c2943b64f10f3a0756ceb1f47ef8f9b18" | "0xbde1c927f6222c07c8df264e68b42b8382c7c2b85f4729e0df94297cfeebfa91" | "0x4d58aea1a67f94be21ab1415bf3b602592430eb9112268fd0fc4e141b1a35e76" | "0x14c03281bce13010b158e5a4a3378be394ac9e16118aedb17d82ced51e66836c" | "0x99fd3e76f43b2cc221cb9860bc6c96cda95af3fa07ef5f04e071b54aa9386d06" | "0x1b1c2f1a04968094d8d0453d49838f7a809d1202ae04a1c2e0964e442ff7988b" | "0xc8ccd3cb3267dd76f563584920ac60f2283b719917481b85fe5e10b754932455";
402
+ function treeTypeHash(height: number): "0x270da1ebafc0f24637af3612fb8c3a1d828fcb56d3637c24e86dd006b12ca7f9" | "0x828b9cdf8326a1cf234328e4d5229546a98fb72ef73624f5b6b31538e555b96c" | "0xfcb7a3ca4094246b8185620c4cf025c93032b6f0384805aa3f22afe04290e982" | "0xcc97cb1955496a5269b5a7afca62ba694edcab26ba838a1adbd257931249de92" | "0xda3feb08db360ad9e09540132ff04d2b6a596fdaa4747892217aaa4c7c9bcc31" | "0x15bd6e2aa1a7a61614187ac16d2cbf8610c8f2f3c3d9eaa380ae7a501ee3cf06" | "0xb726cb7fab1a24c28213cbd482fa5a301f127fb25feb01da341919983a72711a" | "0xcea9cd557c6f821868ea287304199d0e0554af630bfa8fe36c64eb3bbacca418" | "0xf7dbde8234e8e345cec8fc0a8ac5909ee336b214882751ecd51e7b37df4f6cdd" | "0x5400a5d43d39e6bfe910af8cb84ac77bf501d310413769dffd62ccecda8b00c6" | "0x0754209b60d99d0822b3ecd5a970f9db09df9c8998a8441e24b81f06d6c76fee" | "0xf5d561d88647c3b38ed6636709d3166819fc66f8ed52a0daf4ae186387b4646c" | "0x5801c07a6c7df039ce00a7a2b8bd92aa1cf333c30b0bc3d78768590b6063d09e" | "0xc9da7190eaf4b14c7cb1c14f9898256c0adb6b1dc303afe79594dea64fe199c0" | "0xa47534c85ac57c583568465d40fd46683d2d558d8129fe1aca01e93023afca92" | "0xb1e841691fb54f4ef85e2ed9de45d610e57f49e1e6eb2510ceead16e447dd519" | "0x4fa4f16f09f0c36c7670449a4032073380d28a60071e12ee8874bb3e5a8318fc" | "0x817bbaac8bb863670f488b454cdd5d0990d9d81871a68e9df381c3c13d3f2ba2" | "0xc447f06079bddf4b011523c4bce119e9e90fdf937de4ee88f48010406560e9c1" | "0x1608d5eb56943c667c34b413f9f8a1c24a84ddfe1301a9c25487e638de1f5822" | "0x3a677100d2e855c24a62d1e9c365bff90d02287f066a07064843ca1ee70ea113";
386
403
  /**
387
- * Builds EcrecoverRatifier typed data for a tree.
404
+ * Builds EcrecoverRatifier typed data for a tree-like input.
388
405
  *
389
406
  * Use after the tree is built and validated, before requesting the signer
390
407
  * signature. The EIP-712 verifier is derived from the shared ratifier address
391
408
  * on the tree offers. `ratify` calls this for you when given a client and
392
409
  * account.
393
410
  *
394
- * @param params.tree - Ecrecover-ratified offer tree to sign.
411
+ * @param params.tree - Ecrecover-ratified offer tree-like input to sign.
395
412
  * @param params.chainId - EIP-155 chain id included in the EIP-712 domain.
396
413
  * @returns EIP-712 typed-data descriptor.
397
414
  * @throws {InvalidTreeError} when the tree is invalid or contains multiple ratifiers.
@@ -404,12 +421,14 @@ export declare namespace EcrecoverRatifierUtils {
404
421
  *
405
422
  * const offer = Offer.create({
406
423
  * market: {
424
+ * chainId: 8453,
425
+ * midnight: "0x0000000000000000000000000000000000001000",
407
426
  * loanToken: "0x0000000000000000000000000000000000006000",
408
427
  * collateralParams: [
409
428
  * {
410
429
  * token: "0x0000000000000000000000000000000000007000",
411
430
  * lltv: 770000000000000000n,
412
- * maxLif: 1061007957559681697n,
431
+ * liquidationCursor: 250000000000000000n,
413
432
  * oracle: "0x0000000000000000000000000000000000008000",
414
433
  * },
415
434
  * ],
@@ -437,7 +456,7 @@ export declare namespace EcrecoverRatifierUtils {
437
456
  /**
438
457
  * Builds the EcrecoverRatifier digest used by the Solidity ratifier.
439
458
  *
440
- * @param params.tree - Ecrecover-ratified offer tree to hash.
459
+ * @param params.tree - Ecrecover-ratified offer tree-like input to hash.
441
460
  * @param params.chainId - EIP-155 chain id included in the EIP-712 domain.
442
461
  * @returns EIP-712 digest.
443
462
  * @throws {InvalidTreeError} when the tree contains multiple ratifiers.
@@ -450,12 +469,14 @@ export declare namespace EcrecoverRatifierUtils {
450
469
  *
451
470
  * const offer = Offer.create({
452
471
  * market: {
472
+ * chainId: 8453,
473
+ * midnight: "0x0000000000000000000000000000000000001000",
453
474
  * loanToken: "0x0000000000000000000000000000000000006000",
454
475
  * collateralParams: [
455
476
  * {
456
477
  * token: "0x0000000000000000000000000000000000007000",
457
478
  * lltv: 770000000000000000n,
458
- * maxLif: 1061007957559681697n,
479
+ * liquidationCursor: 250000000000000000n,
459
480
  * oracle: "0x0000000000000000000000000000000000008000",
460
481
  * },
461
482
  * ],
@@ -488,12 +509,13 @@ export declare namespace EcrecoverRatifierUtils {
488
509
  * client and account. The account may be the maker or an address authorized
489
510
  * by every maker in the tree; the protocol checks that authorization onchain.
490
511
  *
491
- * @param params.tree - Ecrecover-ratified offer tree to sign.
512
+ * @param params.tree - Ecrecover-ratified offer tree-like input to sign.
492
513
  * @param params.client - Viem client whose transport signs the tree typed data.
493
514
  * @param params.account - Account used to sign the tree typed data.
494
515
  * @returns Signature returned by the client.
495
- * @throws {InvalidTreeError} when the tree is invalid or contains multiple ratifiers.
516
+ * @throws {InvalidTreeError} when the tree is invalid, contains multiple ratifiers, or spans multiple chain ids.
496
517
  * @throws {InvalidTreeHeightError} when the tree height is unsupported.
518
+ * @throws {ChainIdMismatchError} when `params.client.chain?.id` does not match the tree offer chain id.
497
519
  * @throws {InvalidTypedDataSignatureError} when the returned signature does not recover to `params.account`.
498
520
  * @example
499
521
  * ```ts
@@ -504,12 +526,14 @@ export declare namespace EcrecoverRatifierUtils {
504
526
  *
505
527
  * const offer = Offer.create({
506
528
  * market: {
529
+ * chainId: 8453,
530
+ * midnight: "0x0000000000000000000000000000000000001000",
507
531
  * loanToken: "0x0000000000000000000000000000000000006000",
508
532
  * collateralParams: [
509
533
  * {
510
534
  * token: "0x0000000000000000000000000000000000007000",
511
535
  * lltv: 770000000000000000n,
512
- * maxLif: 1061007957559681697n,
536
+ * liquidationCursor: 250000000000000000n,
513
537
  * oracle: "0x0000000000000000000000000000000000008000",
514
538
  * },
515
539
  * ],
@@ -539,7 +563,7 @@ export declare namespace EcrecoverRatifierUtils {
539
563
  * ```
540
564
  */
541
565
  function sign(params: {
542
- readonly tree: Tree;
566
+ readonly tree: RatifierTreeInput;
543
567
  readonly client: Client<Transport, Chain, Account | undefined>;
544
568
  readonly account: Account | Address;
545
569
  }): Promise<Hex>;
@@ -628,7 +652,7 @@ export declare namespace EcrecoverRatifierUtils {
628
652
  * Use after a tree has been signed when a caller needs data for one offer
629
653
  * leaf. Use `ratify` to produce payload-ready items for the whole tree.
630
654
  *
631
- * @param params.tree - Ecrecover-ratified offer tree that produced the proof.
655
+ * @param params.tree - Ecrecover-ratified offer tree-like input that produced the proof.
632
656
  * @param params.leafIndex - Leaf index to prove.
633
657
  * @param params.signature - Ecrecover signature for the tree root.
634
658
  * @returns ABI-encoded EcrecoverRatifier data.
@@ -640,12 +664,14 @@ export declare namespace EcrecoverRatifierUtils {
640
664
  *
641
665
  * const offer = Offer.create({
642
666
  * market: {
667
+ * chainId: 8453,
668
+ * midnight: "0x0000000000000000000000000000000000001000",
643
669
  * loanToken: "0x0000000000000000000000000000000000006000",
644
670
  * collateralParams: [
645
671
  * {
646
672
  * token: "0x0000000000000000000000000000000000007000",
647
673
  * lltv: 770000000000000000n,
648
- * maxLif: 1061007957559681697n,
674
+ * liquidationCursor: 250000000000000000n,
649
675
  * oracle: "0x0000000000000000000000000000000000008000",
650
676
  * },
651
677
  * ],
@@ -677,14 +703,14 @@ export declare namespace EcrecoverRatifierUtils {
677
703
  * The returned items preserve tree leaf order and include ratifier data
678
704
  * required by takers. The group id is stored on each inline offer.
679
705
  *
680
- * @param params.tree - Ecrecover-ratified offer tree to ratify.
706
+ * @param params.tree - Ecrecover-ratified offer tree-like input to ratify.
681
707
  * @param params.client - Optional viem client whose transport signs typed data built from `params.tree`.
682
708
  * @param params.account - Optional account used to sign typed data built from `params.tree`.
683
709
  * @param params.signature - Optional precomputed signature for `params.tree`.
684
710
  * @returns Items containing each offer and its ratifier data.
685
711
  * @throws {InvalidTreeError} when the tree is invalid or contains multiple ratifiers.
686
712
  * @throws {InvalidTreeHeightError} when the tree height is unsupported.
687
- * @throws {InvalidTypedDataSignatureError} when client signing returns a signature that does not recover to `params.account`.
713
+ * @throws {InvalidTypedDataSignatureError} when client signing or a precomputed signature does not recover to `params.account`.
688
714
  * @example
689
715
  * ```ts
690
716
  * import { EcrecoverRatifierUtils, Tree } from "@morpho-org/midnight-sdk";
@@ -694,12 +720,14 @@ export declare namespace EcrecoverRatifierUtils {
694
720
  *
695
721
  * const offer = Offer.create({
696
722
  * market: {
723
+ * chainId: 8453,
724
+ * midnight: "0x0000000000000000000000000000000000001000",
697
725
  * loanToken: "0x0000000000000000000000000000000000006000",
698
726
  * collateralParams: [
699
727
  * {
700
728
  * token: "0x0000000000000000000000000000000000007000",
701
729
  * lltv: 770000000000000000n,
702
- * maxLif: 1061007957559681697n,
730
+ * liquidationCursor: 250000000000000000n,
703
731
  * oracle: "0x0000000000000000000000000000000000008000",
704
732
  * },
705
733
  * ],
@@ -728,6 +756,6 @@ export declare namespace EcrecoverRatifierUtils {
728
756
  * console.log(items.length);
729
757
  * ```
730
758
  */
731
- function ratify(params: EcrecoverRatifierRatifyParams): Promise<readonly PayloadItem[]>;
759
+ function ratify(params: EcrecoverRatifierRatifyParams): Promise<readonly Payload.Item[]>;
732
760
  }
733
761
  export {};