@morpho-dev/router 0.1.11 → 0.1.12

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 (32) hide show
  1. package/README.md +7 -7
  2. package/dist/drizzle/{offers_v1.1 → router_v1.1}/0000_init.sql +47 -39
  3. package/dist/drizzle/{offers_v1.1/meta/0007_snapshot.json → router_v1.1/meta/0000_snapshot.json} +21 -21
  4. package/dist/drizzle/router_v1.1/meta/_journal.json +13 -0
  5. package/dist/index.browser.d.cts +186 -159
  6. package/dist/index.browser.d.ts +186 -159
  7. package/dist/index.browser.js +807 -491
  8. package/dist/index.browser.js.map +1 -1
  9. package/dist/index.browser.mjs +809 -493
  10. package/dist/index.browser.mjs.map +1 -1
  11. package/dist/index.node.d.cts +1795 -1759
  12. package/dist/index.node.d.ts +1795 -1759
  13. package/dist/index.node.js +2923 -2495
  14. package/dist/index.node.js.map +1 -1
  15. package/dist/index.node.mjs +2925 -2496
  16. package/dist/index.node.mjs.map +1 -1
  17. package/package.json +4 -4
  18. package/dist/drizzle/offers_v1.1/0001_new_table_for_collectors_block_numbers.sql +0 -5
  19. package/dist/drizzle/offers_v1.1/0002_update-liquidity-tables.sql +0 -8
  20. package/dist/drizzle/offers_v1.1/0003_add-not-null-for-queue-id.sql +0 -1
  21. package/dist/drizzle/offers_v1.1/0004_add-callback-id-to-offer.sql +0 -1
  22. package/dist/drizzle/offers_v1.1/0005_add-missing-indices-to-liquidity-tables.sql +0 -2
  23. package/dist/drizzle/offers_v1.1/0006_add-callback-amount-to-queues-table.sql +0 -1
  24. package/dist/drizzle/offers_v1.1/0007_add-index-to-created-at.sql +0 -2
  25. package/dist/drizzle/offers_v1.1/meta/0000_snapshot.json +0 -827
  26. package/dist/drizzle/offers_v1.1/meta/0001_snapshot.json +0 -827
  27. package/dist/drizzle/offers_v1.1/meta/0002_snapshot.json +0 -833
  28. package/dist/drizzle/offers_v1.1/meta/0003_snapshot.json +0 -833
  29. package/dist/drizzle/offers_v1.1/meta/0004_snapshot.json +0 -839
  30. package/dist/drizzle/offers_v1.1/meta/0005_snapshot.json +0 -877
  31. package/dist/drizzle/offers_v1.1/meta/0006_snapshot.json +0 -884
  32. package/dist/drizzle/offers_v1.1/meta/_journal.json +0 -62
@@ -1,87 +1,19 @@
1
1
  import * as _morpho_dev_mempool from '@morpho-dev/mempool';
2
- import { Offer, Errors, Format, Chain, LLTV, Mempool, Compute, Maturity } from '@morpho-dev/mempool';
2
+ import { Offer, Errors, Format, Maturity, LLTV, Compute, Chain, Mempool } from '@morpho-dev/mempool';
3
3
  export * from '@morpho-dev/mempool';
4
- import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
5
- import { z, ZodError } from 'zod/v4';
6
4
  import * as viem from 'viem';
7
- import { Address, Hex, PublicActions, WalletClient, PublicClient } from 'viem';
5
+ import { Address, Hex, PublicClient, PublicActions } from 'viem';
6
+ import { z, ZodError } from 'zod/v4';
7
+ import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
8
+ import * as hono_utils_types from 'hono/utils/types';
9
+ import * as hono from 'hono';
10
+ import { Context } from 'hono';
11
+ import * as hono_utils_http_status from 'hono/utils/http-status';
8
12
  import { PGlite } from '@electric-sql/pglite';
9
13
  import { drizzle } from 'drizzle-orm/node-postgres';
10
14
  import { drizzle as drizzle$1 } from 'drizzle-orm/pglite';
11
15
  import { Pool } from 'pg';
12
16
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
13
- import * as hono_utils_types from 'hono/utils/types';
14
- import * as hono from 'hono';
15
- import { Context } from 'hono';
16
- import * as hono_utils_http_status from 'hono/utils/http-status';
17
-
18
- declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
19
-
20
- declare const schemas: {
21
- readonly get_offers: z.ZodObject<{
22
- creators: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
23
- side: z.ZodOptional<z.ZodEnum<{
24
- buy: "buy";
25
- sell: "sell";
26
- }>>;
27
- chains: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<number[], string>>>;
28
- loan_tokens: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
29
- status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
30
- callback_addresses: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
31
- min_amount: z.ZodOptional<z.ZodBigInt>;
32
- max_amount: z.ZodOptional<z.ZodBigInt>;
33
- min_rate: z.ZodOptional<z.ZodBigInt>;
34
- max_rate: z.ZodOptional<z.ZodBigInt>;
35
- min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
36
- max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
37
- min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
38
- max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
39
- collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
40
- collateral_oracles: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
41
- collateral_tuple: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
42
- asset: string;
43
- oracle: string | undefined;
44
- lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
45
- }[], string>>>;
46
- min_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
47
- max_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
48
- sort_by: z.ZodOptional<z.ZodEnum<{
49
- rate: "rate";
50
- maturity: "maturity";
51
- expiry: "expiry";
52
- amount: "amount";
53
- }>>;
54
- sort_order: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
55
- asc: "asc";
56
- desc: "desc";
57
- }>>>;
58
- cursor: z.ZodOptional<z.ZodString>;
59
- limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
60
- }, z.core.$strip>;
61
- readonly match_offers: z.ZodObject<{
62
- side: z.ZodEnum<{
63
- buy: "buy";
64
- sell: "sell";
65
- }>;
66
- chain_id: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>;
67
- rate: z.ZodOptional<z.ZodBigInt>;
68
- collaterals: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
69
- asset: string;
70
- oracle: string;
71
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
72
- }[], string>>>;
73
- maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
74
- min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
75
- max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
76
- loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
77
- creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
78
- cursor: z.ZodOptional<z.ZodString>;
79
- limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
80
- }, z.core.$strip>;
81
- };
82
- type Action = keyof typeof schemas;
83
- declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
84
- declare function safeParse<A extends Action>(action: A, query: unknown, error?: z.core.$ZodErrorMap<z.core.$ZodIssue>): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
85
17
 
86
18
  declare const OfferStatusValues: readonly ["valid", "callback_not_supported", "callback_error", "unverified"];
87
19
  type OfferStatus = (typeof OfferStatusValues)[number];
