@morpho-dev/router 0.1.10 → 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 (28) 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/0005_snapshot.json → router_v1.1/meta/0000_snapshot.json} +76 -21
  4. package/dist/drizzle/router_v1.1/meta/_journal.json +13 -0
  5. package/dist/index.browser.d.cts +185 -143
  6. package/dist/index.browser.d.ts +185 -143
  7. package/dist/index.browser.js +808 -443
  8. package/dist/index.browser.js.map +1 -1
  9. package/dist/index.browser.mjs +810 -445
  10. package/dist/index.browser.mjs.map +1 -1
  11. package/dist/index.node.d.cts +1861 -1792
  12. package/dist/index.node.d.ts +1861 -1792
  13. package/dist/index.node.js +2921 -2384
  14. package/dist/index.node.js.map +1 -1
  15. package/dist/index.node.mjs +2923 -2385
  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/meta/0000_snapshot.json +0 -827
  24. package/dist/drizzle/offers_v1.1/meta/0001_snapshot.json +0 -827
  25. package/dist/drizzle/offers_v1.1/meta/0002_snapshot.json +0 -833
  26. package/dist/drizzle/offers_v1.1/meta/0003_snapshot.json +0 -833
  27. package/dist/drizzle/offers_v1.1/meta/0004_snapshot.json +0 -839
  28. package/dist/drizzle/offers_v1.1/meta/_journal.json +0 -48
@@ -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,127 +237,245 @@ 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
- 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;
280
291
  };
281
- type LiquidityPool = {
282
- id: string;
283
- amount: string;
284
- 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;
285
321
  };
286
- type LiquidityQueueWithPool = {
287
- queue: LiquidityQueue;
288
- pool: LiquidityPool;
322
+ type RouterApiClientConfig = {
323
+ readonly url: URL;
324
+ readonly headers: Headers;
289
325
  };
290
- type Liquidity = {
291
- userPosition: LiquidityUserPosition;
292
- queues: LiquidityQueueWithPool[];
293
- };
294
- declare function fetch(parameters: {
295
- client: Pick<PublicActions, "multicall">;
296
- chainId: bigint;
297
- spender: Address;
298
- type: CallbackType;
299
- pairs: Array<{
300
- user: Address;
301
- contract: Address;
326
+ type Client = Compute<RouterApiClientConfig & {
327
+ get: (parameters: GetParameters) => Promise<{
328
+ cursor: string | null;
329
+ offers: OfferResponse[];
302
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;
303
416
  options?: {
304
- batchSize?: number;
305
- retryAttempts?: number;
306
- retryDelayMs?: number;
307
- blockNumber?: number;
417
+ maxBatchSize?: number;
418
+ interval?: number;
308
419
  };
309
- }): Promise<Liquidity[]>;
310
- declare function serialize(liquidity: Liquidity): string;
420
+ }): Collector<"buy_with_empty_callback_liquidity">;
311
421
 
312
- type Liquidity$1_Liquidity = Liquidity;
313
- type Liquidity$1_LiquidityPool = LiquidityPool;
314
- type Liquidity$1_LiquidityQueue = LiquidityQueue;
315
- type Liquidity$1_LiquidityQueueWithPool = LiquidityQueueWithPool;
316
- type Liquidity$1_LiquidityUserPosition = LiquidityUserPosition;
317
- declare const Liquidity$1_fetch: typeof fetch;
318
- declare const Liquidity$1_fetchBalancesAndAllowances: typeof fetchBalancesAndAllowances;
319
- declare const Liquidity$1_serialize: typeof serialize;
320
- declare namespace Liquidity$1 {
321
- 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 };
322
- }
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">;
323
433
 
324
- declare enum CallbackType {
325
- BuyWithEmptyCallback = "buy_with_empty_callback",
326
- SellWithdrawFromWallet = "sell_withdraw_from_wallet"
327
- }
328
- declare const WhitelistedCallbackAddresses: Record<CallbackType, readonly string[]>;
329
- declare function buildLiquidity(parameters: {
330
- type: CallbackType;
331
- user: string;
332
- contract: string;
333
- chainId: bigint;
334
- amount: string | bigint;
335
- index?: number;
336
- updatedAt?: Date;
337
- }): Liquidity;
338
- declare function getCallbackIdForOffer(offer: Offer.Offer): string | null;
339
- declare function decode$1(parameters: {
340
- type: CallbackType;
341
- data: Hex;
342
- }): Array<{
343
- collateral: Address;
344
- amount: bigint;
345
- }>;
346
- declare function encode$1(parameters: {
347
- type: CallbackType;
348
- data: {
349
- collaterals: Address[];
350
- amounts: bigint[];
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;
351
443
  };
352
- }): Hex;
444
+ }): Collector<"consumed_events">;
353
445
 
354
- type Callback_CallbackType = CallbackType;
355
- declare const Callback_CallbackType: typeof CallbackType;
356
- declare const Callback_WhitelistedCallbackAddresses: typeof WhitelistedCallbackAddresses;
357
- declare const Callback_buildLiquidity: typeof buildLiquidity;
358
- declare const Callback_getCallbackIdForOffer: typeof getCallbackIdForOffer;
359
- declare namespace Callback {
360
- 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 };
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 };
361
479
  }
362
480
 
