@morpho-dev/router 0.1.18 → 0.2.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 (53) hide show
  1. package/README.md +29 -19
  2. package/dist/chunk-jass6xSI.mjs +13 -0
  3. package/dist/cli.js +6574 -6194
  4. package/dist/drizzle/migrations/0000_setup_single_migration_folder.sql +204 -0
  5. package/dist/drizzle/migrations/0001_add-trigger-for-consumed-events.sql +58 -0
  6. package/dist/drizzle/migrations/0002_insert-status-code.sql +1 -0
  7. package/dist/drizzle/migrations/0003_update-triggers-for-consumed-events.sql +3 -0
  8. package/dist/drizzle/migrations/0004_drop-status-offers-foreign-key-constraint.sql +1 -0
  9. package/dist/drizzle/migrations/0005_add-index-to-boost-group-query-and-offer-hash.sql +1 -0
  10. package/dist/drizzle/migrations/0006_add-callbacks-and-positions-relations.sql +37 -0
  11. package/dist/drizzle/migrations/0008_validation.sql +15 -0
  12. package/dist/drizzle/migrations/0009_add-transfers-table.sql +14 -0
  13. package/dist/drizzle/migrations/0010_add-price.sql +1 -0
  14. package/dist/drizzle/migrations/0011_nullable-callback-amount.sql +1 -0
  15. package/dist/drizzle/migrations/0012_add-position-asset.sql +1 -0
  16. package/dist/drizzle/migrations/0013_remove-depecrated-domains.sql +13 -0
  17. package/dist/drizzle/migrations/0014_rename-offers-v2-into-offers.sql +23 -0
  18. package/dist/drizzle/{router_v1.4 → migrations}/meta/0000_snapshot.json +858 -78
  19. package/dist/drizzle/migrations/meta/0001_snapshot.json +1752 -0
  20. package/dist/drizzle/migrations/meta/0002_snapshot.json +1752 -0
  21. package/dist/drizzle/migrations/meta/0003_snapshot.json +1752 -0
  22. package/dist/drizzle/{router_v1.4/meta/0001_snapshot.json → migrations/meta/0004_snapshot.json} +848 -78
  23. package/dist/drizzle/migrations/meta/0005_snapshot.json +1775 -0
  24. package/dist/drizzle/migrations/meta/0006_snapshot.json +1973 -0
  25. package/dist/drizzle/migrations/meta/0008_snapshot.json +1955 -0
  26. package/dist/drizzle/migrations/meta/0009_snapshot.json +2078 -0
  27. package/dist/drizzle/migrations/meta/0010_snapshot.json +2084 -0
  28. package/dist/drizzle/migrations/meta/0013_snapshot.json +1290 -0
  29. package/dist/drizzle/migrations/meta/0014_snapshot.json +1290 -0
  30. package/dist/drizzle/migrations/meta/_journal.json +104 -0
  31. package/dist/index.browser.d.mts +2794 -0
  32. package/dist/index.browser.d.mts.map +1 -0
  33. package/dist/index.browser.d.ts +2290 -1172
  34. package/dist/index.browser.d.ts.map +1 -0
  35. package/dist/index.browser.js +3820 -2519
  36. package/dist/index.browser.js.map +1 -1
  37. package/dist/index.browser.mjs +3615 -2467
  38. package/dist/index.browser.mjs.map +1 -1
  39. package/dist/index.node.d.mts +4987 -0
  40. package/dist/index.node.d.mts.map +1 -0
  41. package/dist/index.node.d.ts +4423 -2906
  42. package/dist/index.node.d.ts.map +1 -0
  43. package/dist/index.node.js +7810 -6141
  44. package/dist/index.node.js.map +1 -1
  45. package/dist/index.node.mjs +7556 -6102
  46. package/dist/index.node.mjs.map +1 -1
  47. package/package.json +29 -15
  48. package/dist/cli.js.map +0 -1
  49. package/dist/drizzle/router_v1.4/0000_add_obligation_id.sql +0 -112
  50. package/dist/drizzle/router_v1.4/0001_update-primary-key-on-link.sql +0 -3
  51. package/dist/drizzle/router_v1.4/meta/_journal.json +0 -20
  52. package/dist/index.browser.d.cts +0 -1675
  53. package/dist/index.node.d.cts +0 -3471