@@ -218,6 +150,74 @@ declare namespace RouterOffer$1 {
218
150
  export { RouterOffer$1_InvalidRouterOfferError as InvalidRouterOfferError, type RouterOffer$1_OfferConsumed as OfferConsumed, type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer, RouterOffer$1_RouterOfferSchema as RouterOfferSchema, RouterOffer$1_consumedEvent as consumedEvent, from$1 as from, RouterOffer$1_fromConsumedLog as fromConsumedLog, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
219
151
  }
220
152
 
153
+ declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
154
+
155
+ declare const schemas: {
156
+ readonly get_offers: z.ZodObject<{
157
+ creators: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
158
+ side: z.ZodOptional<z.ZodEnum<{
159
+ buy: "buy";
160
+ sell: "sell";
161
+ }>>;
162
+ chains: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<number[], string>>>;
163
+ loan_tokens: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
164
+ status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
165
+ callback_addresses: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
166
+ min_amount: z.ZodOptional<z.ZodBigInt>;
167
+ max_amount: z.ZodOptional<z.ZodBigInt>;
168
+ min_rate: z.ZodOptional<z.ZodBigInt>;
169
+ max_rate: z.ZodOptional<z.ZodBigInt>;
170
+ min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
171
+ max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
172
+ min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
173
+ max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
174
+ collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
175
+ collateral_oracles: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
176
+ collateral_tuple: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
177
+ asset: string;
178
+ oracle: string | undefined;
179
+ lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
180
+ }[], string>>>;
181
+ min_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
182
+ max_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
183
+ sort_by: z.ZodOptional<z.ZodEnum<{
184
+ amount: "amount";
185
+ rate: "rate";
186
+ maturity: "maturity";
187
+ expiry: "expiry";
188
+ }>>;
189
+ sort_order: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
190
+ asc: "asc";
191
+ desc: "desc";
192
+ }>>>;
193
+ cursor: z.ZodOptional<z.ZodString>;
194
+ limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
195
+ }, z.core.$strip>;
196
+ readonly match_offers: z.ZodObject<{
197
+ side: z.ZodEnum<{
198
+ buy: "buy";
199
+ sell: "sell";
200
+ }>;
201
+ chain_id: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>;
202
+ rate: z.ZodOptional<z.ZodBigInt>;
203
+ collaterals: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
204
+ asset: string;
205
+ oracle: string;
206
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
207
+ }[], string>>>;
208
+ maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
209
+ min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
210
+ max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
211
+ loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
212
+ creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
213
+ cursor: z.ZodOptional<z.ZodString>;
214
+ limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
215
+ }, z.core.$strip>;
216
+ };
217
+ type Action = keyof typeof schemas;
218
+ declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
219
+ declare function safeParse<A extends Action>(action: A, query: unknown, error?: z.core.$ZodErrorMap<z.core.$ZodIssue>): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
220
+
221
221
  type OfferResponse = {
222
222
  offer: Offer.Offer;
223
223
  consumed: bigint;
@@ -237,94 +237,378 @@ declare function toResponse(routerOffer: RouterOffer): OfferResponse;
237
237
  */
238
238
  declare function fromResponse(offerResponse: OfferResponse): RouterOffer;
239
239
 
240
- type index$3_OfferResponse = OfferResponse;
241
- declare const index$3_OpenApi: typeof OpenApi;
242
- declare const index$3_fromResponse: typeof fromResponse;
243
- declare const index$3_parse: typeof parse;
244
- declare const index$3_safeParse: typeof safeParse;
245
- declare const index$3_toResponse: typeof toResponse;
246
- declare namespace index$3 {
247
- export { type index$3_OfferResponse as OfferResponse, index$3_OpenApi as OpenApi, index$3_fromResponse as fromResponse, index$3_parse as parse, index$3_safeParse as safeParse, index$3_toResponse as toResponse };
248
- }
249
-
250
- declare function fetchBalancesAndAllowances(parameters: {
251
- client: Pick<PublicActions, "multicall">;
252
- spender: Address;
253
- pairs: Array<{
254
- user: Address;
255
- token: Address;
240
+ type GetParameters = {
241
+ /** Filter by multiple creator addresses (comma-separated) */
242
+ creators?: string[];
243
+ /** Filter by offer type: buy offers or sell offers */
244
+ side?: "buy" | "sell";
245
+ /** Filter by multiple blockchain networks (comma-separated chain IDs) */
246
+ chains?: number[];
247
+ /** Filter by multiple loan assets (comma-separated) */
248
+ loanTokens?: string[];
249
+ /** Filter by multiple statuses (comma-separated) */
250
+ status?: OfferStatus[];
251
+ /** Filter by multiple callback addresses (comma-separated) */
252
+ callbackAddresses?: string[];
253
+ /** Minimum amount of assets in the offer */
254
+ minAmount?: bigint;
255
+ /** Maximum amount of assets in the offer */
256
+ maxAmount?: bigint;
257
+ /** Minimum rate per asset (in wei) */
258
+ minRate?: bigint;
259
+ /** Maximum rate per asset (in wei) */
260
+ maxRate?: bigint;
261
+ /** Minimum maturity timestamp (Unix timestamp in seconds) */
262
+ minMaturity?: Maturity.Maturity;
263
+ /** Maximum maturity timestamp (Unix timestamp in seconds) */
264
+ maxMaturity?: Maturity.Maturity;
265
+ /** Minimum expiry timestamp (Unix timestamp in seconds) */
266
+ minExpiry?: number;
267
+ /** Maximum expiry timestamp (Unix timestamp in seconds) */
268
+ maxExpiry?: number;
269
+ /** Filter by multiple collateral assets (comma-separated) */
270
+ collateralAssets?: string[];
271
+ /** Filter by multiple rate oracles (comma-separated) */
272
+ collateralOracles?: string[];
273
+ /** Filter by collateral combinations */
274
+ collateralTuple?: Array<{
275
+ asset: string;
276
+ oracle?: string;
277
+ lltv?: LLTV.LLTV;
256
278
  }>;
257
- options?: {
258
- batchSize?: number;
259
- retryAttempts?: number;
260
- retryDelayMs?: number;
261
- blockNumber?: number;
262
- };
263
- }): Promise<Map<Address, Map<Address, {
264
- balance: bigint;
265
- allowance: bigint;
266
- }>>>;
267
- type LiquidityUserPosition = {
268
- id: string;
269
- availableLiquidityQueueId: string;
270
- user: string;
271
- chainId: bigint;
272
- amount: string;
273
- updatedAt: Date;
274
- };
275
- type LiquidityQueue = {
276
- queueId: string;
277
- availableLiquidityPoolId: string;
278
- index: number;
279
- callbackAmount: string;
280
- updatedAt: Date;
279
+ /** Minimum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
280
+ minLltv?: LLTV.LLTV;
281
+ /** Maximum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
282
+ maxLltv?: LLTV.LLTV;
283
+ /** Field to sort results by */
284
+ sortBy?: "rate" | "maturity" | "expiry" | "amount";
285
+ /** Sort direction: asc (ascending) or desc (descending, default) */
286
+ sortOrder?: "asc" | "desc";
287
+ /** Pagination cursor in base64url-encoded format */
288
+ cursor?: string;
289
+ /** Maximum number of offers to return. Defaults to 20. Maximum is 100. */
290
+ limit?: number;
281
291
  };
282
- type LiquidityPool = {
283
- id: string;
284
- amount: string;
285
- updatedAt: Date;
292
+ type MatchParameters = {
293
+ /** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
294
+ side: "buy" | "sell";
295
+ /** The blockchain network chain ID */
296
+ chainId: number;
297
+ /** Rate per asset (in wei) for matching offers */
298
+ rate?: bigint;
299
+ /** Collateral requirements */
300
+ collaterals?: Array<{
301
+ asset: string;
302
+ oracle: string;
303
+ lltv: LLTV.LLTV;
304
+ }>;
305
+ /** Exact maturity timestamp (Unix timestamp in seconds) */
306
+ maturity?: Maturity.Maturity;
307
+ /** Minimum maturity timestamp (Unix timestamp in seconds, inclusive) */
308
+ minMaturity?: Maturity.Maturity;
309
+ /** Maximum maturity timestamp (Unix timestamp in seconds, inclusive) */
310
+ maxMaturity?: Maturity.Maturity;
311
+ /** The loan asset address to match against */
312
+ loanToken?: string;
313
+ /** Filter by a specific offer creator address */
314
+ creator?: string;
315
+ /** Filter by multiple statuses (comma-separated) */
316
+ status?: OfferStatus[];
317
+ /** Pagination cursor in base64url-encoded format */
318
+ cursor?: string;
319
+ /** Maximum number of offers to return. Defaults to 20. Maximum is 100. */
320
+ limit?: number;
286
321
  };
287
- type LiquidityQueueWithPool = {
288
- queue: LiquidityQueue;
289
- pool: LiquidityPool;
322
+ type RouterApiClientConfig = {
323
+ readonly url: URL;
324
+ readonly headers: Headers;
290
325
  };
291
- type Liquidity = {
326
+ type Client = Compute<RouterApiClientConfig & {
327
+ get: (parameters: GetParameters) => Promise<{
328
+ cursor: string | null;
329
+ offers: OfferResponse[];
330
+ }>;
331
+ match: (parameters: MatchParameters) => Promise<{
332
+ cursor: string | null;
333
+ offers: OfferResponse[];
334
+ }>;
335
+ }>;
336
+ declare function connect$1(opts?: {
337
+ url?: string;
338
+ apiKey?: string;
339
+ headers?: Headers;
340
+ }): Client;
341
+ declare namespace connect$1 {
342
+ type ErrorType = InvalidUrlError;
343
+ }
344
+ /**
345
+ * Get offers from the router.
346
+ * @returns The offers with pagination cursor.
347
+ */
348
+ declare function get(config: RouterApiClientConfig, parameters: GetParameters): Promise<{
349
+ cursor: string | null;
350
+ offers: OfferResponse[];
351
+ }>;
352
+ declare namespace get {
353
+ type ErrorType = GetApiErrorType;
354
+ }
355
+ /**
356
+ * Match offers from the router.
357
+ * @returns The matched offers with pagination cursor.
358
+ */
359
+ declare function match(config: RouterApiClientConfig, parameters: MatchParameters): Promise<{
360
+ cursor: string | null;
361
+ offers: OfferResponse[];
362
+ }>;
363
+ declare namespace match {
364
+ type ErrorType = GetApiErrorType;
365
+ }
366
+ type GetApiErrorType = HttpGetOffersFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
367
+ declare class InvalidUrlError extends Errors.BaseError {
368
+ name: string;
369
+ constructor(url: string);
370
+ }
371
+ declare class HttpUnauthorizedError extends Errors.BaseError {
372
+ name: string;
373
+ constructor();
374
+ }
375
+ declare class HttpForbiddenError extends Errors.BaseError {
376
+ name: string;
377
+ constructor();
378
+ }
379
+ declare class HttpRateLimitError extends Errors.BaseError {
380
+ name: string;
381
+ constructor();
382
+ }
383
+ declare class HttpGetOffersFailedError extends Errors.BaseError {
384
+ name: string;
385
+ constructor(message: string, { details }?: {
386
+ details?: string;
387
+ });
388
+ }
389
+
390
+ type Name = "mempool_offers" | "consumed_events" | "buy_with_empty_callback_liquidity" | "sell_erc20_callback_liquidity" | "chain_reorgs";
391
+ /** A general collector interface. */
392
+ type Collector<name extends Name = Name> = {
393
+ /** The name of the collector. */
394
+ name: name;
395
+ /** Start collecting data from external sources.
396
+ * @yields The last block number processed by the collector.
397
+ */
398
+ collect: () => AsyncGenerator<number, void, void>;
399
+ /** The last block number processed by the collector. */
400
+ lastSyncedBlock: () => Promise<number>;
401
+ /** The callback to call when a reorg is detected. */
402
+ onReorg(lastFinalizedBlockNumber: number): void;
403
+ };
404
+ /** Start a collector.
405
+ * @param collector - The collector to start.
406
+ * @returns A function to stop the collector.
407
+ */
408
+ declare function start(collector: Collector): () => void;
409
+
410
+ declare function createBuyWithEmptyCallbackLiquidityCollector(params: {
411
+ client: PublicClient;
412
+ offerStore: OfferStore;
413
+ collectorBlockStore: CollectorBlockStore;
414
+ liquidityStore: LiquidityStore;
415
+ chain: Chain.Chain;
416
+ options?: {
417
+ maxBatchSize?: number;
418
+ interval?: number;
419
+ };
420
+ }): Collector<"buy_with_empty_callback_liquidity">;
421
+
422
+ declare function createChainReorgsCollector(parameters: {
423
+ client: PublicClient;
424
+ subscribers: Collector[];
425
+ collectorStore: CollectorBlockStore;
426
+ chain: Chain.Chain;
427
+ options?: {
428
+ maxBatchSize?: number;
429
+ interval?: number;
430
+ maxBlockNumber?: number;
431
+ };
432
+ }): Collector<"chain_reorgs">;
433
+
434
+ declare function createConsumedEventsCollector(parameters: {
435
+ client: PublicClient;
436
+ contractAddress: Address;
437
+ offerStore: OfferStore;
438
+ collectorBlockStore: CollectorBlockStore;
439
+ chainId: Chain.Id;
440
+ options?: {
441
+ maxBatchSize?: number;
442
+ interval?: number;
443
+ };
444
+ }): Collector<"consumed_events">;
445
+
446
+ declare function createMempoolCollector(parameters: {
447
+ mempool: Mempool.Client;
448
+ offerStore: OfferStore;
449
+ collectorBlockStore: CollectorBlockStore;
450
+ chain: Chain.Chain;
451
+ options?: {
452
+ maxBatchSize?: number;
453
+ interval?: number;
454
+ };
455
+ }): Collector<"mempool_offers">;
456
+
457
+ declare function createSellERC20CallbackLiquidityCollector(params: {
458
+ client: PublicClient;
459
+ offerStore: OfferStore;
460
+ collectorBlockStore: CollectorBlockStore;
461
+ liquidityStore: LiquidityStore;
462
+ chain: Chain.Chain;
463
+ options?: {
464
+ maxBatchSize?: number;
465
+ interval?: number;
466
+ };
467
+ }): Collector<"sell_erc20_callback_liquidity">;
468
+
469
+ type index$1_Collector<name extends Name = Name> = Collector<name>;
470
+ type index$1_Name = Name;
471
+ declare const index$1_createBuyWithEmptyCallbackLiquidityCollector: typeof createBuyWithEmptyCallbackLiquidityCollector;
472
+ declare const index$1_createChainReorgsCollector: typeof createChainReorgsCollector;
473
+ declare const index$1_createConsumedEventsCollector: typeof createConsumedEventsCollector;
474
+ declare const index$1_createMempoolCollector: typeof createMempoolCollector;
475
+ declare const index$1_createSellERC20CallbackLiquidityCollector: typeof createSellERC20CallbackLiquidityCollector;
476
+ declare const index$1_start: typeof start;
477
+ declare namespace index$1 {
478
+ export { type index$1_Collector as Collector, type index$1_Name as Name, index$1_createBuyWithEmptyCallbackLiquidityCollector as createBuyWithEmptyCallbackLiquidityCollector, index$1_createChainReorgsCollector as createChainReorgsCollector, index$1_createConsumedEventsCollector as createConsumedEventsCollector, index$1_createMempoolCollector as createMempoolCollector, index$1_createSellERC20CallbackLiquidityCollector as createSellERC20CallbackLiquidityCollector, index$1_start as start };
479
+ }
480
+
481
+ type PgDB = ReturnType<typeof drizzle> & {
482
+ name: "pg";
483
+ pool: Pool;
484
+ };
485
+ type PGLiteDB = ReturnType<typeof drizzle$1> & {
486
+ name: "pglite";
487
+ pool: PGlite;
488
+ };
489
+ type PG = PgDB | PGLiteDB;
490
+ declare function connect(parameters: {
491
+ type: "pg";
492
+ endpoint: string;
493
+ } | {
494
+ type: "pglite";
495
+ }): PG;
496
+ declare function applyMigrations(pg: PG): Promise<void>;
497
+ declare function clean(pg: PG): Promise<void>;
498
+
499
+ type PG$1_PG = PG;
500
+ type PG$1_PGLiteDB = PGLiteDB;
501
+ type PG$1_PgDB = PgDB;
502
+ declare const PG$1_applyMigrations: typeof applyMigrations;
503
+ declare const PG$1_clean: typeof clean;
504
+ declare const PG$1_connect: typeof connect;
505
+ declare namespace PG$1 {
506
+ export { type PG$1_PG as PG, type PG$1_PGLiteDB as PGLiteDB, type PG$1_PgDB as PgDB, PG$1_applyMigrations as applyMigrations, PG$1_clean as clean, PG$1_connect as connect };
507
+ }
508
+
509
+ type CollectorBlockStore = {
510
+ /** Get the latest block number processed by a collector for a given chain. */
511
+ getBlockNumber: (parameters: {
512
+ collectorName: Name;
513
+ chainId: Chain.Id;
514
+ }) => Promise<number>;
515
+ /** Save the latest block number processed by a collector for a given chain. */
516
+ saveBlockNumber: (parameters: {
517
+ collectorName: Name;
518
+ chainId: Chain.Id;
519
+ blockNumber: number;
520
+ }) => Promise<void>;
521
+ };
522
+ /** Postgres implementation. */
523
+ declare const create$3: (config: {
524
+ db: PG;
525
+ }) => CollectorBlockStore;
526
+ declare function memory$1(): CollectorBlockStore;
527
+
528
+ type CollectorBlockStore$1_CollectorBlockStore = CollectorBlockStore;
529
+ declare namespace CollectorBlockStore$1 {
530
+ export { type CollectorBlockStore$1_CollectorBlockStore as CollectorBlockStore, create$3 as create, memory$1 as memory };
531
+ }
532
+
533
+ type LiquidityUserPosition = {
534
+ id: string;
535
+ availableLiquidityQueueId: string;
536
+ user: string;
537
+ chainId: bigint;
538
+ amount: string;
539
+ updatedAt: Date;
540
+ };
541
+ type LiquidityQueue = {
542
+ queueId: string;
543
+ availableLiquidityPoolId: string;
544
+ index: number;
545
+ callbackAmount: string;
546
+ updatedAt: Date;
547
+ };
548
+ type LiquidityPool = {
549
+ id: string;
550
+ amount: string;
551
+ updatedAt: Date;
552
+ };
553
+ type LiquidityQueueWithPool = {
554
+ queue: LiquidityQueue;
555
+ pool: LiquidityPool;
556
+ };
557
+ type Liquidity = {
292
558
  userPosition: LiquidityUserPosition;
293
559
  queues: LiquidityQueueWithPool[];
294
560
  };
295
- declare function fetch(parameters: {
561
+ type FetchOptions = {
562
+ batchSize?: number;
563
+ retryAttempts?: number;
564
+ retryDelayMs?: number;
565
+ blockNumber?: number;
566
+ };
567
+ type LiquidityClient = {
568
+ /** Fetch liquidity for buy offers based on wallet token balances and allowances. */
569
+ fetchBuyLiquidity: (parameters: {
570
+ chainId: bigint;
571
+ spender: Address;
572
+ pairs: Array<{
573
+ user: Address;
574
+ loanToken: Address;
575
+ }>;
576
+ options?: FetchOptions;
577
+ }) => Promise<Liquidity[]>;
578
+ /** Fetch liquidity for sell offers based on collateral capacity and existing positions. */
579
+ fetchSellLiquidity: (parameters: {
580
+ chainId: bigint;
581
+ spender: Address;
582
+ morphoAddress: Address;
583
+ offers: Array<Offer.Offer>;
584
+ options?: FetchOptions;
585
+ }) => Promise<Liquidity[]>;
586
+ };
587
+ /**
588
+ * Create a liquidity client with the specified blockchain client.
589
+ *
590
+ * @param config - Configuration containing the blockchain client
591
+ * @returns LiquidityClient
592
+ */
593
+ declare const create$2: (config: {
296
594
  client: Pick<PublicActions, "multicall">;
297
- chainId: bigint;
298
- spender: Address;
299
- type: CallbackType;
300
- pairs: Array<{
301
- user: Address;
302
- loanToken: Address;
303
- }>;
304
- options?: {
305
- batchSize?: number;
306
- retryAttempts?: number;
307
- retryDelayMs?: number;
308
- blockNumber?: number;
309
- };
310
- }): Promise<Liquidity[]>;
595
+ }) => LiquidityClient;
311
596
  declare function serialize(liquidity: Liquidity): string;
312
597
 
313
598
  type Liquidity$1_Liquidity = Liquidity;
599
+ type Liquidity$1_LiquidityClient = LiquidityClient;
314
600
  type Liquidity$1_LiquidityPool = LiquidityPool;
315
601
  type Liquidity$1_LiquidityQueue = LiquidityQueue;
316
602
  type Liquidity$1_LiquidityQueueWithPool = LiquidityQueueWithPool;
317
603
  type Liquidity$1_LiquidityUserPosition = LiquidityUserPosition;
318
- declare const Liquidity$1_fetch: typeof fetch;
319
- declare const Liquidity$1_fetchBalancesAndAllowances: typeof fetchBalancesAndAllowances;
320
604
  declare const Liquidity$1_serialize: typeof serialize;
321
605
  declare namespace Liquidity$1 {
322
- export { type Liquidity$1_Liquidity as Liquidity, type Liquidity$1_LiquidityPool as LiquidityPool, type Liquidity$1_LiquidityQueue as LiquidityQueue, type Liquidity$1_LiquidityQueueWithPool as LiquidityQueueWithPool, type Liquidity$1_LiquidityUserPosition as LiquidityUserPosition, Liquidity$1_fetch as fetch, Liquidity$1_fetchBalancesAndAllowances as fetchBalancesAndAllowances, Liquidity$1_serialize as serialize };
606
+ export { type Liquidity$1_Liquidity as Liquidity, type Liquidity$1_LiquidityClient as LiquidityClient, type Liquidity$1_LiquidityPool as LiquidityPool, type Liquidity$1_LiquidityQueue as LiquidityQueue, type Liquidity$1_LiquidityQueueWithPool as LiquidityQueueWithPool, type Liquidity$1_LiquidityUserPosition as LiquidityUserPosition, create$2 as create, Liquidity$1_serialize as serialize };
323
607
  }
324
608
 
325
609
  declare enum CallbackType {
326
610
  BuyWithEmptyCallback = "buy_with_empty_callback",
327
- SellWithdrawFromWallet = "sell_withdraw_from_wallet"
611
+ SellERC20Callback = "sell_erc20_callback"
328
612
  }
329
613
  declare const WhitelistedCallbackAddresses: Record<CallbackType, readonly string[]>;
330
614
  type BuildLiquidityParameters = {
@@ -336,9 +620,10 @@ type BuildLiquidityParameters = {
336
620
  index?: number;
337
621
  updatedAt?: Date;
338
622
  } | {
339
- type: CallbackType.SellWithdrawFromWallet;
623
+ type: CallbackType.SellERC20Callback;
340
624
  user: Address;
341
625
  termId: string;
626
+ offerHash: string;
342
627
  chainId: Chain.Id;
343
628
  amount: bigint;
344
629
  collaterals: Array<{
@@ -375,68 +660,19 @@ declare namespace Callback {
375
660
  export { Callback_CallbackType as CallbackType, Callback_WhitelistedCallbackAddresses as WhitelistedCallbackAddresses, Callback_buildLiquidity as buildLiquidity, decode$1 as decode, encode$1 as encode, Callback_getCallbackIdForOffer as getCallbackIdForOffer };
376
661
  }
377
662
 
378
- type PgDB = ReturnType<typeof drizzle> & {
379
- name: "pg";
380
- pool: Pool;
381
- };
382
- type PGLiteDB = ReturnType<typeof drizzle$1> & {
383
- name: "pglite";
384
- pool: PGlite;
385
- };
386
- type PG = PgDB | PGLiteDB;
387
- declare function connect$1(parameters: {
388
- type: "pg";
389
- endpoint: string;
390
- } | {
391
- type: "pglite";
392
- }): PG;
393
- declare function applyMigrations(pg: PG): Promise<void>;
394
- declare function clean(pg: PG): Promise<void>;
395
-
396
- type PG$1_PG = PG;
397
- type PG$1_PGLiteDB = PGLiteDB;
398
- type PG$1_PgDB = PgDB;
399
- declare const PG$1_applyMigrations: typeof applyMigrations;
400
- declare const PG$1_clean: typeof clean;
401
- declare namespace PG$1 {
402
- export { type PG$1_PG as PG, type PG$1_PGLiteDB as PGLiteDB, type PG$1_PgDB as PgDB, PG$1_applyMigrations as applyMigrations, PG$1_clean as clean, connect$1 as connect };
403
- }
404
-
405
- type CollectorBlockStore = {
406
- /** Get the latest block number processed by a collector for a given chain. */
407
- getBlockNumber: (parameters: {
408
- collectorName: Name;
409
- chainId: Chain.Id;
410
- }) => Promise<number>;
411
- /** Save the latest block number processed by a collector for a given chain. */
412
- saveBlockNumber: (parameters: {
413
- collectorName: Name;
414
- chainId: Chain.Id;
415
- blockNumber: number;
416
- }) => Promise<void>;
417
- };
418
- /** Postgres implementation. */
419
- declare const create$2: (config: {
420
- db: PG;
421
- }) => CollectorBlockStore;
422
- declare function memory$1(): CollectorBlockStore;
423
-
424
- type CollectorBlockStore$1_CollectorBlockStore = CollectorBlockStore;
425
- declare namespace CollectorBlockStore$1 {
426
- export { type CollectorBlockStore$1_CollectorBlockStore as CollectorBlockStore, create$2 as create, memory$1 as memory };
427
- }
428
-
429
- type LiquidityStore = {
430
- /** Get a liquidity entry by user position id, including queues and pools. */
431
- getByUserPositionId: (parameters: {
432
- userPositionId: string;
433
- }) => Promise<Liquidity | null>;
434
- /** Get all liquidity entries, grouped by user position, including queues and pools. */
435
- getAll: () => Promise<Liquidity[]>;
436
- /** Save or update a liquidity entry (transactional upsert across all three tables). */
437
- save: (parameters: {
438
- liquidity: Liquidity;
439
- }) => Promise<void>;
663
+ type LiquidityStore = {
664
+ /** Get a liquidity entry by user position id, including queues and pools. */
665
+ getByUserPositionId: (parameters: {
666
+ userPositionId: string;
667
+ }) => Promise<Liquidity | null>;
668
+ /** Get all liquidity entries, grouped by user position, including queues and pools. */
669
+ getAll: (parameters?: {
670
+ callbackType?: CallbackType;
671
+ }) => Promise<Liquidity[]>;
672
+ /** Save or update a liquidity entry (transactional upsert across all three tables). */
673
+ save: (parameters: {
674
+ liquidity: Liquidity;
675
+ }) => Promise<void>;
440
676
  };
441
677
  /** Postgres implementation. */
442
678
  declare const create$1: (config: {
@@ -545,99 +781,156 @@ type FindMatchingOffersParams = {
545
781
  type GetAllParams = {
546
782
  query?: GetOffersFilters;
547
783
  };
548
-
549
784
  type PgConfig = {
550
785
  /** The database instance to use for operations. */
551
786
  db: PG;
552
787
  };
553
788
  declare function create(config: PgConfig): OfferStore;
554
789
 
555
- type index$2_FindMatchingOffersParams = FindMatchingOffersParams;
556
- type index$2_GetAllParams = GetAllParams;
557
- type index$2_GetOffersFilters = GetOffersFilters;
558
- type index$2_OfferStore = OfferStore;
559
- type index$2_PgConfig = PgConfig;
560
- declare const index$2_create: typeof create;
561
- declare namespace index$2 {
562
- export { type index$2_FindMatchingOffersParams as FindMatchingOffersParams, type index$2_GetAllParams as GetAllParams, type index$2_GetOffersFilters as GetOffersFilters, type index$2_OfferStore as OfferStore, type index$2_PgConfig as PgConfig, index$2_create as create };
790
+ type OfferStore$1_FindMatchingOffersParams = FindMatchingOffersParams;
791
+ type OfferStore$1_GetAllParams = GetAllParams;
792
+ type OfferStore$1_GetOffersFilters = GetOffersFilters;
793
+ type OfferStore$1_OfferStore = OfferStore;
794
+ type OfferStore$1_PgConfig = PgConfig;
795
+ declare const OfferStore$1_create: typeof create;
796
+ declare namespace OfferStore$1 {
797
+ export { type OfferStore$1_FindMatchingOffersParams as FindMatchingOffersParams, type OfferStore$1_GetAllParams as GetAllParams, type OfferStore$1_GetOffersFilters as GetOffersFilters, type OfferStore$1_OfferStore as OfferStore, type OfferStore$1_PgConfig as PgConfig, OfferStore$1_create as create };
563
798
  }
564
799
 
565
- type Name = "mempool_offers" | "consumed_events" | "buy_with_empty_callback_liquidity" | "chain_reorgs";
566
- /** A general collector interface. */
567
- type Collector<name extends Name = Name> = {
568
- /** The name of the collector. */
569
- name: name;
570
- /** Start collecting data from external sources.
571
- * @yields The last block number processed by the collector.
572
- */
573
- collect: () => AsyncGenerator<number, void, void>;
574
- /** The last block number processed by the collector. */
575
- lastSyncedBlock: () => Promise<number>;
576
- /** The callback to call when a reorg is detected. */
577
- onReorg(lastFinalizedBlockNumber: number): void;
578
- };
579
- /** Start a collector.
580
- * @param collector - The collector to start.
581
- * @returns A function to stop the collector.
800
+ /**
801
+ * Start a local router server.
802
+ * @example
803
+ * ```ts
804
+ * import { Router } from "@morpho-dev/router";
805
+ * await Router.serve(); // local router server running on http://localhost:8081
806
+ * ```
582
807
  */
583
- declare function start(collector: Collector): () => void;
584
-
585
- declare function createBuyWithEmptyCallbackLiquidityCollector(params: {
586
- client: WalletClient;
587
- offerStore: OfferStore;
588
- collectorBlockStore: CollectorBlockStore;
589
- liquidityStore: LiquidityStore;
590
- chain: Chain.Chain;
591
- options?: {
592
- maxBatchSize?: number;
593
- interval?: number;
808
+ declare function serve(parameters: {
809
+ port: number;
810
+ store: OfferStore;
811
+ }): Promise<void>;
812
+ declare function error(error: unknown, c: Context): Response & hono.TypedResponse<{
813
+ statusCode: number;
814
+ body: string;
815
+ }, hono_utils_http_status.ContentfulStatusCode, "json">;
816
+ declare function success<T>(c: Context, { data, cursor, }: {
817
+ data: T | T[];
818
+ cursor?: string | null;
819
+ }): Response & hono.TypedResponse<{
820
+ status: string;
821
+ cursor: string | null | undefined;
822
+ data: T | T[];
823
+ meta: {
824
+ timestamp: string;
594
825
  };
595
- }): Collector<"buy_with_empty_callback_liquidity">;
596
-
597
- declare function createChainReorgsCollector(parameters: {
598
- client: PublicClient;
599
- subscribers: Collector[];
600
- collectorStore: CollectorBlockStore;
601
- chain: Chain.Chain;
602
- options?: {
603
- maxBatchSize?: number;
604
- interval?: number;
605
- maxBlockNumber?: number;
826
+ } extends hono_utils_types.JSONValue ? { [K in keyof {
827
+ status: string;
828
+ cursor: string | null | undefined;
829
+ data: T | T[];
830
+ meta: {
831
+ timestamp: string;
606
832
  };
607
- }): Collector<"chain_reorgs">;
608
-
609
- declare function createConsumedEventsCollector(parameters: {
610
- client: PublicClient;
611
- contractAddress: Address;
612
- offerStore: OfferStore;
613
- collectorBlockStore: CollectorBlockStore;
614
- chainId: Chain.Id;
615
- options?: {
616
- maxBatchSize?: number;
617
- interval?: number;
833
+ } as ({
834
+ status: string;
835
+ cursor: string | null | undefined;
836
+ data: T | T[];
837
+ meta: {
838
+ timestamp: string;
618
839
  };
619
- }): Collector<"consumed_events">;
620
-
621
- declare function createMempoolCollector(parameters: {
622
- mempool: Mempool.Client;
623
- offerStore: OfferStore;
624
- collectorBlockStore: CollectorBlockStore;
625
- chain: Chain.Chain;
626
- options?: {
627
- maxBatchSize?: number;
628
- interval?: number;
840
+ }[K] extends infer T_1 ? T_1 extends {
841
+ status: string;
842
+ cursor: string | null | undefined;
843
+ data: T | T[];
844
+ meta: {
845
+ timestamp: string;
629
846
  };
630
- }): Collector<"mempool_offers">;
847
+ }[K] ? T_1 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) extends true ? never : K]: boolean extends ({
848
+ status: string;
849
+ cursor: string | null | undefined;
850
+ data: T | T[];
851
+ meta: {
852
+ timestamp: string;
853
+ };
854
+ }[K] extends infer T_2 ? T_2 extends {
855
+ status: string;
856
+ cursor: string | null | undefined;
857
+ data: T | T[];
858
+ meta: {
859
+ timestamp: string;
860
+ };
861
+ }[K] ? T_2 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) ? hono_utils_types.JSONParsed<{
862
+ status: string;
863
+ cursor: string | null | undefined;
864
+ data: T | T[];
865
+ meta: {
866
+ timestamp: string;
867
+ };
868
+ }[K]> | undefined : hono_utils_types.JSONParsed<{
869
+ status: string;
870
+ cursor: string | null | undefined;
871
+ data: T | T[];
872
+ meta: {
873
+ timestamp: string;
874
+ };
875
+ }[K]>; } : never, hono_utils_http_status.ContentfulStatusCode, "json">;
876
+ declare class APIError extends Error {
877
+ statusCode: number;
878
+ code: string;
879
+ details?: unknown | undefined;
880
+ constructor(statusCode: number, message: string, code: string, details?: unknown | undefined);
881
+ }
882
+ declare class ValidationError extends APIError {
883
+ constructor(message: string, details?: unknown);
884
+ }
885
+ declare class NotFoundError extends APIError {
886
+ constructor(message: string);
887
+ }
888
+ declare class InternalServerError extends APIError {
889
+ constructor(message?: string);
890
+ }
891
+ declare class BadRequestError extends APIError {
892
+ constructor(message?: string, details?: unknown);
893
+ }
894
+ declare function handleZodError(error: z.ZodError): ValidationError;
631
895
 
632
- type index$1_Collector<name extends Name = Name> = Collector<name>;
633
- type index$1_Name = Name;
634
- declare const index$1_createBuyWithEmptyCallbackLiquidityCollector: typeof createBuyWithEmptyCallbackLiquidityCollector;
635
- declare const index$1_createChainReorgsCollector: typeof createChainReorgsCollector;
636
- declare const index$1_createConsumedEventsCollector: typeof createConsumedEventsCollector;
637
- declare const index$1_createMempoolCollector: typeof createMempoolCollector;
638
- declare const index$1_start: typeof start;
639
- declare namespace index$1 {
640
- export { type index$1_Collector as Collector, type index$1_Name as Name, index$1_createBuyWithEmptyCallbackLiquidityCollector as createBuyWithEmptyCallbackLiquidityCollector, index$1_createChainReorgsCollector as createChainReorgsCollector, index$1_createConsumedEventsCollector as createConsumedEventsCollector, index$1_createMempoolCollector as createMempoolCollector, index$1_start as start };
896
+ type index_APIError = APIError;
897
+ declare const index_APIError: typeof APIError;
898
+ type index_BadRequestError = BadRequestError;
899
+ declare const index_BadRequestError: typeof BadRequestError;
900
+ type index_Client = Client;
901
+ type index_GetParameters = GetParameters;
902
+ type index_HttpForbiddenError = HttpForbiddenError;
903
+ declare const index_HttpForbiddenError: typeof HttpForbiddenError;
904
+ type index_HttpGetOffersFailedError = HttpGetOffersFailedError;
905
+ declare const index_HttpGetOffersFailedError: typeof HttpGetOffersFailedError;
906
+ type index_HttpRateLimitError = HttpRateLimitError;
907
+ declare const index_HttpRateLimitError: typeof HttpRateLimitError;
908
+ type index_HttpUnauthorizedError = HttpUnauthorizedError;
909
+ declare const index_HttpUnauthorizedError: typeof HttpUnauthorizedError;
910
+ type index_InternalServerError = InternalServerError;
911
+ declare const index_InternalServerError: typeof InternalServerError;
912
+ type index_InvalidUrlError = InvalidUrlError;
913
+ declare const index_InvalidUrlError: typeof InvalidUrlError;
914
+ type index_MatchParameters = MatchParameters;
915
+ type index_NotFoundError = NotFoundError;
916
+ declare const index_NotFoundError: typeof NotFoundError;
917
+ type index_OfferResponse = OfferResponse;
918
+ declare const index_OpenApi: typeof OpenApi;
919
+ type index_RouterApiClientConfig = RouterApiClientConfig;
920
+ type index_ValidationError = ValidationError;
921
+ declare const index_ValidationError: typeof ValidationError;
922
+ declare const index_error: typeof error;
923
+ declare const index_fromResponse: typeof fromResponse;
924
+ declare const index_get: typeof get;
925
+ declare const index_handleZodError: typeof handleZodError;
926
+ declare const index_match: typeof match;
927
+ declare const index_parse: typeof parse;
928
+ declare const index_safeParse: typeof safeParse;
929
+ declare const index_serve: typeof serve;
930
+ declare const index_success: typeof success;
931
+ declare const index_toResponse: typeof toResponse;
932
+ declare namespace index {
933
+ export { index_APIError as APIError, index_BadRequestError as BadRequestError, type index_Client as Client, type index_GetParameters as GetParameters, index_HttpForbiddenError as HttpForbiddenError, index_HttpGetOffersFailedError as HttpGetOffersFailedError, index_HttpRateLimitError as HttpRateLimitError, index_HttpUnauthorizedError as HttpUnauthorizedError, index_InternalServerError as InternalServerError, index_InvalidUrlError as InvalidUrlError, type index_MatchParameters as MatchParameters, index_NotFoundError as NotFoundError, type index_OfferResponse as OfferResponse, index_OpenApi as OpenApi, type index_RouterApiClientConfig as RouterApiClientConfig, index_ValidationError as ValidationError, connect$1 as connect, index_error as error, index_fromResponse as fromResponse, index_get as get, index_handleZodError as handleZodError, index_match as match, index_parse as parse, index_safeParse as safeParse, index_serve as serve, index_success as success, index_toResponse as toResponse };
641
934
  }
642
935
 
643
936
  type Cursor = {
@@ -693,1263 +986,6 @@ declare namespace Logger$1 {
693
986
  export { type Logger$1_LogEntry as LogEntry, type Logger$1_LogFn as LogFn, type Logger$1_LogLevel as LogLevel, Logger$1_LogLevelValues as LogLevelValues, type Logger$1_Logger as Logger, Logger$1_defaultLogger as defaultLogger, Logger$1_getLogger as getLogger, Logger$1_runWithLogger as runWithLogger, Logger$1_silentLogger as silentLogger };
694
987
  }
695
988
 
696
- declare const VERSION = "offers_v1.1";
697
- declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
698
- name: "offers";
699
- schema: "offers_v1.1";
700
- columns: {
701
- hash: drizzle_orm_pg_core.PgColumn<{
702
- name: "hash";
703
- tableName: "offers";
704
- dataType: "string";
705
- columnType: "PgVarchar";
706
- data: string;
707
- driverParam: string;
708
- notNull: true;
709
- hasDefault: false;
710
- isPrimaryKey: true;
711
- isAutoincrement: false;
712
- hasRuntimeDefault: false;
713
- enumValues: [string, ...string[]];
714
- baseColumn: never;
715
- identity: undefined;
716
- generated: undefined;
717
- }, {}, {
718
- length: 66;
719
- }>;
720
- offering: drizzle_orm_pg_core.PgColumn<{
721
- name: "offering";
722
- tableName: "offers";
723
- dataType: "string";
724
- columnType: "PgVarchar";
725
- data: string;
726
- driverParam: string;
727
- notNull: true;
728
- hasDefault: false;
729
- isPrimaryKey: false;
730
- isAutoincrement: false;
731
- hasRuntimeDefault: false;
732
- enumValues: [string, ...string[]];
733
- baseColumn: never;
734
- identity: undefined;
735
- generated: undefined;
736
- }, {}, {
737
- length: 42;
738
- }>;
739
- assets: drizzle_orm_pg_core.PgColumn<{
740
- name: "assets";
741
- tableName: "offers";
742
- dataType: "string";
743
- columnType: "PgNumeric";
744
- data: string;
745
- driverParam: string;
746
- notNull: true;
747
- hasDefault: false;
748
- isPrimaryKey: false;
749
- isAutoincrement: false;
750
- hasRuntimeDefault: false;
751
- enumValues: undefined;
752
- baseColumn: never;
753
- identity: undefined;
754
- generated: undefined;
755
- }, {}, {}>;
756
- rate: drizzle_orm_pg_core.PgColumn<{
757
- name: "rate";
758
- tableName: "offers";
759
- dataType: "bigint";
760
- columnType: "PgBigInt64";
761
- data: bigint;
762
- driverParam: string;
763
- notNull: true;
764
- hasDefault: false;
765
- isPrimaryKey: false;
766
- isAutoincrement: false;
767
- hasRuntimeDefault: false;
768
- enumValues: undefined;
769
- baseColumn: never;
770
- identity: undefined;
771
- generated: undefined;
772
- }, {}, {}>;
773
- maturity: drizzle_orm_pg_core.PgColumn<{
774
- name: "maturity";
775
- tableName: "offers";
776
- dataType: "number";
777
- columnType: "PgInteger";
778
- data: number;
779
- driverParam: string | number;
780
- notNull: true;
781
- hasDefault: false;
782
- isPrimaryKey: false;
783
- isAutoincrement: false;
784
- hasRuntimeDefault: false;
785
- enumValues: undefined;
786
- baseColumn: never;
787
- identity: undefined;
788
- generated: undefined;
789
- }, {}, {}>;
790
- expiry: drizzle_orm_pg_core.PgColumn<{
791
- name: "expiry";
792
- tableName: "offers";
793
- dataType: "number";
794
- columnType: "PgInteger";
795
- data: number;
796
- driverParam: string | number;
797
- notNull: true;
798
- hasDefault: false;
799
- isPrimaryKey: false;
800
- isAutoincrement: false;
801
- hasRuntimeDefault: false;
802
- enumValues: undefined;
803
- baseColumn: never;
804
- identity: undefined;
805
- generated: undefined;
806
- }, {}, {}>;
807
- start: drizzle_orm_pg_core.PgColumn<{
808
- name: "start";
809
- tableName: "offers";
810
- dataType: "number";
811
- columnType: "PgInteger";
812
- data: number;
813
- driverParam: string | number;
814
- notNull: true;
815
- hasDefault: false;
816
- isPrimaryKey: false;
817
- isAutoincrement: false;
818
- hasRuntimeDefault: false;
819
- enumValues: undefined;
820
- baseColumn: never;
821
- identity: undefined;
822
- generated: undefined;
823
- }, {}, {}>;
824
- nonce: drizzle_orm_pg_core.PgColumn<{
825
- name: "nonce";
826
- tableName: "offers";
827
- dataType: "bigint";
828
- columnType: "PgBigInt64";
829
- data: bigint;
830
- driverParam: string;
831
- notNull: true;
832
- hasDefault: false;
833
- isPrimaryKey: false;
834
- isAutoincrement: false;
835
- hasRuntimeDefault: false;
836
- enumValues: undefined;
837
- baseColumn: never;
838
- identity: undefined;
839
- generated: undefined;
840
- }, {}, {}>;
841
- buy: drizzle_orm_pg_core.PgColumn<{
842
- name: "buy";
843
- tableName: "offers";
844
- dataType: "boolean";
845
- columnType: "PgBoolean";
846
- data: boolean;
847
- driverParam: boolean;
848
- notNull: true;
849
- hasDefault: false;
850
- isPrimaryKey: false;
851
- isAutoincrement: false;
852
- hasRuntimeDefault: false;
853
- enumValues: undefined;
854
- baseColumn: never;
855
- identity: undefined;
856
- generated: undefined;
857
- }, {}, {}>;
858
- chainId: drizzle_orm_pg_core.PgColumn<{
859
- name: "chain_id";
860
- tableName: "offers";
861
- dataType: "bigint";
862
- columnType: "PgBigInt64";
863
- data: bigint;
864
- driverParam: string;
865
- notNull: true;
866
- hasDefault: false;
867
- isPrimaryKey: false;
868
- isAutoincrement: false;
869
- hasRuntimeDefault: false;
870
- enumValues: undefined;
871
- baseColumn: never;
872
- identity: undefined;
873
- generated: undefined;
874
- }, {}, {}>;
875
- loanToken: drizzle_orm_pg_core.PgColumn<{
876
- name: "loan_token";
877
- tableName: "offers";
878
- dataType: "string";
879
- columnType: "PgVarchar";
880
- data: string;
881
- driverParam: string;
882
- notNull: true;
883
- hasDefault: false;
884
- isPrimaryKey: false;
885
- isAutoincrement: false;
886
- hasRuntimeDefault: false;
887
- enumValues: [string, ...string[]];
888
- baseColumn: never;
889
- identity: undefined;
890
- generated: undefined;
891
- }, {}, {
892
- length: 42;
893
- }>;
894
- callbackAddress: drizzle_orm_pg_core.PgColumn<{
895
- name: "callback_address";
896
- tableName: "offers";
897
- dataType: "string";
898
- columnType: "PgVarchar";
899
- data: string;
900
- driverParam: string;
901
- notNull: true;
902
- hasDefault: false;
903
- isPrimaryKey: false;
904
- isAutoincrement: false;
905
- hasRuntimeDefault: false;
906
- enumValues: [string, ...string[]];
907
- baseColumn: never;
908
- identity: undefined;
909
- generated: undefined;
910
- }, {}, {
911
- length: 42;
912
- }>;
913
- callbackData: drizzle_orm_pg_core.PgColumn<{
914
- name: "callback_data";
915
- tableName: "offers";
916
- dataType: "string";
917
- columnType: "PgText";
918
- data: string;
919
- driverParam: string;
920
- notNull: true;
921
- hasDefault: false;
922
- isPrimaryKey: false;
923
- isAutoincrement: false;
924
- hasRuntimeDefault: false;
925
- enumValues: [string, ...string[]];
926
- baseColumn: never;
927
- identity: undefined;
928
- generated: undefined;
929
- }, {}, {}>;
930
- callbackGasLimit: drizzle_orm_pg_core.PgColumn<{
931
- name: "callback_gas_limit";
932
- tableName: "offers";
933
- dataType: "bigint";
934
- columnType: "PgBigInt64";
935
- data: bigint;
936
- driverParam: string;
937
- notNull: true;
938
- hasDefault: false;
939
- isPrimaryKey: false;
940
- isAutoincrement: false;
941
- hasRuntimeDefault: false;
942
- enumValues: undefined;
943
- baseColumn: never;
944
- identity: undefined;
945
- generated: undefined;
946
- }, {}, {}>;
947
- signature: drizzle_orm_pg_core.PgColumn<{
948
- name: "signature";
949
- tableName: "offers";
950
- dataType: "string";
951
- columnType: "PgVarchar";
952
- data: string;
953
- driverParam: string;
954
- notNull: false;
955
- hasDefault: false;
956
- isPrimaryKey: false;
957
- isAutoincrement: false;
958
- hasRuntimeDefault: false;
959
- enumValues: [string, ...string[]];
960
- baseColumn: never;
961
- identity: undefined;
962
- generated: undefined;
963
- }, {}, {
964
- length: 132;
965
- }>;
966
- callbackId: drizzle_orm_pg_core.PgColumn<{
967
- name: "callback_id";
968
- tableName: "offers";
969
- dataType: "string";
970
- columnType: "PgVarchar";
971
- data: string;
972
- driverParam: string;
973
- notNull: false;
974
- hasDefault: false;
975
- isPrimaryKey: false;
976
- isAutoincrement: false;
977
- hasRuntimeDefault: false;
978
- enumValues: [string, ...string[]];
979
- baseColumn: never;
980
- identity: undefined;
981
- generated: undefined;
982
- }, {}, {
983
- length: 256;
984
- }>;
985
- createdAt: drizzle_orm_pg_core.PgColumn<{
986
- name: "created_at";
987
- tableName: "offers";
988
- dataType: "date";
989
- columnType: "PgTimestamp";
990
- data: Date;
991
- driverParam: string;
992
- notNull: true;
993
- hasDefault: true;
994
- isPrimaryKey: false;
995
- isAutoincrement: false;
996
- hasRuntimeDefault: false;
997
- enumValues: undefined;
998
- baseColumn: never;
999
- identity: undefined;
1000
- generated: undefined;
1001
- }, {}, {}>;
1002
- };
1003
- dialect: "pg";
1004
- }>;
1005
- declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
1006
- name: "offer_collaterals";
1007
- schema: "offers_v1.1";
1008
- columns: {
1009
- id: drizzle_orm_pg_core.PgColumn<{
1010
- name: "id";
1011
- tableName: "offer_collaterals";
1012
- dataType: "number";
1013
- columnType: "PgSerial";
1014
- data: number;
1015
- driverParam: number;
1016
- notNull: true;
1017
- hasDefault: true;
1018
- isPrimaryKey: true;
1019
- isAutoincrement: false;
1020
- hasRuntimeDefault: false;
1021
- enumValues: undefined;
1022
- baseColumn: never;
1023
- identity: undefined;
1024
- generated: undefined;
1025
- }, {}, {}>;
1026
- offerHash: drizzle_orm_pg_core.PgColumn<{
1027
- name: "offer_hash";
1028
- tableName: "offer_collaterals";
1029
- dataType: "string";
1030
- columnType: "PgVarchar";
1031
- data: string;
1032
- driverParam: string;
1033
- notNull: true;
1034
- hasDefault: false;
1035
- isPrimaryKey: false;
1036
- isAutoincrement: false;
1037
- hasRuntimeDefault: false;
1038
- enumValues: [string, ...string[]];
1039
- baseColumn: never;
1040
- identity: undefined;
1041
- generated: undefined;
1042
- }, {}, {
1043
- length: 66;
1044
- }>;
1045
- asset: drizzle_orm_pg_core.PgColumn<{
1046
- name: "asset";
1047
- tableName: "offer_collaterals";
1048
- dataType: "string";
1049
- columnType: "PgVarchar";
1050
- data: string;
1051
- driverParam: string;
1052
- notNull: true;
1053
- hasDefault: false;
1054
- isPrimaryKey: false;
1055
- isAutoincrement: false;
1056
- hasRuntimeDefault: false;
1057
- enumValues: [string, ...string[]];
1058
- baseColumn: never;
1059
- identity: undefined;
1060
- generated: undefined;
1061
- }, {}, {
1062
- length: 42;
1063
- }>;
1064
- oracle: drizzle_orm_pg_core.PgColumn<{
1065
- name: "oracle";
1066
- tableName: "offer_collaterals";
1067
- dataType: "string";
1068
- columnType: "PgVarchar";
1069
- data: string;
1070
- driverParam: string;
1071
- notNull: true;
1072
- hasDefault: false;
1073
- isPrimaryKey: false;
1074
- isAutoincrement: false;
1075
- hasRuntimeDefault: false;
1076
- enumValues: [string, ...string[]];
1077
- baseColumn: never;
1078
- identity: undefined;
1079
- generated: undefined;
1080
- }, {}, {
1081
- length: 42;
1082
- }>;
1083
- lltv: drizzle_orm_pg_core.PgColumn<{
1084
- name: "lltv";
1085
- tableName: "offer_collaterals";
1086
- dataType: "bigint";
1087
- columnType: "PgBigInt64";
1088
- data: bigint;
1089
- driverParam: string;
1090
- notNull: true;
1091
- hasDefault: false;
1092
- isPrimaryKey: false;
1093
- isAutoincrement: false;
1094
- hasRuntimeDefault: false;
1095
- enumValues: undefined;
1096
- baseColumn: never;
1097
- identity: undefined;
1098
- generated: undefined;
1099
- }, {}, {}>;
1100
- };
1101
- dialect: "pg";
1102
- }>;
1103
- declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
1104
- name: "offer_status";
1105
- schema: "offers_v1.1";
1106
- columns: {
1107
- id: drizzle_orm_pg_core.PgColumn<{
1108
- name: "id";
1109
- tableName: "offer_status";
1110
- dataType: "number";
1111
- columnType: "PgSerial";
1112
- data: number;
1113
- driverParam: number;
1114
- notNull: true;
1115
- hasDefault: true;
1116
- isPrimaryKey: true;
1117
- isAutoincrement: false;
1118
- hasRuntimeDefault: false;
1119
- enumValues: undefined;
1120
- baseColumn: never;
1121
- identity: undefined;
1122
- generated: undefined;
1123
- }, {}, {}>;
1124
- offerHash: drizzle_orm_pg_core.PgColumn<{
1125
- name: "offer_hash";
1126
- tableName: "offer_status";
1127
- dataType: "string";
1128
- columnType: "PgVarchar";
1129
- data: string;
1130
- driverParam: string;
1131
- notNull: true;
1132
- hasDefault: false;
1133
- isPrimaryKey: false;
1134
- isAutoincrement: false;
1135
- hasRuntimeDefault: false;
1136
- enumValues: [string, ...string[]];
1137
- baseColumn: never;
1138
- identity: undefined;
1139
- generated: undefined;
1140
- }, {}, {
1141
- length: 66;
1142
- }>;
1143
- status: drizzle_orm_pg_core.PgColumn<{
1144
- name: "status";
1145
- tableName: "offer_status";
1146
- dataType: "string";
1147
- columnType: "PgText";
1148
- data: "valid" | "callback_not_supported" | "callback_error" | "unverified";
1149
- driverParam: string;
1150
- notNull: true;
1151
- hasDefault: false;
1152
- isPrimaryKey: false;
1153
- isAutoincrement: false;
1154
- hasRuntimeDefault: false;
1155
- enumValues: [string, ...string[]];
1156
- baseColumn: never;
1157
- identity: undefined;
1158
- generated: undefined;
1159
- }, {}, {
1160
- $type: "valid" | "callback_not_supported" | "callback_error" | "unverified";
1161
- }>;
1162
- metadata: drizzle_orm_pg_core.PgColumn<{
1163
- name: "metadata";
1164
- tableName: "offer_status";
1165
- dataType: "json";
1166
- columnType: "PgJsonb";
1167
- data: unknown;
1168
- driverParam: unknown;
1169
- notNull: false;
1170
- hasDefault: false;
1171
- isPrimaryKey: false;
1172
- isAutoincrement: false;
1173
- hasRuntimeDefault: false;
1174
- enumValues: undefined;
1175
- baseColumn: never;
1176
- identity: undefined;
1177
- generated: undefined;
1178
- }, {}, {}>;
1179
- createdAt: drizzle_orm_pg_core.PgColumn<{
1180
- name: "created_at";
1181
- tableName: "offer_status";
1182
- dataType: "date";
1183
- columnType: "PgTimestamp";
1184
- data: Date;
1185
- driverParam: string;
1186
- notNull: true;
1187
- hasDefault: true;
1188
- isPrimaryKey: false;
1189
- isAutoincrement: false;
1190
- hasRuntimeDefault: false;
1191
- enumValues: undefined;
1192
- baseColumn: never;
1193
- identity: undefined;
1194
- generated: undefined;
1195
- }, {}, {}>;
1196
- };
1197
- dialect: "pg";
1198
- }>;
1199
- declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
1200
- name: "consumed_per_user_and_nonce";
1201
- schema: "offers_v1.1";
1202
- columns: {
1203
- id: drizzle_orm_pg_core.PgColumn<{
1204
- name: "id";
1205
- tableName: "consumed_per_user_and_nonce";
1206
- dataType: "string";
1207
- columnType: "PgVarchar";
1208
- data: string;
1209
- driverParam: string;
1210
- notNull: true;
1211
- hasDefault: false;
1212
- isPrimaryKey: true;
1213
- isAutoincrement: false;
1214
- hasRuntimeDefault: false;
1215
- enumValues: [string, ...string[]];
1216
- baseColumn: never;
1217
- identity: undefined;
1218
- generated: undefined;
1219
- }, {}, {
1220
- length: 255;
1221
- }>;
1222
- chainId: drizzle_orm_pg_core.PgColumn<{
1223
- name: "chain_id";
1224
- tableName: "consumed_per_user_and_nonce";
1225
- dataType: "bigint";
1226
- columnType: "PgBigInt64";
1227
- data: bigint;
1228
- driverParam: string;
1229
- notNull: true;
1230
- hasDefault: false;
1231
- isPrimaryKey: false;
1232
- isAutoincrement: false;
1233
- hasRuntimeDefault: false;
1234
- enumValues: undefined;
1235
- baseColumn: never;
1236
- identity: undefined;
1237
- generated: undefined;
1238
- }, {}, {}>;
1239
- offering: drizzle_orm_pg_core.PgColumn<{
1240
- name: "offering";
1241
- tableName: "consumed_per_user_and_nonce";
1242
- dataType: "string";
1243
- columnType: "PgVarchar";
1244
- data: string;
1245
- driverParam: string;
1246
- notNull: true;
1247
- hasDefault: false;
1248
- isPrimaryKey: false;
1249
- isAutoincrement: false;
1250
- hasRuntimeDefault: false;
1251
- enumValues: [string, ...string[]];
1252
- baseColumn: never;
1253
- identity: undefined;
1254
- generated: undefined;
1255
- }, {}, {
1256
- length: 42;
1257
- }>;
1258
- nonce: drizzle_orm_pg_core.PgColumn<{
1259
- name: "nonce";
1260
- tableName: "consumed_per_user_and_nonce";
1261
- dataType: "bigint";
1262
- columnType: "PgBigInt64";
1263
- data: bigint;
1264
- driverParam: string;
1265
- notNull: true;
1266
- hasDefault: false;
1267
- isPrimaryKey: false;
1268
- isAutoincrement: false;
1269
- hasRuntimeDefault: false;
1270
- enumValues: undefined;
1271
- baseColumn: never;
1272
- identity: undefined;
1273
- generated: undefined;
1274
- }, {}, {}>;
1275
- consumed: drizzle_orm_pg_core.PgColumn<{
1276
- name: "consumed";
1277
- tableName: "consumed_per_user_and_nonce";
1278
- dataType: "string";
1279
- columnType: "PgNumeric";
1280
- data: string;
1281
- driverParam: string;
1282
- notNull: true;
1283
- hasDefault: false;
1284
- isPrimaryKey: false;
1285
- isAutoincrement: false;
1286
- hasRuntimeDefault: false;
1287
- enumValues: undefined;
1288
- baseColumn: never;
1289
- identity: undefined;
1290
- generated: undefined;
1291
- }, {}, {}>;
1292
- createdAt: drizzle_orm_pg_core.PgColumn<{
1293
- name: "created_at";
1294
- tableName: "consumed_per_user_and_nonce";
1295
- dataType: "date";
1296
- columnType: "PgTimestamp";
1297
- data: Date;
1298
- driverParam: string;
1299
- notNull: true;
1300
- hasDefault: true;
1301
- isPrimaryKey: false;
1302
- isAutoincrement: false;
1303
- hasRuntimeDefault: false;
1304
- enumValues: undefined;
1305
- baseColumn: never;
1306
- identity: undefined;
1307
- generated: undefined;
1308
- }, {}, {}>;
1309
- };
1310
- dialect: "pg";
1311
- }>;
1312
- declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
1313
- name: "collector_block_numbers";
1314
- schema: "offers_v1.1";
1315
- columns: {
1316
- chainId: drizzle_orm_pg_core.PgColumn<{
1317
- name: "chain_id";
1318
- tableName: "collector_block_numbers";
1319
- dataType: "bigint";
1320
- columnType: "PgBigInt64";
1321
- data: bigint;
1322
- driverParam: string;
1323
- notNull: true;
1324
- hasDefault: false;
1325
- isPrimaryKey: false;
1326
- isAutoincrement: false;
1327
- hasRuntimeDefault: false;
1328
- enumValues: undefined;
1329
- baseColumn: never;
1330
- identity: undefined;
1331
- generated: undefined;
1332
- }, {}, {}>;
1333
- name: drizzle_orm_pg_core.PgColumn<{
1334
- name: "name";
1335
- tableName: "collector_block_numbers";
1336
- dataType: "string";
1337
- columnType: "PgText";
1338
- data: string;
1339
- driverParam: string;
1340
- notNull: true;
1341
- hasDefault: false;
1342
- isPrimaryKey: false;
1343
- isAutoincrement: false;
1344
- hasRuntimeDefault: false;
1345
- enumValues: [string, ...string[]];
1346
- baseColumn: never;
1347
- identity: undefined;
1348
- generated: undefined;
1349
- }, {}, {}>;
1350
- blockNumber: drizzle_orm_pg_core.PgColumn<{
1351
- name: "block_number";
1352
- tableName: "collector_block_numbers";
1353
- dataType: "number";
1354
- columnType: "PgBigInt53";
1355
- data: number;
1356
- driverParam: string | number;
1357
- notNull: true;
1358
- hasDefault: false;
1359
- isPrimaryKey: false;
1360
- isAutoincrement: false;
1361
- hasRuntimeDefault: false;
1362
- enumValues: undefined;
1363
- baseColumn: never;
1364
- identity: undefined;
1365
- generated: undefined;
1366
- }, {}, {}>;
1367
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1368
- name: "updated_at";
1369
- tableName: "collector_block_numbers";
1370
- dataType: "date";
1371
- columnType: "PgTimestamp";
1372
- data: Date;
1373
- driverParam: string;
1374
- notNull: true;
1375
- hasDefault: true;
1376
- isPrimaryKey: false;
1377
- isAutoincrement: false;
1378
- hasRuntimeDefault: false;
1379
- enumValues: undefined;
1380
- baseColumn: never;
1381
- identity: undefined;
1382
- generated: undefined;
1383
- }, {}, {}>;
1384
- };
1385
- dialect: "pg";
1386
- }>;
1387
- declare const availableLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
1388
- name: "available_liquidity_pools";
1389
- schema: "offers_v1.1";
1390
- columns: {
1391
- id: drizzle_orm_pg_core.PgColumn<{
1392
- name: "id";
1393
- tableName: "available_liquidity_pools";
1394
- dataType: "string";
1395
- columnType: "PgVarchar";
1396
- data: string;
1397
- driverParam: string;
1398
- notNull: true;
1399
- hasDefault: false;
1400
- isPrimaryKey: true;
1401
- isAutoincrement: false;
1402
- hasRuntimeDefault: false;
1403
- enumValues: [string, ...string[]];
1404
- baseColumn: never;
1405
- identity: undefined;
1406
- generated: undefined;
1407
- }, {}, {
1408
- length: 255;
1409
- }>;
1410
- amount: drizzle_orm_pg_core.PgColumn<{
1411
- name: "amount";
1412
- tableName: "available_liquidity_pools";
1413
- dataType: "string";
1414
- columnType: "PgNumeric";
1415
- data: string;
1416
- driverParam: string;
1417
- notNull: true;
1418
- hasDefault: false;
1419
- isPrimaryKey: false;
1420
- isAutoincrement: false;
1421
- hasRuntimeDefault: false;
1422
- enumValues: undefined;
1423
- baseColumn: never;
1424
- identity: undefined;
1425
- generated: undefined;
1426
- }, {}, {}>;
1427
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1428
- name: "updated_at";
1429
- tableName: "available_liquidity_pools";
1430
- dataType: "date";
1431
- columnType: "PgTimestamp";
1432
- data: Date;
1433
- driverParam: string;
1434
- notNull: true;
1435
- hasDefault: true;
1436
- isPrimaryKey: false;
1437
- isAutoincrement: false;
1438
- hasRuntimeDefault: false;
1439
- enumValues: undefined;
1440
- baseColumn: never;
1441
- identity: undefined;
1442
- generated: undefined;
1443
- }, {}, {}>;
1444
- };
1445
- dialect: "pg";
1446
- }>;
1447
- declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
1448
- name: "available_liquidity_queues";
1449
- schema: "offers_v1.1";
1450
- columns: {
1451
- queueId: drizzle_orm_pg_core.PgColumn<{
1452
- name: "queue_id";
1453
- tableName: "available_liquidity_queues";
1454
- dataType: "string";
1455
- columnType: "PgVarchar";
1456
- data: string;
1457
- driverParam: string;
1458
- notNull: true;
1459
- hasDefault: false;
1460
- isPrimaryKey: false;
1461
- isAutoincrement: false;
1462
- hasRuntimeDefault: false;
1463
- enumValues: [string, ...string[]];
1464
- baseColumn: never;
1465
- identity: undefined;
1466
- generated: undefined;
1467
- }, {}, {
1468
- length: 255;
1469
- }>;
1470
- availableLiquidityPoolId: drizzle_orm_pg_core.PgColumn<{
1471
- name: "available_liquidity_pool_id";
1472
- tableName: "available_liquidity_queues";
1473
- dataType: "string";
1474
- columnType: "PgVarchar";
1475
- data: string;
1476
- driverParam: string;
1477
- notNull: true;
1478
- hasDefault: false;
1479
- isPrimaryKey: false;
1480
- isAutoincrement: false;
1481
- hasRuntimeDefault: false;
1482
- enumValues: [string, ...string[]];
1483
- baseColumn: never;
1484
- identity: undefined;
1485
- generated: undefined;
1486
- }, {}, {
1487
- length: 255;
1488
- }>;
1489
- index: drizzle_orm_pg_core.PgColumn<{
1490
- name: "index";
1491
- tableName: "available_liquidity_queues";
1492
- dataType: "number";
1493
- columnType: "PgInteger";
1494
- data: number;
1495
- driverParam: string | number;
1496
- notNull: true;
1497
- hasDefault: false;
1498
- isPrimaryKey: false;
1499
- isAutoincrement: false;
1500
- hasRuntimeDefault: false;
1501
- enumValues: undefined;
1502
- baseColumn: never;
1503
- identity: undefined;
1504
- generated: undefined;
1505
- }, {}, {}>;
1506
- callbackAmount: drizzle_orm_pg_core.PgColumn<{
1507
- name: "callback_amount";
1508
- tableName: "available_liquidity_queues";
1509
- dataType: "string";
1510
- columnType: "PgNumeric";
1511
- data: string;
1512
- driverParam: string;
1513
- notNull: true;
1514
- hasDefault: true;
1515
- isPrimaryKey: false;
1516
- isAutoincrement: false;
1517
- hasRuntimeDefault: false;
1518
- enumValues: undefined;
1519
- baseColumn: never;
1520
- identity: undefined;
1521
- generated: undefined;
1522
- }, {}, {}>;
1523
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1524
- name: "updated_at";
1525
- tableName: "available_liquidity_queues";
1526
- dataType: "date";
1527
- columnType: "PgTimestamp";
1528
- data: Date;
1529
- driverParam: string;
1530
- notNull: true;
1531
- hasDefault: true;
1532
- isPrimaryKey: false;
1533
- isAutoincrement: false;
1534
- hasRuntimeDefault: false;
1535
- enumValues: undefined;
1536
- baseColumn: never;
1537
- identity: undefined;
1538
- generated: undefined;
1539
- }, {}, {}>;
1540
- };
1541
- dialect: "pg";
1542
- }>;
1543
- declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
1544
- name: "user_positions";
1545
- schema: "offers_v1.1";
1546
- columns: {
1547
- id: drizzle_orm_pg_core.PgColumn<{
1548
- name: "id";
1549
- tableName: "user_positions";
1550
- dataType: "string";
1551
- columnType: "PgVarchar";
1552
- data: string;
1553
- driverParam: string;
1554
- notNull: true;
1555
- hasDefault: false;
1556
- isPrimaryKey: true;
1557
- isAutoincrement: false;
1558
- hasRuntimeDefault: false;
1559
- enumValues: [string, ...string[]];
1560
- baseColumn: never;
1561
- identity: undefined;
1562
- generated: undefined;
1563
- }, {}, {
1564
- length: 255;
1565
- }>;
1566
- availableLiquidityQueueId: drizzle_orm_pg_core.PgColumn<{
1567
- name: "available_liquidity_queue_id";
1568
- tableName: "user_positions";
1569
- dataType: "string";
1570
- columnType: "PgVarchar";
1571
- data: string;
1572
- driverParam: string;
1573
- notNull: true;
1574
- hasDefault: false;
1575
- isPrimaryKey: false;
1576
- isAutoincrement: false;
1577
- hasRuntimeDefault: false;
1578
- enumValues: [string, ...string[]];
1579
- baseColumn: never;
1580
- identity: undefined;
1581
- generated: undefined;
1582
- }, {}, {
1583
- length: 255;
1584
- }>;
1585
- user: drizzle_orm_pg_core.PgColumn<{
1586
- name: "user";
1587
- tableName: "user_positions";
1588
- dataType: "string";
1589
- columnType: "PgVarchar";
1590
- data: string;
1591
- driverParam: string;
1592
- notNull: true;
1593
- hasDefault: false;
1594
- isPrimaryKey: false;
1595
- isAutoincrement: false;
1596
- hasRuntimeDefault: false;
1597
- enumValues: [string, ...string[]];
1598
- baseColumn: never;
1599
- identity: undefined;
1600
- generated: undefined;
1601
- }, {}, {
1602
- length: 255;
1603
- }>;
1604
- chainId: drizzle_orm_pg_core.PgColumn<{
1605
- name: "chain_id";
1606
- tableName: "user_positions";
1607
- dataType: "bigint";
1608
- columnType: "PgBigInt64";
1609
- data: bigint;
1610
- driverParam: string;
1611
- notNull: true;
1612
- hasDefault: false;
1613
- isPrimaryKey: false;
1614
- isAutoincrement: false;
1615
- hasRuntimeDefault: false;
1616
- enumValues: undefined;
1617
- baseColumn: never;
1618
- identity: undefined;
1619
- generated: undefined;
1620
- }, {}, {}>;
1621
- amount: drizzle_orm_pg_core.PgColumn<{
1622
- name: "amount";
1623
- tableName: "user_positions";
1624
- dataType: "string";
1625
- columnType: "PgNumeric";
1626
- data: string;
1627
- driverParam: string;
1628
- notNull: true;
1629
- hasDefault: false;
1630
- isPrimaryKey: false;
1631
- isAutoincrement: false;
1632
- hasRuntimeDefault: false;
1633
- enumValues: undefined;
1634
- baseColumn: never;
1635
- identity: undefined;
1636
- generated: undefined;
1637
- }, {}, {}>;
1638
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1639
- name: "updated_at";
1640
- tableName: "user_positions";
1641
- dataType: "date";
1642
- columnType: "PgTimestamp";
1643
- data: Date;
1644
- driverParam: string;
1645
- notNull: true;
1646
- hasDefault: true;
1647
- isPrimaryKey: false;
1648
- isAutoincrement: false;
1649
- hasRuntimeDefault: false;
1650
- enumValues: undefined;
1651
- baseColumn: never;
1652
- identity: undefined;
1653
- generated: undefined;
1654
- }, {}, {}>;
1655
- };
1656
- dialect: "pg";
1657
- }>;
1658
-
1659
- declare const schema_VERSION: typeof VERSION;
1660
- declare const schema_availableLiquidityPools: typeof availableLiquidityPools;
1661
- declare const schema_availableLiquidityQueues: typeof availableLiquidityQueues;
1662
- declare const schema_collectorBlockNumbers: typeof collectorBlockNumbers;
1663
- declare const schema_consumed: typeof consumed;
1664
- declare const schema_offerCollaterals: typeof offerCollaterals;
1665
- declare const schema_offerStatus: typeof offerStatus;
1666
- declare const schema_offers: typeof offers;
1667
- declare const schema_userPositions: typeof userPositions;
1668
- declare namespace schema {
1669
- export { schema_VERSION as VERSION, schema_availableLiquidityPools as availableLiquidityPools, schema_availableLiquidityQueues as availableLiquidityQueues, schema_collectorBlockNumbers as collectorBlockNumbers, schema_consumed as consumed, schema_offerCollaterals as offerCollaterals, schema_offerStatus as offerStatus, schema_offers as offers, schema_userPositions as userPositions };
1670
- }
1671
-
1672
- type GetParameters = {
1673
- /** Filter by multiple creator addresses (comma-separated) */
1674
- creators?: string[];
1675
- /** Filter by offer type: buy offers or sell offers */
1676
- side?: "buy" | "sell";
1677
- /** Filter by multiple blockchain networks (comma-separated chain IDs) */
1678
- chains?: number[];
1679
- /** Filter by multiple loan assets (comma-separated) */
1680
- loanTokens?: string[];
1681
- /** Filter by multiple statuses (comma-separated) */
1682
- status?: OfferStatus[];
1683
- /** Filter by multiple callback addresses (comma-separated) */
1684
- callbackAddresses?: string[];
1685
- /** Minimum amount of assets in the offer */
1686
- minAmount?: bigint;
1687
- /** Maximum amount of assets in the offer */
1688
- maxAmount?: bigint;
1689
- /** Minimum rate per asset (in wei) */
1690
- minRate?: bigint;
1691
- /** Maximum rate per asset (in wei) */
1692
- maxRate?: bigint;
1693
- /** Minimum maturity timestamp (Unix timestamp in seconds) */
1694
- minMaturity?: Maturity.Maturity;
1695
- /** Maximum maturity timestamp (Unix timestamp in seconds) */
1696
- maxMaturity?: Maturity.Maturity;
1697
- /** Minimum expiry timestamp (Unix timestamp in seconds) */
1698
- minExpiry?: number;
1699
- /** Maximum expiry timestamp (Unix timestamp in seconds) */
1700
- maxExpiry?: number;
1701
- /** Filter by multiple collateral assets (comma-separated) */
1702
- collateralAssets?: string[];
1703
- /** Filter by multiple rate oracles (comma-separated) */
1704
- collateralOracles?: string[];
1705
- /** Filter by collateral combinations */
1706
- collateralTuple?: Array<{
1707
- asset: string;
1708
- oracle?: string;
1709
- lltv?: LLTV.LLTV;
1710
- }>;
1711
- /** Minimum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
1712
- minLltv?: LLTV.LLTV;
1713
- /** Maximum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
1714
- maxLltv?: LLTV.LLTV;
1715
- /** Field to sort results by */
1716
- sortBy?: "rate" | "maturity" | "expiry" | "amount";
1717
- /** Sort direction: asc (ascending) or desc (descending, default) */
1718
- sortOrder?: "asc" | "desc";
1719
- /** Pagination cursor in base64url-encoded format */
1720
- cursor?: string;
1721
- /** Maximum number of offers to return. Defaults to 20. Maximum is 100. */
1722
- limit?: number;
1723
- };
1724
- type MatchParameters = {
1725
- /** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
1726
- side: "buy" | "sell";
1727
- /** The blockchain network chain ID */
1728
- chainId: number;
1729
- /** Rate per asset (in wei) for matching offers */
1730
- rate?: bigint;
1731
- /** Collateral requirements */
1732
- collaterals?: Array<{
1733
- asset: string;
1734
- oracle: string;
1735
- lltv: LLTV.LLTV;
1736
- }>;
1737
- /** Exact maturity timestamp (Unix timestamp in seconds) */
1738
- maturity?: Maturity.Maturity;
1739
- /** Minimum maturity timestamp (Unix timestamp in seconds, inclusive) */
1740
- minMaturity?: Maturity.Maturity;
1741
- /** Maximum maturity timestamp (Unix timestamp in seconds, inclusive) */
1742
- maxMaturity?: Maturity.Maturity;
1743
- /** The loan asset address to match against */
1744
- loanToken?: string;
1745
- /** Filter by a specific offer creator address */
1746
- creator?: string;
1747
- /** Filter by multiple statuses (comma-separated) */
1748
- status?: OfferStatus[];
1749
- /** Pagination cursor in base64url-encoded format */
1750
- cursor?: string;
1751
- /** Maximum number of offers to return. Defaults to 20. Maximum is 100. */
1752
- limit?: number;
1753
- };
1754
- type RouterClientConfig = {
1755
- readonly url: URL;
1756
- readonly headers: Headers;
1757
- };
1758
- type Client = Compute<RouterClientConfig & {
1759
- get: (parameters: GetParameters) => Promise<{
1760
- cursor: string | null;
1761
- offers: OfferResponse[];
1762
- }>;
1763
- match: (parameters: MatchParameters) => Promise<{
1764
- cursor: string | null;
1765
- offers: OfferResponse[];
1766
- }>;
1767
- }>;
1768
- declare function connect(opts?: {
1769
- url?: string;
1770
- apiKey?: string;
1771
- headers?: Headers;
1772
- }): Client;
1773
- declare namespace connect {
1774
- type ErrorType = InvalidUrlError;
1775
- }
1776
- /**
1777
- * Get offers from the router.
1778
- * @returns The offers with pagination cursor.
1779
- */
1780
- declare function get(config: RouterClientConfig, parameters: GetParameters): Promise<{
1781
- cursor: string | null;
1782
- offers: OfferResponse[];
1783
- }>;
1784
- declare namespace get {
1785
- type ErrorType = GetApiErrorType;
1786
- }
1787
- /**
1788
- * Match offers from the router.
1789
- * @returns The matched offers with pagination cursor.
1790
- */
1791
- declare function match(config: RouterClientConfig, parameters: MatchParameters): Promise<{
1792
- cursor: string | null;
1793
- offers: OfferResponse[];
1794
- }>;
1795
- declare namespace match {
1796
- type ErrorType = GetApiErrorType;
1797
- }
1798
- type GetApiErrorType = HttpGetOffersFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
1799
- declare class InvalidUrlError extends Errors.BaseError {
1800
- name: string;
1801
- constructor(url: string);
1802
- }
1803
- declare class HttpUnauthorizedError extends Errors.BaseError {
1804
- name: string;
1805
- constructor();
1806
- }
1807
- declare class HttpForbiddenError extends Errors.BaseError {
1808
- name: string;
1809
- constructor();
1810
- }
1811
- declare class HttpRateLimitError extends Errors.BaseError {
1812
- name: string;
1813
- constructor();
1814
- }
1815
- declare class HttpGetOffersFailedError extends Errors.BaseError {
1816
- name: string;
1817
- constructor(message: string, { details }?: {
1818
- details?: string;
1819
- });
1820
- }
1821
-
1822
- /**
1823
- * Start a local router server.
1824
- * @example
1825
- * ```ts
1826
- * import { Router } from "@morpho-dev/router";
1827
- * await Router.serve(); // local router server running on http://localhost:8081
1828
- * ```
1829
- */
1830
- declare function serve(parameters: {
1831
- port: number;
1832
- store: OfferStore;
1833
- }): Promise<void>;
1834
- declare function error(error: unknown, c: Context): Response & hono.TypedResponse<{
1835
- statusCode: number;
1836
- body: string;
1837
- }, hono_utils_http_status.ContentfulStatusCode, "json">;
1838
- declare function success<T>(c: Context, { data, cursor, }: {
1839
- data: T | T[];
1840
- cursor?: string | null;
1841
- }): Response & hono.TypedResponse<{
1842
- status: string;
1843
- cursor: string | null | undefined;
1844
- data: T | T[];
1845
- meta: {
1846
- timestamp: string;
1847
- };
1848
- } extends hono_utils_types.JSONValue ? { [K in keyof {
1849
- status: string;
1850
- cursor: string | null | undefined;
1851
- data: T | T[];
1852
- meta: {
1853
- timestamp: string;
1854
- };
1855
- } as ({
1856
- status: string;
1857
- cursor: string | null | undefined;
1858
- data: T | T[];
1859
- meta: {
1860
- timestamp: string;
1861
- };
1862
- }[K] extends infer T_1 ? T_1 extends {
1863
- status: string;
1864
- cursor: string | null | undefined;
1865
- data: T | T[];
1866
- meta: {
1867
- timestamp: string;
1868
- };
1869
- }[K] ? T_1 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) extends true ? never : K]: boolean extends ({
1870
- status: string;
1871
- cursor: string | null | undefined;
1872
- data: T | T[];
1873
- meta: {
1874
- timestamp: string;
1875
- };
1876
- }[K] extends infer T_2 ? T_2 extends {
1877
- status: string;
1878
- cursor: string | null | undefined;
1879
- data: T | T[];
1880
- meta: {
1881
- timestamp: string;
1882
- };
1883
- }[K] ? T_2 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) ? hono_utils_types.JSONParsed<{
1884
- status: string;
1885
- cursor: string | null | undefined;
1886
- data: T | T[];
1887
- meta: {
1888
- timestamp: string;
1889
- };
1890
- }[K]> | undefined : hono_utils_types.JSONParsed<{
1891
- status: string;
1892
- cursor: string | null | undefined;
1893
- data: T | T[];
1894
- meta: {
1895
- timestamp: string;
1896
- };
1897
- }[K]>; } : never, hono_utils_http_status.ContentfulStatusCode, "json">;
1898
- declare class APIError extends Error {
1899
- statusCode: number;
1900
- code: string;
1901
- details?: unknown | undefined;
1902
- constructor(statusCode: number, message: string, code: string, details?: unknown | undefined);
1903
- }
1904
- declare class ValidationError extends APIError {
1905
- constructor(message: string, details?: unknown);
1906
- }
1907
- declare class NotFoundError extends APIError {
1908
- constructor(message: string);
1909
- }
1910
- declare class InternalServerError extends APIError {
1911
- constructor(message?: string);
1912
- }
1913
- declare class BadRequestError extends APIError {
1914
- constructor(message?: string, details?: unknown);
1915
- }
1916
- declare function handleZodError(error: z.ZodError): ValidationError;
1917
-
1918
- type index_APIError = APIError;
1919
- declare const index_APIError: typeof APIError;
1920
- type index_BadRequestError = BadRequestError;
1921
- declare const index_BadRequestError: typeof BadRequestError;
1922
- type index_Client = Client;
1923
- type index_GetParameters = GetParameters;
1924
- type index_HttpForbiddenError = HttpForbiddenError;
1925
- declare const index_HttpForbiddenError: typeof HttpForbiddenError;
1926
- type index_HttpGetOffersFailedError = HttpGetOffersFailedError;
1927
- declare const index_HttpGetOffersFailedError: typeof HttpGetOffersFailedError;
1928
- type index_HttpRateLimitError = HttpRateLimitError;
1929
- declare const index_HttpRateLimitError: typeof HttpRateLimitError;
1930
- type index_HttpUnauthorizedError = HttpUnauthorizedError;
1931
- declare const index_HttpUnauthorizedError: typeof HttpUnauthorizedError;
1932
- type index_InternalServerError = InternalServerError;
1933
- declare const index_InternalServerError: typeof InternalServerError;
1934
- type index_InvalidUrlError = InvalidUrlError;
1935
- declare const index_InvalidUrlError: typeof InvalidUrlError;
1936
- type index_MatchParameters = MatchParameters;
1937
- type index_NotFoundError = NotFoundError;
1938
- declare const index_NotFoundError: typeof NotFoundError;
1939
- type index_RouterClientConfig = RouterClientConfig;
1940
- type index_ValidationError = ValidationError;
1941
- declare const index_ValidationError: typeof ValidationError;
1942
- declare const index_connect: typeof connect;
1943
- declare const index_error: typeof error;
1944
- declare const index_get: typeof get;
1945
- declare const index_handleZodError: typeof handleZodError;
1946
- declare const index_match: typeof match;
1947
- declare const index_serve: typeof serve;
1948
- declare const index_success: typeof success;
1949
- declare namespace index {
1950
- export { index_APIError as APIError, index_BadRequestError as BadRequestError, type index_Client as Client, type index_GetParameters as GetParameters, index_HttpForbiddenError as HttpForbiddenError, index_HttpGetOffersFailedError as HttpGetOffersFailedError, index_HttpRateLimitError as HttpRateLimitError, index_HttpUnauthorizedError as HttpUnauthorizedError, index_InternalServerError as InternalServerError, index_InvalidUrlError as InvalidUrlError, type index_MatchParameters as MatchParameters, index_NotFoundError as NotFoundError, type index_RouterClientConfig as RouterClientConfig, index_ValidationError as ValidationError, index_connect as connect, index_error as error, index_get as get, index_handleZodError as handleZodError, index_match as match, index_serve as serve, index_success as success };
1951
- }
1952
-
1953
989
  type config = {
1954
990
  chain: Chain.Chain;
1955
991
  rpcUrl: string;
@@ -2043,230 +1079,1230 @@ declare function morpho(): (Rule<{
2043
1079
  readonly data: viem.Hex;
2044
1080
  readonly gasLimit: bigint;
2045
1081
  };
2046
- readonly hash: viem.Hex;
2047
- signature?: viem.Hex;
2048
- createdAt?: number;
2049
- }, "chain_id", MorphoContext> | Rule<{
2050
- readonly offering: Address;
2051
- readonly assets: bigint;
2052
- readonly rate: bigint;
2053
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2054
- readonly expiry: number;
2055
- readonly nonce: bigint;
2056
- readonly buy: boolean;
2057
- readonly chainId: bigint;
2058
- readonly loanToken: Address;
2059
- readonly start: number;
2060
- readonly collaterals: readonly {
2061
- asset: Address;
2062
- oracle: Address;
2063
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2064
- }[];
2065
- readonly callback: {
2066
- readonly address: Address;
2067
- readonly data: viem.Hex;
2068
- readonly gasLimit: bigint;
1082
+ readonly hash: viem.Hex;
1083
+ signature?: viem.Hex;
1084
+ createdAt?: number;
1085
+ }, "chain_id", MorphoContext> | Rule<{
1086
+ readonly offering: Address;
1087
+ readonly assets: bigint;
1088
+ readonly rate: bigint;
1089
+ readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
1090
+ readonly expiry: number;
1091
+ readonly nonce: bigint;
1092
+ readonly buy: boolean;
1093
+ readonly chainId: bigint;
1094
+ readonly loanToken: Address;
1095
+ readonly start: number;
1096
+ readonly collaterals: readonly {
1097
+ asset: Address;
1098
+ oracle: Address;
1099
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
1100
+ }[];
1101
+ readonly callback: {
1102
+ readonly address: Address;
1103
+ readonly data: viem.Hex;
1104
+ readonly gasLimit: bigint;
1105
+ };
1106
+ readonly hash: viem.Hex;
1107
+ signature?: viem.Hex;
1108
+ createdAt?: number;
1109
+ }, "loan_token", MorphoContext> | Rule<{
1110
+ readonly offering: Address;
1111
+ readonly assets: bigint;
1112
+ readonly rate: bigint;
1113
+ readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
1114
+ readonly expiry: number;
1115
+ readonly nonce: bigint;
1116
+ readonly buy: boolean;
1117
+ readonly chainId: bigint;
1118
+ readonly loanToken: Address;
1119
+ readonly start: number;
1120
+ readonly collaterals: readonly {
1121
+ asset: Address;
1122
+ oracle: Address;
1123
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
1124
+ }[];
1125
+ readonly callback: {
1126
+ readonly address: Address;
1127
+ readonly data: viem.Hex;
1128
+ readonly gasLimit: bigint;
1129
+ };
1130
+ readonly hash: viem.Hex;
1131
+ signature?: viem.Hex;
1132
+ createdAt?: number;
1133
+ }, "expiry", MorphoContext> | Rule<{
1134
+ readonly offering: Address;
1135
+ readonly assets: bigint;
1136
+ readonly rate: bigint;
1137
+ readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
1138
+ readonly expiry: number;
1139
+ readonly nonce: bigint;
1140
+ readonly buy: boolean;
1141
+ readonly chainId: bigint;
1142
+ readonly loanToken: Address;
1143
+ readonly start: number;
1144
+ readonly collaterals: readonly {
1145
+ asset: Address;
1146
+ oracle: Address;
1147
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
1148
+ }[];
1149
+ readonly callback: {
1150
+ readonly address: Address;
1151
+ readonly data: viem.Hex;
1152
+ readonly gasLimit: bigint;
1153
+ };
1154
+ readonly hash: viem.Hex;
1155
+ signature?: viem.Hex;
1156
+ createdAt?: number;
1157
+ }, "sell_offers_empty_callback", MorphoContext> | Rule<{
1158
+ readonly offering: Address;
1159
+ readonly assets: bigint;
1160
+ readonly rate: bigint;
1161
+ readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
1162
+ readonly expiry: number;
1163
+ readonly nonce: bigint;
1164
+ readonly buy: boolean;
1165
+ readonly chainId: bigint;
1166
+ readonly loanToken: Address;
1167
+ readonly start: number;
1168
+ readonly collaterals: readonly {
1169
+ asset: Address;
1170
+ oracle: Address;
1171
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
1172
+ }[];
1173
+ readonly callback: {
1174
+ readonly address: Address;
1175
+ readonly data: viem.Hex;
1176
+ readonly gasLimit: bigint;
1177
+ };
1178
+ readonly hash: viem.Hex;
1179
+ signature?: viem.Hex;
1180
+ createdAt?: number;
1181
+ }, "buy_offers_non_empty_callback", MorphoContext> | Rule<{
1182
+ readonly offering: Address;
1183
+ readonly assets: bigint;
1184
+ readonly rate: bigint;
1185
+ readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
1186
+ readonly expiry: number;
1187
+ readonly nonce: bigint;
1188
+ readonly buy: boolean;
1189
+ readonly chainId: bigint;
1190
+ readonly loanToken: Address;
1191
+ readonly start: number;
1192
+ readonly collaterals: readonly {
1193
+ asset: Address;
1194
+ oracle: Address;
1195
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
1196
+ }[];
1197
+ readonly callback: {
1198
+ readonly address: Address;
1199
+ readonly data: viem.Hex;
1200
+ readonly gasLimit: bigint;
1201
+ };
1202
+ readonly hash: viem.Hex;
1203
+ signature?: viem.Hex;
1204
+ createdAt?: number;
1205
+ }, "sell_offers_non_whitelisted_callback", MorphoContext> | Rule<{
1206
+ readonly offering: Address;
1207
+ readonly assets: bigint;
1208
+ readonly rate: bigint;
1209
+ readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
1210
+ readonly expiry: number;
1211
+ readonly nonce: bigint;
1212
+ readonly buy: boolean;
1213
+ readonly chainId: bigint;
1214
+ readonly loanToken: Address;
1215
+ readonly start: number;
1216
+ readonly collaterals: readonly {
1217
+ asset: Address;
1218
+ oracle: Address;
1219
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
1220
+ }[];
1221
+ readonly callback: {
1222
+ readonly address: Address;
1223
+ readonly data: viem.Hex;
1224
+ readonly gasLimit: bigint;
1225
+ };
1226
+ readonly hash: viem.Hex;
1227
+ signature?: viem.Hex;
1228
+ createdAt?: number;
1229
+ }, "sell_offers_callback_data_invalid", MorphoContext> | Rule<{
1230
+ readonly offering: Address;
1231
+ readonly assets: bigint;
1232
+ readonly rate: bigint;
1233
+ readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
1234
+ readonly expiry: number;
1235
+ readonly nonce: bigint;
1236
+ readonly buy: boolean;
1237
+ readonly chainId: bigint;
1238
+ readonly loanToken: Address;
1239
+ readonly start: number;
1240
+ readonly collaterals: readonly {
1241
+ asset: Address;
1242
+ oracle: Address;
1243
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
1244
+ }[];
1245
+ readonly callback: {
1246
+ readonly address: Address;
1247
+ readonly data: viem.Hex;
1248
+ readonly gasLimit: bigint;
1249
+ };
1250
+ readonly hash: viem.Hex;
1251
+ signature?: viem.Hex;
1252
+ createdAt?: number;
1253
+ }, "sell_offers_callback_collateral_invalid", MorphoContext> | Rule<{
1254
+ readonly offering: Address;
1255
+ readonly assets: bigint;
1256
+ readonly rate: bigint;
1257
+ readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
1258
+ readonly expiry: number;
1259
+ readonly nonce: bigint;
1260
+ readonly buy: boolean;
1261
+ readonly chainId: bigint;
1262
+ readonly loanToken: Address;
1263
+ readonly start: number;
1264
+ readonly collaterals: readonly {
1265
+ asset: Address;
1266
+ oracle: Address;
1267
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
1268
+ }[];
1269
+ readonly callback: {
1270
+ readonly address: Address;
1271
+ readonly data: viem.Hex;
1272
+ readonly gasLimit: bigint;
1273
+ };
1274
+ readonly hash: viem.Hex;
1275
+ signature?: viem.Hex;
1276
+ createdAt?: number;
1277
+ }, "maturity", MorphoContext>)[];
1278
+
1279
+ type ValidationRule_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
1280
+ type ValidationRule_MorphoContext = MorphoContext;
1281
+ type ValidationRule_Rule<T, Name extends string = string, Ctx = void> = Rule<T, Name, Ctx>;
1282
+ type ValidationRule_RuleNames<Rules extends readonly {
1283
+ name: string;
1284
+ }[]> = RuleNames<Rules>;
1285
+ type ValidationRule_Single<T, RuleName extends string, Ctx = void> = Single<T, RuleName, Ctx>;
1286
+ declare const ValidationRule_batch: typeof batch;
1287
+ declare const ValidationRule_morpho: typeof morpho;
1288
+ declare const ValidationRule_single: typeof single;
1289
+ declare namespace ValidationRule {
1290
+ export { type ValidationRule_Batch as Batch, type ValidationRule_MorphoContext as MorphoContext, type ValidationRule_Rule as Rule, type ValidationRule_RuleNames as RuleNames, type ValidationRule_Single as Single, ValidationRule_batch as batch, ValidationRule_morpho as morpho, ValidationRule_single as single };
1291
+ }
1292
+
1293
+ /**
1294
+ * A validation issue.
1295
+ */
1296
+ type Issue<T, RuleName extends string = string> = {
1297
+ /** The name of the rule that caused the issue. */
1298
+ ruleName: RuleName;
1299
+ /** The message of the issue. */
1300
+ message: string;
1301
+ /** The item that was not valid. */
1302
+ item: T;
1303
+ };
1304
+ /**
1305
+ * The result of a validation.
1306
+ */
1307
+ type Result<T, RuleName extends string = string> = {
1308
+ /** The items that were valid. */
1309
+ valid: T[];
1310
+ /** The reports of the failed validations. */
1311
+ issues: Issue<T, RuleName>[];
1312
+ };
1313
+ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name, void>[]>(parameters: {
1314
+ items: T[];
1315
+ rules: Rules;
1316
+ chunkSize?: number;
1317
+ }): Promise<Result<T, RuleNames<Rules>>>;
1318
+ declare function run<T, Ctx, Name extends string, Rules extends readonly Rule<T, Name, Ctx>[]>(parameters: {
1319
+ items: T[];
1320
+ rules: Rules;
1321
+ ctx: Ctx;
1322
+ chunkSize?: number;
1323
+ }): Promise<Result<T, RuleNames<Rules>>>;
1324
+
1325
+ type Validation_Issue<T, RuleName extends string = string> = Issue<T, RuleName>;
1326
+ type Validation_Result<T, RuleName extends string = string> = Result<T, RuleName>;
1327
+ declare const Validation_run: typeof run;
1328
+ declare namespace Validation {
1329
+ export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
1330
+ }
1331
+
1332
+ declare const VERSION = "router_v1.1";
1333
+ declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
1334
+ name: "offers";
1335
+ schema: "router_v1.1";
1336
+ columns: {
1337
+ hash: drizzle_orm_pg_core.PgColumn<{
1338
+ name: "hash";
1339
+ tableName: "offers";
1340
+ dataType: "string";
1341
+ columnType: "PgVarchar";
1342
+ data: string;
1343
+ driverParam: string;
1344
+ notNull: true;
1345
+ hasDefault: false;
1346
+ isPrimaryKey: true;
1347
+ isAutoincrement: false;
1348
+ hasRuntimeDefault: false;
1349
+ enumValues: [string, ...string[]];
1350
+ baseColumn: never;
1351
+ identity: undefined;
1352
+ generated: undefined;
1353
+ }, {}, {
1354
+ length: 66;
1355
+ }>;
1356
+ offering: drizzle_orm_pg_core.PgColumn<{
1357
+ name: "offering";
1358
+ tableName: "offers";
1359
+ dataType: "string";
1360
+ columnType: "PgVarchar";
1361
+ data: string;
1362
+ driverParam: string;
1363
+ notNull: true;
1364
+ hasDefault: false;
1365
+ isPrimaryKey: false;
1366
+ isAutoincrement: false;
1367
+ hasRuntimeDefault: false;
1368
+ enumValues: [string, ...string[]];
1369
+ baseColumn: never;
1370
+ identity: undefined;
1371
+ generated: undefined;
1372
+ }, {}, {
1373
+ length: 42;
1374
+ }>;
1375
+ assets: drizzle_orm_pg_core.PgColumn<{
1376
+ name: "assets";
1377
+ tableName: "offers";
1378
+ dataType: "string";
1379
+ columnType: "PgNumeric";
1380
+ data: string;
1381
+ driverParam: string;
1382
+ notNull: true;
1383
+ hasDefault: false;
1384
+ isPrimaryKey: false;
1385
+ isAutoincrement: false;
1386
+ hasRuntimeDefault: false;
1387
+ enumValues: undefined;
1388
+ baseColumn: never;
1389
+ identity: undefined;
1390
+ generated: undefined;
1391
+ }, {}, {}>;
1392
+ rate: drizzle_orm_pg_core.PgColumn<{
1393
+ name: "rate";
1394
+ tableName: "offers";
1395
+ dataType: "bigint";
1396
+ columnType: "PgBigInt64";
1397
+ data: bigint;
1398
+ driverParam: string;
1399
+ notNull: true;
1400
+ hasDefault: false;
1401
+ isPrimaryKey: false;
1402
+ isAutoincrement: false;
1403
+ hasRuntimeDefault: false;
1404
+ enumValues: undefined;
1405
+ baseColumn: never;
1406
+ identity: undefined;
1407
+ generated: undefined;
1408
+ }, {}, {}>;
1409
+ maturity: drizzle_orm_pg_core.PgColumn<{
1410
+ name: "maturity";
1411
+ tableName: "offers";
1412
+ dataType: "number";
1413
+ columnType: "PgInteger";
1414
+ data: number;
1415
+ driverParam: string | number;
1416
+ notNull: true;
1417
+ hasDefault: false;
1418
+ isPrimaryKey: false;
1419
+ isAutoincrement: false;
1420
+ hasRuntimeDefault: false;
1421
+ enumValues: undefined;
1422
+ baseColumn: never;
1423
+ identity: undefined;
1424
+ generated: undefined;
1425
+ }, {}, {}>;
1426
+ expiry: drizzle_orm_pg_core.PgColumn<{
1427
+ name: "expiry";
1428
+ tableName: "offers";
1429
+ dataType: "number";
1430
+ columnType: "PgInteger";
1431
+ data: number;
1432
+ driverParam: string | number;
1433
+ notNull: true;
1434
+ hasDefault: false;
1435
+ isPrimaryKey: false;
1436
+ isAutoincrement: false;
1437
+ hasRuntimeDefault: false;
1438
+ enumValues: undefined;
1439
+ baseColumn: never;
1440
+ identity: undefined;
1441
+ generated: undefined;
1442
+ }, {}, {}>;
1443
+ start: drizzle_orm_pg_core.PgColumn<{
1444
+ name: "start";
1445
+ tableName: "offers";
1446
+ dataType: "number";
1447
+ columnType: "PgInteger";
1448
+ data: number;
1449
+ driverParam: string | number;
1450
+ notNull: true;
1451
+ hasDefault: false;
1452
+ isPrimaryKey: false;
1453
+ isAutoincrement: false;
1454
+ hasRuntimeDefault: false;
1455
+ enumValues: undefined;
1456
+ baseColumn: never;
1457
+ identity: undefined;
1458
+ generated: undefined;
1459
+ }, {}, {}>;
1460
+ nonce: drizzle_orm_pg_core.PgColumn<{
1461
+ name: "nonce";
1462
+ tableName: "offers";
1463
+ dataType: "bigint";
1464
+ columnType: "PgBigInt64";
1465
+ data: bigint;
1466
+ driverParam: string;
1467
+ notNull: true;
1468
+ hasDefault: false;
1469
+ isPrimaryKey: false;
1470
+ isAutoincrement: false;
1471
+ hasRuntimeDefault: false;
1472
+ enumValues: undefined;
1473
+ baseColumn: never;
1474
+ identity: undefined;
1475
+ generated: undefined;
1476
+ }, {}, {}>;
1477
+ buy: drizzle_orm_pg_core.PgColumn<{
1478
+ name: "buy";
1479
+ tableName: "offers";
1480
+ dataType: "boolean";
1481
+ columnType: "PgBoolean";
1482
+ data: boolean;
1483
+ driverParam: boolean;
1484
+ notNull: true;
1485
+ hasDefault: false;
1486
+ isPrimaryKey: false;
1487
+ isAutoincrement: false;
1488
+ hasRuntimeDefault: false;
1489
+ enumValues: undefined;
1490
+ baseColumn: never;
1491
+ identity: undefined;
1492
+ generated: undefined;
1493
+ }, {}, {}>;
1494
+ chainId: drizzle_orm_pg_core.PgColumn<{
1495
+ name: "chain_id";
1496
+ tableName: "offers";
1497
+ dataType: "bigint";
1498
+ columnType: "PgBigInt64";
1499
+ data: bigint;
1500
+ driverParam: string;
1501
+ notNull: true;
1502
+ hasDefault: false;
1503
+ isPrimaryKey: false;
1504
+ isAutoincrement: false;
1505
+ hasRuntimeDefault: false;
1506
+ enumValues: undefined;
1507
+ baseColumn: never;
1508
+ identity: undefined;
1509
+ generated: undefined;
1510
+ }, {}, {}>;
1511
+ loanToken: drizzle_orm_pg_core.PgColumn<{
1512
+ name: "loan_token";
1513
+ tableName: "offers";
1514
+ dataType: "string";
1515
+ columnType: "PgVarchar";
1516
+ data: string;
1517
+ driverParam: string;
1518
+ notNull: true;
1519
+ hasDefault: false;
1520
+ isPrimaryKey: false;
1521
+ isAutoincrement: false;
1522
+ hasRuntimeDefault: false;
1523
+ enumValues: [string, ...string[]];
1524
+ baseColumn: never;
1525
+ identity: undefined;
1526
+ generated: undefined;
1527
+ }, {}, {
1528
+ length: 42;
1529
+ }>;
1530
+ callbackAddress: drizzle_orm_pg_core.PgColumn<{
1531
+ name: "callback_address";
1532
+ tableName: "offers";
1533
+ dataType: "string";
1534
+ columnType: "PgVarchar";
1535
+ data: string;
1536
+ driverParam: string;
1537
+ notNull: true;
1538
+ hasDefault: false;
1539
+ isPrimaryKey: false;
1540
+ isAutoincrement: false;
1541
+ hasRuntimeDefault: false;
1542
+ enumValues: [string, ...string[]];
1543
+ baseColumn: never;
1544
+ identity: undefined;
1545
+ generated: undefined;
1546
+ }, {}, {
1547
+ length: 42;
1548
+ }>;
1549
+ callbackData: drizzle_orm_pg_core.PgColumn<{
1550
+ name: "callback_data";
1551
+ tableName: "offers";
1552
+ dataType: "string";
1553
+ columnType: "PgText";
1554
+ data: string;
1555
+ driverParam: string;
1556
+ notNull: true;
1557
+ hasDefault: false;
1558
+ isPrimaryKey: false;
1559
+ isAutoincrement: false;
1560
+ hasRuntimeDefault: false;
1561
+ enumValues: [string, ...string[]];
1562
+ baseColumn: never;
1563
+ identity: undefined;
1564
+ generated: undefined;
1565
+ }, {}, {}>;
1566
+ callbackGasLimit: drizzle_orm_pg_core.PgColumn<{
1567
+ name: "callback_gas_limit";
1568
+ tableName: "offers";
1569
+ dataType: "bigint";
1570
+ columnType: "PgBigInt64";
1571
+ data: bigint;
1572
+ driverParam: string;
1573
+ notNull: true;
1574
+ hasDefault: false;
1575
+ isPrimaryKey: false;
1576
+ isAutoincrement: false;
1577
+ hasRuntimeDefault: false;
1578
+ enumValues: undefined;
1579
+ baseColumn: never;
1580
+ identity: undefined;
1581
+ generated: undefined;
1582
+ }, {}, {}>;
1583
+ signature: drizzle_orm_pg_core.PgColumn<{
1584
+ name: "signature";
1585
+ tableName: "offers";
1586
+ dataType: "string";
1587
+ columnType: "PgVarchar";
1588
+ data: string;
1589
+ driverParam: string;
1590
+ notNull: false;
1591
+ hasDefault: false;
1592
+ isPrimaryKey: false;
1593
+ isAutoincrement: false;
1594
+ hasRuntimeDefault: false;
1595
+ enumValues: [string, ...string[]];
1596
+ baseColumn: never;
1597
+ identity: undefined;
1598
+ generated: undefined;
1599
+ }, {}, {
1600
+ length: 132;
1601
+ }>;
1602
+ callbackId: drizzle_orm_pg_core.PgColumn<{
1603
+ name: "callback_id";
1604
+ tableName: "offers";
1605
+ dataType: "string";
1606
+ columnType: "PgVarchar";
1607
+ data: string;
1608
+ driverParam: string;
1609
+ notNull: false;
1610
+ hasDefault: false;
1611
+ isPrimaryKey: false;
1612
+ isAutoincrement: false;
1613
+ hasRuntimeDefault: false;
1614
+ enumValues: [string, ...string[]];
1615
+ baseColumn: never;
1616
+ identity: undefined;
1617
+ generated: undefined;
1618
+ }, {}, {
1619
+ length: 256;
1620
+ }>;
1621
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1622
+ name: "created_at";
1623
+ tableName: "offers";
1624
+ dataType: "date";
1625
+ columnType: "PgTimestamp";
1626
+ data: Date;
1627
+ driverParam: string;
1628
+ notNull: true;
1629
+ hasDefault: true;
1630
+ isPrimaryKey: false;
1631
+ isAutoincrement: false;
1632
+ hasRuntimeDefault: false;
1633
+ enumValues: undefined;
1634
+ baseColumn: never;
1635
+ identity: undefined;
1636
+ generated: undefined;
1637
+ }, {}, {}>;
1638
+ };
1639
+ dialect: "pg";
1640
+ }>;
1641
+ declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
1642
+ name: "offer_collaterals";
1643
+ schema: "router_v1.1";
1644
+ columns: {
1645
+ id: drizzle_orm_pg_core.PgColumn<{
1646
+ name: "id";
1647
+ tableName: "offer_collaterals";
1648
+ dataType: "number";
1649
+ columnType: "PgSerial";
1650
+ data: number;
1651
+ driverParam: number;
1652
+ notNull: true;
1653
+ hasDefault: true;
1654
+ isPrimaryKey: true;
1655
+ isAutoincrement: false;
1656
+ hasRuntimeDefault: false;
1657
+ enumValues: undefined;
1658
+ baseColumn: never;
1659
+ identity: undefined;
1660
+ generated: undefined;
1661
+ }, {}, {}>;
1662
+ offerHash: drizzle_orm_pg_core.PgColumn<{
1663
+ name: "offer_hash";
1664
+ tableName: "offer_collaterals";
1665
+ dataType: "string";
1666
+ columnType: "PgVarchar";
1667
+ data: string;
1668
+ driverParam: string;
1669
+ notNull: true;
1670
+ hasDefault: false;
1671
+ isPrimaryKey: false;
1672
+ isAutoincrement: false;
1673
+ hasRuntimeDefault: false;
1674
+ enumValues: [string, ...string[]];
1675
+ baseColumn: never;
1676
+ identity: undefined;
1677
+ generated: undefined;
1678
+ }, {}, {
1679
+ length: 66;
1680
+ }>;
1681
+ asset: drizzle_orm_pg_core.PgColumn<{
1682
+ name: "asset";
1683
+ tableName: "offer_collaterals";
1684
+ dataType: "string";
1685
+ columnType: "PgVarchar";
1686
+ data: string;
1687
+ driverParam: string;
1688
+ notNull: true;
1689
+ hasDefault: false;
1690
+ isPrimaryKey: false;
1691
+ isAutoincrement: false;
1692
+ hasRuntimeDefault: false;
1693
+ enumValues: [string, ...string[]];
1694
+ baseColumn: never;
1695
+ identity: undefined;
1696
+ generated: undefined;
1697
+ }, {}, {
1698
+ length: 42;
1699
+ }>;
1700
+ oracle: drizzle_orm_pg_core.PgColumn<{
1701
+ name: "oracle";
1702
+ tableName: "offer_collaterals";
1703
+ dataType: "string";
1704
+ columnType: "PgVarchar";
1705
+ data: string;
1706
+ driverParam: string;
1707
+ notNull: true;
1708
+ hasDefault: false;
1709
+ isPrimaryKey: false;
1710
+ isAutoincrement: false;
1711
+ hasRuntimeDefault: false;
1712
+ enumValues: [string, ...string[]];
1713
+ baseColumn: never;
1714
+ identity: undefined;
1715
+ generated: undefined;
1716
+ }, {}, {
1717
+ length: 42;
1718
+ }>;
1719
+ lltv: drizzle_orm_pg_core.PgColumn<{
1720
+ name: "lltv";
1721
+ tableName: "offer_collaterals";
1722
+ dataType: "bigint";
1723
+ columnType: "PgBigInt64";
1724
+ data: bigint;
1725
+ driverParam: string;
1726
+ notNull: true;
1727
+ hasDefault: false;
1728
+ isPrimaryKey: false;
1729
+ isAutoincrement: false;
1730
+ hasRuntimeDefault: false;
1731
+ enumValues: undefined;
1732
+ baseColumn: never;
1733
+ identity: undefined;
1734
+ generated: undefined;
1735
+ }, {}, {}>;
2069
1736
  };
2070
- readonly hash: viem.Hex;
2071
- signature?: viem.Hex;
2072
- createdAt?: number;
2073
- }, "loan_token", MorphoContext> | Rule<{
2074
- readonly offering: Address;
2075
- readonly assets: bigint;
2076
- readonly rate: bigint;
2077
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2078
- readonly expiry: number;
2079
- readonly nonce: bigint;
2080
- readonly buy: boolean;
2081
- readonly chainId: bigint;
2082
- readonly loanToken: Address;
2083
- readonly start: number;
2084
- readonly collaterals: readonly {
2085
- asset: Address;
2086
- oracle: Address;
2087
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2088
- }[];
2089
- readonly callback: {
2090
- readonly address: Address;
2091
- readonly data: viem.Hex;
2092
- readonly gasLimit: bigint;
1737
+ dialect: "pg";
1738
+ }>;
1739
+ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
1740
+ name: "offer_status";
1741
+ schema: "router_v1.1";
1742
+ columns: {
1743
+ id: drizzle_orm_pg_core.PgColumn<{
1744
+ name: "id";
1745
+ tableName: "offer_status";
1746
+ dataType: "number";
1747
+ columnType: "PgSerial";
1748
+ data: number;
1749
+ driverParam: number;
1750
+ notNull: true;
1751
+ hasDefault: true;
1752
+ isPrimaryKey: true;
1753
+ isAutoincrement: false;
1754
+ hasRuntimeDefault: false;
1755
+ enumValues: undefined;
1756
+ baseColumn: never;
1757
+ identity: undefined;
1758
+ generated: undefined;
1759
+ }, {}, {}>;
1760
+ offerHash: drizzle_orm_pg_core.PgColumn<{
1761
+ name: "offer_hash";
1762
+ tableName: "offer_status";
1763
+ dataType: "string";
1764
+ columnType: "PgVarchar";
1765
+ data: string;
1766
+ driverParam: string;
1767
+ notNull: true;
1768
+ hasDefault: false;
1769
+ isPrimaryKey: false;
1770
+ isAutoincrement: false;
1771
+ hasRuntimeDefault: false;
1772
+ enumValues: [string, ...string[]];
1773
+ baseColumn: never;
1774
+ identity: undefined;
1775
+ generated: undefined;
1776
+ }, {}, {
1777
+ length: 66;
1778
+ }>;
1779
+ status: drizzle_orm_pg_core.PgColumn<{
1780
+ name: "status";
1781
+ tableName: "offer_status";
1782
+ dataType: "string";
1783
+ columnType: "PgText";
1784
+ data: "valid" | "callback_not_supported" | "callback_error" | "unverified";
1785
+ driverParam: string;
1786
+ notNull: true;
1787
+ hasDefault: false;
1788
+ isPrimaryKey: false;
1789
+ isAutoincrement: false;
1790
+ hasRuntimeDefault: false;
1791
+ enumValues: [string, ...string[]];
1792
+ baseColumn: never;
1793
+ identity: undefined;
1794
+ generated: undefined;
1795
+ }, {}, {
1796
+ $type: "valid" | "callback_not_supported" | "callback_error" | "unverified";
1797
+ }>;
1798
+ metadata: drizzle_orm_pg_core.PgColumn<{
1799
+ name: "metadata";
1800
+ tableName: "offer_status";
1801
+ dataType: "json";
1802
+ columnType: "PgJsonb";
1803
+ data: unknown;
1804
+ driverParam: unknown;
1805
+ notNull: false;
1806
+ hasDefault: false;
1807
+ isPrimaryKey: false;
1808
+ isAutoincrement: false;
1809
+ hasRuntimeDefault: false;
1810
+ enumValues: undefined;
1811
+ baseColumn: never;
1812
+ identity: undefined;
1813
+ generated: undefined;
1814
+ }, {}, {}>;
1815
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1816
+ name: "created_at";
1817
+ tableName: "offer_status";
1818
+ dataType: "date";
1819
+ columnType: "PgTimestamp";
1820
+ data: Date;
1821
+ driverParam: string;
1822
+ notNull: true;
1823
+ hasDefault: true;
1824
+ isPrimaryKey: false;
1825
+ isAutoincrement: false;
1826
+ hasRuntimeDefault: false;
1827
+ enumValues: undefined;
1828
+ baseColumn: never;
1829
+ identity: undefined;
1830
+ generated: undefined;
1831
+ }, {}, {}>;
2093
1832
  };
2094
- readonly hash: viem.Hex;
2095
- signature?: viem.Hex;
2096
- createdAt?: number;
2097
- }, "expiry", MorphoContext> | Rule<{
2098
- readonly offering: Address;
2099
- readonly assets: bigint;
2100
- readonly rate: bigint;
2101
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2102
- readonly expiry: number;
2103
- readonly nonce: bigint;
2104
- readonly buy: boolean;
2105
- readonly chainId: bigint;
2106
- readonly loanToken: Address;
2107
- readonly start: number;
2108
- readonly collaterals: readonly {
2109
- asset: Address;
2110
- oracle: Address;
2111
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2112
- }[];
2113
- readonly callback: {
2114
- readonly address: Address;
2115
- readonly data: viem.Hex;
2116
- readonly gasLimit: bigint;
1833
+ dialect: "pg";
1834
+ }>;
1835
+ declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
1836
+ name: "consumed_per_user_and_nonce";
1837
+ schema: "router_v1.1";
1838
+ columns: {
1839
+ id: drizzle_orm_pg_core.PgColumn<{
1840
+ name: "id";
1841
+ tableName: "consumed_per_user_and_nonce";
1842
+ dataType: "string";
1843
+ columnType: "PgVarchar";
1844
+ data: string;
1845
+ driverParam: string;
1846
+ notNull: true;
1847
+ hasDefault: false;
1848
+ isPrimaryKey: true;
1849
+ isAutoincrement: false;
1850
+ hasRuntimeDefault: false;
1851
+ enumValues: [string, ...string[]];
1852
+ baseColumn: never;
1853
+ identity: undefined;
1854
+ generated: undefined;
1855
+ }, {}, {
1856
+ length: 255;
1857
+ }>;
1858
+ chainId: drizzle_orm_pg_core.PgColumn<{
1859
+ name: "chain_id";
1860
+ tableName: "consumed_per_user_and_nonce";
1861
+ dataType: "bigint";
1862
+ columnType: "PgBigInt64";
1863
+ data: bigint;
1864
+ driverParam: string;
1865
+ notNull: true;
1866
+ hasDefault: false;
1867
+ isPrimaryKey: false;
1868
+ isAutoincrement: false;
1869
+ hasRuntimeDefault: false;
1870
+ enumValues: undefined;
1871
+ baseColumn: never;
1872
+ identity: undefined;
1873
+ generated: undefined;
1874
+ }, {}, {}>;
1875
+ offering: drizzle_orm_pg_core.PgColumn<{
1876
+ name: "offering";
1877
+ tableName: "consumed_per_user_and_nonce";
1878
+ dataType: "string";
1879
+ columnType: "PgVarchar";
1880
+ data: string;
1881
+ driverParam: string;
1882
+ notNull: true;
1883
+ hasDefault: false;
1884
+ isPrimaryKey: false;
1885
+ isAutoincrement: false;
1886
+ hasRuntimeDefault: false;
1887
+ enumValues: [string, ...string[]];
1888
+ baseColumn: never;
1889
+ identity: undefined;
1890
+ generated: undefined;
1891
+ }, {}, {
1892
+ length: 42;
1893
+ }>;
1894
+ nonce: drizzle_orm_pg_core.PgColumn<{
1895
+ name: "nonce";
1896
+ tableName: "consumed_per_user_and_nonce";
1897
+ dataType: "bigint";
1898
+ columnType: "PgBigInt64";
1899
+ data: bigint;
1900
+ driverParam: string;
1901
+ notNull: true;
1902
+ hasDefault: false;
1903
+ isPrimaryKey: false;
1904
+ isAutoincrement: false;
1905
+ hasRuntimeDefault: false;
1906
+ enumValues: undefined;
1907
+ baseColumn: never;
1908
+ identity: undefined;
1909
+ generated: undefined;
1910
+ }, {}, {}>;
1911
+ consumed: drizzle_orm_pg_core.PgColumn<{
1912
+ name: "consumed";
1913
+ tableName: "consumed_per_user_and_nonce";
1914
+ dataType: "string";
1915
+ columnType: "PgNumeric";
1916
+ data: string;
1917
+ driverParam: string;
1918
+ notNull: true;
1919
+ hasDefault: false;
1920
+ isPrimaryKey: false;
1921
+ isAutoincrement: false;
1922
+ hasRuntimeDefault: false;
1923
+ enumValues: undefined;
1924
+ baseColumn: never;
1925
+ identity: undefined;
1926
+ generated: undefined;
1927
+ }, {}, {}>;
1928
+ createdAt: drizzle_orm_pg_core.PgColumn<{
1929
+ name: "created_at";
1930
+ tableName: "consumed_per_user_and_nonce";
1931
+ dataType: "date";
1932
+ columnType: "PgTimestamp";
1933
+ data: Date;
1934
+ driverParam: string;
1935
+ notNull: true;
1936
+ hasDefault: true;
1937
+ isPrimaryKey: false;
1938
+ isAutoincrement: false;
1939
+ hasRuntimeDefault: false;
1940
+ enumValues: undefined;
1941
+ baseColumn: never;
1942
+ identity: undefined;
1943
+ generated: undefined;
1944
+ }, {}, {}>;
2117
1945
  };
2118
- readonly hash: viem.Hex;
2119
- signature?: viem.Hex;
2120
- createdAt?: number;
2121
- }, "sell_offers_empty_callback", MorphoContext> | Rule<{
2122
- readonly offering: Address;
2123
- readonly assets: bigint;
2124
- readonly rate: bigint;
2125
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2126
- readonly expiry: number;
2127
- readonly nonce: bigint;
2128
- readonly buy: boolean;
2129
- readonly chainId: bigint;
2130
- readonly loanToken: Address;
2131
- readonly start: number;
2132
- readonly collaterals: readonly {
2133
- asset: Address;
2134
- oracle: Address;
2135
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2136
- }[];
2137
- readonly callback: {
2138
- readonly address: Address;
2139
- readonly data: viem.Hex;
2140
- readonly gasLimit: bigint;
1946
+ dialect: "pg";
1947
+ }>;
1948
+ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
1949
+ name: "collector_block_numbers";
1950
+ schema: "router_v1.1";
1951
+ columns: {
1952
+ chainId: drizzle_orm_pg_core.PgColumn<{
1953
+ name: "chain_id";
1954
+ tableName: "collector_block_numbers";
1955
+ dataType: "bigint";
1956
+ columnType: "PgBigInt64";
1957
+ data: bigint;
1958
+ driverParam: string;
1959
+ notNull: true;
1960
+ hasDefault: false;
1961
+ isPrimaryKey: false;
1962
+ isAutoincrement: false;
1963
+ hasRuntimeDefault: false;
1964
+ enumValues: undefined;
1965
+ baseColumn: never;
1966
+ identity: undefined;
1967
+ generated: undefined;
1968
+ }, {}, {}>;
1969
+ name: drizzle_orm_pg_core.PgColumn<{
1970
+ name: "name";
1971
+ tableName: "collector_block_numbers";
1972
+ dataType: "string";
1973
+ columnType: "PgText";
1974
+ data: string;
1975
+ driverParam: string;
1976
+ notNull: true;
1977
+ hasDefault: false;
1978
+ isPrimaryKey: false;
1979
+ isAutoincrement: false;
1980
+ hasRuntimeDefault: false;
1981
+ enumValues: [string, ...string[]];
1982
+ baseColumn: never;
1983
+ identity: undefined;
1984
+ generated: undefined;
1985
+ }, {}, {}>;
1986
+ blockNumber: drizzle_orm_pg_core.PgColumn<{
1987
+ name: "block_number";
1988
+ tableName: "collector_block_numbers";
1989
+ dataType: "number";
1990
+ columnType: "PgBigInt53";
1991
+ data: number;
1992
+ driverParam: string | number;
1993
+ notNull: true;
1994
+ hasDefault: false;
1995
+ isPrimaryKey: false;
1996
+ isAutoincrement: false;
1997
+ hasRuntimeDefault: false;
1998
+ enumValues: undefined;
1999
+ baseColumn: never;
2000
+ identity: undefined;
2001
+ generated: undefined;
2002
+ }, {}, {}>;
2003
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
2004
+ name: "updated_at";
2005
+ tableName: "collector_block_numbers";
2006
+ dataType: "date";
2007
+ columnType: "PgTimestamp";
2008
+ data: Date;
2009
+ driverParam: string;
2010
+ notNull: true;
2011
+ hasDefault: true;
2012
+ isPrimaryKey: false;
2013
+ isAutoincrement: false;
2014
+ hasRuntimeDefault: false;
2015
+ enumValues: undefined;
2016
+ baseColumn: never;
2017
+ identity: undefined;
2018
+ generated: undefined;
2019
+ }, {}, {}>;
2141
2020
  };
2142
- readonly hash: viem.Hex;
2143
- signature?: viem.Hex;
2144
- createdAt?: number;
2145
- }, "buy_offers_non_empty_callback", MorphoContext> | Rule<{
2146
- readonly offering: Address;
2147
- readonly assets: bigint;
2148
- readonly rate: bigint;
2149
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2150
- readonly expiry: number;
2151
- readonly nonce: bigint;
2152
- readonly buy: boolean;
2153
- readonly chainId: bigint;
2154
- readonly loanToken: Address;
2155
- readonly start: number;
2156
- readonly collaterals: readonly {
2157
- asset: Address;
2158
- oracle: Address;
2159
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2160
- }[];
2161
- readonly callback: {
2162
- readonly address: Address;
2163
- readonly data: viem.Hex;
2164
- readonly gasLimit: bigint;
2021
+ dialect: "pg";
2022
+ }>;
2023
+ declare const availableLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
2024
+ name: "available_liquidity_pools";
2025
+ schema: "router_v1.1";
2026
+ columns: {
2027
+ id: drizzle_orm_pg_core.PgColumn<{
2028
+ name: "id";
2029
+ tableName: "available_liquidity_pools";
2030
+ dataType: "string";
2031
+ columnType: "PgVarchar";
2032
+ data: string;
2033
+ driverParam: string;
2034
+ notNull: true;
2035
+ hasDefault: false;
2036
+ isPrimaryKey: true;
2037
+ isAutoincrement: false;
2038
+ hasRuntimeDefault: false;
2039
+ enumValues: [string, ...string[]];
2040
+ baseColumn: never;
2041
+ identity: undefined;
2042
+ generated: undefined;
2043
+ }, {}, {
2044
+ length: 255;
2045
+ }>;
2046
+ amount: drizzle_orm_pg_core.PgColumn<{
2047
+ name: "amount";
2048
+ tableName: "available_liquidity_pools";
2049
+ dataType: "string";
2050
+ columnType: "PgNumeric";
2051
+ data: string;
2052
+ driverParam: string;
2053
+ notNull: true;
2054
+ hasDefault: false;
2055
+ isPrimaryKey: false;
2056
+ isAutoincrement: false;
2057
+ hasRuntimeDefault: false;
2058
+ enumValues: undefined;
2059
+ baseColumn: never;
2060
+ identity: undefined;
2061
+ generated: undefined;
2062
+ }, {}, {}>;
2063
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
2064
+ name: "updated_at";
2065
+ tableName: "available_liquidity_pools";
2066
+ dataType: "date";
2067
+ columnType: "PgTimestamp";
2068
+ data: Date;
2069
+ driverParam: string;
2070
+ notNull: true;
2071
+ hasDefault: true;
2072
+ isPrimaryKey: false;
2073
+ isAutoincrement: false;
2074
+ hasRuntimeDefault: false;
2075
+ enumValues: undefined;
2076
+ baseColumn: never;
2077
+ identity: undefined;
2078
+ generated: undefined;
2079
+ }, {}, {}>;
2165
2080
  };
2166
- readonly hash: viem.Hex;
2167
- signature?: viem.Hex;
2168
- createdAt?: number;
2169
- }, "sell_offers_non_whitelisted_callback", MorphoContext> | Rule<{
2170
- readonly offering: Address;
2171
- readonly assets: bigint;
2172
- readonly rate: bigint;
2173
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2174
- readonly expiry: number;
2175
- readonly nonce: bigint;
2176
- readonly buy: boolean;
2177
- readonly chainId: bigint;
2178
- readonly loanToken: Address;
2179
- readonly start: number;
2180
- readonly collaterals: readonly {
2181
- asset: Address;
2182
- oracle: Address;
2183
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2184
- }[];
2185
- readonly callback: {
2186
- readonly address: Address;
2187
- readonly data: viem.Hex;
2188
- readonly gasLimit: bigint;
2081
+ dialect: "pg";
2082
+ }>;
2083
+ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
2084
+ name: "available_liquidity_queues";
2085
+ schema: "router_v1.1";
2086
+ columns: {
2087
+ queueId: drizzle_orm_pg_core.PgColumn<{
2088
+ name: "queue_id";
2089
+ tableName: "available_liquidity_queues";
2090
+ dataType: "string";
2091
+ columnType: "PgVarchar";
2092
+ data: string;
2093
+ driverParam: string;
2094
+ notNull: true;
2095
+ hasDefault: false;
2096
+ isPrimaryKey: false;
2097
+ isAutoincrement: false;
2098
+ hasRuntimeDefault: false;
2099
+ enumValues: [string, ...string[]];
2100
+ baseColumn: never;
2101
+ identity: undefined;
2102
+ generated: undefined;
2103
+ }, {}, {
2104
+ length: 255;
2105
+ }>;
2106
+ availableLiquidityPoolId: drizzle_orm_pg_core.PgColumn<{
2107
+ name: "available_liquidity_pool_id";
2108
+ tableName: "available_liquidity_queues";
2109
+ dataType: "string";
2110
+ columnType: "PgVarchar";
2111
+ data: string;
2112
+ driverParam: string;
2113
+ notNull: true;
2114
+ hasDefault: false;
2115
+ isPrimaryKey: false;
2116
+ isAutoincrement: false;
2117
+ hasRuntimeDefault: false;
2118
+ enumValues: [string, ...string[]];
2119
+ baseColumn: never;
2120
+ identity: undefined;
2121
+ generated: undefined;
2122
+ }, {}, {
2123
+ length: 255;
2124
+ }>;
2125
+ index: drizzle_orm_pg_core.PgColumn<{
2126
+ name: "index";
2127
+ tableName: "available_liquidity_queues";
2128
+ dataType: "number";
2129
+ columnType: "PgInteger";
2130
+ data: number;
2131
+ driverParam: string | number;
2132
+ notNull: true;
2133
+ hasDefault: false;
2134
+ isPrimaryKey: false;
2135
+ isAutoincrement: false;
2136
+ hasRuntimeDefault: false;
2137
+ enumValues: undefined;
2138
+ baseColumn: never;
2139
+ identity: undefined;
2140
+ generated: undefined;
2141
+ }, {}, {}>;
2142
+ callbackAmount: drizzle_orm_pg_core.PgColumn<{
2143
+ name: "callback_amount";
2144
+ tableName: "available_liquidity_queues";
2145
+ dataType: "string";
2146
+ columnType: "PgNumeric";
2147
+ data: string;
2148
+ driverParam: string;
2149
+ notNull: true;
2150
+ hasDefault: true;
2151
+ isPrimaryKey: false;
2152
+ isAutoincrement: false;
2153
+ hasRuntimeDefault: false;
2154
+ enumValues: undefined;
2155
+ baseColumn: never;
2156
+ identity: undefined;
2157
+ generated: undefined;
2158
+ }, {}, {}>;
2159
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
2160
+ name: "updated_at";
2161
+ tableName: "available_liquidity_queues";
2162
+ dataType: "date";
2163
+ columnType: "PgTimestamp";
2164
+ data: Date;
2165
+ driverParam: string;
2166
+ notNull: true;
2167
+ hasDefault: true;
2168
+ isPrimaryKey: false;
2169
+ isAutoincrement: false;
2170
+ hasRuntimeDefault: false;
2171
+ enumValues: undefined;
2172
+ baseColumn: never;
2173
+ identity: undefined;
2174
+ generated: undefined;
2175
+ }, {}, {}>;
2189
2176
  };
2190
- readonly hash: viem.Hex;
2191
- signature?: viem.Hex;
2192
- createdAt?: number;
2193
- }, "sell_offers_callback_data_invalid", MorphoContext> | Rule<{
2194
- readonly offering: Address;
2195
- readonly assets: bigint;
2196
- readonly rate: bigint;
2197
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2198
- readonly expiry: number;
2199
- readonly nonce: bigint;
2200
- readonly buy: boolean;
2201
- readonly chainId: bigint;
2202
- readonly loanToken: Address;
2203
- readonly start: number;
2204
- readonly collaterals: readonly {
2205
- asset: Address;
2206
- oracle: Address;
2207
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2208
- }[];
2209
- readonly callback: {
2210
- readonly address: Address;
2211
- readonly data: viem.Hex;
2212
- readonly gasLimit: bigint;
2177
+ dialect: "pg";
2178
+ }>;
2179
+ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
2180
+ name: "user_positions";
2181
+ schema: "router_v1.1";
2182
+ columns: {
2183
+ id: drizzle_orm_pg_core.PgColumn<{
2184
+ name: "id";
2185
+ tableName: "user_positions";
2186
+ dataType: "string";
2187
+ columnType: "PgVarchar";
2188
+ data: string;
2189
+ driverParam: string;
2190
+ notNull: true;
2191
+ hasDefault: false;
2192
+ isPrimaryKey: true;
2193
+ isAutoincrement: false;
2194
+ hasRuntimeDefault: false;
2195
+ enumValues: [string, ...string[]];
2196
+ baseColumn: never;
2197
+ identity: undefined;
2198
+ generated: undefined;
2199
+ }, {}, {
2200
+ length: 255;
2201
+ }>;
2202
+ availableLiquidityQueueId: drizzle_orm_pg_core.PgColumn<{
2203
+ name: "available_liquidity_queue_id";
2204
+ tableName: "user_positions";
2205
+ dataType: "string";
2206
+ columnType: "PgVarchar";
2207
+ data: string;
2208
+ driverParam: string;
2209
+ notNull: true;
2210
+ hasDefault: false;
2211
+ isPrimaryKey: false;
2212
+ isAutoincrement: false;
2213
+ hasRuntimeDefault: false;
2214
+ enumValues: [string, ...string[]];
2215
+ baseColumn: never;
2216
+ identity: undefined;
2217
+ generated: undefined;
2218
+ }, {}, {
2219
+ length: 255;
2220
+ }>;
2221
+ user: drizzle_orm_pg_core.PgColumn<{
2222
+ name: "user";
2223
+ tableName: "user_positions";
2224
+ dataType: "string";
2225
+ columnType: "PgVarchar";
2226
+ data: string;
2227
+ driverParam: string;
2228
+ notNull: true;
2229
+ hasDefault: false;
2230
+ isPrimaryKey: false;
2231
+ isAutoincrement: false;
2232
+ hasRuntimeDefault: false;
2233
+ enumValues: [string, ...string[]];
2234
+ baseColumn: never;
2235
+ identity: undefined;
2236
+ generated: undefined;
2237
+ }, {}, {
2238
+ length: 255;
2239
+ }>;
2240
+ chainId: drizzle_orm_pg_core.PgColumn<{
2241
+ name: "chain_id";
2242
+ tableName: "user_positions";
2243
+ dataType: "bigint";
2244
+ columnType: "PgBigInt64";
2245
+ data: bigint;
2246
+ driverParam: string;
2247
+ notNull: true;
2248
+ hasDefault: false;
2249
+ isPrimaryKey: false;
2250
+ isAutoincrement: false;
2251
+ hasRuntimeDefault: false;
2252
+ enumValues: undefined;
2253
+ baseColumn: never;
2254
+ identity: undefined;
2255
+ generated: undefined;
2256
+ }, {}, {}>;
2257
+ amount: drizzle_orm_pg_core.PgColumn<{
2258
+ name: "amount";
2259
+ tableName: "user_positions";
2260
+ dataType: "string";
2261
+ columnType: "PgNumeric";
2262
+ data: string;
2263
+ driverParam: string;
2264
+ notNull: true;
2265
+ hasDefault: false;
2266
+ isPrimaryKey: false;
2267
+ isAutoincrement: false;
2268
+ hasRuntimeDefault: false;
2269
+ enumValues: undefined;
2270
+ baseColumn: never;
2271
+ identity: undefined;
2272
+ generated: undefined;
2273
+ }, {}, {}>;
2274
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
2275
+ name: "updated_at";
2276
+ tableName: "user_positions";
2277
+ dataType: "date";
2278
+ columnType: "PgTimestamp";
2279
+ data: Date;
2280
+ driverParam: string;
2281
+ notNull: true;
2282
+ hasDefault: true;
2283
+ isPrimaryKey: false;
2284
+ isAutoincrement: false;
2285
+ hasRuntimeDefault: false;
2286
+ enumValues: undefined;
2287
+ baseColumn: never;
2288
+ identity: undefined;
2289
+ generated: undefined;
2290
+ }, {}, {}>;
2213
2291
  };
2214
- readonly hash: viem.Hex;
2215
- signature?: viem.Hex;
2216
- createdAt?: number;
2217
- }, "sell_offers_callback_collateral_invalid", MorphoContext>)[];
2218
-
2219
- type ValidationRule_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
2220
- type ValidationRule_MorphoContext = MorphoContext;
2221
- type ValidationRule_Rule<T, Name extends string = string, Ctx = void> = Rule<T, Name, Ctx>;
2222
- type ValidationRule_RuleNames<Rules extends readonly {
2223
- name: string;
2224
- }[]> = RuleNames<Rules>;
2225
- type ValidationRule_Single<T, RuleName extends string, Ctx = void> = Single<T, RuleName, Ctx>;
2226
- declare const ValidationRule_batch: typeof batch;
2227
- declare const ValidationRule_morpho: typeof morpho;
2228
- declare const ValidationRule_single: typeof single;
2229
- declare namespace ValidationRule {
2230
- export { type ValidationRule_Batch as Batch, type ValidationRule_MorphoContext as MorphoContext, type ValidationRule_Rule as Rule, type ValidationRule_RuleNames as RuleNames, type ValidationRule_Single as Single, ValidationRule_batch as batch, ValidationRule_morpho as morpho, ValidationRule_single as single };
2231
- }
2232
-
2233
- /**
2234
- * A validation issue.
2235
- */
2236
- type Issue<T, RuleName extends string = string> = {
2237
- /** The name of the rule that caused the issue. */
2238
- ruleName: RuleName;
2239
- /** The message of the issue. */
2240
- message: string;
2241
- /** The item that was not valid. */
2242
- item: T;
2243
- };
2244
- /**
2245
- * The result of a validation.
2246
- */
2247
- type Result<T, RuleName extends string = string> = {
2248
- /** The items that were valid. */
2249
- valid: T[];
2250
- /** The reports of the failed validations. */
2251
- issues: Issue<T, RuleName>[];
2252
- };
2253
- declare function run<T, Name extends string, Rules extends readonly Rule<T, Name, void>[]>(parameters: {
2254
- items: T[];
2255
- rules: Rules;
2256
- chunkSize?: number;
2257
- }): Promise<Result<T, RuleNames<Rules>>>;
2258
- declare function run<T, Ctx, Name extends string, Rules extends readonly Rule<T, Name, Ctx>[]>(parameters: {
2259
- items: T[];
2260
- rules: Rules;
2261
- ctx: Ctx;
2262
- chunkSize?: number;
2263
- }): Promise<Result<T, RuleNames<Rules>>>;
2292
+ dialect: "pg";
2293
+ }>;
2264
2294
 