363
481
  type PgDB = ReturnType<typeof drizzle> & {
@@ -369,7 +487,7 @@ type PGLiteDB = ReturnType<typeof drizzle$1> & {
369
487
  pool: PGlite;
370
488
  };
371
489
  type PG = PgDB | PGLiteDB;
372
- declare function connect$1(parameters: {
490
+ declare function connect(parameters: {
373
491
  type: "pg";
374
492
  endpoint: string;
375
493
  } | {
@@ -383,8 +501,9 @@ type PG$1_PGLiteDB = PGLiteDB;
383
501
  type PG$1_PgDB = PgDB;
384
502
  declare const PG$1_applyMigrations: typeof applyMigrations;
385
503
  declare const PG$1_clean: typeof clean;
504
+ declare const PG$1_connect: typeof connect;
386
505
  declare namespace PG$1 {
387
- 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 };
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 };
388
507
  }
389
508
 
390
509
  type CollectorBlockStore = {
@@ -401,56 +520,188 @@ type CollectorBlockStore = {
401
520
  }) => Promise<void>;
402
521
  };
403
522
  /** Postgres implementation. */
404
- declare const create$2: (config: {
523
+ declare const create$3: (config: {
405
524
  db: PG;
406
525
  }) => CollectorBlockStore;
407
526
  declare function memory$1(): CollectorBlockStore;
408
527
 
409
528
  type CollectorBlockStore$1_CollectorBlockStore = CollectorBlockStore;
410
529
  declare namespace CollectorBlockStore$1 {
411
- export { type CollectorBlockStore$1_CollectorBlockStore as CollectorBlockStore, create$2 as create, memory$1 as memory };
530
+ export { type CollectorBlockStore$1_CollectorBlockStore as CollectorBlockStore, create$3 as create, memory$1 as memory };
412
531
  }
413
532
 
414
- type LiquidityStore = {
415
- /** Get a liquidity entry by user position id, including queues and pools. */
416
- getByUserPositionId: (parameters: {
417
- userPositionId: string;
418
- }) => Promise<Liquidity | null>;
419
- /** Get all liquidity entries, grouped by user position, including queues and pools. */
420
- getAll: () => Promise<Liquidity[]>;
421
- /** Save or update a liquidity entry (transactional upsert across all three tables). */
422
- save: (parameters: {
423
- liquidity: Liquidity;
424
- }) => Promise<void>;
533
+ type LiquidityUserPosition = {
534
+ id: string;
535
+ availableLiquidityQueueId: string;
536
+ user: string;
537
+ chainId: bigint;
538
+ amount: string;
539
+ updatedAt: Date;
425
540
  };
426
- /** Postgres implementation. */
427
- declare const create$1: (config: {
428
- db: PG;
429
- }) => LiquidityStore;
430
- declare function memory(): LiquidityStore;
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 = {
558
+ userPosition: LiquidityUserPosition;
559
+ queues: LiquidityQueueWithPool[];
560
+ };
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: {
594
+ client: Pick<PublicActions, "multicall">;
595
+ }) => LiquidityClient;
596
+ declare function serialize(liquidity: Liquidity): string;
431
597
 
432
- type LiquidityStore$1_LiquidityStore = LiquidityStore;
433
- declare const LiquidityStore$1_memory: typeof memory;
434
- declare namespace LiquidityStore$1 {
435
- export { type LiquidityStore$1_LiquidityStore as LiquidityStore, create$1 as create, LiquidityStore$1_memory as memory };
598
+ type Liquidity$1_Liquidity = Liquidity;
599
+ type Liquidity$1_LiquidityClient = LiquidityClient;
600
+ type Liquidity$1_LiquidityPool = LiquidityPool;
601
+ type Liquidity$1_LiquidityQueue = LiquidityQueue;
602
+ type Liquidity$1_LiquidityQueueWithPool = LiquidityQueueWithPool;
603
+ type Liquidity$1_LiquidityUserPosition = LiquidityUserPosition;
604
+ declare const Liquidity$1_serialize: typeof serialize;
605
+ declare namespace Liquidity$1 {
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 };
436
607
  }
437
608
 
438
- /**
439
- * The `OfferStore` is responsible for managing offer data in the database.
440
- */
441
- type OfferStore = {
442
- /** Create a single offer in the database. */
443
- create: (parameters: {
444
- offer: Offer.Offer;
445
- status: OfferStatus;
446
- metadata?: OfferMetadata;
447
- }) => Promise<string>;
448
- /** Create multiple offers in the database. */
449
- createMany: (parameters: {
450
- offer: Offer.Offer;
451
- status: OfferStatus;
452
- metadata?: OfferMetadata;
453
- }[]) => Promise<string[]>;
609
+ declare enum CallbackType {
610
+ BuyWithEmptyCallback = "buy_with_empty_callback",
611
+ SellERC20Callback = "sell_erc20_callback"
612
+ }
613
+ declare const WhitelistedCallbackAddresses: Record<CallbackType, readonly string[]>;
614
+ type BuildLiquidityParameters = {
615
+ type: CallbackType.BuyWithEmptyCallback;
616
+ user: Address;
617
+ loanToken: Address;
618
+ chainId: Chain.Id;
619
+ amount: bigint;
620
+ index?: number;
621
+ updatedAt?: Date;
622
+ } | {
623
+ type: CallbackType.SellERC20Callback;
624
+ user: Address;
625
+ termId: string;
626
+ offerHash: string;
627
+ chainId: Chain.Id;
628
+ amount: bigint;
629
+ collaterals: Array<{
630
+ collateralAddress: Address;
631
+ balance: bigint;
632
+ callbackAmount: bigint;
633
+ }>;
634
+ index?: number;
635
+ updatedAt?: Date;
636
+ };
637
+ declare function buildLiquidity(parameters: BuildLiquidityParameters): Liquidity;
638
+ declare function getCallbackIdForOffer(offer: Offer.Offer): string | null;
639
+ declare function decode$1(parameters: {
640
+ type: CallbackType;
641
+ data: Hex;
642
+ }): Array<{
643
+ collateral: Address;
644
+ amount: bigint;
645
+ }>;
646
+ declare function encode$1(parameters: {
647
+ type: CallbackType;
648
+ data: {
649
+ collaterals: Address[];
650
+ amounts: bigint[];
651
+ };
652
+ }): Hex;
653
+
654
+ type Callback_CallbackType = CallbackType;
655
+ declare const Callback_CallbackType: typeof CallbackType;
656
+ declare const Callback_WhitelistedCallbackAddresses: typeof WhitelistedCallbackAddresses;
657
+ declare const Callback_buildLiquidity: typeof buildLiquidity;
658
+ declare const Callback_getCallbackIdForOffer: typeof getCallbackIdForOffer;
659
+ declare namespace Callback {
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 };
661
+ }
662
+
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>;
676
+ };
677
+ /** Postgres implementation. */
678
+ declare const create$1: (config: {
679
+ db: PG;
680
+ }) => LiquidityStore;
681
+ declare function memory(): LiquidityStore;
682
+
683
+ type LiquidityStore$1_LiquidityStore = LiquidityStore;
684
+ declare const LiquidityStore$1_memory: typeof memory;
685
+ declare namespace LiquidityStore$1 {
686
+ export { type LiquidityStore$1_LiquidityStore as LiquidityStore, create$1 as create, LiquidityStore$1_memory as memory };
687
+ }
688
+
689
+ /**
690
+ * The `OfferStore` is responsible for managing offer data in the database.
691
+ */
692
+ type OfferStore = {
693
+ /** Create a single offer in the database. */
694
+ create: (parameters: {
695
+ offer: Offer.Offer;
696
+ status: OfferStatus;
697
+ metadata?: OfferMetadata;
698
+ }) => Promise<string>;
699
+ /** Create multiple offers in the database. */
700
+ createMany: (parameters: {
701
+ offer: Offer.Offer;
702
+ status: OfferStatus;
703
+ metadata?: OfferMetadata;
704
+ }[]) => Promise<string[]>;
454
705
  /** Get all offers from the database with optional filtering, sorting, and pagination. */
455
706
  getAll: (params?: GetAllParams) => Promise<{
456
707
  offers: RouterOffer[];
@@ -530,130 +781,188 @@ type FindMatchingOffersParams = {
530
781
  type GetAllParams = {
531
782
  query?: GetOffersFilters;
532
783
  };
533
-
534
784
  type PgConfig = {
535
785
  /** The database instance to use for operations. */
536
786
  db: PG;
537
787
  };
538
788
  declare function create(config: PgConfig): OfferStore;
539
789
 
540
- type index$2_FindMatchingOffersParams = FindMatchingOffersParams;
541
- type index$2_GetAllParams = GetAllParams;
542
- type index$2_GetOffersFilters = GetOffersFilters;
543
- type index$2_OfferStore = OfferStore;
544
- type index$2_PgConfig = PgConfig;
545
- declare const index$2_create: typeof create;
546
- declare namespace index$2 {
547
- 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 };
548
798
  }
549
799
 
550
- type Name = "mempool_offers" | "consumed_events" | "buy_with_empty_callback_liquidity" | "chain_reorgs";
551
- /** A general collector interface. */
552
- type Collector<name extends Name = Name> = {
553
- /** The name of the collector. */
554
- name: name;
555
- /** Start collecting data from external sources.
556
- * @yields The last block number processed by the collector.
557
- */
558
- collect: () => AsyncGenerator<number, void, void>;
559
- /** The last block number processed by the collector. */
560
- lastSyncedBlock: () => Promise<number>;
561
- /** The callback to call when a reorg is detected. */
562
- onReorg(lastFinalizedBlockNumber: number): void;
563
- };
564
- /** Start a collector.
565
- * @param collector - The collector to start.
566
- * @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
+ * ```
567
807
  */
568
- declare function start(collector: Collector): () => void;
569
-
570
- declare function createBuyWithEmptyCallbackLiquidityCollector(params: {
571
- client: WalletClient;
572
- offerStore: OfferStore;
573
- collectorBlockStore: CollectorBlockStore;
574
- liquidityStore: LiquidityStore;
575
- chain: Chain.Chain;
576
- options?: {
577
- maxBatchSize?: number;
578
- 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;
579
825
  };
580
- }): Collector<"buy_with_empty_callback_liquidity">;
581
-
582
- declare function createChainReorgsCollector(parameters: {
583
- client: PublicClient;
584
- subscribers: Collector[];
585
- collectorStore: CollectorBlockStore;
586
- chain: Chain.Chain;
587
- options?: {
588
- maxBatchSize?: number;
589
- interval?: 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;
590
832
  };
591
- }): Collector<"chain_reorgs">;
592
-
593
- declare function createConsumedEventsCollector(parameters: {
594
- client: PublicClient;
595
- contractAddress: Address;
596
- offerStore: OfferStore;
597
- collectorBlockStore: CollectorBlockStore;
598
- chainId: Chain.Id;
599
- options?: {
600
- maxBatchSize?: number;
601
- interval?: number;
833
+ } as ({
834
+ status: string;
835
+ cursor: string | null | undefined;
836
+ data: T | T[];
837
+ meta: {
838
+ timestamp: string;
602
839
  };
603
- }): Collector<"consumed_events">;
604
-
605
- declare function createMempoolCollector(parameters: {
606
- mempool: Mempool.Client;
607
- offerStore: OfferStore;
608
- collectorBlockStore: CollectorBlockStore;
609
- chain: Chain.Chain;
610
- options?: {
611
- maxBatchSize?: number;
612
- 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;
613
846
  };
614
- }): Collector<"mempool_offers">;
615
-
616
- type index$1_Collector<name extends Name = Name> = Collector<name>;
617
- type index$1_Name = Name;
618
- declare const index$1_createBuyWithEmptyCallbackLiquidityCollector: typeof createBuyWithEmptyCallbackLiquidityCollector;
619
- declare const index$1_createChainReorgsCollector: typeof createChainReorgsCollector;
620
- declare const index$1_createConsumedEventsCollector: typeof createConsumedEventsCollector;
621
- declare const index$1_createMempoolCollector: typeof createMempoolCollector;
622
- declare const index$1_start: typeof start;
623
- declare namespace index$1 {
624
- 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 };
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);
625
881
  }
626
-
627
- type Cursor = {
628
- sort: "rate" | "maturity" | "expiry" | "amount";
629
- dir: "asc" | "desc";
630
- rate?: string;
631
- maturity?: number;
632
- expiry?: number;
633
- assets?: string;
634
- hash: string;
635
- };
636
- declare function validate(cursor: unknown): cursor is Cursor;
637
- declare function encode(c: Cursor): string;
638
- declare function decode(token?: string): Cursor | null;
639
-
640
- type Cursor$1_Cursor = Cursor;
641
- declare const Cursor$1_decode: typeof decode;
642
- declare const Cursor$1_encode: typeof encode;
643
- declare const Cursor$1_validate: typeof validate;
644
- declare namespace Cursor$1 {
645
- export { type Cursor$1_Cursor as Cursor, Cursor$1_decode as decode, Cursor$1_encode as encode, Cursor$1_validate as validate };
882
+ declare class ValidationError extends APIError {
883
+ constructor(message: string, details?: unknown);
646
884
  }
647
-
648
- declare const LogLevelValues: readonly ["silent", "trace", "debug", "info", "warn", "error", "fatal"];
649
- type LogLevel = (typeof LogLevelValues)[number];
650
- type LogEntry = Compute<{
651
- msg: string;
652
- } & Record<string, unknown>>;
653
- type LogFn = (entry: LogEntry) => void;
654
- type Logger = {
655
- trace: LogFn;
656
- debug: LogFn;
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;
895
+
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 };
934
+ }
935
+
936
+ type Cursor = {
937
+ sort: "rate" | "maturity" | "expiry" | "amount";
938
+ dir: "asc" | "desc";
939
+ rate?: string;
940
+ maturity?: number;
941
+ expiry?: number;
942
+ assets?: string;
943
+ hash: string;
944
+ };
945
+ declare function validate(cursor: unknown): cursor is Cursor;
946
+ declare function encode(c: Cursor): string;
947
+ declare function decode(token?: string): Cursor | null;
948
+
949
+ type Cursor$1_Cursor = Cursor;
950
+ declare const Cursor$1_decode: typeof decode;
951
+ declare const Cursor$1_encode: typeof encode;
952
+ declare const Cursor$1_validate: typeof validate;
953
+ declare namespace Cursor$1 {
954
+ export { type Cursor$1_Cursor as Cursor, Cursor$1_decode as decode, Cursor$1_encode as encode, Cursor$1_validate as validate };
955
+ }
956
+
957
+ declare const LogLevelValues: readonly ["trace", "debug", "info", "warn", "error", "fatal", "silent"];
958
+ type LogLevel = (typeof LogLevelValues)[number];
959
+ type LogEntry = Compute<{
960
+ msg: string;
961
+ } & Record<string, unknown>>;
962
+ type LogFn = (entry: LogEntry) => void;
963
+ type Logger = {
964
+ trace: LogFn;
965
+ debug: LogFn;
657
966
  info: LogFn;
658
967
  warn: LogFn;
659
968
  error: LogFn;
@@ -677,1246 +986,6 @@ declare namespace Logger$1 {
677
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 };
678
987
  }
679
988
 
680
- declare const VERSION = "offers_v1.1";
681
- declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
682
- name: "offers";
683
- schema: "offers_v1.1";
684
- columns: {
685
- hash: drizzle_orm_pg_core.PgColumn<{
686
- name: "hash";
687
- tableName: "offers";
688
- dataType: "string";
689
- columnType: "PgVarchar";
690
- data: string;
691
- driverParam: string;
692
- notNull: true;
693
- hasDefault: false;
694
- isPrimaryKey: true;
695
- isAutoincrement: false;
696
- hasRuntimeDefault: false;
697
- enumValues: [string, ...string[]];
698
- baseColumn: never;
699
- identity: undefined;
700
- generated: undefined;
701
- }, {}, {
702
- length: 66;
703
- }>;
704
- offering: drizzle_orm_pg_core.PgColumn<{
705
- name: "offering";
706
- tableName: "offers";
707
- dataType: "string";
708
- columnType: "PgVarchar";
709
- data: string;
710
- driverParam: string;
711
- notNull: true;
712
- hasDefault: false;
713
- isPrimaryKey: false;
714
- isAutoincrement: false;
715
- hasRuntimeDefault: false;
716
- enumValues: [string, ...string[]];
717
- baseColumn: never;
718
- identity: undefined;
719
- generated: undefined;
720
- }, {}, {
721
- length: 42;
722
- }>;
723
- assets: drizzle_orm_pg_core.PgColumn<{
724
- name: "assets";
725
- tableName: "offers";
726
- dataType: "string";
727
- columnType: "PgNumeric";
728
- data: string;
729
- driverParam: string;
730
- notNull: true;
731
- hasDefault: false;
732
- isPrimaryKey: false;
733
- isAutoincrement: false;
734
- hasRuntimeDefault: false;
735
- enumValues: undefined;
736
- baseColumn: never;
737
- identity: undefined;
738
- generated: undefined;
739
- }, {}, {}>;
740
- rate: drizzle_orm_pg_core.PgColumn<{
741
- name: "rate";
742
- tableName: "offers";
743
- dataType: "bigint";
744
- columnType: "PgBigInt64";
745
- data: bigint;
746
- driverParam: string;
747
- notNull: true;
748
- hasDefault: false;
749
- isPrimaryKey: false;
750
- isAutoincrement: false;
751
- hasRuntimeDefault: false;
752
- enumValues: undefined;
753
- baseColumn: never;
754
- identity: undefined;
755
- generated: undefined;
756
- }, {}, {}>;
757
- maturity: drizzle_orm_pg_core.PgColumn<{
758
- name: "maturity";
759
- tableName: "offers";
760
- dataType: "number";
761
- columnType: "PgInteger";
762
- data: number;
763
- driverParam: string | number;
764
- notNull: true;
765
- hasDefault: false;
766
- isPrimaryKey: false;
767
- isAutoincrement: false;
768
- hasRuntimeDefault: false;
769
- enumValues: undefined;
770
- baseColumn: never;
771
- identity: undefined;
772
- generated: undefined;
773
- }, {}, {}>;
774
- expiry: drizzle_orm_pg_core.PgColumn<{
775
- name: "expiry";
776
- tableName: "offers";
777
- dataType: "number";
778
- columnType: "PgInteger";
779
- data: number;
780
- driverParam: string | number;
781
- notNull: true;
782
- hasDefault: false;
783
- isPrimaryKey: false;
784
- isAutoincrement: false;
785
- hasRuntimeDefault: false;
786
- enumValues: undefined;
787
- baseColumn: never;
788
- identity: undefined;
789
- generated: undefined;
790
- }, {}, {}>;
791
- start: drizzle_orm_pg_core.PgColumn<{
792
- name: "start";
793
- tableName: "offers";
794
- dataType: "number";
795
- columnType: "PgInteger";
796
- data: number;
797
- driverParam: string | number;
798
- notNull: true;
799
- hasDefault: false;
800
- isPrimaryKey: false;
801
- isAutoincrement: false;
802
- hasRuntimeDefault: false;
803
- enumValues: undefined;
804
- baseColumn: never;
805
- identity: undefined;
806
- generated: undefined;
807
- }, {}, {}>;
808
- nonce: drizzle_orm_pg_core.PgColumn<{
809
- name: "nonce";
810
- tableName: "offers";
811
- dataType: "bigint";
812
- columnType: "PgBigInt64";
813
- data: bigint;
814
- driverParam: string;
815
- notNull: true;
816
- hasDefault: false;
817
- isPrimaryKey: false;
818
- isAutoincrement: false;
819
- hasRuntimeDefault: false;
820
- enumValues: undefined;
821
- baseColumn: never;
822
- identity: undefined;
823
- generated: undefined;
824
- }, {}, {}>;
825
- buy: drizzle_orm_pg_core.PgColumn<{
826
- name: "buy";
827
- tableName: "offers";
828
- dataType: "boolean";
829
- columnType: "PgBoolean";
830
- data: boolean;
831
- driverParam: boolean;
832
- notNull: true;
833
- hasDefault: false;
834
- isPrimaryKey: false;
835
- isAutoincrement: false;
836
- hasRuntimeDefault: false;
837
- enumValues: undefined;
838
- baseColumn: never;
839
- identity: undefined;
840
- generated: undefined;
841
- }, {}, {}>;
842
- chainId: drizzle_orm_pg_core.PgColumn<{
843
- name: "chain_id";
844
- tableName: "offers";
845
- dataType: "bigint";
846
- columnType: "PgBigInt64";
847
- data: bigint;
848
- driverParam: string;
849
- notNull: true;
850
- hasDefault: false;
851
- isPrimaryKey: false;
852
- isAutoincrement: false;
853
- hasRuntimeDefault: false;
854
- enumValues: undefined;
855
- baseColumn: never;
856
- identity: undefined;
857
- generated: undefined;
858
- }, {}, {}>;
859
- loanToken: drizzle_orm_pg_core.PgColumn<{
860
- name: "loan_token";
861
- tableName: "offers";
862
- dataType: "string";
863
- columnType: "PgVarchar";
864
- data: string;
865
- driverParam: string;
866
- notNull: true;
867
- hasDefault: false;
868
- isPrimaryKey: false;
869
- isAutoincrement: false;
870
- hasRuntimeDefault: false;
871
- enumValues: [string, ...string[]];
872
- baseColumn: never;
873
- identity: undefined;
874
- generated: undefined;
875
- }, {}, {
876
- length: 42;
877
- }>;
878
- callbackAddress: drizzle_orm_pg_core.PgColumn<{
879
- name: "callback_address";
880
- tableName: "offers";
881
- dataType: "string";
882
- columnType: "PgVarchar";
883
- data: string;
884
- driverParam: string;
885
- notNull: true;
886
- hasDefault: false;
887
- isPrimaryKey: false;
888
- isAutoincrement: false;
889
- hasRuntimeDefault: false;
890
- enumValues: [string, ...string[]];
891
- baseColumn: never;
892
- identity: undefined;
893
- generated: undefined;
894
- }, {}, {
895
- length: 42;
896
- }>;
897
- callbackData: drizzle_orm_pg_core.PgColumn<{
898
- name: "callback_data";
899
- tableName: "offers";
900
- dataType: "string";
901
- columnType: "PgText";
902
- data: string;
903
- driverParam: string;
904
- notNull: true;
905
- hasDefault: false;
906
- isPrimaryKey: false;
907
- isAutoincrement: false;
908
- hasRuntimeDefault: false;
909
- enumValues: [string, ...string[]];
910
- baseColumn: never;
911
- identity: undefined;
912
- generated: undefined;
913
- }, {}, {}>;
914
- callbackGasLimit: drizzle_orm_pg_core.PgColumn<{
915
- name: "callback_gas_limit";
916
- tableName: "offers";
917
- dataType: "bigint";
918
- columnType: "PgBigInt64";
919
- data: bigint;
920
- driverParam: string;
921
- notNull: true;
922
- hasDefault: false;
923
- isPrimaryKey: false;
924
- isAutoincrement: false;
925
- hasRuntimeDefault: false;
926
- enumValues: undefined;
927
- baseColumn: never;
928
- identity: undefined;
929
- generated: undefined;
930
- }, {}, {}>;
931
- signature: drizzle_orm_pg_core.PgColumn<{
932
- name: "signature";
933
- tableName: "offers";
934
- dataType: "string";
935
- columnType: "PgVarchar";
936
- data: string;
937
- driverParam: string;
938
- notNull: false;
939
- hasDefault: false;
940
- isPrimaryKey: false;
941
- isAutoincrement: false;
942
- hasRuntimeDefault: false;
943
- enumValues: [string, ...string[]];
944
- baseColumn: never;
945
- identity: undefined;
946
- generated: undefined;
947
- }, {}, {
948
- length: 132;
949
- }>;
950
- callbackId: drizzle_orm_pg_core.PgColumn<{
951
- name: "callback_id";
952
- tableName: "offers";
953
- dataType: "string";
954
- columnType: "PgVarchar";
955
- data: string;
956
- driverParam: string;
957
- notNull: false;
958
- hasDefault: false;
959
- isPrimaryKey: false;
960
- isAutoincrement: false;
961
- hasRuntimeDefault: false;
962
- enumValues: [string, ...string[]];
963
- baseColumn: never;
964
- identity: undefined;
965
- generated: undefined;
966
- }, {}, {
967
- length: 256;
968
- }>;
969
- createdAt: drizzle_orm_pg_core.PgColumn<{
970
- name: "created_at";
971
- tableName: "offers";
972
- dataType: "date";
973
- columnType: "PgTimestamp";
974
- data: Date;
975
- driverParam: string;
976
- notNull: true;
977
- hasDefault: true;
978
- isPrimaryKey: false;
979
- isAutoincrement: false;
980
- hasRuntimeDefault: false;
981
- enumValues: undefined;
982
- baseColumn: never;
983
- identity: undefined;
984
- generated: undefined;
985
- }, {}, {}>;
986
- };
987
- dialect: "pg";
988
- }>;
989
- declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
990
- name: "offer_collaterals";
991
- schema: "offers_v1.1";
992
- columns: {
993
- id: drizzle_orm_pg_core.PgColumn<{
994
- name: "id";
995
- tableName: "offer_collaterals";
996
- dataType: "number";
997
- columnType: "PgSerial";
998
- data: number;
999
- driverParam: number;
1000
- notNull: true;
1001
- hasDefault: true;
1002
- isPrimaryKey: true;
1003
- isAutoincrement: false;
1004
- hasRuntimeDefault: false;
1005
- enumValues: undefined;
1006
- baseColumn: never;
1007
- identity: undefined;
1008
- generated: undefined;
1009
- }, {}, {}>;
1010
- offerHash: drizzle_orm_pg_core.PgColumn<{
1011
- name: "offer_hash";
1012
- tableName: "offer_collaterals";
1013
- dataType: "string";
1014
- columnType: "PgVarchar";
1015
- data: string;
1016
- driverParam: string;
1017
- notNull: true;
1018
- hasDefault: false;
1019
- isPrimaryKey: false;
1020
- isAutoincrement: false;
1021
- hasRuntimeDefault: false;
1022
- enumValues: [string, ...string[]];
1023
- baseColumn: never;
1024
- identity: undefined;
1025
- generated: undefined;
1026
- }, {}, {
1027
- length: 66;
1028
- }>;
1029
- asset: drizzle_orm_pg_core.PgColumn<{
1030
- name: "asset";
1031
- tableName: "offer_collaterals";
1032
- dataType: "string";
1033
- columnType: "PgVarchar";
1034
- data: string;
1035
- driverParam: string;
1036
- notNull: true;
1037
- hasDefault: false;
1038
- isPrimaryKey: false;
1039
- isAutoincrement: false;
1040
- hasRuntimeDefault: false;
1041
- enumValues: [string, ...string[]];
1042
- baseColumn: never;
1043
- identity: undefined;
1044
- generated: undefined;
1045
- }, {}, {
1046
- length: 42;
1047
- }>;
1048
- oracle: drizzle_orm_pg_core.PgColumn<{
1049
- name: "oracle";
1050
- tableName: "offer_collaterals";
1051
- dataType: "string";
1052
- columnType: "PgVarchar";
1053
- data: string;
1054
- driverParam: string;
1055
- notNull: true;
1056
- hasDefault: false;
1057
- isPrimaryKey: false;
1058
- isAutoincrement: false;
1059
- hasRuntimeDefault: false;
1060
- enumValues: [string, ...string[]];
1061
- baseColumn: never;
1062
- identity: undefined;
1063
- generated: undefined;
1064
- }, {}, {
1065
- length: 42;
1066
- }>;
1067
- lltv: drizzle_orm_pg_core.PgColumn<{
1068
- name: "lltv";
1069
- tableName: "offer_collaterals";
1070
- dataType: "bigint";
1071
- columnType: "PgBigInt64";
1072
- data: bigint;
1073
- driverParam: string;
1074
- notNull: true;
1075
- hasDefault: false;
1076
- isPrimaryKey: false;
1077
- isAutoincrement: false;
1078
- hasRuntimeDefault: false;
1079
- enumValues: undefined;
1080
- baseColumn: never;
1081
- identity: undefined;
1082
- generated: undefined;
1083
- }, {}, {}>;
1084
- };
1085
- dialect: "pg";
1086
- }>;
1087
- declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
1088
- name: "offer_status";
1089
- schema: "offers_v1.1";
1090
- columns: {
1091
- id: drizzle_orm_pg_core.PgColumn<{
1092
- name: "id";
1093
- tableName: "offer_status";
1094
- dataType: "number";
1095
- columnType: "PgSerial";
1096
- data: number;
1097
- driverParam: number;
1098
- notNull: true;
1099
- hasDefault: true;
1100
- isPrimaryKey: true;
1101
- isAutoincrement: false;
1102
- hasRuntimeDefault: false;
1103
- enumValues: undefined;
1104
- baseColumn: never;
1105
- identity: undefined;
1106
- generated: undefined;
1107
- }, {}, {}>;
1108
- offerHash: drizzle_orm_pg_core.PgColumn<{
1109
- name: "offer_hash";
1110
- tableName: "offer_status";
1111
- dataType: "string";
1112
- columnType: "PgVarchar";
1113
- data: string;
1114
- driverParam: string;
1115
- notNull: true;
1116
- hasDefault: false;
1117
- isPrimaryKey: false;
1118
- isAutoincrement: false;
1119
- hasRuntimeDefault: false;
1120
- enumValues: [string, ...string[]];
1121
- baseColumn: never;
1122
- identity: undefined;
1123
- generated: undefined;
1124
- }, {}, {
1125
- length: 66;
1126
- }>;
1127
- status: drizzle_orm_pg_core.PgColumn<{
1128
- name: "status";
1129
- tableName: "offer_status";
1130
- dataType: "string";
1131
- columnType: "PgText";
1132
- data: "valid" | "callback_not_supported" | "callback_error" | "unverified";
1133
- driverParam: string;
1134
- notNull: true;
1135
- hasDefault: false;
1136
- isPrimaryKey: false;
1137
- isAutoincrement: false;
1138
- hasRuntimeDefault: false;
1139
- enumValues: [string, ...string[]];
1140
- baseColumn: never;
1141
- identity: undefined;
1142
- generated: undefined;
1143
- }, {}, {
1144
- $type: "valid" | "callback_not_supported" | "callback_error" | "unverified";
1145
- }>;
1146
- metadata: drizzle_orm_pg_core.PgColumn<{
1147
- name: "metadata";
1148
- tableName: "offer_status";
1149
- dataType: "json";
1150
- columnType: "PgJsonb";
1151
- data: unknown;
1152
- driverParam: unknown;
1153
- notNull: false;
1154
- hasDefault: false;
1155
- isPrimaryKey: false;
1156
- isAutoincrement: false;
1157
- hasRuntimeDefault: false;
1158
- enumValues: undefined;
1159
- baseColumn: never;
1160
- identity: undefined;
1161
- generated: undefined;
1162
- }, {}, {}>;
1163
- createdAt: drizzle_orm_pg_core.PgColumn<{
1164
- name: "created_at";
1165
- tableName: "offer_status";
1166
- dataType: "date";
1167
- columnType: "PgTimestamp";
1168
- data: Date;
1169
- driverParam: string;
1170
- notNull: true;
1171
- hasDefault: true;
1172
- isPrimaryKey: false;
1173
- isAutoincrement: false;
1174
- hasRuntimeDefault: false;
1175
- enumValues: undefined;
1176
- baseColumn: never;
1177
- identity: undefined;
1178
- generated: undefined;
1179
- }, {}, {}>;
1180
- };
1181
- dialect: "pg";
1182
- }>;
1183
- declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
1184
- name: "consumed_per_user_and_nonce";
1185
- schema: "offers_v1.1";
1186
- columns: {
1187
- id: drizzle_orm_pg_core.PgColumn<{
1188
- name: "id";
1189
- tableName: "consumed_per_user_and_nonce";
1190
- dataType: "string";
1191
- columnType: "PgVarchar";
1192
- data: string;
1193
- driverParam: string;
1194
- notNull: true;
1195
- hasDefault: false;
1196
- isPrimaryKey: true;
1197
- isAutoincrement: false;
1198
- hasRuntimeDefault: false;
1199
- enumValues: [string, ...string[]];
1200
- baseColumn: never;
1201
- identity: undefined;
1202
- generated: undefined;
1203
- }, {}, {
1204
- length: 255;
1205
- }>;
1206
- chainId: drizzle_orm_pg_core.PgColumn<{
1207
- name: "chain_id";
1208
- tableName: "consumed_per_user_and_nonce";
1209
- dataType: "bigint";
1210
- columnType: "PgBigInt64";
1211
- data: bigint;
1212
- driverParam: string;
1213
- notNull: true;
1214
- hasDefault: false;
1215
- isPrimaryKey: false;
1216
- isAutoincrement: false;
1217
- hasRuntimeDefault: false;
1218
- enumValues: undefined;
1219
- baseColumn: never;
1220
- identity: undefined;
1221
- generated: undefined;
1222
- }, {}, {}>;
1223
- offering: drizzle_orm_pg_core.PgColumn<{
1224
- name: "offering";
1225
- tableName: "consumed_per_user_and_nonce";
1226
- dataType: "string";
1227
- columnType: "PgVarchar";
1228
- data: string;
1229
- driverParam: string;
1230
- notNull: true;
1231
- hasDefault: false;
1232
- isPrimaryKey: false;
1233
- isAutoincrement: false;
1234
- hasRuntimeDefault: false;
1235
- enumValues: [string, ...string[]];
1236
- baseColumn: never;
1237
- identity: undefined;
1238
- generated: undefined;
1239
- }, {}, {
1240
- length: 42;
1241
- }>;
1242
- nonce: drizzle_orm_pg_core.PgColumn<{
1243
- name: "nonce";
1244
- tableName: "consumed_per_user_and_nonce";
1245
- dataType: "bigint";
1246
- columnType: "PgBigInt64";
1247
- data: bigint;
1248
- driverParam: string;
1249
- notNull: true;
1250
- hasDefault: false;
1251
- isPrimaryKey: false;
1252
- isAutoincrement: false;
1253
- hasRuntimeDefault: false;
1254
- enumValues: undefined;
1255
- baseColumn: never;
1256
- identity: undefined;
1257
- generated: undefined;
1258
- }, {}, {}>;
1259
- consumed: drizzle_orm_pg_core.PgColumn<{
1260
- name: "consumed";
1261
- tableName: "consumed_per_user_and_nonce";
1262
- dataType: "string";
1263
- columnType: "PgNumeric";
1264
- data: string;
1265
- driverParam: string;
1266
- notNull: true;
1267
- hasDefault: false;
1268
- isPrimaryKey: false;
1269
- isAutoincrement: false;
1270
- hasRuntimeDefault: false;
1271
- enumValues: undefined;
1272
- baseColumn: never;
1273
- identity: undefined;
1274
- generated: undefined;
1275
- }, {}, {}>;
1276
- createdAt: drizzle_orm_pg_core.PgColumn<{
1277
- name: "created_at";
1278
- tableName: "consumed_per_user_and_nonce";
1279
- dataType: "date";
1280
- columnType: "PgTimestamp";
1281
- data: Date;
1282
- driverParam: string;
1283
- notNull: true;
1284
- hasDefault: true;
1285
- isPrimaryKey: false;
1286
- isAutoincrement: false;
1287
- hasRuntimeDefault: false;
1288
- enumValues: undefined;
1289
- baseColumn: never;
1290
- identity: undefined;
1291
- generated: undefined;
1292
- }, {}, {}>;
1293
- };
1294
- dialect: "pg";
1295
- }>;
1296
- declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
1297
- name: "collector_block_numbers";
1298
- schema: "offers_v1.1";
1299
- columns: {
1300
- chainId: drizzle_orm_pg_core.PgColumn<{
1301
- name: "chain_id";
1302
- tableName: "collector_block_numbers";
1303
- dataType: "bigint";
1304
- columnType: "PgBigInt64";
1305
- data: bigint;
1306
- driverParam: string;
1307
- notNull: true;
1308
- hasDefault: false;
1309
- isPrimaryKey: false;
1310
- isAutoincrement: false;
1311
- hasRuntimeDefault: false;
1312
- enumValues: undefined;
1313
- baseColumn: never;
1314
- identity: undefined;
1315
- generated: undefined;
1316
- }, {}, {}>;
1317
- name: drizzle_orm_pg_core.PgColumn<{
1318
- name: "name";
1319
- tableName: "collector_block_numbers";
1320
- dataType: "string";
1321
- columnType: "PgText";
1322
- data: string;
1323
- driverParam: string;
1324
- notNull: true;
1325
- hasDefault: false;
1326
- isPrimaryKey: false;
1327
- isAutoincrement: false;
1328
- hasRuntimeDefault: false;
1329
- enumValues: [string, ...string[]];
1330
- baseColumn: never;
1331
- identity: undefined;
1332
- generated: undefined;
1333
- }, {}, {}>;
1334
- blockNumber: drizzle_orm_pg_core.PgColumn<{
1335
- name: "block_number";
1336
- tableName: "collector_block_numbers";
1337
- dataType: "number";
1338
- columnType: "PgBigInt53";
1339
- data: number;
1340
- driverParam: string | number;
1341
- notNull: true;
1342
- hasDefault: false;
1343
- isPrimaryKey: false;
1344
- isAutoincrement: false;
1345
- hasRuntimeDefault: false;
1346
- enumValues: undefined;
1347
- baseColumn: never;
1348
- identity: undefined;
1349
- generated: undefined;
1350
- }, {}, {}>;
1351
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1352
- name: "updated_at";
1353
- tableName: "collector_block_numbers";
1354
- dataType: "date";
1355
- columnType: "PgTimestamp";
1356
- data: Date;
1357
- driverParam: string;
1358
- notNull: true;
1359
- hasDefault: true;
1360
- isPrimaryKey: false;
1361
- isAutoincrement: false;
1362
- hasRuntimeDefault: false;
1363
- enumValues: undefined;
1364
- baseColumn: never;
1365
- identity: undefined;
1366
- generated: undefined;
1367
- }, {}, {}>;
1368
- };
1369
- dialect: "pg";
1370
- }>;
1371
- declare const availableLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
1372
- name: "available_liquidity_pools";
1373
- schema: "offers_v1.1";
1374
- columns: {
1375
- id: drizzle_orm_pg_core.PgColumn<{
1376
- name: "id";
1377
- tableName: "available_liquidity_pools";
1378
- dataType: "string";
1379
- columnType: "PgVarchar";
1380
- data: string;
1381
- driverParam: string;
1382
- notNull: true;
1383
- hasDefault: false;
1384
- isPrimaryKey: true;
1385
- isAutoincrement: false;
1386
- hasRuntimeDefault: false;
1387
- enumValues: [string, ...string[]];
1388
- baseColumn: never;
1389
- identity: undefined;
1390
- generated: undefined;
1391
- }, {}, {
1392
- length: 255;
1393
- }>;
1394
- amount: drizzle_orm_pg_core.PgColumn<{
1395
- name: "amount";
1396
- tableName: "available_liquidity_pools";
1397
- dataType: "string";
1398
- columnType: "PgNumeric";
1399
- data: string;
1400
- driverParam: string;
1401
- notNull: true;
1402
- hasDefault: false;
1403
- isPrimaryKey: false;
1404
- isAutoincrement: false;
1405
- hasRuntimeDefault: false;
1406
- enumValues: undefined;
1407
- baseColumn: never;
1408
- identity: undefined;
1409
- generated: undefined;
1410
- }, {}, {}>;
1411
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1412
- name: "updated_at";
1413
- tableName: "available_liquidity_pools";
1414
- dataType: "date";
1415
- columnType: "PgTimestamp";
1416
- data: Date;
1417
- driverParam: string;
1418
- notNull: true;
1419
- hasDefault: true;
1420
- isPrimaryKey: false;
1421
- isAutoincrement: false;
1422
- hasRuntimeDefault: false;
1423
- enumValues: undefined;
1424
- baseColumn: never;
1425
- identity: undefined;
1426
- generated: undefined;
1427
- }, {}, {}>;
1428
- };
1429
- dialect: "pg";
1430
- }>;
1431
- declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
1432
- name: "available_liquidity_queues";
1433
- schema: "offers_v1.1";
1434
- columns: {
1435
- queueId: drizzle_orm_pg_core.PgColumn<{
1436
- name: "queue_id";
1437
- tableName: "available_liquidity_queues";
1438
- dataType: "string";
1439
- columnType: "PgVarchar";
1440
- data: string;
1441
- driverParam: string;
1442
- notNull: true;
1443
- hasDefault: false;
1444
- isPrimaryKey: false;
1445
- isAutoincrement: false;
1446
- hasRuntimeDefault: false;
1447
- enumValues: [string, ...string[]];
1448
- baseColumn: never;
1449
- identity: undefined;
1450
- generated: undefined;
1451
- }, {}, {
1452
- length: 255;
1453
- }>;
1454
- availableLiquidityPoolId: drizzle_orm_pg_core.PgColumn<{
1455
- name: "available_liquidity_pool_id";
1456
- tableName: "available_liquidity_queues";
1457
- dataType: "string";
1458
- columnType: "PgVarchar";
1459
- data: string;
1460
- driverParam: string;
1461
- notNull: true;
1462
- hasDefault: false;
1463
- isPrimaryKey: false;
1464
- isAutoincrement: false;
1465
- hasRuntimeDefault: false;
1466
- enumValues: [string, ...string[]];
1467
- baseColumn: never;
1468
- identity: undefined;
1469
- generated: undefined;
1470
- }, {}, {
1471
- length: 255;
1472
- }>;
1473
- index: drizzle_orm_pg_core.PgColumn<{
1474
- name: "index";
1475
- tableName: "available_liquidity_queues";
1476
- dataType: "number";
1477
- columnType: "PgInteger";
1478
- data: number;
1479
- driverParam: string | number;
1480
- notNull: true;
1481
- hasDefault: false;
1482
- isPrimaryKey: false;
1483
- isAutoincrement: false;
1484
- hasRuntimeDefault: false;
1485
- enumValues: undefined;
1486
- baseColumn: never;
1487
- identity: undefined;
1488
- generated: undefined;
1489
- }, {}, {}>;
1490
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1491
- name: "updated_at";
1492
- tableName: "available_liquidity_queues";
1493
- dataType: "date";
1494
- columnType: "PgTimestamp";
1495
- data: Date;
1496
- driverParam: string;
1497
- notNull: true;
1498
- hasDefault: true;
1499
- isPrimaryKey: false;
1500
- isAutoincrement: false;
1501
- hasRuntimeDefault: false;
1502
- enumValues: undefined;
1503
- baseColumn: never;
1504
- identity: undefined;
1505
- generated: undefined;
1506
- }, {}, {}>;
1507
- };
1508
- dialect: "pg";
1509
- }>;
1510
- declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
1511
- name: "user_positions";
1512
- schema: "offers_v1.1";
1513
- columns: {
1514
- id: drizzle_orm_pg_core.PgColumn<{
1515
- name: "id";
1516
- tableName: "user_positions";
1517
- dataType: "string";
1518
- columnType: "PgVarchar";
1519
- data: string;
1520
- driverParam: string;
1521
- notNull: true;
1522
- hasDefault: false;
1523
- isPrimaryKey: true;
1524
- isAutoincrement: false;
1525
- hasRuntimeDefault: false;
1526
- enumValues: [string, ...string[]];
1527
- baseColumn: never;
1528
- identity: undefined;
1529
- generated: undefined;
1530
- }, {}, {
1531
- length: 255;
1532
- }>;
1533
- availableLiquidityQueueId: drizzle_orm_pg_core.PgColumn<{
1534
- name: "available_liquidity_queue_id";
1535
- tableName: "user_positions";
1536
- dataType: "string";
1537
- columnType: "PgVarchar";
1538
- data: string;
1539
- driverParam: string;
1540
- notNull: true;
1541
- hasDefault: false;
1542
- isPrimaryKey: false;
1543
- isAutoincrement: false;
1544
- hasRuntimeDefault: false;
1545
- enumValues: [string, ...string[]];
1546
- baseColumn: never;
1547
- identity: undefined;
1548
- generated: undefined;
1549
- }, {}, {
1550
- length: 255;
1551
- }>;
1552
- user: drizzle_orm_pg_core.PgColumn<{
1553
- name: "user";
1554
- tableName: "user_positions";
1555
- dataType: "string";
1556
- columnType: "PgVarchar";
1557
- data: string;
1558
- driverParam: string;
1559
- notNull: true;
1560
- hasDefault: false;
1561
- isPrimaryKey: false;
1562
- isAutoincrement: false;
1563
- hasRuntimeDefault: false;
1564
- enumValues: [string, ...string[]];
1565
- baseColumn: never;
1566
- identity: undefined;
1567
- generated: undefined;
1568
- }, {}, {
1569
- length: 255;
1570
- }>;
1571
- chainId: drizzle_orm_pg_core.PgColumn<{
1572
- name: "chain_id";
1573
- tableName: "user_positions";
1574
- dataType: "bigint";
1575
- columnType: "PgBigInt64";
1576
- data: bigint;
1577
- driverParam: string;
1578
- notNull: true;
1579
- hasDefault: false;
1580
- isPrimaryKey: false;
1581
- isAutoincrement: false;
1582
- hasRuntimeDefault: false;
1583
- enumValues: undefined;
1584
- baseColumn: never;
1585
- identity: undefined;
1586
- generated: undefined;
1587
- }, {}, {}>;
1588
- amount: drizzle_orm_pg_core.PgColumn<{
1589
- name: "amount";
1590
- tableName: "user_positions";
1591
- dataType: "string";
1592
- columnType: "PgNumeric";
1593
- data: string;
1594
- driverParam: string;
1595
- notNull: true;
1596
- hasDefault: false;
1597
- isPrimaryKey: false;
1598
- isAutoincrement: false;
1599
- hasRuntimeDefault: false;
1600
- enumValues: undefined;
1601
- baseColumn: never;
1602
- identity: undefined;
1603
- generated: undefined;
1604
- }, {}, {}>;
1605
- updatedAt: drizzle_orm_pg_core.PgColumn<{
1606
- name: "updated_at";
1607
- tableName: "user_positions";
1608
- dataType: "date";
1609
- columnType: "PgTimestamp";
1610
- data: Date;
1611
- driverParam: string;
1612
- notNull: true;
1613
- hasDefault: true;
1614
- isPrimaryKey: false;
1615
- isAutoincrement: false;
1616
- hasRuntimeDefault: false;
1617
- enumValues: undefined;
1618
- baseColumn: never;
1619
- identity: undefined;
1620
- generated: undefined;
1621
- }, {}, {}>;
1622
- };
1623
- dialect: "pg";
1624
- }>;
1625
-
1626
- declare const schema_VERSION: typeof VERSION;
1627
- declare const schema_availableLiquidityPools: typeof availableLiquidityPools;
1628
- declare const schema_availableLiquidityQueues: typeof availableLiquidityQueues;
1629
- declare const schema_collectorBlockNumbers: typeof collectorBlockNumbers;
1630
- declare const schema_consumed: typeof consumed;
1631
- declare const schema_offerCollaterals: typeof offerCollaterals;
1632
- declare const schema_offerStatus: typeof offerStatus;
1633
- declare const schema_offers: typeof offers;
1634
- declare const schema_userPositions: typeof userPositions;
1635
- declare namespace schema {
1636
- 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 };
1637
- }
1638
-
1639
- type GetParameters = {
1640
- /** Filter by multiple creator addresses (comma-separated) */
1641
- creators?: string[];
1642
- /** Filter by offer type: buy offers or sell offers */
1643
- side?: "buy" | "sell";
1644
- /** Filter by multiple blockchain networks (comma-separated chain IDs) */
1645
- chains?: number[];
1646
- /** Filter by multiple loan assets (comma-separated) */
1647
- loanTokens?: string[];
1648
- /** Filter by multiple statuses (comma-separated) */
1649
- status?: OfferStatus[];
1650
- /** Filter by multiple callback addresses (comma-separated) */
1651
- callbackAddresses?: string[];
1652
- /** Minimum amount of assets in the offer */
1653
- minAmount?: bigint;
1654
- /** Maximum amount of assets in the offer */
1655
- maxAmount?: bigint;
1656
- /** Minimum rate per asset (in wei) */
1657
- minRate?: bigint;
1658
- /** Maximum rate per asset (in wei) */
1659
- maxRate?: bigint;
1660
- /** Minimum maturity timestamp (Unix timestamp in seconds) */
1661
- minMaturity?: Maturity.Maturity;
1662
- /** Maximum maturity timestamp (Unix timestamp in seconds) */
1663
- maxMaturity?: Maturity.Maturity;
1664
- /** Minimum expiry timestamp (Unix timestamp in seconds) */
1665
- minExpiry?: number;
1666
- /** Maximum expiry timestamp (Unix timestamp in seconds) */
1667
- maxExpiry?: number;
1668
- /** Filter by multiple collateral assets (comma-separated) */
1669
- collateralAssets?: string[];
1670
- /** Filter by multiple rate oracles (comma-separated) */
1671
- collateralOracles?: string[];
1672
- /** Filter by collateral combinations */
1673
- collateralTuple?: Array<{
1674
- asset: string;
1675
- oracle?: string;
1676
- lltv?: LLTV.LLTV;
1677
- }>;
1678
- /** Minimum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
1679
- minLltv?: LLTV.LLTV;
1680
- /** Maximum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
1681
- maxLltv?: LLTV.LLTV;
1682
- /** Field to sort results by */
1683
- sortBy?: "rate" | "maturity" | "expiry" | "amount";
1684
- /** Sort direction: asc (ascending) or desc (descending, default) */
1685
- sortOrder?: "asc" | "desc";
1686
- /** Pagination cursor in base64url-encoded format */
1687
- cursor?: string;
1688
- /** Maximum number of offers to return. Defaults to 20. Maximum is 100. */
1689
- limit?: number;
1690
- };
1691
- type MatchParameters = {
1692
- /** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
1693
- side: "buy" | "sell";
1694
- /** The blockchain network chain ID */
1695
- chainId: number;
1696
- /** Rate per asset (in wei) for matching offers */
1697
- rate?: bigint;
1698
- /** Collateral requirements */
1699
- collaterals?: Array<{
1700
- asset: string;
1701
- oracle: string;
1702
- lltv: LLTV.LLTV;
1703
- }>;
1704
- /** Exact maturity timestamp (Unix timestamp in seconds) */
1705
- maturity?: Maturity.Maturity;
1706
- /** Minimum maturity timestamp (Unix timestamp in seconds, inclusive) */
1707
- minMaturity?: Maturity.Maturity;
1708
- /** Maximum maturity timestamp (Unix timestamp in seconds, inclusive) */
1709
- maxMaturity?: Maturity.Maturity;
1710
- /** The loan asset address to match against */
1711
- loanToken?: string;
1712
- /** Filter by a specific offer creator address */
1713
- creator?: string;
1714
- /** Filter by multiple statuses (comma-separated) */
1715
- status?: OfferStatus[];
1716
- /** Pagination cursor in base64url-encoded format */
1717
- cursor?: string;
1718
- /** Maximum number of offers to return. Defaults to 20. Maximum is 100. */
1719
- limit?: number;
1720
- };
1721
- type RouterClientConfig = {
1722
- readonly url: URL;
1723
- readonly headers: Headers;
1724
- };
1725
- type Client = Compute<RouterClientConfig & {
1726
- get: (parameters: GetParameters) => Promise<{
1727
- cursor: string | null;
1728
- offers: OfferResponse[];
1729
- }>;
1730
- match: (parameters: MatchParameters) => Promise<{
1731
- cursor: string | null;
1732
- offers: OfferResponse[];
1733
- }>;
1734
- }>;
1735
- declare function connect(opts?: {
1736
- url?: string;
1737
- apiKey?: string;
1738
- headers?: Headers;
1739
- }): Client;
1740
- declare namespace connect {
1741
- type ErrorType = InvalidUrlError;
1742
- }
1743
- /**
1744
- * Get offers from the router.
1745
- * @returns The offers with pagination cursor.
1746
- */
1747
- declare function get(config: RouterClientConfig, parameters: GetParameters): Promise<{
1748
- cursor: string | null;
1749
- offers: OfferResponse[];
1750
- }>;
1751
- declare namespace get {
1752
- type ErrorType = GetApiErrorType;
1753
- }
1754
- /**
1755
- * Match offers from the router.
1756
- * @returns The matched offers with pagination cursor.
1757
- */
1758
- declare function match(config: RouterClientConfig, parameters: MatchParameters): Promise<{
1759
- cursor: string | null;
1760
- offers: OfferResponse[];
1761
- }>;
1762
- declare namespace match {
1763
- type ErrorType = GetApiErrorType;
1764
- }
1765
- type GetApiErrorType = HttpGetOffersFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
1766
- declare class InvalidUrlError extends Errors.BaseError {
1767
- name: string;
1768
- constructor(url: string);
1769
- }
1770
- declare class HttpUnauthorizedError extends Errors.BaseError {
1771
- name: string;
1772
- constructor();
1773
- }
1774
- declare class HttpForbiddenError extends Errors.BaseError {
1775
- name: string;
1776
- constructor();
1777
- }
1778
- declare class HttpRateLimitError extends Errors.BaseError {
1779
- name: string;
1780
- constructor();
1781
- }
1782
- declare class HttpGetOffersFailedError extends Errors.BaseError {
1783
- name: string;
1784
- constructor(message: string, { details }?: {
1785
- details?: string;
1786
- });
1787
- }
1788
-
1789
- /**
1790
- * Start a local router server.
1791
- * @example
1792
- * ```ts
1793
- * import { Router } from "@morpho-dev/router";
1794
- * await Router.serve(); // local router server running on http://localhost:8081
1795
- * ```
1796
- */
1797
- declare function serve(parameters: {
1798
- port: number;
1799
- store: OfferStore;
1800
- }): Promise<void>;
1801
- declare function error(error: unknown, c: Context): Response & hono.TypedResponse<{
1802
- statusCode: number;
1803
- body: string;
1804
- }, hono_utils_http_status.ContentfulStatusCode, "json">;
1805
- declare function success<T>(c: Context, { data, cursor, }: {
1806
- data: T | T[];
1807
- cursor?: string | null;
1808
- }): Response & hono.TypedResponse<{
1809
- status: string;
1810
- cursor: string | null | undefined;
1811
- data: T | T[];
1812
- meta: {
1813
- timestamp: string;
1814
- };
1815
- } extends hono_utils_types.JSONValue ? { [K in keyof {
1816
- status: string;
1817
- cursor: string | null | undefined;
1818
- data: T | T[];
1819
- meta: {
1820
- timestamp: string;
1821
- };
1822
- } as ({
1823
- status: string;
1824
- cursor: string | null | undefined;
1825
- data: T | T[];
1826
- meta: {
1827
- timestamp: string;
1828
- };
1829
- }[K] extends infer T_1 ? T_1 extends {
1830
- status: string;
1831
- cursor: string | null | undefined;
1832
- data: T | T[];
1833
- meta: {
1834
- timestamp: string;
1835
- };
1836
- }[K] ? T_1 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) extends true ? never : K]: boolean extends ({
1837
- status: string;
1838
- cursor: string | null | undefined;
1839
- data: T | T[];
1840
- meta: {
1841
- timestamp: string;
1842
- };
1843
- }[K] extends infer T_2 ? T_2 extends {
1844
- status: string;
1845
- cursor: string | null | undefined;
1846
- data: T | T[];
1847
- meta: {
1848
- timestamp: string;
1849
- };
1850
- }[K] ? T_2 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) ? hono_utils_types.JSONParsed<{
1851
- status: string;
1852
- cursor: string | null | undefined;
1853
- data: T | T[];
1854
- meta: {
1855
- timestamp: string;
1856
- };
1857
- }[K]> | undefined : hono_utils_types.JSONParsed<{
1858
- status: string;
1859
- cursor: string | null | undefined;
1860
- data: T | T[];
1861
- meta: {
1862
- timestamp: string;
1863
- };
1864
- }[K]>; } : never, hono_utils_http_status.ContentfulStatusCode, "json">;
1865
- declare class APIError extends Error {
1866
- statusCode: number;
1867
- code: string;
1868
- details?: unknown | undefined;
1869
- constructor(statusCode: number, message: string, code: string, details?: unknown | undefined);
1870
- }
1871
- declare class ValidationError extends APIError {
1872
- constructor(message: string, details?: unknown);
1873
- }
1874
- declare class NotFoundError extends APIError {
1875
- constructor(message: string);
1876
- }
1877
- declare class InternalServerError extends APIError {
1878
- constructor(message?: string);
1879
- }
1880
- declare class BadRequestError extends APIError {
1881
- constructor(message?: string, details?: unknown);
1882
- }
1883
- declare function handleZodError(error: z.ZodError): ValidationError;
1884
-
1885
- type index_APIError = APIError;
1886
- declare const index_APIError: typeof APIError;
1887
- type index_BadRequestError = BadRequestError;
1888
- declare const index_BadRequestError: typeof BadRequestError;
1889
- type index_Client = Client;
1890
- type index_GetParameters = GetParameters;
1891
- type index_HttpForbiddenError = HttpForbiddenError;
1892
- declare const index_HttpForbiddenError: typeof HttpForbiddenError;
1893
- type index_HttpGetOffersFailedError = HttpGetOffersFailedError;
1894
- declare const index_HttpGetOffersFailedError: typeof HttpGetOffersFailedError;
1895
- type index_HttpRateLimitError = HttpRateLimitError;
1896
- declare const index_HttpRateLimitError: typeof HttpRateLimitError;
1897
- type index_HttpUnauthorizedError = HttpUnauthorizedError;
1898
- declare const index_HttpUnauthorizedError: typeof HttpUnauthorizedError;
1899
- type index_InternalServerError = InternalServerError;
1900
- declare const index_InternalServerError: typeof InternalServerError;
1901
- type index_InvalidUrlError = InvalidUrlError;
1902
- declare const index_InvalidUrlError: typeof InvalidUrlError;
1903
- type index_MatchParameters = MatchParameters;
1904
- type index_NotFoundError = NotFoundError;
1905
- declare const index_NotFoundError: typeof NotFoundError;
1906
- type index_RouterClientConfig = RouterClientConfig;
1907
- type index_ValidationError = ValidationError;
1908
- declare const index_ValidationError: typeof ValidationError;
1909
- declare const index_connect: typeof connect;
1910
- declare const index_error: typeof error;
1911
- declare const index_get: typeof get;
1912
- declare const index_handleZodError: typeof handleZodError;
1913
- declare const index_match: typeof match;
1914
- declare const index_serve: typeof serve;
1915
- declare const index_success: typeof success;
1916
- declare namespace index {
1917
- 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 };
1918
- }
1919
-
1920
989
  type config = {
1921
990
  chain: Chain.Chain;
1922
991
  rpcUrl: string;
@@ -2010,230 +1079,1230 @@ declare function morpho(): (Rule<{
2010
1079
  readonly data: viem.Hex;
2011
1080
  readonly gasLimit: bigint;
2012
1081
  };
2013
- readonly hash: viem.Hex;
2014
- signature?: viem.Hex;
2015
- createdAt?: number;
2016
- }, "chain_id", MorphoContext> | Rule<{
2017
- readonly offering: Address;
2018
- readonly assets: bigint;
2019
- readonly rate: bigint;
2020
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2021
- readonly expiry: number;
2022
- readonly nonce: bigint;
2023
- readonly buy: boolean;
2024
- readonly chainId: bigint;
2025
- readonly loanToken: Address;
2026
- readonly start: number;
2027
- readonly collaterals: readonly {
2028
- asset: Address;
2029
- oracle: Address;
2030
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2031
- }[];
2032
- readonly callback: {
2033
- readonly address: Address;
2034
- readonly data: viem.Hex;
2035
- 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
+ }, {}, {}>;
2036
1736
  };
2037
- readonly hash: viem.Hex;
2038
- signature?: viem.Hex;
2039
- createdAt?: number;
2040
- }, "loan_token", MorphoContext> | Rule<{
2041
- readonly offering: Address;
2042
- readonly assets: bigint;
2043
- readonly rate: bigint;
2044
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2045
- readonly expiry: number;
2046
- readonly nonce: bigint;
2047
- readonly buy: boolean;
2048
- readonly chainId: bigint;
2049
- readonly loanToken: Address;
2050
- readonly start: number;
2051
- readonly collaterals: readonly {
2052
- asset: Address;
2053
- oracle: Address;
2054
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2055
- }[];
2056
- readonly callback: {
2057
- readonly address: Address;
2058
- readonly data: viem.Hex;
2059
- 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
+ }, {}, {}>;
2060
1832
  };