@@ -0,0 +1,2794 @@
1
+ import { z } from "zod/v4";
2
+ import { AbiEvent, Address, ChainContract, ChainFormatters, GetLogsReturnType, Hex, MulticallParameters, PublicClient, Transport, WalletClient } from "viem";
3
+ import "reflect-metadata";
4
+ import { OpenAPIDocument } from "openapi-metadata";
5
+ import * as z$1 from "zod";
6
+ import { Client } from "openapi-fetch";
7
+ import { Chain } from "viem/chains";
8
+ import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
9
+
10
+ //#region src/api/Schema/BookResponse.d.ts
11
+ declare namespace BookResponse_d_exports {
12
+ export { BookLevelResponse, from$13 as from };
13
+ }
14
+ type BookLevelResponse = {
15
+ rate: string;
16
+ assets: string;
17
+ count: number;
18
+ };
19
+ declare function from$13(level: {
20
+ rate: bigint;
21
+ assets: bigint;
22
+ count: number;
23
+ }): BookLevelResponse;
24
+ //#endregion
25
+ //#region src/api/Schema/health.d.ts
26
+ declare const CollectorHealth: z.ZodObject<{
27
+ name: z.ZodString;
28
+ chain_id: z.ZodNumber;
29
+ block_number: z.ZodNullable<z.ZodNumber>;
30
+ updated_at: z.ZodNullable<z.ZodString>;
31
+ lag: z.ZodNullable<z.ZodNumber>;
32
+ status: z.ZodEnum<{
33
+ live: "live";
34
+ lagging: "lagging";
35
+ unknown: "unknown";
36
+ }>;
37
+ }, z.core.$strip>;
38
+ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
39
+ name: z.ZodString;
40
+ chain_id: z.ZodNumber;
41
+ block_number: z.ZodNullable<z.ZodNumber>;
42
+ updated_at: z.ZodNullable<z.ZodString>;
43
+ lag: z.ZodNullable<z.ZodNumber>;
44
+ status: z.ZodEnum<{
45
+ live: "live";
46
+ lagging: "lagging";
47
+ unknown: "unknown";
48
+ }>;
49
+ }, z.core.$strip>>;
50
+ declare const ChainHealth: z.ZodObject<{
51
+ chain_id: z.ZodNumber;
52
+ local_block_number: z.ZodNumber;
53
+ remote_block_number: z.ZodNullable<z.ZodNumber>;
54
+ updated_at: z.ZodString;
55
+ }, z.core.$strip>;
56
+ declare const ChainsHealthResponse: z.ZodArray<z.ZodObject<{
57
+ chain_id: z.ZodNumber;
58
+ local_block_number: z.ZodNumber;
59
+ remote_block_number: z.ZodNullable<z.ZodNumber>;
60
+ updated_at: z.ZodString;
61
+ }, z.core.$strip>>;
62
+ declare const RouterStatusResponse: z.ZodObject<{
63
+ status: z.ZodEnum<{
64
+ live: "live";
65
+ syncing: "syncing";
66
+ }>;
67
+ }, z.core.$strip>;
68
+ type CollectorsHealthResponse = z.infer<typeof CollectorsHealthResponse>;
69
+ type ChainsHealthResponse = z.infer<typeof ChainsHealthResponse>;
70
+ type RouterStatusResponse = z.infer<typeof RouterStatusResponse>;
71
+ //#endregion
72
+ //#region src/core/Abi/MetaMorpho.d.ts
73
+ declare const MetaMorpho: readonly [{
74
+ readonly name: "balanceOf";
75
+ readonly type: "function";
76
+ readonly stateMutability: "view";
77
+ readonly inputs: readonly [{
78
+ readonly type: "address";
79
+ readonly name: "account";
80
+ }];
81
+ readonly outputs: readonly [{
82
+ readonly type: "uint256";
83
+ }];
84
+ }, {
85
+ readonly name: "DECIMALS_OFFSET";
86
+ readonly type: "function";
87
+ readonly stateMutability: "view";
88
+ readonly inputs: readonly [];
89
+ readonly outputs: readonly [{
90
+ readonly type: "uint8";
91
+ }];
92
+ }, {
93
+ readonly name: "totalAssets";
94
+ readonly type: "function";
95
+ readonly stateMutability: "view";
96
+ readonly inputs: readonly [];
97
+ readonly outputs: readonly [{
98
+ readonly type: "uint256";
99
+ }];
100
+ }, {
101
+ readonly name: "totalSupply";
102
+ readonly type: "function";
103
+ readonly stateMutability: "view";
104
+ readonly inputs: readonly [];
105
+ readonly outputs: readonly [{
106
+ readonly type: "uint256";
107
+ }];
108
+ }, {
109
+ readonly name: "maxWithdraw";
110
+ readonly type: "function";
111
+ readonly stateMutability: "view";
112
+ readonly inputs: readonly [{
113
+ readonly type: "address";
114
+ readonly name: "owner";
115
+ }];
116
+ readonly outputs: readonly [{
117
+ readonly type: "uint256";
118
+ readonly name: "assets";
119
+ }];
120
+ }, {
121
+ readonly name: "asset";
122
+ readonly type: "function";
123
+ readonly stateMutability: "view";
124
+ readonly inputs: readonly [];
125
+ readonly outputs: readonly [{
126
+ readonly type: "address";
127
+ }];
128
+ }, {
129
+ readonly name: "Transfer";
130
+ readonly type: "event";
131
+ readonly inputs: readonly [{
132
+ readonly type: "address";
133
+ readonly name: "from";
134
+ readonly indexed: true;
135
+ }, {
136
+ readonly type: "address";
137
+ readonly name: "to";
138
+ readonly indexed: true;
139
+ }, {
140
+ readonly type: "uint256";
141
+ readonly name: "value";
142
+ }];
143
+ }, {
144
+ readonly name: "withdrawQueue";
145
+ readonly type: "function";
146
+ readonly stateMutability: "view";
147
+ readonly inputs: readonly [{
148
+ readonly type: "uint256";
149
+ readonly name: "index";
150
+ }];
151
+ readonly outputs: readonly [{
152
+ readonly type: "bytes32";
153
+ }];
154
+ }, {
155
+ readonly name: "withdrawQueueLength";
156
+ readonly type: "function";
157
+ readonly stateMutability: "view";
158
+ readonly inputs: readonly [];
159
+ readonly outputs: readonly [{
160
+ readonly type: "uint256";
161
+ }];
162
+ }];
163
+ type MetaMorpho = typeof MetaMorpho;
164
+ //#endregion
165
+ //#region src/core/Abi/MetaMorphoFactory.d.ts
166
+ declare const MetaMorphoFactory: readonly [{
167
+ readonly name: "CreateMetaMorpho";
168
+ readonly type: "event";
169
+ readonly inputs: readonly [{
170
+ readonly type: "address";
171
+ readonly name: "metaMorpho";
172
+ readonly indexed: true;
173
+ }, {
174
+ readonly type: "address";
175
+ readonly name: "caller";
176
+ readonly indexed: true;
177
+ }, {
178
+ readonly type: "address";
179
+ readonly name: "initialOwner";
180
+ }, {
181
+ readonly type: "uint256";
182
+ readonly name: "initialTimelock";
183
+ }, {
184
+ readonly type: "address";
185
+ readonly name: "asset";
186
+ readonly indexed: true;
187
+ }, {
188
+ readonly type: "string";
189
+ readonly name: "name";
190
+ }, {
191
+ readonly type: "string";
192
+ readonly name: "symbol";
193
+ }, {
194
+ readonly type: "bytes32";
195
+ readonly name: "salt";
196
+ }];
197
+ }, {
198
+ readonly name: "isMetaMorpho";
199
+ readonly type: "function";
200
+ readonly stateMutability: "view";
201
+ readonly inputs: readonly [{
202
+ readonly type: "address";
203
+ }];
204
+ readonly outputs: readonly [{
205
+ readonly type: "bool";
206
+ }];
207
+ }];
208
+ type MetaMorphoFactory = typeof MetaMorphoFactory;
209
+ declare namespace index_d_exports {
210
+ export { ERC4626, MetaMorpho, MetaMorphoFactory, Morpho, Oracle$1 as Oracle };
211
+ }
212
+ declare const Oracle$1: readonly [{
213
+ readonly type: "function";
214
+ readonly name: "price";
215
+ readonly inputs: readonly [];
216
+ readonly outputs: readonly [{
217
+ readonly name: "";
218
+ readonly type: "uint256";
219
+ }];
220
+ readonly stateMutability: "view";
221
+ }];
222
+ declare const ERC4626: readonly [{
223
+ readonly type: "function";
224
+ readonly name: "asset";
225
+ readonly inputs: readonly [];
226
+ readonly outputs: readonly [{
227
+ readonly name: "";
228
+ readonly type: "address";
229
+ }];
230
+ readonly stateMutability: "view";
231
+ }];
232
+ declare const Morpho: readonly [{
233
+ readonly type: "function";
234
+ readonly name: "collateralOf";
235
+ readonly inputs: readonly [{
236
+ readonly name: "";
237
+ readonly type: "address";
238
+ readonly internalType: "address";
239
+ }, {
240
+ readonly name: "";
241
+ readonly type: "bytes32";
242
+ readonly internalType: "bytes32";
243
+ }, {
244
+ readonly name: "";
245
+ readonly type: "address";
246
+ readonly internalType: "address";
247
+ }];
248
+ readonly outputs: readonly [{
249
+ readonly name: "";
250
+ readonly type: "uint256";
251
+ readonly internalType: "uint256";
252
+ }];
253
+ readonly stateMutability: "view";
254
+ }, {
255
+ readonly type: "function";
256
+ readonly name: "debtOf";
257
+ readonly inputs: readonly [{
258
+ readonly name: "";
259
+ readonly type: "address";
260
+ readonly internalType: "address";
261
+ }, {
262
+ readonly name: "";
263
+ readonly type: "bytes32";
264
+ readonly internalType: "bytes32";
265
+ }];
266
+ readonly outputs: readonly [{
267
+ readonly name: "";
268
+ readonly type: "uint256";
269
+ readonly internalType: "uint256";
270
+ }];
271
+ readonly stateMutability: "view";
272
+ }, {
273
+ readonly type: "function";
274
+ readonly name: "market";
275
+ readonly inputs: readonly [{
276
+ readonly name: "id";
277
+ readonly type: "bytes32";
278
+ readonly internalType: "Id";
279
+ }];
280
+ readonly outputs: readonly [{
281
+ readonly name: "totalSupplyAssets";
282
+ readonly type: "uint128";
283
+ readonly internalType: "uint128";
284
+ }, {
285
+ readonly name: "totalSupplyShares";
286
+ readonly type: "uint128";
287
+ readonly internalType: "uint128";
288
+ }, {
289
+ readonly name: "totalBorrowAssets";
290
+ readonly type: "uint128";
291
+ readonly internalType: "uint128";
292
+ }, {
293
+ readonly name: "totalBorrowShares";
294
+ readonly type: "uint128";
295
+ readonly internalType: "uint128";
296
+ }, {
297
+ readonly name: "lastUpdate";
298
+ readonly type: "uint128";
299
+ readonly internalType: "uint128";
300
+ }, {
301
+ readonly name: "fee";
302
+ readonly type: "uint128";
303
+ readonly internalType: "uint128";
304
+ }];
305
+ readonly stateMutability: "view";
306
+ }, {
307
+ readonly type: "function";
308
+ readonly name: "position";
309
+ readonly inputs: readonly [{
310
+ readonly name: "id";
311
+ readonly type: "bytes32";
312
+ readonly internalType: "Id";
313
+ }, {
314
+ readonly name: "user";
315
+ readonly type: "address";
316
+ readonly internalType: "address";
317
+ }];
318
+ readonly outputs: readonly [{
319
+ readonly name: "supplyShares";
320
+ readonly type: "uint256";
321
+ readonly internalType: "uint256";
322
+ }, {
323
+ readonly name: "borrowShares";
324
+ readonly type: "uint128";
325
+ readonly internalType: "uint128";
326
+ }, {
327
+ readonly name: "collateral";
328
+ readonly type: "uint128";
329
+ readonly internalType: "uint128";
330
+ }];
331
+ readonly stateMutability: "view";
332
+ }];
333
+ declare namespace Callback_d_exports {
334
+ export { CallbackType, decode$3 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$3 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
335
+ }
336
+ declare enum CallbackType {
337
+ BuyWithEmptyCallback = "buy_with_empty_callback",
338
+ BuyVaultV1Callback = "buy_vault_v1_callback",
339
+ SellERC20Callback = "sell_erc20_callback",
340
+ }
341
+ declare const isEmptyCallback: (offer: Offer) => boolean;
342
+ declare function decode$3(type: CallbackType, data: Hex): {
343
+ contract: Address;
344
+ amount: bigint;
345
+ }[];
346
+ declare function encode$3(type: CallbackType, data: any): Hex;
347
+ declare function decodeBuyVaultV1Callback(data: Hex): Array<{
348
+ contract: Address;
349
+ amount: bigint;
350
+ }>;
351
+ declare function decodeSellERC20Callback(data: Hex): Array<{
352
+ contract: Address;
353
+ amount: bigint;
354
+ }>;
355
+ declare function encodeBuyVaultV1Callback(parameters: {
356
+ vaults: Address[];
357
+ amounts: bigint[];
358
+ }): Hex;
359
+ declare function encodeSellERC20Callback(parameters: {
360
+ collaterals: Address[];
361
+ amounts: bigint[];
362
+ }): Hex;
363
+ declare namespace Errors_d_exports {
364
+ export { BaseError, GlobalErrorType, ReorgError };
365
+ }
366
+ type GlobalErrorType<name extends string = "Error"> = Error & {
367
+ name: name;
368
+ };
369
+ /**
370
+ * Base error class inherited by all errors thrown by mempool.
371
+ *
372
+ * @example
373
+ * ```ts
374
+ * import { Errors } from 'mempool'
375
+ * throw new Errors.BaseError('An error occurred')
376
+ * ```
377
+ */
378
+ declare class BaseError<cause extends Error | undefined = undefined> extends Error {
379
+ details: string;
380
+ shortMessage: string;
381
+ cause: cause;
382
+ name: string;
383
+ constructor(shortMessage: string, options?: {
384
+ cause?: cause | undefined;
385
+ details?: string | undefined;
386
+ metaMessages?: (string | undefined)[] | undefined;
387
+ });
388
+ walk(): Error;
389
+ walk(fn: (err: unknown) => boolean): Error | null;
390
+ }
391
+ declare class ReorgError extends BaseError {
392
+ name: string;
393
+ constructor(blockNumber: number);
394
+ }
395
+ declare namespace Chain_d_exports {
396
+ export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains$1 as chains, getChain, getWhitelistedChains, streamLogs };
397
+ }
398
+ type Chain$1 = Compute<Chain<ChainFormatters, {
399
+ morpho: ChainContract;
400
+ morphoBlue: ChainContract;
401
+ mempool: ChainContract;
402
+ vaults: {
403
+ factories: {
404
+ v1_0: ChainContract;
405
+ v1_1: ChainContract;
406
+ };
407
+ };
408
+ }> & {
409
+ id: Id;
410
+ name: Name;
411
+ }>;
412
+ declare const ChainId: {
413
+ readonly ETHEREUM: 1;
414
+ readonly BASE: 8453;
415
+ readonly "ETHEREUM-VIRTUAL-TESTNET": 109111114;
416
+ readonly ANVIL: 505050505;
417
+ };
418
+ type Name = Lowercase<keyof typeof ChainId>;
419
+ declare const chainNames: readonly Name[];
420
+ type Id = (typeof ChainId)[Uppercase<Name>];
421
+ declare const chainIds: readonly Id[];
422
+ declare function getChain(chainId: Id): Chain$1 | undefined;
423
+ declare const getWhitelistedChains: () => Chain$1[];
424
+ declare const chains$1: Record<Lowercase<Name>, Chain$1>;
425
+ declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
426
+ client: PublicClient;
427
+ contractAddress?: Address;
428
+ event?: abiEvent;
429
+ blockNumberGte?: number;
430
+ blockNumberLte?: number;
431
+ order: "asc" | "desc";
432
+ options: {
433
+ maxBatchSize?: number;
434
+ blockWindow?: number;
435
+ };
436
+ }): AsyncGenerator<{
437
+ logs: GetLogsReturnType<abiEvent | undefined>;
438
+ blockNumber: number;
439
+ }, void, void>;
440
+ declare class InvalidBlockRangeError extends BaseError {
441
+ name: string;
442
+ constructor(fromBlock: bigint, toBlock: bigint);
443
+ }
444
+ declare class InvalidBlockWindowError extends BaseError {
445
+ name: string;
446
+ constructor(blockWindow: number);
447
+ }
448
+ declare class InvalidBatchSizeError extends BaseError {
449
+ name: string;
450
+ constructor(maxBatchSize: number);
451
+ }
452
+ declare class MissingBlockNumberError extends BaseError {
453
+ name: string;
454
+ constructor();
455
+ }
456
+ //#endregion
457
+ //#region src/core/types.d.ts
458
+ /** Combines members of an intersection into a readable type. */
459
+ type Compute<type> = { [key in keyof type]: type[key] } & unknown;
460
+ declare const BrandTypeId: unique symbol;
461
+ type Brand<in out ID extends string | symbol> = {
462
+ readonly [BrandTypeId]: { readonly [id in ID]: ID };
463
+ };
464
+ declare namespace LLTV_d_exports {
465
+ export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$12 as from };
466
+ }
467
+ type LLTV = bigint & Brand<"LLTV">;
468
+ declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
469
+ type Options = (typeof Options)[number];
470
+ /**
471
+ * Convert a LLTV option or a scaled LLTV to a LLTV.
472
+ * @param lltv - The LLTV option or the scaled LLTV.
473
+ * @returns The LLTV.
474
+ */
475
+ declare function from$12(lltv: Options | bigint): LLTV;
476
+ declare namespace from$12 {
477
+ type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
478
+ }
479
+ declare class InvalidOptionError$1 extends BaseError {
480
+ readonly name = "LLTV.InvalidOptionError";
481
+ constructor(input: number);
482
+ }
483
+ declare class InvalidLLTVError extends BaseError {
484
+ readonly name = "LLTV.InvalidLLTVError";
485
+ constructor(input: bigint);
486
+ }
487
+ declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
488
+ declare namespace Collateral_d_exports {
489
+ export { Collateral, CollateralSchema, CollateralsSchema, from$11 as from, random$3 as random };
490
+ }
491
+ type Collateral = {
492
+ /** Asset being used as collateral. */
493
+ asset: Address;
494
+ /** Liquidation Loan-to-Value of the collateral. */
495
+ lltv: LLTV;
496
+ /** Oracle contract used to price the collateral. */
497
+ oracle: Address;
498
+ };
499
+ declare const CollateralSchema: z$1.ZodObject<{
500
+ asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
501
+ oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
502
+ lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
503
+ }, z$1.core.$strip>;
504
+ declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
505
+ asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
506
+ oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
507
+ lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
508
+ }, z$1.core.$strip>>;
509
+ declare const from$11: (parameters: from$11.Parameters) => from$11.ReturnType;
510
+ declare namespace from$11 {
511
+ type Parameters = {
512
+ asset: Address;
513
+ lltv: Options | bigint;
514
+ oracle: Address;
515
+ };
516
+ type ReturnType = Collateral;
517
+ }
518
+ /**
519
+ * Generates a random collateral.
520
+ * @returns A randomly generated collateral. {@link random.ReturnType}
521
+ *
522
+ * @example
523
+ * ```ts
524
+ * const collateral = Collateral.random();
525
+ * ```
526
+ */
527
+ declare function random$3(): random$3.ReturnType;
528
+ declare namespace random$3 {
529
+ type ReturnType = Collateral;
530
+ }
531
+ declare namespace ERC4626_d_exports {
532
+ export { DenominatorIsZeroError, convertToAssets, convertToShares, decimalsOffset };
533
+ }
534
+ /**
535
+ * Calculate the decimals offset used by the ERC4626 implementation.
536
+ * @param parameters - {@link decimalsOffset.Parameters}.
537
+ * @returns The decimals offset.
538
+ *
539
+ * @example
540
+ * ```ts
541
+ * const decimalsOffset = decimalsOffset({ underlyingDecimals: 6 });
542
+ * // decimalsOffset = 12
543
+ * ```
544
+ */
545
+ declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
546
+ declare namespace decimalsOffset {
547
+ type Parameters = {
548
+ /** The number of decimals of the underlying asset. */
549
+ underlyingDecimals: number;
550
+ };
551
+ type ReturnType = number;
552
+ }
553
+ /**
554
+ * Convert shares to assets.
555
+ * @throws If the denominator is 0. {@link DenominatorIsZeroError}
556
+ * @param parameters - {@link convertToAssets.Parameters}.
557
+ * @returns The amount of assets.
558
+ *
559
+ * @example
560
+ * ```ts
561
+ * const assets = convertToAssets(100n, { totalAssets: 1000n, totalSupply: 1000n, decimalsOffset: 18 });
562
+ * // assets = 100n
563
+ * ```
564
+ */
565
+ declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
566
+ declare namespace convertToAssets {
567
+ type Parameters = {
568
+ /** The amount of shares to convert. */
569
+ shares: bigint;
570
+ /** Total amount of assets in the vault. */
571
+ totalAssets: bigint;
572
+ /** Total amount of shares in the vault. */
573
+ totalSupply: bigint;
574
+ /**
575
+ * OpenZeppelin decimals offset used by the ERC4626 implementation.
576
+ * Calculated to be `max(0, 18 - underlyingDecimals)` at construction, so the initial conversion rate maximizes
577
+ * precision between shares and assets.
578
+ */
579
+ decimalsOffset: number;
580
+ };
581
+ type ReturnType = bigint;
582
+ type ErrorType = DenominatorIsZeroError;
583
+ }
584
+ /**
585
+ * Convert assets to shares.
586
+ * @throws If the denominator is 0. {@link DenominatorIsZeroError}
587
+ * @param parameters - {@link convertToShares.Parameters}.
588
+ * @returns The amount of shares.
589
+ *
590
+ * @example
591
+ * ```ts
592
+ * const shares = convertToShares(100n, { totalAssets: 1000n, totalSupply: 1000n, decimalsOffset: 12 });
593
+ * // shares = 100n
594
+ * ```
595
+ */
596
+ declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
597
+ declare namespace convertToShares {
598
+ type Parameters = {
599
+ /** The amount of assets to convert. */
600
+ assets: bigint;
601
+ /** Total amount of assets in the vault. */
602
+ totalAssets: bigint;
603
+ /** Total amount of shares in the vault. */
604
+ totalSupply: bigint;
605
+ /**
606
+ * OpenZeppelin decimals offset used by the ERC4626 implementation.
607
+ * Calculated to be `max(0, 18 - underlyingDecimals)` at construction, so the initial conversion rate maximizes
608
+ * precision between shares and assets.
609
+ */
610
+ decimalsOffset: number;
611
+ };
612
+ type ReturnType = bigint;
613
+ type ErrorType = DenominatorIsZeroError;
614
+ }
615
+ declare class DenominatorIsZeroError extends BaseError {
616
+ readonly name = "ERC4626.DenominatorIsZeroError";
617
+ constructor();
618
+ }
619
+ declare namespace Format_d_exports {
620
+ export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
621
+ }
622
+ /** The snake case representation of a type with bigint values stringified. */
623
+ type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
624
+ /** Make arrays/tuples and object props mutable, deeply. */
625
+ type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
626
+ /** Stringifies bigint values to strings and preserves branded primitives. */
627
+ type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
628
+ /** Key remapping that also preserves branded primitives. */
629
+ type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
630
+ type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
631
+ /**
632
+ * Formats object keys to snake case.
633
+ * Preserves ethereum addresses as is.
634
+ * Converts ethereum addresses to checksummed if used as values.
635
+ * Stringifies bigint values to strings.
636
+ */
637
+ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
638
+ /**
639
+ * Formats a snake case object to its camel case type.
640
+ * Preserves ethereum addresses as is.
641
+ * Converts checksummed ethereum addresses to lowercase if used as values.
642
+ * @warning Does not unstringify bigint values.
643
+ */
644
+ declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
645
+ declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
646
+ declare namespace Maturity_d_exports {
647
+ export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$10 as from };
648
+ }
649
+ /**
650
+ * Maturity is a number that represents a date in seconds.
651
+ */
652
+ type Maturity = number & Brand<"Maturity">;
653
+ declare const MaturitySchema: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
654
+ declare enum MaturityType {
655
+ EndOfWeek = "end_of_week",
656
+ EndOfNextWeek = "end_of_next_week",
657
+ EndOfMonth = "end_of_month",
658
+ EndOfNextMonth = "end_of_next_month",
659
+ EndOfQuarter = "end_of_quarter",
660
+ EndOfNextQuarter = "end_of_next_quarter",
661
+ }
662
+ declare const MaturityOptions: {
663
+ readonly end_of_week: () => Maturity;
664
+ readonly end_of_next_week: () => Maturity;
665
+ readonly end_of_month: () => Maturity;
666
+ readonly end_of_next_month: () => Maturity;
667
+ readonly end_of_quarter: () => Maturity;
668
+ readonly end_of_next_quarter: () => Maturity;
669
+ };
670
+ type MaturityOptions = keyof typeof MaturityOptions;
671
+ /**
672
+ * Creates a maturity from a timestamp in seconds or a maturity option.
673
+ * @throws {InvalidFormatError} If the maturity is in milliseconds.
674
+ * @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
675
+ * @throws {InvalidOptionError} If the maturity is not a valid option.
676
+ */
677
+ declare function from$10(ts: from$10.Parameters): Maturity;
678
+ declare namespace from$10 {
679
+ type Parameters = number | MaturityOptions;
680
+ type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
681
+ }
682
+ declare class InvalidFormatError extends BaseError {
683
+ readonly name = "Maturity.InvalidFormatError";
684
+ constructor();
685
+ }
686
+ declare class InvalidDateError extends BaseError {
687
+ readonly name = "Maturity.InvalidDateError";
688
+ constructor(input: number);
689
+ }
690
+ declare class InvalidOptionError extends BaseError {
691
+ readonly name = "Maturity.InvalidOptionError";
692
+ constructor(input: string);
693
+ }
694
+ declare namespace Offer_d_exports {
695
+ export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferHashSchema, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$2 as decode, domain, encode$2 as encode, from$9 as from, fromSnakeCase$2 as fromSnakeCase, hash, obligationId, random$2 as random, sign, signatureMsg, toSnakeCase, types };
696
+ }
697
+ type Offer = {
698
+ /** The address that made the offer. */
699
+ readonly offering: Address;
700
+ /** The amount of assets offered. */
701
+ readonly assets: bigint;
702
+ /**
703
+ * The amount of assets that can be taken from the offer. takeable = min(max - consumed, available)
704
+ * Where available is the total amount of assets retrievable from offering positions.
705
+ */
706
+ readonly takeable: bigint;
707
+ /** The interest rate (with 18 decimals). */
708
+ readonly rate: bigint;
709
+ /** The date at which all interests will be paid. */
710
+ readonly maturity: Maturity;
711
+ /** The date at which the offer will expire. */
712
+ readonly expiry: number;
713
+ /** The date at which the offer will start. */
714
+ readonly start: number;
715
+ /** The nonce. Used for OCO (One-Cancelled-Other) mechanism. */
716
+ readonly nonce: bigint;
717
+ /** The side of the offer. `true` for buy, `false` for sell. */
718
+ readonly buy: boolean;
719
+ /** The chain id where the liquidity for this offer is located. */
720
+ readonly chainId: Id;
721
+ /** The token that is being borrowed. */
722
+ readonly loanToken: Address;
723
+ /** The exact set of collaterals required to borrow the loan token. */
724
+ readonly collaterals: readonly Collateral[];
725
+ /** The optional callback data to retrieve the maker funds. */
726
+ readonly callback: {
727
+ readonly address: Address;
728
+ readonly data: Hex;
729
+ readonly gasLimit: bigint;
730
+ };
731
+ /** The amount of assets consumed from the offer. */
732
+ consumed: bigint;
733
+ /** The hash of the offer. */
734
+ readonly hash: Hex;
735
+ /** The block number at which the offer was created. */
736
+ readonly blockNumber: number;
737
+ /** The signature of the offer. */
738
+ signature?: Hex;
739
+ };
740
+ declare enum Status {
741
+ VALID = "VALID",
742
+ SIMULATION_ERROR = "SIMULATION_ERROR",
743
+ }
744
+ type Validation = {
745
+ offerHash: Hex;
746
+ status: Status;
747
+ };
748
+ declare const OfferHashSchema: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
749
+ declare const OfferSchema: (parameters?: {
750
+ omitHash?: boolean;
751
+ }) => z$1.ZodObject<{
752
+ offering: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
753
+ assets: z$1.ZodBigInt;
754
+ rate: z$1.ZodBigInt;
755
+ maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
756
+ expiry: z$1.ZodNumber;
757
+ start: z$1.ZodNumber;
758
+ nonce: z$1.ZodBigInt;
759
+ buy: z$1.ZodBoolean;
760
+ chainId: z$1.ZodNumber;
761
+ loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
762
+ collaterals: z$1.ZodArray<z$1.ZodObject<{
763
+ asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
764
+ oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
765
+ lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
766
+ }, z$1.core.$strip>>;
767
+ callback: z$1.ZodObject<{
768
+ address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
769
+ data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
770
+ gasLimit: z$1.ZodBigInt;
771
+ }, z$1.core.$strip>;
772
+ signature: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
773
+ consumed: z$1.ZodOptional<z$1.ZodBigInt>;
774
+ takeable: z$1.ZodOptional<z$1.ZodBigInt>;
775
+ blockNumber: z$1.ZodOptional<z$1.ZodNumber>;
776
+ }, z$1.core.$strip>;
777
+ /**
778
+ * Creates an offer from a plain object.
779
+ * @throws {InvalidOfferError} If the offer is invalid.
780
+ * @param input - The offer to create.
781
+ * @returns The created offer with its hash.
782
+ */
783
+ declare function from$9(input: Compute<Omit<Offer, "chainId" | "hash"> & {
784
+ chainId: number;
785
+ }>): Offer;
786
+ declare namespace from$9 {
787
+ type ErrorType = InvalidOfferError;
788
+ }
789
+ /**
790
+ * Creates an offer from a snake case object.
791
+ * @throws {InvalidOfferError} If the offer is invalid.
792
+ * @param input - The offer to create.
793
+ * @returns The created offer with its hash.
794
+ */
795
+ declare function fromSnakeCase$2(input: Snake<Omit<Offer, "chainId" | "hash"> & {
796
+ chainId: number;
797
+ }>): Offer;
798
+ /**
799
+ * Converts an offer to a snake case object.
800
+ * @param offer - The offer to convert.
801
+ * @returns The converted offer.
802
+ */
803
+ declare function toSnakeCase(offer: Offer): Snake<Offer>;
804
+ type RandomConfig = {
805
+ chains?: Chain$1[];
806
+ loanTokens?: Address[];
807
+ collateralTokens?: Address[];
808
+ assetsDecimals?: Record<Address, number>;
809
+ buy?: boolean;
810
+ assets?: bigint;
811
+ consumed?: bigint;
812
+ takeable?: bigint;
813
+ offering?: Address;
814
+ maturity?: Maturity;
815
+ start?: number;
816
+ expiry?: number;
817
+ nonce?: bigint;
818
+ rate?: bigint;
819
+ callback?: {
820
+ address: Address;
821
+ data: Hex;
822
+ gasLimit: bigint;
823
+ };
824
+ collaterals?: readonly Collateral[];
825
+ signature?: Hex;
826
+ blockNumber?: number;
827
+ };
828
+ /**
829
+ * Generates a random Offer.
830
+ * The returned Offer contains randomly generated values.
831
+ * @warning The generated Offer should not be used for production usage.
832
+ * @returns {Offer} A randomly generated Offer object.
833
+ */
834
+ declare function random$2(config?: RandomConfig): Offer;
835
+ /**
836
+ * Creates an EIP-712 domain object.
837
+ * @param chainId - The chain ID.
838
+ * @returns The EIP-712 domain object.
839
+ */
840
+ declare const domain: (chainId: number) => {
841
+ chainId: bigint;
842
+ verifyingContract: "0x0000000000000000000000000000000000000000";
843
+ };
844
+ /**
845
+ * The EIP-712 types for the offer.
846
+ * @warning The ordering of the types should NEVER be changed. The offer hash is computed based on the order of the types.
847
+ * @returns The EIP-712 types.
848
+ */
849
+ declare const types: {
850
+ readonly EIP712Domain: readonly [{
851
+ readonly name: "chainId";
852
+ readonly type: "uint256";
853
+ }, {
854
+ readonly name: "verifyingContract";
855
+ readonly type: "address";
856
+ }];
857
+ readonly Offer: readonly [{
858
+ readonly name: "offering";
859
+ readonly type: "address";
860
+ }, {
861
+ readonly name: "assets";
862
+ readonly type: "uint256";
863
+ }, {
864
+ readonly name: "rate";
865
+ readonly type: "uint256";
866
+ }, {
867
+ readonly name: "maturity";
868
+ readonly type: "uint256";
869
+ }, {
870
+ readonly name: "expiry";
871
+ readonly type: "uint256";
872
+ }, {
873
+ readonly name: "nonce";
874
+ readonly type: "uint256";
875
+ }, {
876
+ readonly name: "buy";
877
+ readonly type: "bool";
878
+ }, {
879
+ readonly name: "loanToken";
880
+ readonly type: "address";
881
+ }, {
882
+ readonly name: "collaterals";
883
+ readonly type: "Collateral[]";
884
+ }, {
885
+ readonly name: "callback";
886
+ readonly type: "Callback";
887
+ }];
888
+ readonly Collateral: readonly [{
889
+ readonly name: "asset";
890
+ readonly type: "address";
891
+ }, {
892
+ readonly name: "oracle";
893
+ readonly type: "address";
894
+ }, {
895
+ readonly name: "lltv";
896
+ readonly type: "uint256";
897
+ }];
898
+ readonly Callback: readonly [{
899
+ readonly name: "address";
900
+ readonly type: "address";
901
+ }, {
902
+ readonly name: "data";
903
+ readonly type: "bytes";
904
+ }, {
905
+ readonly name: "gasLimit";
906
+ readonly type: "uint256";
907
+ }];
908
+ };
909
+ /**
910
+ * Signs an array of offers.
911
+ * @throws {Error} If the wallet account is not set.
912
+ * @param offers - The offers to sign.
913
+ * @param wallet - The wallet to sign the offers with.
914
+ * @returns The signed offers.
915
+ */
916
+ declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
917
+ declare function signatureMsg(offers: Offer[]): Hex;
918
+ declare function hash(offer: Omit<Offer, "hash">): Hex;
919
+ /**
920
+ * Calculates the obligation id for an offer based on the smart contract's Obligation struct.
921
+ * The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals (sorted by token address), maturity)).
922
+ * @param offer - The offer to calculate the obligation id for.
923
+ * @returns The obligation id as a 32-byte hex string.
924
+ */
925
+ declare function obligationId(offer: Offer): Hex;
926
+ declare function encode$2(offer: Offer): `0x${string}`;
927
+ declare function decode$2(data: Hex, blockNumber: number | bigint): Offer;
928
+ type OfferConsumed = {
929
+ id: string;
930
+ chainId: Id;
931
+ offering: Address;
932
+ nonce: bigint;
933
+ amount: bigint;
934
+ blockNumber: number;
935
+ };
936
+ /**
937
+ * ABI for the Consumed event emitted by the Obligation contract.
938
+ */
939
+ declare const consumedEvent: {
940
+ readonly type: "event";
941
+ readonly name: "Consumed";
942
+ readonly inputs: readonly [{
943
+ readonly name: "user";
944
+ readonly type: "address";
945
+ readonly indexed: true;
946
+ readonly internalType: "address";
947
+ }, {
948
+ readonly name: "nonce";
949
+ readonly type: "uint256";
950
+ readonly indexed: true;
951
+ readonly internalType: "uint256";
952
+ }, {
953
+ readonly name: "amount";
954
+ readonly type: "uint256";
955
+ readonly indexed: false;
956
+ readonly internalType: "uint256";
957
+ }];
958
+ readonly anonymous: false;
959
+ };
960
+ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
961
+ readonly name = "Offer.InvalidOfferError";
962
+ constructor(error: z$1.ZodError | Error);
963
+ /**
964
+ * Formats ZodError issues into a human-readable string with line breaks.
965
+ * @example
966
+ * "- 'assets': too small, expected >= 0
967
+ * - 'start': must be before expiry"
968
+ */
969
+ static formatDetails(error: z$1.ZodError | Error): string;
970
+ /**
971
+ * Returns the formatted human-readable message.
972
+ */
973
+ get formattedMessage(): string;
974
+ }
975
+ declare class AccountNotSetError extends BaseError {
976
+ readonly name = "Offer.AccountNotSetError";
977
+ constructor();
978
+ }
979
+ declare namespace Liquidity_d_exports {
980
+ export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateBuyVaultCallbackPoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateSellERC20CallbackPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
981
+ }
982
+ /**
983
+ * Represents a liquidity pool with a unique ID and amount.
984
+ */
985
+ type LiquidityPool = {
986
+ id: string;
987
+ amount: bigint;
988
+ };
989
+ /**
990
+ * Represents a hierarchical relationship between two liquidity pools.
991
+ */
992
+ type LiquidityLink = {
993
+ parentPoolId: string;
994
+ childPoolId: string;
995
+ priority: number;
996
+ };
997
+ /**
998
+ * Represents the connection between an offer and its liquidity pools.
999
+ */
1000
+ type OfferLiquidityPool = {
1001
+ offerHash: Offer["hash"];
1002
+ poolId: string;
1003
+ /**
1004
+ * The available capacity/liquidity from this pool for this offer.
1005
+ * Meaning varies by pool type:
1006
+ * - BuyWithEmptyCallback: Matches allowance amount from pool bellow
1007
+ * - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
1008
+ * - SellERC20Callback: Existing debt as negative value (reduces available capacity)
1009
+ */
1010
+ amount: bigint;
1011
+ };
1012
+ /**
1013
+ * Calculate maximum debt capacity from collateral amount.
1014
+ * @param amount - Collateral amount
1015
+ * @param oraclePrice - Oracle price (scaled to 36 decimals)
1016
+ * @param lltv - Loan-to-value ratio (scaled to 18 decimals)
1017
+ * @returns Maximum debt capacity
1018
+ */
1019
+ declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
1020
+ /**
1021
+ * Generate pool ID for balance pools.
1022
+ */
1023
+ declare function generateBalancePoolId(parameters: {
1024
+ user: Address;
1025
+ chainId: Id;
1026
+ token: Address;
1027
+ }): string;
1028
+ /**
1029
+ * Generate pool ID for allowance pools.
1030
+ */
1031
+ declare function generateAllowancePoolId(parameters: {
1032
+ user: Address;
1033
+ chainId: Id;
1034
+ token: Address;
1035
+ }): string;
1036
+ /**
1037
+ * Generate pool ID for sell ERC20 callback pools.
1038
+ * Each offer has its own callback pool to prevent liquidity conflicts.
1039
+ */
1040
+ declare function generateSellERC20CallbackPoolId(parameters: {
1041
+ user: Address;
1042
+ chainId: Id;
1043
+ obligationId: Hex;
1044
+ token: Address;
1045
+ offerHash: Hex;
1046
+ }): string;
1047
+ /**
1048
+ * Generate pool ID for obligation collateral pools.
1049
+ * Obligation collateral pools represent collateral already deposited in the obligation.
1050
+ * These pools are shared across all offers with the same obligation.
1051
+ */
1052
+ declare function generateObligationCollateralPoolId(parameters: {
1053
+ user: Address;
1054
+ chainId: Id;
1055
+ obligationId: Hex;
1056
+ token: Address;
1057
+ }): string;
1058
+ /**
1059
+ * Generate pool ID for buy vault callback pools.
1060
+ */
1061
+ declare function generateBuyVaultCallbackPoolId(parameters: {
1062
+ user: Address;
1063
+ chainId: Id;
1064
+ vault: Address;
1065
+ offerHash: Hex;
1066
+ }): string;
1067
+ /**
1068
+ * Generate pool ID for debt pools.
1069
+ */
1070
+ declare function generateDebtPoolId(parameters: {
1071
+ user: Address;
1072
+ chainId: Id;
1073
+ obligationId: Hex;
1074
+ }): string;
1075
+ /**
1076
+ * Generate pool ID for user position in a vault.
1077
+ */
1078
+ declare function generateUserVaultPositionPoolId(parameters: {
1079
+ user: Address;
1080
+ chainId: Id;
1081
+ vault: Address;
1082
+ }): string;
1083
+ /**
1084
+ * Generate pool ID for vault position in a market.
1085
+ */
1086
+ declare function generateVaultPositionPoolId(parameters: {
1087
+ vault: Address;
1088
+ chainId: Id;
1089
+ marketId: string;
1090
+ }): string;
1091
+ /**
1092
+ * Generate pool ID for market total liquidity.
1093
+ */
1094
+ declare function generateMarketLiquidityPoolId(parameters: {
1095
+ chainId: Id;
1096
+ marketId: string;
1097
+ }): string;
1098
+ declare namespace Obligation_d_exports {
1099
+ export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$8 as from, fromSnakeCase$1 as fromSnakeCase, id, random$1 as random };
1100
+ }
1101
+ type Obligation = {
1102
+ /** The chain id where the liquidity for this obligation is located. */
1103
+ chainId: Id;
1104
+ /** The token that is being borrowed for this obligation. */
1105
+ loanToken: Address;
1106
+ /** The exact set of collaterals required to borrow the loan token. */
1107
+ collaterals: Collateral[];
1108
+ /** The maturity of the obligation. */
1109
+ maturity: Maturity;
1110
+ };
1111
+ declare const ObligationSchema: z$1.ZodObject<{
1112
+ chainId: z$1.ZodNumber;
1113
+ loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1114
+ collaterals: z$1.ZodArray<z$1.ZodObject<{
1115
+ asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1116
+ oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1117
+ lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
1118
+ }, z$1.core.$strip>>;
1119
+ maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
1120
+ }, z$1.core.$strip>;
1121
+ /**
1122
+ * Creates an obligation from the given parameters.
1123
+ * @constructor
1124
+ * @param parameters - {@link from.Parameters}
1125
+ * @returns The created obligation. {@link Obligation}
1126
+ * @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
1127
+ *
1128
+ * @example
1129
+ * ```ts
1130
+ * const obligation = Obligation.from({
1131
+ * chainId: 1,
1132
+ * loanToken: privateKeyToAccount(generatePrivateKey()).address,
1133
+ * collaterals: [
1134
+ * Collateral.from({
1135
+ * asset: privateKeyToAccount(generatePrivateKey()).address,
1136
+ * oracle: privateKeyToAccount(generatePrivateKey()).address,
1137
+ * lltv: 0.965
1138
+ * }),
1139
+ * ],
1140
+ * maturity: Maturity.from("end_of_next_quarter"),
1141
+ * });
1142
+ * ```
1143
+ */
1144
+ declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
1145
+ declare namespace from$8 {
1146
+ type Parameters = {
1147
+ /** The chain id where the liquidity for this obligation is located. */
1148
+ chainId: number;
1149
+ /** The token that is being borrowed for this obligation. */
1150
+ loanToken: Address;
1151
+ /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
1152
+ collaterals: from$11.Parameters[] | readonly from$11.Parameters[];
1153
+ /** The maturity of the obligation. */
1154
+ maturity: from$10.Parameters;
1155
+ };
1156
+ type ReturnType = Obligation;
1157
+ type ErrorType = InvalidObligationError;
1158
+ }
1159
+ /**
1160
+ * Creates an obligation from a snake case object.
1161
+ * @throws If the obligation is invalid. {@link fromSnakeCase.ErrorType}
1162
+ * @param input - {@link fromSnakeCase.Parameters}
1163
+ * @returns The created obligation. {@link fromSnakeCase.ReturnType}
1164
+ */
1165
+ declare function fromSnakeCase$1(input: fromSnakeCase$1.Parameters): fromSnakeCase$1.ReturnType;
1166
+ declare namespace fromSnakeCase$1 {
1167
+ type Parameters = Snake<Omit<Obligation, "chainId"> & {
1168
+ chainId: number;
1169
+ }>;
1170
+ type ReturnType = Obligation;
1171
+ type ErrorType = InvalidObligationError;
1172
+ }
1173
+ /**
1174
+ * Calculates the obligation id based on the smart contract's Obligation struct.
1175
+ * The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals, maturity)).
1176
+ * @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
1177
+ * @param obligation - {@link id.Parameters}
1178
+ * @returns The obligation id as a 32-byte hex string. {@link id.ReturnType}
1179
+ *
1180
+ * @example
1181
+ * ```ts
1182
+ * const obligation = Obligation.random();
1183
+ * const id = Obligation.id(obligation);
1184
+ * console.log(id); // 0x1234567890123456789012345678901234567890123456789012345678901234
1185
+ * ```
1186
+ */
1187
+ declare function id(obligation: id.Parameters): id.ReturnType;
1188
+ declare namespace id {
1189
+ type Parameters = Obligation;
1190
+ type ReturnType = Hex;
1191
+ type ErrorType = CollateralsAreNotSortedError;
1192
+ }
1193
+ /**
1194
+ * Generates a random obligation.
1195
+ * @returns A randomly generated obligation. {@link random.ReturnType}
1196
+ *
1197
+ * @example
1198
+ * ```ts
1199
+ * const obligation = Obligation.random();
1200
+ * ```
1201
+ */
1202
+ declare function random$1(): random$1.ReturnType;
1203
+ declare namespace random$1 {
1204
+ type ReturnType = Obligation;
1205
+ }
1206
+ declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
1207
+ readonly name = "Obligation.InvalidObligationError";
1208
+ constructor(error: z$1.ZodError | Error);
1209
+ }
1210
+ declare class CollateralsAreNotSortedError extends BaseError {
1211
+ readonly name = "Obligation.CollateralsAreNotSortedError";
1212
+ constructor();
1213
+ }
1214
+ declare namespace Oracle_d_exports {
1215
+ export { Conversion, Oracle, from$7 as from };
1216
+ }
1217
+ /**
1218
+ * An oracle contract that provides price information for assets.
1219
+ */
1220
+ type Oracle = {
1221
+ /** The chain id where the oracle is deployed. */
1222
+ readonly chainId: Id;
1223
+ /** The address of the oracle contract. */
1224
+ readonly address: Address;
1225
+ /** The price returned by the oracle (in the oracle's native units), null if no price available. */
1226
+ readonly price: bigint | null;
1227
+ /** The block number at which the price was fetched. */
1228
+ readonly blockNumber: number;
1229
+ };
1230
+ /**
1231
+ * Create an Oracle from a plain object.
1232
+ * @param data - The data to create the oracle from.
1233
+ * @returns The created oracle.
1234
+ */
1235
+ declare function from$7(data: from$7.Parameters): from$7.ReturnType;
1236
+ declare namespace from$7 {
1237
+ type Parameters = {
1238
+ chainId: Id;
1239
+ address: Address;
1240
+ price: string | null;
1241
+ blockNumber: number;
1242
+ };
1243
+ type ReturnType = Oracle;
1244
+ }
1245
+ /**
1246
+ * Conversion utilities for converting between collateral and loan token amounts
1247
+ * using oracle prices and LLTV
1248
+ */
1249
+ declare namespace Conversion {
1250
+ /**
1251
+ * Converts a collateral amount to loan token
1252
+ * Uses the formula: (amount * price / 10^36) * lltv / 10^18
1253
+ *
1254
+ * @param amount - The collateral amount to convert
1255
+ * @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
1256
+ * @returns The equivalent loan token amount
1257
+ */
1258
+ function collateralToLoan(amount: bigint, params: {
1259
+ price: bigint;
1260
+ lltv: bigint;
1261
+ }): bigint;
1262
+ /**
1263
+ * Converts a loan token amount to collateral
1264
+ * Uses the inverse formula: (amount * 10^36 / price) * 10^18 / lltv
1265
+ * Returns 0n if price or lltv is zero (invalid conversion).
1266
+ *
1267
+ * @param amount - The loan token amount to convert
1268
+ * @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
1269
+ * @returns The equivalent collateral amount, or 0n if conversion is invalid
1270
+ */
1271
+ function loanToCollateral(amount: bigint, params: {
1272
+ price: bigint;
1273
+ lltv: bigint;
1274
+ }): bigint;
1275
+ }
1276
+ declare namespace Position_d_exports {
1277
+ export { Position, Type, from$6 as from };
1278
+ }
1279
+ type Position = {
1280
+ /** The chain id. */
1281
+ chainId: Id;
1282
+ /** The contract address from which the position is called.
1283
+ * While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
1284
+ * For example, when depositing into a vault, we would specify the vault contract address as the contract not the underlying vault's ERC20 token address.
1285
+ */
1286
+ contract: Address;
1287
+ /** The user address. */
1288
+ user: Address;
1289
+ /** The type of position. */
1290
+ type: Type;
1291
+ /** The balance of the position. */
1292
+ balance?: bigint;
1293
+ /** The underlying asset of the position.
1294
+ * For ERC20 positions, this equals the contract address.
1295
+ * For vault positions, this is the vault's underlying asset.
1296
+ */
1297
+ asset?: Address;
1298
+ /** The block number at which the position was last updated. */
1299
+ blockNumber: number;
1300
+ };
1301
+ declare enum Type {
1302
+ ERC20 = "erc20",
1303
+ VAULT_V1 = "vault_v1",
1304
+ }
1305
+ /**
1306
+ * @constructor
1307
+ * Creates a Position.
1308
+ * @param parameters - {@link from.Parameters}
1309
+ * @returns The created Position. {@link from.ReturnType}
1310
+ */
1311
+ declare function from$6(parameters: from$6.Parameters): from$6.ReturnType;
1312
+ declare namespace from$6 {
1313
+ type Parameters = {
1314
+ chainId: Id;
1315
+ contract: Address;
1316
+ user: Address;
1317
+ type: Type;
1318
+ balance?: bigint;
1319
+ asset?: Address;
1320
+ blockNumber: number;
1321
+ };
1322
+ type ReturnType = Position;
1323
+ }
1324
+ declare namespace Quote_d_exports {
1325
+ export { InvalidQuoteError, Quote, QuoteSchema, from$5 as from, fromSnakeCase, random };
1326
+ }
1327
+ type Quote = {
1328
+ /** The obligation id. */
1329
+ obligationId: Hex;
1330
+ ask: {
1331
+ /** The highest interest rate the seller will accept to pay for the obligation. (18 decimals). */
1332
+ rate: bigint;
1333
+ };
1334
+ bid: {
1335
+ /** The lowest interest rate a buyer is willing to be paid for the obligation. (18 decimals). */
1336
+ rate: bigint;
1337
+ };
1338
+ };
1339
+ declare const QuoteSchema: z$1.ZodObject<{
1340
+ obligationId: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
1341
+ ask: z$1.ZodObject<{
1342
+ rate: z$1.ZodBigInt;
1343
+ }, z$1.core.$strip>;
1344
+ bid: z$1.ZodObject<{
1345
+ rate: z$1.ZodBigInt;
1346
+ }, z$1.core.$strip>;
1347
+ }, z$1.core.$strip>;
1348
+ /**
1349
+ * Creates a quote for a given obligation.
1350
+ * @constructor
1351
+ * @param parameters - {@link from.Parameters}
1352
+ * @returns The created quote. {@link Quote}
1353
+ * @throws If the quote is invalid. {@link InvalidQuoteError}
1354
+ *
1355
+ * @example
1356
+ * ```ts
1357
+ * const quote = Quote.from({ obligationId: "0x123", ask: { assets: 100n, rate: 100n }, bid: { assets: 100n, rate: 100n } });
1358
+ * ```
1359
+ */
1360
+ declare function from$5(parameters: from$5.Parameters): from$5.ReturnType;
1361
+ declare namespace from$5 {
1362
+ type Parameters = Quote;
1363
+ type ReturnType = Quote;
1364
+ type ErrorType = InvalidQuoteError;
1365
+ }
1366
+ /**
1367
+ * Creates a quote from a snake case object.
1368
+ * @throws If the quote is invalid. {@link InvalidQuoteError}
1369
+ * @param snake - {@link fromSnakeCase.Parameters}
1370
+ * @returns The created quote. {@link fromSnakeCase.ReturnType}
1371
+ */
1372
+ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
1373
+ declare namespace fromSnakeCase {
1374
+ type Parameters = Snake<Quote>;
1375
+ type ReturnType = Quote;
1376
+ type ErrorType = from$5.ErrorType;
1377
+ }
1378
+ /**
1379
+ * Generates a random quote.
1380
+ * @returns A randomly generated quote. {@link random.ReturnType}
1381
+ *
1382
+ * @example
1383
+ * ```ts
1384
+ * const quote = Quote.random();
1385
+ * ```
1386
+ */
1387
+ declare function random(): random.ReturnType;
1388
+ declare namespace random {
1389
+ type Parameters = never;
1390
+ type ReturnType = Quote;
1391
+ type ErrorType = from$5.ErrorType;
1392
+ }
1393
+ declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
1394
+ readonly name = "Quote.InvalidQuoteError";
1395
+ constructor(error: z$1.ZodError | Error);
1396
+ }
1397
+ declare namespace Transfer_d_exports {
1398
+ export { Transfer, from$4 as from };
1399
+ }
1400
+ type Transfer = {
1401
+ id: string;
1402
+ chainId: Id;
1403
+ contract: Address;
1404
+ from: Address;
1405
+ to: Address;
1406
+ value: bigint;
1407
+ blockNumber: number;
1408
+ };
1409
+ /**
1410
+ * @constructor
1411
+ *
1412
+ * Creates a {@link Transfer}.
1413
+ * @param parameters - {@link from.Parameters}
1414
+ * @returns The created Transfer. {@link from.ReturnType}
1415
+ *
1416
+ * @example
1417
+ * ```ts
1418
+ * const transfer = Transfer.from({ id: "1", chainId: 1, contract: "0x123", from: "0x456", to: "0x789", value: 100n, blockNumber: 100n });
1419
+ * ```
1420
+ */
1421
+ declare function from$4(parameters: from$4.Parameters): from$4.ReturnType;
1422
+ declare namespace from$4 {
1423
+ type Parameters = {
1424
+ id: string;
1425
+ chainId: Id;
1426
+ contract: Address;
1427
+ from: Address;
1428
+ to: Address;
1429
+ value: bigint;
1430
+ blockNumber: number;
1431
+ };
1432
+ type ReturnType = Transfer;
1433
+ }
1434
+ declare namespace Tree_d_exports {
1435
+ export { Tree, VERSION, decode$1 as decode, encode$1 as encode, from$3 as from };
1436
+ }
1437
+ type Tree = Compute<StandardMerkleTree<[Hex]> & {
1438
+ offers: Offer[];
1439
+ root: Hex;
1440
+ }>;
1441
+ declare const VERSION = 1;
1442
+ /**
1443
+ * Builds a Merkle tree from a list of offers.
1444
+ *
1445
+ * Leaves are the offer `hash` values as `bytes32` and are deterministically
1446
+ * ordered in ascending lexicographic order so that the resulting root is stable
1447
+ * regardless of the input order.
1448
+ *
1449
+ * @param offers - Offers to include in the tree.
1450
+ * @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
1451
+ */
1452
+ declare const from$3: (offers: Offer[]) => Tree;
1453
+ /**
1454
+ * Encodes an `Tree` into a Hex string with a version byte prefix and gzipped payload.
1455
+ *
1456
+ * - Layout: `0x{vv}{zip...}` where `{vv}` is one-byte version as two hex chars.
1457
+ * - Payload is gzip(JSON.stringify([root, ...offers])) with bigint stringified.
1458
+ *
1459
+ * @param tree - The offer Merkle tree to encode.
1460
+ * @returns Hex string starting with `0x{vv}` followed by gzipped payload bytes.
1461
+ * @throws Error if the given `root` does not match the offers.
1462
+ */
1463
+ declare const encode$1: (tree: Tree) => Hex;
1464
+ /**
1465
+ * Decodes a Hex string produced by {@link encode} back into an `Tree`.
1466
+ *
1467
+ * - Ensures the first byte version matches {@link VERSION}.
1468
+ * - Decompresses with gunzip, parses JSON, validates offers, and re-checks the root.
1469
+ *
1470
+ * @param encoded - Hex string in the form `0x{vv}{zip...}`.
1471
+ * @returns A validated `Tree` rebuilt from the offers.
1472
+ * @throws Error if the version is invalid or the root does not match the offers.
1473
+ */
1474
+ declare const decode$1: (encoded: Hex) => Tree;
1475
+ //#endregion
1476
+ //#region src/api/Schema/generated/swagger.d.ts
1477
+ /**
1478
+ * This file was auto-generated by openapi-typescript.
1479
+ * Do not make direct changes to the file.
1480
+ */
1481
+
1482
+ interface paths {
1483
+ "/v1/books/{obligationId}/{side}": {
1484
+ parameters: {
1485
+ query?: never;
1486
+ header?: never;
1487
+ path?: never;
1488
+ cookie?: never;
1489
+ };
1490
+ /**
1491
+ * Get aggregated book
1492
+ * @description Returns aggregated book data for a given obligation and side. Offers are grouped by rate with summed takeable amounts. Book levels are sorted by rate (ascending for buy side, descending for sell side).
1493
+ */
1494
+ get: {
1495
+ parameters: {
1496
+ query?: {
1497
+ /**
1498
+ * @description Maximum number of rate levels to return.
1499
+ * @example 10
1500
+ */
1501
+ limit?: number;
1502
+ /**
1503
+ * @description Pagination cursor in base64url-encoded format.
1504
+ * @example eyJvZmZzZXQiOjEwMH0
1505
+ */
1506
+ cursor?: string;
1507
+ };
1508
+ header?: never;
1509
+ path?: never;
1510
+ cookie?: never;
1511
+ };
1512
+ requestBody?: never;
1513
+ responses: {
1514
+ /** @description Success */
1515
+ 200: {
1516
+ headers: {
1517
+ [name: string]: unknown;
1518
+ };
1519
+ content: {
1520
+ "application/json": components["schemas"]["BookListResponse"];
1521
+ };
1522
+ };
1523
+ /** @description Bad Request */
1524
+ 400: {
1525
+ headers: {
1526
+ [name: string]: unknown;
1527
+ };
1528
+ content: {
1529
+ "application/json": components["schemas"]["BadRequestResponse"];
1530
+ };
1531
+ };
1532
+ };
1533
+ };
1534
+ put?: never;
1535
+ post?: never;
1536
+ delete?: never;
1537
+ options?: never;
1538
+ head?: never;
1539
+ patch?: never;
1540
+ trace?: never;
1541
+ };
1542
+ "/v1/offers": {
1543
+ parameters: {
1544
+ query?: never;
1545
+ header?: never;
1546
+ path?: never;
1547
+ cookie?: never;
1548
+ };
1549
+ /**
1550
+ * List all offers
1551
+ * @description Returns offers. Provide either `obligation_id` + `side` (order book) or `offering` (by maker).
1552
+ */
1553
+ get: {
1554
+ parameters: {
1555
+ query?: {
1556
+ /**
1557
+ * @description Maximum number of offers to return.
1558
+ * @example 10
1559
+ */
1560
+ limit?: number;
1561
+ /**
1562
+ * @description Pagination cursor in base64url-encoded format.
1563
+ * @example eyJvZmZzZXQiOjEwMH0
1564
+ */
1565
+ cursor?: string;
1566
+ /**
1567
+ * @description Maker address to filter offers by. Alternative to obligation_id + side.
1568
+ * @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
1569
+ */
1570
+ offering?: string;
1571
+ /**
1572
+ * @description Obligation id used to filter offers. Required when not using offering.
1573
+ * @example 0x1234567890123456789012345678901234567890123456789012345678901234
1574
+ */
1575
+ obligation_id?: string;
1576
+ /**
1577
+ * @description Side of the offer. Required when using obligation_id.
1578
+ * @example buy
1579
+ */
1580
+ side?: "buy" | "sell";
1581
+ };
1582
+ header?: never;
1583
+ path?: never;
1584
+ cookie?: never;
1585
+ };
1586
+ requestBody?: never;
1587
+ responses: {
1588
+ /** @description Success */
1589
+ 200: {
1590
+ headers: {
1591
+ [name: string]: unknown;
1592
+ };
1593
+ content: {
1594
+ "application/json": components["schemas"]["OfferListResponse"];
1595
+ };
1596
+ };
1597
+ /** @description Bad Request */
1598
+ 400: {
1599
+ headers: {
1600
+ [name: string]: unknown;
1601
+ };
1602
+ content: {
1603
+ "application/json": components["schemas"]["BadRequestResponse"];
1604
+ };
1605
+ };
1606
+ };
1607
+ };
1608
+ put?: never;
1609
+ post?: never;
1610
+ delete?: never;
1611
+ options?: never;
1612
+ head?: never;
1613
+ patch?: never;
1614
+ trace?: never;
1615
+ };
1616
+ "/v1/obligations": {
1617
+ parameters: {
1618
+ query?: never;
1619
+ header?: never;
1620
+ path?: never;
1621
+ cookie?: never;
1622
+ };
1623
+ /**
1624
+ * List all obligations
1625
+ * @description Returns a list of obligations with their current best ask and bid. Obligations are sorted by their id in ascending order by default.
1626
+ */
1627
+ get: {
1628
+ parameters: {
1629
+ query?: {
1630
+ /** @example 10 */
1631
+ limit?: number;
1632
+ /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
1633
+ cursor?: string;
1634
+ };
1635
+ header?: never;
1636
+ path?: never;
1637
+ cookie?: never;
1638
+ };
1639
+ requestBody?: never;
1640
+ responses: {
1641
+ /** @description Success */
1642
+ 200: {
1643
+ headers: {
1644
+ [name: string]: unknown;
1645
+ };
1646
+ content: {
1647
+ "application/json": components["schemas"]["ObligationListResponse"];
1648
+ };
1649
+ };
1650
+ /** @description Bad Request */
1651
+ 400: {
1652
+ headers: {
1653
+ [name: string]: unknown;
1654
+ };
1655
+ content: {
1656
+ "application/json": components["schemas"]["BadRequestResponse"];
1657
+ };
1658
+ };
1659
+ };
1660
+ };
1661
+ put?: never;
1662
+ post?: never;
1663
+ delete?: never;
1664
+ options?: never;
1665
+ head?: never;
1666
+ patch?: never;
1667
+ trace?: never;
1668
+ };
1669
+ "/v1/obligations/{obligationId}": {
1670
+ parameters: {
1671
+ query?: never;
1672
+ header?: never;
1673
+ path?: never;
1674
+ cookie?: never;
1675
+ };
1676
+ /**
1677
+ * Get an obligation
1678
+ * @description Returns an obligation by its id.
1679
+ */
1680
+ get: {
1681
+ parameters: {
1682
+ query?: never;
1683
+ header?: never;
1684
+ path?: never;
1685
+ cookie?: never;
1686
+ };
1687
+ requestBody?: never;
1688
+ responses: {
1689
+ /** @description Success */
1690
+ 200: {
1691
+ headers: {
1692
+ [name: string]: unknown;
1693
+ };
1694
+ content: {
1695
+ "application/json": components["schemas"]["ObligationSingleSuccessResponse"];
1696
+ };
1697
+ };
1698
+ /** @description Bad Request */
1699
+ 400: {
1700
+ headers: {
1701
+ [name: string]: unknown;
1702
+ };
1703
+ content: {
1704
+ "application/json": components["schemas"]["BadRequestResponse"];
1705
+ };
1706
+ };
1707
+ };
1708
+ };
1709
+ put?: never;
1710
+ post?: never;
1711
+ delete?: never;
1712
+ options?: never;
1713
+ head?: never;
1714
+ patch?: never;
1715
+ trace?: never;
1716
+ };
1717
+ "/v1/health": {
1718
+ parameters: {
1719
+ query?: never;
1720
+ header?: never;
1721
+ path?: never;
1722
+ cookie?: never;
1723
+ };
1724
+ /**
1725
+ * Retrieve global health
1726
+ * @description Returns the aggregated status of the router.
1727
+ */
1728
+ get: {
1729
+ parameters: {
1730
+ query?: never;
1731
+ header?: never;
1732
+ path?: never;
1733
+ cookie?: never;
1734
+ };
1735
+ requestBody?: never;
1736
+ responses: {
1737
+ /** @description Success */
1738
+ 200: {
1739
+ headers: {
1740
+ [name: string]: unknown;
1741
+ };
1742
+ content: {
1743
+ "application/json": components["schemas"]["RouterStatusSuccessResponse"];
1744
+ };
1745
+ };
1746
+ };
1747
+ };
1748
+ put?: never;
1749
+ post?: never;
1750
+ delete?: never;
1751
+ options?: never;
1752
+ head?: never;
1753
+ patch?: never;
1754
+ trace?: never;
1755
+ };
1756
+ "/v1/health/collectors": {
1757
+ parameters: {
1758
+ query?: never;
1759
+ header?: never;
1760
+ path?: never;
1761
+ cookie?: never;
1762
+ };
1763
+ /**
1764
+ * Retrieve collectors health
1765
+ * @description Returns the latest block numbers processed by collectors and their sync status.
1766
+ */
1767
+ get: {
1768
+ parameters: {
1769
+ query?: never;
1770
+ header?: never;
1771
+ path?: never;
1772
+ cookie?: never;
1773
+ };
1774
+ requestBody?: never;
1775
+ responses: {
1776
+ /** @description Success */
1777
+ 200: {
1778
+ headers: {
1779
+ [name: string]: unknown;
1780
+ };
1781
+ content: {
1782
+ "application/json": components["schemas"]["CollectorsHealthSuccessResponse"];
1783
+ };
1784
+ };
1785
+ };
1786
+ };
1787
+ put?: never;
1788
+ post?: never;
1789
+ delete?: never;
1790
+ options?: never;
1791
+ head?: never;
1792
+ patch?: never;
1793
+ trace?: never;
1794
+ };
1795
+ "/v1/health/chains": {
1796
+ parameters: {
1797
+ query?: never;
1798
+ header?: never;
1799
+ path?: never;
1800
+ cookie?: never;
1801
+ };
1802
+ /**
1803
+ * Retrieve chains health
1804
+ * @description Returns the latest block that can be processed by collectors for each chain.
1805
+ */
1806
+ get: {
1807
+ parameters: {
1808
+ query?: never;
1809
+ header?: never;
1810
+ path?: never;
1811
+ cookie?: never;
1812
+ };
1813
+ requestBody?: never;
1814
+ responses: {
1815
+ /** @description Success */
1816
+ 200: {
1817
+ headers: {
1818
+ [name: string]: unknown;
1819
+ };
1820
+ content: {
1821
+ "application/json": components["schemas"]["ChainsHealthSuccessResponse"];
1822
+ };
1823
+ };
1824
+ };
1825
+ };
1826
+ put?: never;
1827
+ post?: never;
1828
+ delete?: never;
1829
+ options?: never;
1830
+ head?: never;
1831
+ patch?: never;
1832
+ trace?: never;
1833
+ };
1834
+ "/v1/validate": {
1835
+ parameters: {
1836
+ query?: never;
1837
+ header?: never;
1838
+ path?: never;
1839
+ cookie?: never;
1840
+ };
1841
+ get?: never;
1842
+ put?: never;
1843
+ /**
1844
+ * Validate offers
1845
+ * @description Validates offers against router validation rules. Returns validation status for each offer.
1846
+ *
1847
+ * **Available validation rules:**
1848
+ * - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
1849
+ * - **chain_ids**: Validates that offer chain is one of: [109111114]
1850
+ * - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
1851
+ * - **callback**: Validates callbacks: buy empty callback is allowed; sell offers must use a non-empty callback; non-empty callbacks must target one of [0x3333333333333333333333333333333333333333, 0x4444444444444444444444444444444444444444, 0x1111111111111111111111111111111111111111, 0x2222222222222222222222222222222222222222]
1852
+ * - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list
1853
+ */
1854
+ post: {
1855
+ parameters: {
1856
+ query?: never;
1857
+ header?: never;
1858
+ path?: never;
1859
+ cookie?: never;
1860
+ };
1861
+ requestBody?: {
1862
+ content: {
1863
+ "application/json": components["schemas"]["ValidateOffersRequest"];
1864
+ };
1865
+ };
1866
+ responses: {
1867
+ /** @description Success */
1868
+ 200: {
1869
+ headers: {
1870
+ [name: string]: unknown;
1871
+ };
1872
+ content: {
1873
+ "application/json": components["schemas"]["ValidateOffersListResponse"];
1874
+ };
1875
+ };
1876
+ /** @description Bad Request */
1877
+ 400: {
1878
+ headers: {
1879
+ [name: string]: unknown;
1880
+ };
1881
+ content: {
1882
+ "application/json": components["schemas"]["BadRequestResponse"];
1883
+ };
1884
+ };
1885
+ };
1886
+ };
1887
+ delete?: never;
1888
+ options?: never;
1889
+ head?: never;
1890
+ patch?: never;
1891
+ trace?: never;
1892
+ };
1893
+ }
1894
+ interface components {
1895
+ schemas: {
1896
+ BookListResponse: {
1897
+ meta: components["schemas"]["Meta"];
1898
+ /** @example eyJvZmZzZXQiOjEwMH0 */
1899
+ cursor: string | null;
1900
+ /** @description Aggregated book levels grouped by rate. */
1901
+ data: components["schemas"]["BookLevelResponse"][];
1902
+ };
1903
+ Meta: {
1904
+ /** @example 2024-01-01T12:00:00.000Z */
1905
+ timestamp: string;
1906
+ };
1907
+ BookLevelResponse: {
1908
+ /** @example 2750000000000000000 */
1909
+ rate: string;
1910
+ /** @example 369216000000000000000000 */
1911
+ assets: string;
1912
+ /** @example 5 */
1913
+ count: number;
1914
+ };
1915
+ BadRequestResponse: {
1916
+ error: components["schemas"]["ErrorResponse"];
1917
+ meta: components["schemas"]["Meta"];
1918
+ };
1919
+ ErrorResponse: {
1920
+ /**
1921
+ * @example VALIDATION_ERROR
1922
+ * @enum {string}
1923
+ */
1924
+ code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
1925
+ /** @example Limit must be greater than 0. */
1926
+ message: string;
1927
+ /**
1928
+ * @example [
1929
+ * {
1930
+ * "field": "limit",
1931
+ * "issue": "Limit must be greater than 0."
1932
+ * }
1933
+ * ]
1934
+ */
1935
+ details: Record<string, never>;
1936
+ };
1937
+ OfferListResponse: {
1938
+ meta: components["schemas"]["Meta"];
1939
+ /** @example eyJvZmZzZXQiOjEwMH0 */
1940
+ cursor: string | null;
1941
+ /**
1942
+ * @description Offers matching the provided filters.
1943
+ * @example [
1944
+ * {
1945
+ * "hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
1946
+ * "offering": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
1947
+ * "assets": "369216000000000000000000",
1948
+ * "rate": "2750000000000000000",
1949
+ * "maturity": 1761922799,
1950
+ * "expiry": 1761922799,
1951
+ * "start": 1761922790,
1952
+ * "nonce": "571380",
1953
+ * "buy": false,
1954
+ * "chain_id": 1,
1955
+ * "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
1956
+ * "collaterals": [
1957
+ * {
1958
+ * "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
1959
+ * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
1960
+ * "lltv": "860000000000000000"
1961
+ * }
1962
+ * ],
1963
+ * "callback": {
1964
+ * "address": "0x1111111111111111111111111111111111111111",
1965
+ * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
1966
+ * "gas_limit": "500000"
1967
+ * },
1968
+ * "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400",
1969
+ * "consumed": "0",
1970
+ * "takeable": "369216000000000000000000",
1971
+ * "block_number": 2942933377146801
1972
+ * }
1973
+ * ]
1974
+ */
1975
+ data: components["schemas"]["OfferListItemResponse"][];
1976
+ };
1977
+ OfferListItemResponse: {
1978
+ /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
1979
+ hash: string;
1980
+ /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
1981
+ offering: string;
1982
+ /** @example 369216000000000000000000 */
1983
+ assets: string;
1984
+ /** @example 2750000000000000000 */
1985
+ rate: string;
1986
+ /** @example 1761922799 */
1987
+ maturity: number;
1988
+ /** @example 1761922799 */
1989
+ expiry: number;
1990
+ /** @example 1761922790 */
1991
+ start: number;
1992
+ /** @example 571380 */
1993
+ nonce: string;
1994
+ /** @example false */
1995
+ buy: boolean;
1996
+ /** @example 1 */
1997
+ chain_id: number;
1998
+ /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
1999
+ loan_token: string;
2000
+ /**
2001
+ * @example [
2002
+ * {
2003
+ * "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
2004
+ * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
2005
+ * "lltv": "860000000000000000"
2006
+ * }
2007
+ * ]
2008
+ */
2009
+ collaterals: components["schemas"]["CollateralResponse"][];
2010
+ /**
2011
+ * @example {
2012
+ * "address": "0x1111111111111111111111111111111111111111",
2013
+ * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
2014
+ * "gas_limit": "500000"
2015
+ * }
2016
+ */
2017
+ callback: components["schemas"]["OfferCallbackResponse"];
2018
+ /** @example 369216000000000000000000 */
2019
+ takeable: string;
2020
+ /** @example 0 */
2021
+ consumed: string;
2022
+ /** @example 2942933377146801 */
2023
+ block_number: number;
2024
+ /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
2025
+ signature: string | null;
2026
+ };
2027
+ CollateralResponse: {
2028
+ /** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
2029
+ asset: string;
2030
+ /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
2031
+ oracle: string;
2032
+ /** @example 860000000000000000 */
2033
+ lltv: string;
2034
+ };
2035
+ OfferCallbackResponse: {
2036
+ /** @example 0x1111111111111111111111111111111111111111 */
2037
+ address: string;
2038
+ /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2039
+ data: string;
2040
+ /** @example 500000 */
2041
+ gas_limit: string;
2042
+ };
2043
+ ObligationListResponse: {
2044
+ meta: components["schemas"]["Meta"];
2045
+ /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
2046
+ cursor: string | null;
2047
+ /** @description List of obligations with takable offers. */
2048
+ data: components["schemas"]["ObligationResponse"][];
2049
+ };
2050
+ ObligationResponse: {
2051
+ /** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
2052
+ id: string;
2053
+ /** @example 1 */
2054
+ chain_id: number;
2055
+ /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2056
+ loan_token: string;
2057
+ collaterals: components["schemas"]["CollateralResponse"][];
2058
+ /** @example 1761922800 */
2059
+ maturity: number;
2060
+ ask: components["schemas"]["AskResponse"];
2061
+ bid: components["schemas"]["BidResponse"];
2062
+ };
2063
+ AskResponse: {
2064
+ /** @example 1000000000000000000 */
2065
+ rate: string;
2066
+ };
2067
+ BidResponse: {
2068
+ /** @example 1000000000000000000 */
2069
+ rate: string;
2070
+ };
2071
+ ObligationSingleSuccessResponse: {
2072
+ meta: components["schemas"]["Meta"];
2073
+ /** @example null */
2074
+ cursor: string | null;
2075
+ /** @description Obligation details. */
2076
+ data: components["schemas"]["ObligationResponse"];
2077
+ };
2078
+ RouterStatusSuccessResponse: {
2079
+ meta: components["schemas"]["Meta"];
2080
+ /**
2081
+ * @description Aggregated router status.
2082
+ * @example {
2083
+ * "status": "live"
2084
+ * }
2085
+ */
2086
+ data: components["schemas"]["RouterStatusDataResponse"];
2087
+ };
2088
+ RouterStatusDataResponse: {
2089
+ /**
2090
+ * @example live
2091
+ * @enum {string}
2092
+ */
2093
+ status: "live" | "syncing";
2094
+ };
2095
+ CollectorsHealthSuccessResponse: {
2096
+ meta: components["schemas"]["Meta"];
2097
+ /**
2098
+ * @description Collectors health details and sync status.
2099
+ * @example [
2100
+ * {
2101
+ * "name": "offers",
2102
+ * "chain_id": 1,
2103
+ * "block_number": 21345678,
2104
+ * "updated_at": "2024-01-01T12:00:00.000Z",
2105
+ * "lag": 0,
2106
+ * "status": "live"
2107
+ * }
2108
+ * ]
2109
+ */
2110
+ data: components["schemas"]["CollectorHealthResponse"][];
2111
+ };
2112
+ CollectorHealthResponse: {
2113
+ /** @example offers */
2114
+ name: string;
2115
+ /** @example 1 */
2116
+ chain_id: number;
2117
+ /** @example 21345678 */
2118
+ block_number: number | null;
2119
+ /** @example 2024-01-01T12:00:00.000Z */
2120
+ updated_at: string | null;
2121
+ /** @example 0 */
2122
+ lag: number | null;
2123
+ /**
2124
+ * @example live
2125
+ * @enum {string}
2126
+ */
2127
+ status: "live" | "lagging" | "unknown";
2128
+ };
2129
+ ChainsHealthSuccessResponse: {
2130
+ meta: components["schemas"]["Meta"];
2131
+ /**
2132
+ * @description Latest processed block per chain.
2133
+ * @example [
2134
+ * {
2135
+ * "chain_id": 1,
2136
+ * "local_block_number": 21345678,
2137
+ * "remote_block_number": 21345690,
2138
+ * "updated_at": "2024-01-01T12:00:00.000Z"
2139
+ * }
2140
+ * ]
2141
+ */
2142
+ data: components["schemas"]["ChainHealthResponse"][];
2143
+ };
2144
+ ChainHealthResponse: {
2145
+ /** @example 1 */
2146
+ chain_id: number;
2147
+ /** @example 21345678 */
2148
+ local_block_number: number;
2149
+ /** @example 21345690 */
2150
+ remote_block_number: number | null;
2151
+ /** @example 2024-01-01T12:00:00.000Z */
2152
+ updated_at: string;
2153
+ };
2154
+ ValidateOffersRequest: {
2155
+ /** @description Array of offers in snake_case format. Mutually exclusive with 'calldata'. */
2156
+ offers?: components["schemas"]["ValidateOfferRequest"][];
2157
+ /**
2158
+ * @description Encoded tree calldata as a hex string (0x-prefixed). Mutually exclusive with 'offers'.
2159
+ * @example 0x01...
2160
+ */
2161
+ calldata?: string;
2162
+ };
2163
+ ValidateOfferRequest: {
2164
+ /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
2165
+ offering: string;
2166
+ /** @example 369216000000000000000000 */
2167
+ assets: string;
2168
+ /** @example 2750000000000000000 */
2169
+ rate: string;
2170
+ /** @example 1761922799 */
2171
+ maturity: number;
2172
+ /** @example 1761922799 */
2173
+ expiry: number;
2174
+ /** @example 1761922790 */
2175
+ start: number;
2176
+ /** @example 571380 */
2177
+ nonce: string;
2178
+ /** @example false */
2179
+ buy: boolean;
2180
+ /** @example 1 */
2181
+ chain_id: number;
2182
+ /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
2183
+ loan_token: string;
2184
+ /**
2185
+ * @example [
2186
+ * {
2187
+ * "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
2188
+ * "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
2189
+ * "lltv": "860000000000000000"
2190
+ * }
2191
+ * ]
2192
+ */
2193
+ collaterals: components["schemas"]["CollateralResponse"][];
2194
+ /**
2195
+ * @example {
2196
+ * "address": "0x1111111111111111111111111111111111111111",
2197
+ * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
2198
+ * "gas_limit": "500000"
2199
+ * }
2200
+ */
2201
+ callback: components["schemas"]["OfferCallbackResponse"];
2202
+ };
2203
+ ValidateOffersListResponse: {
2204
+ meta: components["schemas"]["Meta"];
2205
+ /** @example null */
2206
+ cursor: string | null;
2207
+ /** @description Validation results for each offer. */
2208
+ data: components["schemas"]["ValidateOfferResultResponse"][];
2209
+ };
2210
+ ValidateOfferResultResponse: {
2211
+ /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
2212
+ offer_hash: string;
2213
+ /** @example false */
2214
+ valid: boolean;
2215
+ /** @example parse_error */
2216
+ rule: string | null;
2217
+ /** @example Invalid offer. 'offering': invalid address */
2218
+ message: string | null;
2219
+ };
2220
+ };
2221
+ responses: never;
2222
+ parameters: never;
2223
+ requestBodies: never;
2224
+ headers: never;
2225
+ pathItems: never;
2226
+ }
2227
+ declare namespace ObligationResponse_d_exports {
2228
+ export { ObligationResponse, from$2 as from };
2229
+ }
2230
+ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
2231
+ /**
2232
+ * Creates an `ObligationResponse` from a `Obligation`.
2233
+ * @constructor
2234
+ * @param obligation - {@link Obligation}
2235
+ * @returns The created `ObligationResponse`. {@link ObligationResponse}
2236
+ */
2237
+ declare function from$2(obligation: Obligation, quote: Quote): ObligationResponse;
2238
+ declare namespace OfferResponse_d_exports {
2239
+ export { OfferResponse, from$1 as from };
2240
+ }
2241
+ type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
2242
+ /**
2243
+ * Creates an `OfferResponse` from an `Offer`.
2244
+ * @constructor
2245
+ * @param offer - {@link Offer}
2246
+ * @returns The created `OfferResponse`. {@link OfferResponse}
2247
+ */
2248
+ declare function from$1(offer: Offer): OfferResponse;
2249
+ //#endregion
2250
+ //#region src/api/Schema/openapi.d.ts
2251
+ declare class BooksController {
2252
+ getBook(): Promise<void>;
2253
+ }
2254
+ declare class ValidateController {
2255
+ validateOffers(): Promise<void>;
2256
+ }
2257
+ declare class OffersController {
2258
+ getOffers(): Promise<void>;
2259
+ }
2260
+ declare class HealthController {
2261
+ getRouterStatus(): Promise<void>;
2262
+ getCollectorsHealth(): Promise<void>;
2263
+ getChainsHealth(): Promise<void>;
2264
+ }
2265
+ declare class ObligationsController {
2266
+ getObligations(): Promise<void>;
2267
+ getObligation(): Promise<void>;
2268
+ }
2269
+ type RuleInfo = {
2270
+ name: string;
2271
+ description: string;
2272
+ };
2273
+ type OpenApiOptions = {
2274
+ rules?: RuleInfo[];
2275
+ };
2276
+ declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
2277
+ //#endregion
2278
+ //#region src/api/Schema/requests.d.ts
2279
+ declare const schemas: {
2280
+ readonly get_offers: z$1.ZodObject<{
2281
+ side: z$1.ZodOptional<z$1.ZodEnum<{
2282
+ buy: "buy";
2283
+ sell: "sell";
2284
+ }>>;
2285
+ obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
2286
+ offering: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
2287
+ cursor: z$1.ZodOptional<z$1.ZodString>;
2288
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
2289
+ }, z$1.core.$strip>;
2290
+ readonly get_obligations: z$1.ZodObject<{
2291
+ cursor: z$1.ZodOptional<z$1.ZodString>;
2292
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
2293
+ }, z$1.core.$strip>;
2294
+ readonly get_obligation: z$1.ZodObject<{
2295
+ obligation_id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2296
+ }, z$1.core.$strip>;
2297
+ readonly get_book: z$1.ZodObject<{
2298
+ obligation_id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
2299
+ side: z$1.ZodEnum<{
2300
+ buy: "buy";
2301
+ sell: "sell";
2302
+ }>;
2303
+ cursor: z$1.ZodOptional<z$1.ZodString>;
2304
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
2305
+ }, z$1.core.$strip>;
2306
+ readonly validate_offers: z$1.ZodObject<{
2307
+ offers: z$1.ZodAny;
2308
+ calldata: z$1.ZodOptional<z$1.ZodString>;
2309
+ }, z$1.core.$strip>;
2310
+ };
2311
+ type Action = keyof typeof schemas;
2312
+ declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
2313
+ declare function safeParse<A extends Action>(action: A, query: unknown, error?: z$1.core.$ZodErrorMap<z$1.core.$ZodIssue>): z$1.ZodSafeParseResult<z$1.infer<(typeof schemas)[A]>>;
2314
+ declare namespace index_d_exports$1 {
2315
+ export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, RouterStatusResponse, RuleInfo, ValidateController, parse, safeParse };
2316
+ }
2317
+ declare namespace Client_d_exports {
2318
+ export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
2319
+ }
2320
+ type RouterClientConfig = {
2321
+ /** The URL of the router. */
2322
+ readonly url: URL;
2323
+ /** The default headers to use for each request. */
2324
+ readonly headers: Headers;
2325
+ };
2326
+ type Client$2 = Compute<RouterClientConfig & {
2327
+ /**
2328
+ * Get offers from the router.
2329
+ * @param parameters - {@link getOffers.Parameters}
2330
+ * @returns The offers with pagination cursor. {@link getOffers.ReturnType}
2331
+ * @throws If the request fails - {@link getOffers.ErrorType}
2332
+ *
2333
+ * @example
2334
+ * ```ts
2335
+ * const router = RouterClient.connect({ url: "https://router.morpho.dev" });
2336
+ * const { offers, cursor } = await router.getOffers({ side: "buy", obligationId: "0xa1c...d2f" });
2337
+ * console.log(offers);
2338
+ * ```
2339
+ */
2340
+ getOffers: (parameters: getOffers.Parameters) => Promise<getOffers.ReturnType>;
2341
+ /**
2342
+ * Get obligations from the router.
2343
+ * @param parameters - {@link getObligations.Parameters}
2344
+ * @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
2345
+ * @throws If the request fails - {@link getObligations.ErrorType}
2346
+ *
2347
+ * @example
2348
+ * ```ts
2349
+ * const router = RouterClient.connect({ url: "https://router.morpho.dev" });
2350
+ * const { obligations, cursor } = await router.getObligations();
2351
+ * console.log(obligations[0].id()); // 0x123...456
2352
+ * ```
2353
+ */
2354
+ getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
2355
+ }>;
2356
+ type ConnectOptions = {
2357
+ /** The URL of the router to interact with.
2358
+ * @default "https://router.morpho.dev"
2359
+ */
2360
+ url?: string;
2361
+ /** The API key to use for the router API. */
2362
+ apiKey?: string;
2363
+ /** The default headers to use for each request. */
2364
+ headers?: Headers;
2365
+ };
2366
+ /**
2367
+ * Creates an instance of a router client.
2368
+ * @constructor
2369
+ * @param parameters - {@link connect.Parameters}
2370
+ * @returns A Router Client. {@link connect.ReturnType}
2371
+ *
2372
+ * @example
2373
+ * ```typescript
2374
+ * const router = RouterClient.connect({ url: "https://router.morpho.dev" });
2375
+ * ```
2376
+ */
2377
+ declare function connect$1(parameters?: connect$1.Parameters): connect$1.ReturnType;
2378
+ declare namespace connect$1 {
2379
+ type Parameters = ConnectOptions;
2380
+ type ReturnType = Client$2;
2381
+ type ErrorType = InvalidUrlError;
2382
+ }
2383
+ declare function getOffers(apiClient: Client<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
2384
+ declare namespace getOffers {
2385
+ type Parameters = {
2386
+ /** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
2387
+ side: "buy" | "sell";
2388
+ /** The offers obligation id */
2389
+ obligationId: Hex;
2390
+ /** Pagination cursor in base64url-encoded format */
2391
+ cursor?: string;
2392
+ /** Maximum number of offers to return. @default 20 */
2393
+ limit?: number;
2394
+ };
2395
+ type ReturnType = {
2396
+ offers: Offer[];
2397
+ /** The pagination cursor. */
2398
+ cursor: string | null;
2399
+ };
2400
+ type ErrorType = GetApiErrorType;
2401
+ }
2402
+ declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
2403
+ declare namespace getObligations {
2404
+ type Parameters = {
2405
+ /** Pagination cursor is a 32-byte hex string. */
2406
+ cursor?: Hex;
2407
+ /** Maximum number of obligations to return. @default 20 */
2408
+ limit?: number;
2409
+ };
2410
+ type ReturnType = {
2411
+ obligations: Compute<{
2412
+ /** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
2413
+ id: () => Hex;
2414
+ } & Obligation & Omit<Quote, "obligationId">>[];
2415
+ /** The pagination cursor. */
2416
+ cursor: string | null;
2417
+ };
2418
+ type ErrorType = GetApiErrorType;
2419
+ }
2420
+ type GetApiErrorType = HttpGetApiFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
2421
+ declare class InvalidUrlError extends BaseError {
2422
+ name: string;
2423
+ constructor(url: string);
2424
+ }
2425
+ declare class HttpUnauthorizedError extends BaseError {
2426
+ name: string;
2427
+ constructor();
2428
+ }
2429
+ declare class HttpForbiddenError extends BaseError {
2430
+ name: string;
2431
+ constructor();
2432
+ }
2433
+ declare class HttpRateLimitError extends BaseError {
2434
+ name: string;
2435
+ constructor();
2436
+ }
2437
+ declare class HttpGetApiFailedError extends BaseError {
2438
+ name: string;
2439
+ constructor(message: string, {
2440
+ details
2441
+ }?: {
2442
+ details?: string;
2443
+ });
2444
+ }
2445
+ declare namespace Cursor_d_exports {
2446
+ export { Cursor, decode, encode, validate };
2447
+ }
2448
+ type Cursor = {
2449
+ sort: "rate" | "maturity" | "expiry" | "amount";
2450
+ dir: "asc" | "desc";
2451
+ rate?: string;
2452
+ maturity?: number;
2453
+ expiry?: number;
2454
+ assets?: string;
2455
+ hash: string;
2456
+ page?: number;
2457
+ };
2458
+ declare function validate(cursor: unknown): cursor is Cursor;
2459
+ declare function encode(c: Cursor): string;
2460
+ declare function decode(token?: string): Cursor | null;
2461
+ declare namespace Gate_d_exports {
2462
+ export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
2463
+ }
2464
+ /**
2465
+ * A validation rule.
2466
+ */
2467
+ type Rule<T, Name$1 extends string = string> = {
2468
+ kind: "single";
2469
+ name: Name$1;
2470
+ description: string;
2471
+ run: Single<T, Name$1>;
2472
+ } | {
2473
+ kind: "batch";
2474
+ name: Name$1;
2475
+ description: string;
2476
+ run: Batch<T, Name$1>;
2477
+ };
2478
+ type RuleNames<Rules$1 extends readonly {
2479
+ name: string;
2480
+ }[]> = Rules$1[number]["name"];
2481
+ /**
2482
+ * A single item validation rule.
2483
+ * @param item - The item to validate.
2484
+ * @returns The issue that was found. If the item is valid, this will be undefined.
2485
+ */
2486
+ type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
2487
+ /**
2488
+ * A batch item validation rule.
2489
+ * @param items - The items to validate.
2490
+ * @returns A map of the items to the issue that was found.
2491
+ */
2492
+ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined> | Promise<Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>>;
2493
+ /**
2494
+ * Create a validation rule iterating over a single item at a time.
2495
+ * @param name - The name of the rule.
2496
+ * @param description - A human-readable description of the rule.
2497
+ * @param run - The function that validates the rule.
2498
+ * @returns The created rule.
2499
+ */
2500
+ declare function single<Name$1 extends string, T>(name: Name$1, description: string, run: Single<T, Name$1>): Rule<T, Name$1>;
2501
+ /**
2502
+ * Create a validation rule iterating over a batch of items at a time.
2503
+ * @param name - The name of the rule.
2504
+ * @param description - A human-readable description of the rule.
2505
+ * @param run - The function that validates the rule.
2506
+ * @returns The created rule.
2507
+ */
2508
+ declare function batch$1<Name$1 extends string, T>(name: Name$1, description: string, run: Batch<T, Name$1>): Rule<T, Name$1>;
2509
+ /**
2510
+ * A validation issue.
2511
+ */
2512
+ type Issue<T, RuleName extends string = string> = {
2513
+ /** The name of the rule that caused the issue. */
2514
+ ruleName: RuleName;
2515
+ /** The message of the issue. */
2516
+ message: string;
2517
+ /** The item that was not valid. */
2518
+ item: T;
2519
+ };
2520
+ /**
2521
+ * The result of a validation.
2522
+ */
2523
+ type Result<T, RuleName extends string = string> = {
2524
+ /** The items that were valid. */
2525
+ valid: T[];
2526
+ /** The reports of the failed validations. */
2527
+ issues: Issue<T, RuleName>[];
2528
+ };
2529
+ declare function run<T, Name$1 extends string, Rules$1 extends readonly Rule<T, Name$1>[]>(parameters: {
2530
+ items: T[];
2531
+ rules: Rules$1;
2532
+ chunkSize?: number;
2533
+ }): Promise<Result<T, RuleNames<Rules$1>>>;
2534
+ declare namespace GateConfig_d_exports {
2535
+ export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
2536
+ }
2537
+ type GateConfig = {
2538
+ callbacks?: CallbackConfig[];
2539
+ maturities?: MaturityType[];
2540
+ };
2541
+ type CallbackConfig = {
2542
+ type: CallbackType.BuyVaultV1Callback;
2543
+ addresses: Address[];
2544
+ vaultFactories: Address[];
2545
+ } | {
2546
+ type: CallbackType.SellERC20Callback;
2547
+ addresses: Address[];
2548
+ } | {
2549
+ type: CallbackType.BuyWithEmptyCallback;
2550
+ };
2551
+ declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
2552
+ type: CallbackType.BuyVaultV1Callback;
2553
+ }> | undefined;
2554
+ declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
2555
+ type: CallbackType.SellERC20Callback;
2556
+ }> | undefined;
2557
+ declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
2558
+ type: CallbackType.BuyWithEmptyCallback;
2559
+ }> | undefined;
2560
+ declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
2561
+ /**
2562
+ * Attempts to infer the configured callback type from a callback address on a chain.
2563
+ * Skips the empty callback type as it does not carry addresses.
2564
+ *
2565
+ * @param chain - Chain name for which to infer the callback type
2566
+ * @param address - Callback contract address
2567
+ * @returns The callback type when found, otherwise undefined
2568
+ */
2569
+ declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
2570
+ /**
2571
+ * Returns the callback addresses for a given chain and callback type, if it exists.
2572
+ * @param chain - Chain name for which to read the validation configuration
2573
+ * @param type - Callback type to retrieve
2574
+ * @returns The matching callback addresses or an empty array if not configured
2575
+ */
2576
+ declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
2577
+ /**
2578
+ * Returns the list of allowed non-empty callback addresses for a chain.
2579
+ *
2580
+ * @param chain - Chain name
2581
+ * @returns Array of allowed callback addresses (lowercased). Empty when none configured
2582
+ */
2583
+ declare const getCallbackAddresses: (chain: Name) => Address[];
2584
+ declare const assets$1: Record<string, Address[]>;
2585
+ declare const configs: Record<Name, GateConfig>;
2586
+ declare namespace Gatekeeper_d_exports {
2587
+ export { Gatekeeper, Rules, create };
2588
+ }
2589
+ type Rules = readonly Rule<Offer, string>[];
2590
+ type Gatekeeper = {
2591
+ rules: Rules;
2592
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
2593
+ };
2594
+ type GatekeeperParameters = {
2595
+ rules: Rules;
2596
+ };
2597
+ declare function create(parameters: GatekeeperParameters): Gatekeeper;
2598
+ //#endregion
2599
+ //#region src/gatekeeper/morphoRules.d.ts
2600
+ declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
2601
+ declare namespace Rules_d_exports {
2602
+ export { ValidityParameters, callback, chains, maturity, token, validity };
2603
+ }
2604
+ type ValidityParameters = {
2605
+ client: PublicClient<Transport, Chain$1>;
2606
+ };
2607
+ /**
2608
+ * set of rules to validate offers.
2609
+ *
2610
+ * @param parameters - Validity parameters with chain and client
2611
+ * @returns Array of validation rules to evaluate against offers
2612
+ */
2613
+ declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
2614
+ declare const chains: ({
2615
+ chains
2616
+ }: {
2617
+ chains: Chain$1[];
2618
+ }) => Rule<Offer, "chain_ids">;
2619
+ declare const maturity: ({
2620
+ maturities
2621
+ }: {
2622
+ maturities: MaturityType[];
2623
+ }) => Rule<Offer, "maturity">;
2624
+ declare const callback: ({
2625
+ callbacks,
2626
+ allowedAddresses
2627
+ }: {
2628
+ callbacks: CallbackType[];
2629
+ allowedAddresses: Address[];
2630
+ }) => Rule<Offer, "callback">;
2631
+ /**
2632
+ * A validation rule that checks if the offer's token is allowed.
2633
+ * @param offer - The offer to validate.
2634
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
2635
+ */
2636
+ declare const token: ({
2637
+ assets
2638
+ }: {
2639
+ assets: Address[];
2640
+ }) => Rule<Offer, "token">;
2641
+ //#endregion
2642
+ //#region src/mempool/MempoolEVMClient.d.ts
2643
+ declare function from(parameters: from.Parameters): from.ReturnType;
2644
+ declare namespace from {
2645
+ type Parameters = {
2646
+ /** The viem client to use. */
2647
+ client: WalletClient;
2648
+ /** The mempool address. */
2649
+ mempoolAddress: Address;
2650
+ /** The block window to use for the mempool. Defaults to 100. */
2651
+ blockWindow?: number;
2652
+ };
2653
+ type ReturnType = Client$1;
2654
+ type ErrorType = null;
2655
+ }
2656
+ declare namespace MempoolClient_d_exports {
2657
+ export { AddParameters, Client$1 as Client, GetParameters, connect };
2658
+ }
2659
+ type AddParameters = Compute<Omit<Offer, "hash" | "createdAt">[]>;
2660
+ type GetParameters = {
2661
+ /** The block number to get offers from. */
2662
+ blockNumberGte?: number;
2663
+ /** The block number to get offers to. */
2664
+ blockNumberLte?: number;
2665
+ /** The loan asset to get offers from. */
2666
+ loanToken?: string;
2667
+ /** The order to get offers. Defaults to "desc". */
2668
+ order?: "asc" | "desc";
2669
+ /** The options to get offers from. */
2670
+ options?: {
2671
+ /** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
2672
+ maxBatchSize?: number;
2673
+ };
2674
+ };
2675
+ /**
2676
+ * Mempool client interface.
2677
+ */
2678
+ type Client$1 = {
2679
+ /**
2680
+ * Add an offer to the mempool.
2681
+ * @returns The created offer with its hash.
2682
+ */
2683
+ add: (parameters: AddParameters) => Promise<Hex>;
2684
+ /** Get offers from the mempool. */
2685
+ get: (parameters?: GetParameters) => AsyncGenerator<{
2686
+ offers: Offer[];
2687
+ /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
2688
+ blockNumber: number;
2689
+ }>;
2690
+ /**
2691
+ * Stream offers from the mempool.
2692
+ * @returns A generator of offers alongside the last block number processed.
2693
+ */
2694
+ stream: (parameters: Compute<Omit<GetParameters, "options"> & {
2695
+ options: GetParameters["options"] & {
2696
+ blockWindow?: number;
2697
+ };
2698
+ }>) => AsyncGenerator<{
2699
+ offers: Offer[];
2700
+ blockNumber: number;
2701
+ }>;
2702
+ };
2703
+ /**
2704
+ * Client to interact with the Mempool contract on a specific chain.
2705
+ */
2706
+ declare function connect(parameters: from.Parameters): Client$1;
2707
+ declare namespace connect {
2708
+ type ErrorType = from.ErrorType;
2709
+ }
2710
+ //#endregion
2711
+ //#region src/utils/BigMath.d.ts
2712
+ declare function max$1(a: bigint, b: bigint): bigint;
2713
+ declare function min(a: bigint, b: bigint): bigint;
2714
+ //#endregion
2715
+ //#region src/utils/batch.d.ts
2716
+ /**
2717
+ * Splits an array into batches of a specified size.
2718
+ * @param array The array to split.
2719
+ * @param batchSize The size of each batch.
2720
+ * @returns An iterator that yields each batch.
2721
+ * @example
2722
+ * ```typescript
2723
+ * const array = [1, 2, 3, 4, 5];
2724
+ * for (const batch of batch(array, 2)) {
2725
+ * console.log(batch);
2726
+ * }
2727
+ * // Output:
2728
+ * // [1, 2]
2729
+ * // [3, 4]
2730
+ * // [5]
2731
+ * ```
2732
+ */
2733
+ declare function batch<T>(array: T[] | readonly T[], batchSize: number): Generator<T[], void, unknown>;
2734
+ //#endregion
2735
+ //#region src/utils/batchMulticall.d.ts
2736
+ /**
2737
+ * Helper function to execute multicall in batches with retry logic.
2738
+ * Abstracts the common pattern of batching calls, retrying, and collecting results.
2739
+ *
2740
+ * @param parameters - Configuration for batched multicall
2741
+ * @returns Promise resolving to flattened array of results
2742
+ */
2743
+ declare function batchMulticall<TResult>(parameters: {
2744
+ client: PublicClient<Transport, Chain$1>;
2745
+ calls: MulticallParameters["contracts"];
2746
+ batchSize: number;
2747
+ retryAttempts: number;
2748
+ retryDelayMs: number;
2749
+ blockNumber?: bigint;
2750
+ }): Promise<TResult[]>;
2751
+ //#endregion
2752
+ //#region src/utils/lazy.d.ts
2753
+ /**
2754
+ * Transform a polling function into an async generator.
2755
+ * @param fn - The polling function to transform.
2756
+ * @returns An async generator.
2757
+ */
2758
+ declare function lazy<T>(pollFn: (emit: (value: T) => void, {
2759
+ stop
2760
+ }: {
2761
+ stop: () => void;
2762
+ }) => () => boolean): () => AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
2763
+ //#endregion
2764
+ //#region src/utils/poll.d.ts
2765
+ /**
2766
+ * Polls a function at a specified interval.
2767
+ * Inspired by https://github.com/wevm/viem/blob/845994d20275d08ff892018e237a4b599eeefb6a/src/utils/poll.ts
2768
+ */
2769
+ declare function poll<data>(fn: ({
2770
+ unpoll
2771
+ }: {
2772
+ unpoll: () => void;
2773
+ }) => Promise<data | undefined>, {
2774
+ interval
2775
+ }: {
2776
+ interval: () => Promise<number>;
2777
+ }): () => boolean;
2778
+ //#endregion
2779
+ //#region src/utils/retry.d.ts
2780
+ declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
2781
+ declare namespace time_d_exports {
2782
+ export { max, now };
2783
+ }
2784
+ declare function now(): number;
2785
+ declare function max(): number;
2786
+ //#endregion
2787
+ //#region src/utils/wait.d.ts
2788
+ declare function wait(time: number): Promise<unknown>;
2789
+ declare namespace index_d_exports$2 {
2790
+ export { BaseError, GlobalErrorType, ReorgError, Snake, time_d_exports as Time, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
2791
+ }
2792
+ //#endregion
2793
+ export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, Collateral_d_exports as Collateral, Compute, Cursor_d_exports as Cursor, ERC4626_d_exports as ERC4626, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports as RouterClient, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, Gate_d_exports as Validation, morphoRules };
2794
+ //# sourceMappingURL=index.browser.d.mts.map