2265
- type Validation_Issue<T, RuleName extends string = string> = Issue<T, RuleName>;
2266
- type Validation_Result<T, RuleName extends string = string> = Result<T, RuleName>;
2267
- declare const Validation_run: typeof run;
2268
- declare namespace Validation {
2269
- export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
2295
+ declare const schema_VERSION: typeof VERSION;
2296
+ declare const schema_availableLiquidityPools: typeof availableLiquidityPools;
2297
+ declare const schema_availableLiquidityQueues: typeof availableLiquidityQueues;
2298
+ declare const schema_collectorBlockNumbers: typeof collectorBlockNumbers;
2299
+ declare const schema_consumed: typeof consumed;
2300
+ declare const schema_offerCollaterals: typeof offerCollaterals;
2301
+ declare const schema_offerStatus: typeof offerStatus;
2302
+ declare const schema_offers: typeof offers;
2303
+ declare const schema_userPositions: typeof userPositions;
2304
+ declare namespace schema {
2305
+ export { schema_VERSION as VERSION, schema_availableLiquidityPools as availableLiquidityPools, schema_availableLiquidityQueues as availableLiquidityQueues, schema_collectorBlockNumbers as collectorBlockNumbers, schema_consumed as consumed, schema_offerCollaterals as offerCollaterals, schema_offerStatus as offerStatus, schema_offers as offers, schema_userPositions as userPositions };
2270
2306
  }
2271
2307
 
2272
- export { index$3 as ApiSchema, Callback, index$1 as Collector, CollectorBlockStore$1 as CollectorBlockStore, Cursor$1 as Cursor, Liquidity$1 as Liquidity, LiquidityStore$1 as LiquidityStore, Logger$1 as Logger, index$2 as OfferStore, schema as OffersSchema, PG$1 as PG, index as Router, RouterOffer$1 as RouterOffer, Services$1 as Services, Validation, ValidationRule };
2308
+ export { Callback, index$1 as Collector, CollectorBlockStore$1 as CollectorBlockStore, Cursor$1 as Cursor, Liquidity$1 as Liquidity, LiquidityStore$1 as LiquidityStore, Logger$1 as Logger, OfferStore$1 as OfferStore, schema as OffersSchema, PG$1 as PG, index as RouterApi, RouterOffer$1 as RouterOffer, Services$1 as Services, Validation, ValidationRule };