2061
- readonly hash: viem.Hex;
2062
- signature?: viem.Hex;
2063
- createdAt?: number;
2064
- }, "expiry", MorphoContext> | Rule<{
2065
- readonly offering: Address;
2066
- readonly assets: bigint;
2067
- readonly rate: bigint;
2068
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2069
- readonly expiry: number;
2070
- readonly nonce: bigint;
2071
- readonly buy: boolean;
2072
- readonly chainId: bigint;
2073
- readonly loanToken: Address;
2074
- readonly start: number;
2075
- readonly collaterals: readonly {
2076
- asset: Address;
2077
- oracle: Address;
2078
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2079
- }[];
2080
- readonly callback: {
2081
- readonly address: Address;
2082
- readonly data: viem.Hex;
2083
- 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
+ }, {}, {}>;
2084
1945
  };
2085
- readonly hash: viem.Hex;
2086
- signature?: viem.Hex;
2087
- createdAt?: number;
2088
- }, "sell_offers_empty_callback", MorphoContext> | Rule<{
2089
- readonly offering: Address;
2090
- readonly assets: bigint;
2091
- readonly rate: bigint;
2092
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2093
- readonly expiry: number;
2094
- readonly nonce: bigint;
2095
- readonly buy: boolean;
2096
- readonly chainId: bigint;
2097
- readonly loanToken: Address;
2098
- readonly start: number;
2099
- readonly collaterals: readonly {
2100
- asset: Address;
2101
- oracle: Address;
2102
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2103
- }[];
2104
- readonly callback: {
2105
- readonly address: Address;
2106
- readonly data: viem.Hex;
2107
- 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
+ }, {}, {}>;
2108
2020
  };
2109
- readonly hash: viem.Hex;
2110
- signature?: viem.Hex;
2111
- createdAt?: number;
2112
- }, "buy_offers_non_empty_callback", MorphoContext> | Rule<{
2113
- readonly offering: Address;
2114
- readonly assets: bigint;
2115
- readonly rate: bigint;
2116
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2117
- readonly expiry: number;
2118
- readonly nonce: bigint;
2119
- readonly buy: boolean;
2120
- readonly chainId: bigint;
2121
- readonly loanToken: Address;
2122
- readonly start: number;
2123
- readonly collaterals: readonly {
2124
- asset: Address;
2125
- oracle: Address;
2126
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2127
- }[];
2128
- readonly callback: {
2129
- readonly address: Address;
2130
- readonly data: viem.Hex;
2131
- 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
+ }, {}, {}>;
2132
2080
  };
2133
- readonly hash: viem.Hex;
2134
- signature?: viem.Hex;
2135
- createdAt?: number;
2136
- }, "sell_offers_non_whitelisted_callback", MorphoContext> | Rule<{
2137
- readonly offering: Address;
2138
- readonly assets: bigint;
2139
- readonly rate: bigint;
2140
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2141
- readonly expiry: number;
2142
- readonly nonce: bigint;
2143
- readonly buy: boolean;
2144
- readonly chainId: bigint;
2145
- readonly loanToken: Address;
2146
- readonly start: number;
2147
- readonly collaterals: readonly {
2148
- asset: Address;
2149
- oracle: Address;
2150
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2151
- }[];
2152
- readonly callback: {
2153
- readonly address: Address;
2154
- readonly data: viem.Hex;
2155
- 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
+ }, {}, {}>;
2156
2176
  };
2157
- readonly hash: viem.Hex;
2158
- signature?: viem.Hex;
2159
- createdAt?: number;
2160
- }, "sell_offers_callback_data_invalid", MorphoContext> | Rule<{
2161
- readonly offering: Address;
2162
- readonly assets: bigint;
2163
- readonly rate: bigint;
2164
- readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
2165
- readonly expiry: number;
2166
- readonly nonce: bigint;
2167
- readonly buy: boolean;
2168
- readonly chainId: bigint;
2169
- readonly loanToken: Address;
2170
- readonly start: number;
2171
- readonly collaterals: readonly {
2172
- asset: Address;
2173
- oracle: Address;
2174
- lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
2175
- }[];
2176
- readonly callback: {
2177
- readonly address: Address;
2178
- readonly data: viem.Hex;
2179
- 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
+ }, {}, {}>;
2180
2291
  };
2181
- readonly hash: viem.Hex;
2182
- signature?: viem.Hex;
2183
- createdAt?: number;
2184
- }, "sell_offers_callback_collateral_invalid", MorphoContext>)[];
2185
-
2186
- type ValidationRule_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
2187
- type ValidationRule_MorphoContext = MorphoContext;
2188
- type ValidationRule_Rule<T, Name extends string = string, Ctx = void> = Rule<T, Name, Ctx>;
2189
- type ValidationRule_RuleNames<Rules extends readonly {
2190
- name: string;
2191
- }[]> = RuleNames<Rules>;
2192
- type ValidationRule_Single<T, RuleName extends string, Ctx = void> = Single<T, RuleName, Ctx>;
2193
- declare const ValidationRule_batch: typeof batch;
2194
- declare const ValidationRule_morpho: typeof morpho;
2195
- declare const ValidationRule_single: typeof single;
2196
- declare namespace ValidationRule {
2197
- 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 };
2198
- }
2199
-
2200
- /**
2201
- * A validation issue.
2202
- */
2203
- type Issue<T, RuleName extends string = string> = {
2204
- /** The name of the rule that caused the issue. */
2205
- ruleName: RuleName;
2206
- /** The message of the issue. */
2207
- message: string;
2208
- /** The item that was not valid. */
2209
- item: T;
2210
- };
2211
- /**
2212
- * The result of a validation.
2213
- */
2214
- type Result<T, RuleName extends string = string> = {
2215
- /** The items that were valid. */
2216
- valid: T[];
2217
- /** The reports of the failed validations. */
2218
- issues: Issue<T, RuleName>[];
2219
- };
2220
- declare function run<T, Name extends string, Rules extends readonly Rule<T, Name, void>[]>(parameters: {
2221
- items: T[];
2222
- rules: Rules;
2223
- chunkSize?: number;
2224
- }): Promise<Result<T, RuleNames<Rules>>>;
2225
- declare function run<T, Ctx, Name extends string, Rules extends readonly Rule<T, Name, Ctx>[]>(parameters: {
2226
- items: T[];
2227
- rules: Rules;
2228
- ctx: Ctx;
2229
- chunkSize?: number;
2230
- }): Promise<Result<T, RuleNames<Rules>>>;
2292
+ dialect: "pg";
2293
+ }>;
2231
2294
 
2232
- type Validation_Issue<T, RuleName extends string = string> = Issue<T, RuleName>;
2233
- type Validation_Result<T, RuleName extends string = string> = Result<T, RuleName>;
2234
- declare const Validation_run: typeof run;
2235
- declare namespace Validation {
2236
- 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 };
2237
2306
  }
2238
2307
 
2239
- 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 };