@morpho-dev/router 0.0.12 → 0.0.14
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.
- package/README.md +15 -0
- package/dist/drizzle/0000_add-offers-table.sql +37 -0
- package/dist/drizzle/0001_create_offer_status_relation.sql +10 -0
- package/dist/drizzle/0002_add_created_at_in_offer_status_relation.sql +3 -0
- package/dist/drizzle/0003_add-cursor-indices-to-offers.sql +6 -0
- package/dist/drizzle/0004_offer-start.sql +1 -0
- package/dist/drizzle/0005_rename-price-token-buy.sql +8 -0
- package/dist/drizzle/0006_rename-buy.sql +3 -0
- package/dist/drizzle/0007_rename-offering.sql +3 -0
- package/dist/drizzle/0008_add-consumed-relation.sql +10 -0
- package/dist/drizzle/meta/0000_snapshot.json +344 -0
- package/dist/drizzle/meta/0001_snapshot.json +426 -0
- package/dist/drizzle/meta/0002_snapshot.json +439 -0
- package/dist/drizzle/meta/0003_snapshot.json +553 -0
- package/dist/drizzle/meta/0004_snapshot.json +559 -0
- package/dist/drizzle/meta/0005_snapshot.json +559 -0
- package/dist/drizzle/meta/0006_snapshot.json +559 -0
- package/dist/drizzle/meta/0007_snapshot.json +559 -0
- package/dist/drizzle/meta/0008_snapshot.json +635 -0
- package/dist/drizzle/meta/_journal.json +69 -0
- package/dist/index.browser.d.cts +116 -25
- package/dist/index.browser.d.ts +116 -25
- package/dist/index.browser.js +671 -70
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +670 -72
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +934 -7
- package/dist/index.node.d.ts +934 -7
- package/dist/index.node.js +2328 -4819
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +2319 -4820
- package/dist/index.node.mjs.map +1 -1
- package/package.json +17 -3
package/dist/index.node.d.cts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { Offer, Errors } from '@morpho-dev/mempool';
|
|
1
|
+
import { Offer, Errors, Format } from '@morpho-dev/mempool';
|
|
2
2
|
export * from '@morpho-dev/mempool';
|
|
3
3
|
import * as viem from 'viem';
|
|
4
4
|
import { Address, Account, Hex, PublicClient } from 'viem';
|
|
5
5
|
import { Chain as Chain$2 } from 'viem/chains';
|
|
6
|
+
import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
|
|
7
|
+
import * as zod_v4 from 'zod/v4';
|
|
8
|
+
import { z, ZodError } from 'zod/v4';
|
|
9
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
10
|
+
import { PGlite } from '@electric-sql/pglite';
|
|
11
|
+
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
12
|
+
import { drizzle as drizzle$1 } from 'drizzle-orm/pglite';
|
|
13
|
+
import { Pool } from 'pg';
|
|
14
|
+
export * from 'drizzle-orm';
|
|
15
|
+
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
6
16
|
|
|
7
17
|
type Compute<type> = {
|
|
8
18
|
[key in keyof type]: type[key];
|
|
@@ -36,22 +46,173 @@ declare namespace Chain$1 {
|
|
|
36
46
|
export { type Chain$1_Chain as Chain, type Chain$1_ChainId as ChainId, type Chain$1_ChainName as ChainName, Chain$1_chainIds as chainIds, Chain$1_chainNames as chainNames, Chain$1_chains as chains, Chain$1_getChain as getChain };
|
|
37
47
|
}
|
|
38
48
|
|
|
49
|
+
declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
|
|
50
|
+
|
|
51
|
+
declare const schemas: {
|
|
52
|
+
readonly get_offers: z.ZodObject<{
|
|
53
|
+
creators: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
54
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
buy: "buy";
|
|
56
|
+
sell: "sell";
|
|
57
|
+
}>>;
|
|
58
|
+
chains: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<number[], string>>>;
|
|
59
|
+
loan_tokens: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
60
|
+
status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
|
|
61
|
+
callback_addresses: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
62
|
+
min_amount: z.ZodOptional<z.ZodBigInt>;
|
|
63
|
+
max_amount: z.ZodOptional<z.ZodBigInt>;
|
|
64
|
+
min_rate: z.ZodOptional<z.ZodBigInt>;
|
|
65
|
+
max_rate: z.ZodOptional<z.ZodBigInt>;
|
|
66
|
+
min_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
|
|
67
|
+
max_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
|
|
68
|
+
min_expiry: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
|
|
69
|
+
max_expiry: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
|
|
70
|
+
collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
71
|
+
collateral_oracles: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
72
|
+
collateral_tuple: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
73
|
+
asset: string;
|
|
74
|
+
oracle: string | undefined;
|
|
75
|
+
lltv: number | undefined;
|
|
76
|
+
}[], string>>>;
|
|
77
|
+
min_lltv: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
|
|
78
|
+
max_lltv: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
|
|
79
|
+
sort_by: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
rate: "rate";
|
|
81
|
+
maturity: "maturity";
|
|
82
|
+
expiry: "expiry";
|
|
83
|
+
amount: "amount";
|
|
84
|
+
}>>;
|
|
85
|
+
sort_order: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
asc: "asc";
|
|
87
|
+
desc: "desc";
|
|
88
|
+
}>>>;
|
|
89
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
90
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
readonly match_offers: z.ZodObject<{
|
|
93
|
+
side: z.ZodEnum<{
|
|
94
|
+
buy: "buy";
|
|
95
|
+
sell: "sell";
|
|
96
|
+
}>;
|
|
97
|
+
chain_id: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>;
|
|
98
|
+
rate: z.ZodOptional<z.ZodBigInt>;
|
|
99
|
+
collaterals: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
100
|
+
asset: string;
|
|
101
|
+
oracle: string;
|
|
102
|
+
lltv: bigint;
|
|
103
|
+
}[], string>>>;
|
|
104
|
+
maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
|
|
105
|
+
min_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
|
|
106
|
+
max_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
|
|
107
|
+
loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
108
|
+
creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
109
|
+
status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
|
|
110
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
111
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
};
|
|
114
|
+
type Action = keyof typeof schemas;
|
|
115
|
+
declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
|
|
116
|
+
declare function safeParse<A extends Action>(action: A, query: unknown): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
|
|
117
|
+
|
|
118
|
+
declare const index$1_OpenApi: typeof OpenApi;
|
|
119
|
+
declare const index$1_parse: typeof parse;
|
|
120
|
+
declare const index$1_safeParse: typeof safeParse;
|
|
121
|
+
declare namespace index$1 {
|
|
122
|
+
export { index$1_OpenApi as OpenApi, index$1_parse as parse, index$1_safeParse as safeParse };
|
|
123
|
+
}
|
|
124
|
+
|
|
39
125
|
declare const OfferStatusValues: readonly ["valid", "callback_not_supported", "callback_error", "unverified"];
|
|
40
126
|
type OfferStatus = (typeof OfferStatusValues)[number];
|
|
41
127
|
type OfferMetadata = {
|
|
42
128
|
issue: string;
|
|
43
129
|
};
|
|
44
130
|
type RouterOffer = Offer.Offer & {
|
|
131
|
+
consumed: bigint;
|
|
45
132
|
status: OfferStatus;
|
|
46
133
|
metadata?: OfferMetadata;
|
|
47
134
|
};
|
|
135
|
+
declare const RouterOfferSchema: (parameters?: {
|
|
136
|
+
omitHash?: boolean;
|
|
137
|
+
}) => zod_v4.ZodObject<{
|
|
138
|
+
offering: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
139
|
+
assets: zod_v4.ZodBigInt;
|
|
140
|
+
rate: zod_v4.ZodBigInt;
|
|
141
|
+
maturity: zod_v4.ZodNumber;
|
|
142
|
+
expiry: zod_v4.ZodNumber;
|
|
143
|
+
start: zod_v4.ZodNumber;
|
|
144
|
+
nonce: zod_v4.ZodBigInt;
|
|
145
|
+
buy: zod_v4.ZodBoolean;
|
|
146
|
+
chainId: zod_v4.ZodBigInt;
|
|
147
|
+
loanToken: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
148
|
+
collaterals: zod_v4.ZodArray<zod_v4.ZodObject<{
|
|
149
|
+
asset: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
150
|
+
oracle: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
151
|
+
lltv: zod_v4.ZodBigInt;
|
|
152
|
+
}, zod_v4_core.$strip>>;
|
|
153
|
+
callback: zod_v4.ZodObject<{
|
|
154
|
+
address: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
155
|
+
data: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
156
|
+
gasLimit: zod_v4.ZodBigInt;
|
|
157
|
+
}, zod_v4_core.$strip>;
|
|
158
|
+
signature: zod_v4.ZodOptional<zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>>;
|
|
159
|
+
createdAt: zod_v4.ZodOptional<zod_v4.ZodNumber>;
|
|
160
|
+
consumed: z.ZodBigInt;
|
|
161
|
+
status: z.ZodEnum<{
|
|
162
|
+
valid: "valid";
|
|
163
|
+
callback_not_supported: "callback_not_supported";
|
|
164
|
+
callback_error: "callback_error";
|
|
165
|
+
unverified: "unverified";
|
|
166
|
+
}>;
|
|
167
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
168
|
+
issue: z.ZodString;
|
|
169
|
+
}, z.core.$strip>>;
|
|
170
|
+
}, zod_v4_core.$strip>;
|
|
171
|
+
/**
|
|
172
|
+
* Creates a router offer from a plain object.
|
|
173
|
+
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
174
|
+
* @param input - The router offer to create.
|
|
175
|
+
* @returns The created router offer with its hash.
|
|
176
|
+
*/
|
|
177
|
+
declare function from(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
178
|
+
declare namespace from {
|
|
179
|
+
type ErrorType = InvalidRouterOfferError;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Creates a router offer from a snake case object.
|
|
183
|
+
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
184
|
+
* @param input - The router offer to create.
|
|
185
|
+
* @returns The created router offer with its hash.
|
|
186
|
+
*/
|
|
187
|
+
declare function fromSnakeCase(input: Format.Snake<Omit<RouterOffer, "hash">>): RouterOffer;
|
|
188
|
+
declare namespace fromSnakeCase {
|
|
189
|
+
type ErrorType = InvalidRouterOfferError;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Converts a router offer to a snake case object.
|
|
193
|
+
* @param offer - The router offer to convert.
|
|
194
|
+
* @returns The converted router offer.
|
|
195
|
+
*/
|
|
196
|
+
declare function toSnakeCase(offer: RouterOffer): Format.Snake<RouterOffer>;
|
|
197
|
+
declare function random(): RouterOffer;
|
|
198
|
+
declare class InvalidRouterOfferError extends Errors.BaseError<ZodError | Error> {
|
|
199
|
+
readonly name = "RouterOffer.InvalidRouterOfferError";
|
|
200
|
+
constructor(error: ZodError | Error);
|
|
201
|
+
}
|
|
48
202
|
|
|
203
|
+
type RouterOffer$1_InvalidRouterOfferError = InvalidRouterOfferError;
|
|
204
|
+
declare const RouterOffer$1_InvalidRouterOfferError: typeof InvalidRouterOfferError;
|
|
49
205
|
type RouterOffer$1_OfferMetadata = OfferMetadata;
|
|
50
206
|
type RouterOffer$1_OfferStatus = OfferStatus;
|
|
51
207
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
52
208
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
209
|
+
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
210
|
+
declare const RouterOffer$1_from: typeof from;
|
|
211
|
+
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
212
|
+
declare const RouterOffer$1_random: typeof random;
|
|
213
|
+
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
53
214
|
declare namespace RouterOffer$1 {
|
|
54
|
-
export { type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer };
|
|
215
|
+
export { RouterOffer$1_InvalidRouterOfferError as InvalidRouterOfferError, 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_from as from, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
55
216
|
}
|
|
56
217
|
|
|
57
218
|
type GetParameters = {
|
|
@@ -203,6 +364,758 @@ declare class HttpGetOffersFailedError extends Errors.BaseError {
|
|
|
203
364
|
});
|
|
204
365
|
}
|
|
205
366
|
|
|
367
|
+
type PgDB = ReturnType<typeof drizzle> & {
|
|
368
|
+
name: "pg";
|
|
369
|
+
pool: Pool;
|
|
370
|
+
};
|
|
371
|
+
type PGLiteDB = ReturnType<typeof drizzle$1> & {
|
|
372
|
+
name: "pglite";
|
|
373
|
+
pool: PGlite;
|
|
374
|
+
};
|
|
375
|
+
type DB = PgDB | PGLiteDB;
|
|
376
|
+
declare function create$1({ type, endpoint, }: {
|
|
377
|
+
type?: "pg" | "pglite";
|
|
378
|
+
endpoint?: string;
|
|
379
|
+
}): DB;
|
|
380
|
+
declare function applyMigrations(db: DB): Promise<void>;
|
|
381
|
+
declare function applyMigrationsPostgres(db: DB): Promise<void>;
|
|
382
|
+
declare function clean(db: DB): Promise<void>;
|
|
383
|
+
|
|
384
|
+
type OfferDB_DB = DB;
|
|
385
|
+
declare const OfferDB_applyMigrations: typeof applyMigrations;
|
|
386
|
+
declare const OfferDB_applyMigrationsPostgres: typeof applyMigrationsPostgres;
|
|
387
|
+
declare const OfferDB_clean: typeof clean;
|
|
388
|
+
declare namespace OfferDB {
|
|
389
|
+
export { type OfferDB_DB as DB, OfferDB_applyMigrations as applyMigrations, OfferDB_applyMigrationsPostgres as applyMigrationsPostgres, OfferDB_clean as clean, create$1 as create };
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
type GetOffersFilters = {
|
|
393
|
+
creators?: string[];
|
|
394
|
+
side?: "buy" | "sell";
|
|
395
|
+
chains?: number[];
|
|
396
|
+
loanTokens?: string[];
|
|
397
|
+
status?: OfferStatus[];
|
|
398
|
+
callbackAddresses?: string[];
|
|
399
|
+
minAmount?: bigint;
|
|
400
|
+
maxAmount?: bigint;
|
|
401
|
+
minRate?: bigint;
|
|
402
|
+
maxRate?: bigint;
|
|
403
|
+
minMaturity?: number;
|
|
404
|
+
maxMaturity?: number;
|
|
405
|
+
minExpiry?: number;
|
|
406
|
+
maxExpiry?: number;
|
|
407
|
+
collateralAssets?: string[];
|
|
408
|
+
collateralOracles?: string[];
|
|
409
|
+
collateralTuple?: Array<{
|
|
410
|
+
asset: string;
|
|
411
|
+
oracle?: string;
|
|
412
|
+
lltv?: number;
|
|
413
|
+
}>;
|
|
414
|
+
minLltv?: number;
|
|
415
|
+
maxLltv?: number;
|
|
416
|
+
sortBy?: "rate" | "maturity" | "expiry" | "amount";
|
|
417
|
+
sortOrder?: "asc" | "desc";
|
|
418
|
+
cursor?: string;
|
|
419
|
+
limit?: number;
|
|
420
|
+
};
|
|
421
|
+
interface FindMatchingOffersParams {
|
|
422
|
+
side: "buy" | "sell";
|
|
423
|
+
chainId: number;
|
|
424
|
+
rate?: bigint;
|
|
425
|
+
collaterals?: Array<{
|
|
426
|
+
asset: string;
|
|
427
|
+
oracle: string;
|
|
428
|
+
lltv: bigint;
|
|
429
|
+
}>;
|
|
430
|
+
maturity?: number;
|
|
431
|
+
minMaturity?: number;
|
|
432
|
+
maxMaturity?: number;
|
|
433
|
+
loanToken?: string;
|
|
434
|
+
creator?: string;
|
|
435
|
+
/** Filter by offer status; if omitted defaults to ["valid"] */
|
|
436
|
+
status?: OfferStatus[];
|
|
437
|
+
/** Cursor string returned by a previous call, for pagination */
|
|
438
|
+
cursor?: string;
|
|
439
|
+
/** Page size; defaults to 20 */
|
|
440
|
+
limit?: number;
|
|
441
|
+
}
|
|
442
|
+
interface GetAllParams {
|
|
443
|
+
query?: GetOffersFilters;
|
|
444
|
+
}
|
|
445
|
+
type OfferRepositoryConfig = {
|
|
446
|
+
/** The database instance to use for operations. */
|
|
447
|
+
db: DB;
|
|
448
|
+
};
|
|
449
|
+
/**
|
|
450
|
+
* The `OfferRepository` is responsible for managing offer data in the database.
|
|
451
|
+
*/
|
|
452
|
+
type OfferRepository = {
|
|
453
|
+
/** Create a single offer in the database. */
|
|
454
|
+
create: (parameters: {
|
|
455
|
+
offer: Offer.Offer;
|
|
456
|
+
status: OfferStatus;
|
|
457
|
+
metadata?: OfferMetadata;
|
|
458
|
+
}) => Promise<string>;
|
|
459
|
+
/** Create multiple offers in the database. */
|
|
460
|
+
createMany: (parameters: {
|
|
461
|
+
offer: Offer.Offer;
|
|
462
|
+
status: OfferStatus;
|
|
463
|
+
metadata?: OfferMetadata;
|
|
464
|
+
}[]) => Promise<string[]>;
|
|
465
|
+
/** Get all offers from the database with optional filtering, sorting, and pagination. */
|
|
466
|
+
getAll: (params?: GetAllParams) => Promise<{
|
|
467
|
+
offers: RouterOffer[];
|
|
468
|
+
nextCursor: string | null;
|
|
469
|
+
}>;
|
|
470
|
+
/** Find offers that match the specified parameters, with cursor pagination. */
|
|
471
|
+
findMatchingOffers: (params: FindMatchingOffersParams) => Promise<{
|
|
472
|
+
offers: RouterOffer[];
|
|
473
|
+
nextCursor: string | null;
|
|
474
|
+
}>;
|
|
475
|
+
/** Delete an offer and its associated collaterals by hash. */
|
|
476
|
+
delete: (hash: Offer.Offer["hash"]) => Promise<boolean>;
|
|
477
|
+
/** Delete multiple offers and their associated collaterals by hashes. */
|
|
478
|
+
deleteMany: (hashes: Offer.Offer["hash"][]) => Promise<number>;
|
|
479
|
+
/** Update the status of an offer. */
|
|
480
|
+
updateStatus: (parameters: {
|
|
481
|
+
offerHash: Offer.Offer["hash"];
|
|
482
|
+
status: OfferStatus;
|
|
483
|
+
metadata?: OfferMetadata;
|
|
484
|
+
}) => Promise<void>;
|
|
485
|
+
updateConsumedAmount: (parameters: {
|
|
486
|
+
chainId: Offer.Offer["chainId"];
|
|
487
|
+
offering: Offer.Offer["offering"];
|
|
488
|
+
nonce: Offer.Offer["nonce"];
|
|
489
|
+
consumed: bigint;
|
|
490
|
+
}) => Promise<void>;
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* Creates a new OfferRepository instance.
|
|
494
|
+
*/
|
|
495
|
+
declare function create(config: OfferRepositoryConfig): OfferRepository;
|
|
496
|
+
type TestOfferRepository = OfferRepository;
|
|
497
|
+
declare function createTest(): TestOfferRepository;
|
|
498
|
+
|
|
499
|
+
type OfferRepository$1_FindMatchingOffersParams = FindMatchingOffersParams;
|
|
500
|
+
type OfferRepository$1_GetAllParams = GetAllParams;
|
|
501
|
+
type OfferRepository$1_GetOffersFilters = GetOffersFilters;
|
|
502
|
+
type OfferRepository$1_OfferRepository = OfferRepository;
|
|
503
|
+
type OfferRepository$1_OfferRepositoryConfig = OfferRepositoryConfig;
|
|
504
|
+
type OfferRepository$1_TestOfferRepository = TestOfferRepository;
|
|
505
|
+
declare const OfferRepository$1_create: typeof create;
|
|
506
|
+
declare const OfferRepository$1_createTest: typeof createTest;
|
|
507
|
+
declare namespace OfferRepository$1 {
|
|
508
|
+
export { type OfferRepository$1_FindMatchingOffersParams as FindMatchingOffersParams, type OfferRepository$1_GetAllParams as GetAllParams, type OfferRepository$1_GetOffersFilters as GetOffersFilters, type OfferRepository$1_OfferRepository as OfferRepository, type OfferRepository$1_OfferRepositoryConfig as OfferRepositoryConfig, type OfferRepository$1_TestOfferRepository as TestOfferRepository, OfferRepository$1_create as create, OfferRepository$1_createTest as createTest };
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
512
|
+
name: "offers";
|
|
513
|
+
schema: undefined;
|
|
514
|
+
columns: {
|
|
515
|
+
hash: drizzle_orm_pg_core.PgColumn<{
|
|
516
|
+
name: "hash";
|
|
517
|
+
tableName: "offers";
|
|
518
|
+
dataType: "string";
|
|
519
|
+
columnType: "PgVarchar";
|
|
520
|
+
data: string;
|
|
521
|
+
driverParam: string;
|
|
522
|
+
notNull: true;
|
|
523
|
+
hasDefault: false;
|
|
524
|
+
isPrimaryKey: true;
|
|
525
|
+
isAutoincrement: false;
|
|
526
|
+
hasRuntimeDefault: false;
|
|
527
|
+
enumValues: [string, ...string[]];
|
|
528
|
+
baseColumn: never;
|
|
529
|
+
identity: undefined;
|
|
530
|
+
generated: undefined;
|
|
531
|
+
}, {}, {
|
|
532
|
+
length: 66;
|
|
533
|
+
}>;
|
|
534
|
+
offering: drizzle_orm_pg_core.PgColumn<{
|
|
535
|
+
name: "offering";
|
|
536
|
+
tableName: "offers";
|
|
537
|
+
dataType: "string";
|
|
538
|
+
columnType: "PgVarchar";
|
|
539
|
+
data: string;
|
|
540
|
+
driverParam: string;
|
|
541
|
+
notNull: true;
|
|
542
|
+
hasDefault: false;
|
|
543
|
+
isPrimaryKey: false;
|
|
544
|
+
isAutoincrement: false;
|
|
545
|
+
hasRuntimeDefault: false;
|
|
546
|
+
enumValues: [string, ...string[]];
|
|
547
|
+
baseColumn: never;
|
|
548
|
+
identity: undefined;
|
|
549
|
+
generated: undefined;
|
|
550
|
+
}, {}, {
|
|
551
|
+
length: 42;
|
|
552
|
+
}>;
|
|
553
|
+
assets: drizzle_orm_pg_core.PgColumn<{
|
|
554
|
+
name: "assets";
|
|
555
|
+
tableName: "offers";
|
|
556
|
+
dataType: "bigint";
|
|
557
|
+
columnType: "PgBigInt64";
|
|
558
|
+
data: bigint;
|
|
559
|
+
driverParam: string;
|
|
560
|
+
notNull: true;
|
|
561
|
+
hasDefault: false;
|
|
562
|
+
isPrimaryKey: false;
|
|
563
|
+
isAutoincrement: false;
|
|
564
|
+
hasRuntimeDefault: false;
|
|
565
|
+
enumValues: undefined;
|
|
566
|
+
baseColumn: never;
|
|
567
|
+
identity: undefined;
|
|
568
|
+
generated: undefined;
|
|
569
|
+
}, {}, {}>;
|
|
570
|
+
rate: drizzle_orm_pg_core.PgColumn<{
|
|
571
|
+
name: "rate";
|
|
572
|
+
tableName: "offers";
|
|
573
|
+
dataType: "bigint";
|
|
574
|
+
columnType: "PgBigInt64";
|
|
575
|
+
data: bigint;
|
|
576
|
+
driverParam: string;
|
|
577
|
+
notNull: true;
|
|
578
|
+
hasDefault: false;
|
|
579
|
+
isPrimaryKey: false;
|
|
580
|
+
isAutoincrement: false;
|
|
581
|
+
hasRuntimeDefault: false;
|
|
582
|
+
enumValues: undefined;
|
|
583
|
+
baseColumn: never;
|
|
584
|
+
identity: undefined;
|
|
585
|
+
generated: undefined;
|
|
586
|
+
}, {}, {}>;
|
|
587
|
+
maturity: drizzle_orm_pg_core.PgColumn<{
|
|
588
|
+
name: "maturity";
|
|
589
|
+
tableName: "offers";
|
|
590
|
+
dataType: "number";
|
|
591
|
+
columnType: "PgInteger";
|
|
592
|
+
data: number;
|
|
593
|
+
driverParam: string | number;
|
|
594
|
+
notNull: true;
|
|
595
|
+
hasDefault: false;
|
|
596
|
+
isPrimaryKey: false;
|
|
597
|
+
isAutoincrement: false;
|
|
598
|
+
hasRuntimeDefault: false;
|
|
599
|
+
enumValues: undefined;
|
|
600
|
+
baseColumn: never;
|
|
601
|
+
identity: undefined;
|
|
602
|
+
generated: undefined;
|
|
603
|
+
}, {}, {}>;
|
|
604
|
+
expiry: drizzle_orm_pg_core.PgColumn<{
|
|
605
|
+
name: "expiry";
|
|
606
|
+
tableName: "offers";
|
|
607
|
+
dataType: "number";
|
|
608
|
+
columnType: "PgInteger";
|
|
609
|
+
data: number;
|
|
610
|
+
driverParam: string | number;
|
|
611
|
+
notNull: true;
|
|
612
|
+
hasDefault: false;
|
|
613
|
+
isPrimaryKey: false;
|
|
614
|
+
isAutoincrement: false;
|
|
615
|
+
hasRuntimeDefault: false;
|
|
616
|
+
enumValues: undefined;
|
|
617
|
+
baseColumn: never;
|
|
618
|
+
identity: undefined;
|
|
619
|
+
generated: undefined;
|
|
620
|
+
}, {}, {}>;
|
|
621
|
+
start: drizzle_orm_pg_core.PgColumn<{
|
|
622
|
+
name: "start";
|
|
623
|
+
tableName: "offers";
|
|
624
|
+
dataType: "number";
|
|
625
|
+
columnType: "PgInteger";
|
|
626
|
+
data: number;
|
|
627
|
+
driverParam: string | number;
|
|
628
|
+
notNull: true;
|
|
629
|
+
hasDefault: false;
|
|
630
|
+
isPrimaryKey: false;
|
|
631
|
+
isAutoincrement: false;
|
|
632
|
+
hasRuntimeDefault: false;
|
|
633
|
+
enumValues: undefined;
|
|
634
|
+
baseColumn: never;
|
|
635
|
+
identity: undefined;
|
|
636
|
+
generated: undefined;
|
|
637
|
+
}, {}, {}>;
|
|
638
|
+
nonce: drizzle_orm_pg_core.PgColumn<{
|
|
639
|
+
name: "nonce";
|
|
640
|
+
tableName: "offers";
|
|
641
|
+
dataType: "bigint";
|
|
642
|
+
columnType: "PgBigInt64";
|
|
643
|
+
data: bigint;
|
|
644
|
+
driverParam: string;
|
|
645
|
+
notNull: true;
|
|
646
|
+
hasDefault: false;
|
|
647
|
+
isPrimaryKey: false;
|
|
648
|
+
isAutoincrement: false;
|
|
649
|
+
hasRuntimeDefault: false;
|
|
650
|
+
enumValues: undefined;
|
|
651
|
+
baseColumn: never;
|
|
652
|
+
identity: undefined;
|
|
653
|
+
generated: undefined;
|
|
654
|
+
}, {}, {}>;
|
|
655
|
+
buy: drizzle_orm_pg_core.PgColumn<{
|
|
656
|
+
name: "buy";
|
|
657
|
+
tableName: "offers";
|
|
658
|
+
dataType: "boolean";
|
|
659
|
+
columnType: "PgBoolean";
|
|
660
|
+
data: boolean;
|
|
661
|
+
driverParam: boolean;
|
|
662
|
+
notNull: true;
|
|
663
|
+
hasDefault: false;
|
|
664
|
+
isPrimaryKey: false;
|
|
665
|
+
isAutoincrement: false;
|
|
666
|
+
hasRuntimeDefault: false;
|
|
667
|
+
enumValues: undefined;
|
|
668
|
+
baseColumn: never;
|
|
669
|
+
identity: undefined;
|
|
670
|
+
generated: undefined;
|
|
671
|
+
}, {}, {}>;
|
|
672
|
+
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
673
|
+
name: "chain_id";
|
|
674
|
+
tableName: "offers";
|
|
675
|
+
dataType: "bigint";
|
|
676
|
+
columnType: "PgBigInt64";
|
|
677
|
+
data: bigint;
|
|
678
|
+
driverParam: string;
|
|
679
|
+
notNull: true;
|
|
680
|
+
hasDefault: false;
|
|
681
|
+
isPrimaryKey: false;
|
|
682
|
+
isAutoincrement: false;
|
|
683
|
+
hasRuntimeDefault: false;
|
|
684
|
+
enumValues: undefined;
|
|
685
|
+
baseColumn: never;
|
|
686
|
+
identity: undefined;
|
|
687
|
+
generated: undefined;
|
|
688
|
+
}, {}, {}>;
|
|
689
|
+
loanToken: drizzle_orm_pg_core.PgColumn<{
|
|
690
|
+
name: "loan_token";
|
|
691
|
+
tableName: "offers";
|
|
692
|
+
dataType: "string";
|
|
693
|
+
columnType: "PgVarchar";
|
|
694
|
+
data: string;
|
|
695
|
+
driverParam: string;
|
|
696
|
+
notNull: true;
|
|
697
|
+
hasDefault: false;
|
|
698
|
+
isPrimaryKey: false;
|
|
699
|
+
isAutoincrement: false;
|
|
700
|
+
hasRuntimeDefault: false;
|
|
701
|
+
enumValues: [string, ...string[]];
|
|
702
|
+
baseColumn: never;
|
|
703
|
+
identity: undefined;
|
|
704
|
+
generated: undefined;
|
|
705
|
+
}, {}, {
|
|
706
|
+
length: 42;
|
|
707
|
+
}>;
|
|
708
|
+
callbackAddress: drizzle_orm_pg_core.PgColumn<{
|
|
709
|
+
name: "callback_address";
|
|
710
|
+
tableName: "offers";
|
|
711
|
+
dataType: "string";
|
|
712
|
+
columnType: "PgVarchar";
|
|
713
|
+
data: string;
|
|
714
|
+
driverParam: string;
|
|
715
|
+
notNull: true;
|
|
716
|
+
hasDefault: false;
|
|
717
|
+
isPrimaryKey: false;
|
|
718
|
+
isAutoincrement: false;
|
|
719
|
+
hasRuntimeDefault: false;
|
|
720
|
+
enumValues: [string, ...string[]];
|
|
721
|
+
baseColumn: never;
|
|
722
|
+
identity: undefined;
|
|
723
|
+
generated: undefined;
|
|
724
|
+
}, {}, {
|
|
725
|
+
length: 42;
|
|
726
|
+
}>;
|
|
727
|
+
callbackData: drizzle_orm_pg_core.PgColumn<{
|
|
728
|
+
name: "callback_data";
|
|
729
|
+
tableName: "offers";
|
|
730
|
+
dataType: "string";
|
|
731
|
+
columnType: "PgText";
|
|
732
|
+
data: string;
|
|
733
|
+
driverParam: string;
|
|
734
|
+
notNull: true;
|
|
735
|
+
hasDefault: false;
|
|
736
|
+
isPrimaryKey: false;
|
|
737
|
+
isAutoincrement: false;
|
|
738
|
+
hasRuntimeDefault: false;
|
|
739
|
+
enumValues: [string, ...string[]];
|
|
740
|
+
baseColumn: never;
|
|
741
|
+
identity: undefined;
|
|
742
|
+
generated: undefined;
|
|
743
|
+
}, {}, {}>;
|
|
744
|
+
callbackGasLimit: drizzle_orm_pg_core.PgColumn<{
|
|
745
|
+
name: "callback_gas_limit";
|
|
746
|
+
tableName: "offers";
|
|
747
|
+
dataType: "bigint";
|
|
748
|
+
columnType: "PgBigInt64";
|
|
749
|
+
data: bigint;
|
|
750
|
+
driverParam: string;
|
|
751
|
+
notNull: true;
|
|
752
|
+
hasDefault: false;
|
|
753
|
+
isPrimaryKey: false;
|
|
754
|
+
isAutoincrement: false;
|
|
755
|
+
hasRuntimeDefault: false;
|
|
756
|
+
enumValues: undefined;
|
|
757
|
+
baseColumn: never;
|
|
758
|
+
identity: undefined;
|
|
759
|
+
generated: undefined;
|
|
760
|
+
}, {}, {}>;
|
|
761
|
+
signature: drizzle_orm_pg_core.PgColumn<{
|
|
762
|
+
name: "signature";
|
|
763
|
+
tableName: "offers";
|
|
764
|
+
dataType: "string";
|
|
765
|
+
columnType: "PgVarchar";
|
|
766
|
+
data: string;
|
|
767
|
+
driverParam: string;
|
|
768
|
+
notNull: false;
|
|
769
|
+
hasDefault: false;
|
|
770
|
+
isPrimaryKey: false;
|
|
771
|
+
isAutoincrement: false;
|
|
772
|
+
hasRuntimeDefault: false;
|
|
773
|
+
enumValues: [string, ...string[]];
|
|
774
|
+
baseColumn: never;
|
|
775
|
+
identity: undefined;
|
|
776
|
+
generated: undefined;
|
|
777
|
+
}, {}, {
|
|
778
|
+
length: 132;
|
|
779
|
+
}>;
|
|
780
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
781
|
+
name: "created_at";
|
|
782
|
+
tableName: "offers";
|
|
783
|
+
dataType: "date";
|
|
784
|
+
columnType: "PgTimestamp";
|
|
785
|
+
data: Date;
|
|
786
|
+
driverParam: string;
|
|
787
|
+
notNull: true;
|
|
788
|
+
hasDefault: true;
|
|
789
|
+
isPrimaryKey: false;
|
|
790
|
+
isAutoincrement: false;
|
|
791
|
+
hasRuntimeDefault: false;
|
|
792
|
+
enumValues: undefined;
|
|
793
|
+
baseColumn: never;
|
|
794
|
+
identity: undefined;
|
|
795
|
+
generated: undefined;
|
|
796
|
+
}, {}, {}>;
|
|
797
|
+
};
|
|
798
|
+
dialect: "pg";
|
|
799
|
+
}>;
|
|
800
|
+
declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
801
|
+
name: "offer_collaterals";
|
|
802
|
+
schema: undefined;
|
|
803
|
+
columns: {
|
|
804
|
+
id: drizzle_orm_pg_core.PgColumn<{
|
|
805
|
+
name: "id";
|
|
806
|
+
tableName: "offer_collaterals";
|
|
807
|
+
dataType: "number";
|
|
808
|
+
columnType: "PgSerial";
|
|
809
|
+
data: number;
|
|
810
|
+
driverParam: number;
|
|
811
|
+
notNull: true;
|
|
812
|
+
hasDefault: true;
|
|
813
|
+
isPrimaryKey: true;
|
|
814
|
+
isAutoincrement: false;
|
|
815
|
+
hasRuntimeDefault: false;
|
|
816
|
+
enumValues: undefined;
|
|
817
|
+
baseColumn: never;
|
|
818
|
+
identity: undefined;
|
|
819
|
+
generated: undefined;
|
|
820
|
+
}, {}, {}>;
|
|
821
|
+
offerHash: drizzle_orm_pg_core.PgColumn<{
|
|
822
|
+
name: "offer_hash";
|
|
823
|
+
tableName: "offer_collaterals";
|
|
824
|
+
dataType: "string";
|
|
825
|
+
columnType: "PgVarchar";
|
|
826
|
+
data: string;
|
|
827
|
+
driverParam: string;
|
|
828
|
+
notNull: true;
|
|
829
|
+
hasDefault: false;
|
|
830
|
+
isPrimaryKey: false;
|
|
831
|
+
isAutoincrement: false;
|
|
832
|
+
hasRuntimeDefault: false;
|
|
833
|
+
enumValues: [string, ...string[]];
|
|
834
|
+
baseColumn: never;
|
|
835
|
+
identity: undefined;
|
|
836
|
+
generated: undefined;
|
|
837
|
+
}, {}, {
|
|
838
|
+
length: 66;
|
|
839
|
+
}>;
|
|
840
|
+
asset: drizzle_orm_pg_core.PgColumn<{
|
|
841
|
+
name: "asset";
|
|
842
|
+
tableName: "offer_collaterals";
|
|
843
|
+
dataType: "string";
|
|
844
|
+
columnType: "PgVarchar";
|
|
845
|
+
data: string;
|
|
846
|
+
driverParam: string;
|
|
847
|
+
notNull: true;
|
|
848
|
+
hasDefault: false;
|
|
849
|
+
isPrimaryKey: false;
|
|
850
|
+
isAutoincrement: false;
|
|
851
|
+
hasRuntimeDefault: false;
|
|
852
|
+
enumValues: [string, ...string[]];
|
|
853
|
+
baseColumn: never;
|
|
854
|
+
identity: undefined;
|
|
855
|
+
generated: undefined;
|
|
856
|
+
}, {}, {
|
|
857
|
+
length: 42;
|
|
858
|
+
}>;
|
|
859
|
+
oracle: drizzle_orm_pg_core.PgColumn<{
|
|
860
|
+
name: "oracle";
|
|
861
|
+
tableName: "offer_collaterals";
|
|
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
|
+
lltv: drizzle_orm_pg_core.PgColumn<{
|
|
879
|
+
name: "lltv";
|
|
880
|
+
tableName: "offer_collaterals";
|
|
881
|
+
dataType: "bigint";
|
|
882
|
+
columnType: "PgBigInt64";
|
|
883
|
+
data: bigint;
|
|
884
|
+
driverParam: string;
|
|
885
|
+
notNull: true;
|
|
886
|
+
hasDefault: false;
|
|
887
|
+
isPrimaryKey: false;
|
|
888
|
+
isAutoincrement: false;
|
|
889
|
+
hasRuntimeDefault: false;
|
|
890
|
+
enumValues: undefined;
|
|
891
|
+
baseColumn: never;
|
|
892
|
+
identity: undefined;
|
|
893
|
+
generated: undefined;
|
|
894
|
+
}, {}, {}>;
|
|
895
|
+
};
|
|
896
|
+
dialect: "pg";
|
|
897
|
+
}>;
|
|
898
|
+
declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
899
|
+
name: "offer_status";
|
|
900
|
+
schema: undefined;
|
|
901
|
+
columns: {
|
|
902
|
+
id: drizzle_orm_pg_core.PgColumn<{
|
|
903
|
+
name: "id";
|
|
904
|
+
tableName: "offer_status";
|
|
905
|
+
dataType: "number";
|
|
906
|
+
columnType: "PgSerial";
|
|
907
|
+
data: number;
|
|
908
|
+
driverParam: number;
|
|
909
|
+
notNull: true;
|
|
910
|
+
hasDefault: true;
|
|
911
|
+
isPrimaryKey: true;
|
|
912
|
+
isAutoincrement: false;
|
|
913
|
+
hasRuntimeDefault: false;
|
|
914
|
+
enumValues: undefined;
|
|
915
|
+
baseColumn: never;
|
|
916
|
+
identity: undefined;
|
|
917
|
+
generated: undefined;
|
|
918
|
+
}, {}, {}>;
|
|
919
|
+
offerHash: drizzle_orm_pg_core.PgColumn<{
|
|
920
|
+
name: "offer_hash";
|
|
921
|
+
tableName: "offer_status";
|
|
922
|
+
dataType: "string";
|
|
923
|
+
columnType: "PgVarchar";
|
|
924
|
+
data: string;
|
|
925
|
+
driverParam: string;
|
|
926
|
+
notNull: true;
|
|
927
|
+
hasDefault: false;
|
|
928
|
+
isPrimaryKey: false;
|
|
929
|
+
isAutoincrement: false;
|
|
930
|
+
hasRuntimeDefault: false;
|
|
931
|
+
enumValues: [string, ...string[]];
|
|
932
|
+
baseColumn: never;
|
|
933
|
+
identity: undefined;
|
|
934
|
+
generated: undefined;
|
|
935
|
+
}, {}, {
|
|
936
|
+
length: 66;
|
|
937
|
+
}>;
|
|
938
|
+
status: drizzle_orm_pg_core.PgColumn<{
|
|
939
|
+
name: "status";
|
|
940
|
+
tableName: "offer_status";
|
|
941
|
+
dataType: "string";
|
|
942
|
+
columnType: "PgText";
|
|
943
|
+
data: "valid" | "callback_not_supported" | "callback_error" | "unverified";
|
|
944
|
+
driverParam: string;
|
|
945
|
+
notNull: true;
|
|
946
|
+
hasDefault: false;
|
|
947
|
+
isPrimaryKey: false;
|
|
948
|
+
isAutoincrement: false;
|
|
949
|
+
hasRuntimeDefault: false;
|
|
950
|
+
enumValues: [string, ...string[]];
|
|
951
|
+
baseColumn: never;
|
|
952
|
+
identity: undefined;
|
|
953
|
+
generated: undefined;
|
|
954
|
+
}, {}, {
|
|
955
|
+
$type: "valid" | "callback_not_supported" | "callback_error" | "unverified";
|
|
956
|
+
}>;
|
|
957
|
+
metadata: drizzle_orm_pg_core.PgColumn<{
|
|
958
|
+
name: "metadata";
|
|
959
|
+
tableName: "offer_status";
|
|
960
|
+
dataType: "json";
|
|
961
|
+
columnType: "PgJsonb";
|
|
962
|
+
data: unknown;
|
|
963
|
+
driverParam: unknown;
|
|
964
|
+
notNull: false;
|
|
965
|
+
hasDefault: false;
|
|
966
|
+
isPrimaryKey: false;
|
|
967
|
+
isAutoincrement: false;
|
|
968
|
+
hasRuntimeDefault: false;
|
|
969
|
+
enumValues: undefined;
|
|
970
|
+
baseColumn: never;
|
|
971
|
+
identity: undefined;
|
|
972
|
+
generated: undefined;
|
|
973
|
+
}, {}, {}>;
|
|
974
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
975
|
+
name: "created_at";
|
|
976
|
+
tableName: "offer_status";
|
|
977
|
+
dataType: "date";
|
|
978
|
+
columnType: "PgTimestamp";
|
|
979
|
+
data: Date;
|
|
980
|
+
driverParam: string;
|
|
981
|
+
notNull: true;
|
|
982
|
+
hasDefault: true;
|
|
983
|
+
isPrimaryKey: false;
|
|
984
|
+
isAutoincrement: false;
|
|
985
|
+
hasRuntimeDefault: false;
|
|
986
|
+
enumValues: undefined;
|
|
987
|
+
baseColumn: never;
|
|
988
|
+
identity: undefined;
|
|
989
|
+
generated: undefined;
|
|
990
|
+
}, {}, {}>;
|
|
991
|
+
};
|
|
992
|
+
dialect: "pg";
|
|
993
|
+
}>;
|
|
994
|
+
declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
995
|
+
name: "consumed_per_user_and_nonce";
|
|
996
|
+
schema: undefined;
|
|
997
|
+
columns: {
|
|
998
|
+
id: drizzle_orm_pg_core.PgColumn<{
|
|
999
|
+
name: "id";
|
|
1000
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1001
|
+
dataType: "number";
|
|
1002
|
+
columnType: "PgSerial";
|
|
1003
|
+
data: number;
|
|
1004
|
+
driverParam: number;
|
|
1005
|
+
notNull: true;
|
|
1006
|
+
hasDefault: true;
|
|
1007
|
+
isPrimaryKey: true;
|
|
1008
|
+
isAutoincrement: false;
|
|
1009
|
+
hasRuntimeDefault: false;
|
|
1010
|
+
enumValues: undefined;
|
|
1011
|
+
baseColumn: never;
|
|
1012
|
+
identity: undefined;
|
|
1013
|
+
generated: undefined;
|
|
1014
|
+
}, {}, {}>;
|
|
1015
|
+
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
1016
|
+
name: "chain_id";
|
|
1017
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1018
|
+
dataType: "bigint";
|
|
1019
|
+
columnType: "PgBigInt64";
|
|
1020
|
+
data: bigint;
|
|
1021
|
+
driverParam: string;
|
|
1022
|
+
notNull: true;
|
|
1023
|
+
hasDefault: false;
|
|
1024
|
+
isPrimaryKey: false;
|
|
1025
|
+
isAutoincrement: false;
|
|
1026
|
+
hasRuntimeDefault: false;
|
|
1027
|
+
enumValues: undefined;
|
|
1028
|
+
baseColumn: never;
|
|
1029
|
+
identity: undefined;
|
|
1030
|
+
generated: undefined;
|
|
1031
|
+
}, {}, {}>;
|
|
1032
|
+
offering: drizzle_orm_pg_core.PgColumn<{
|
|
1033
|
+
name: "offering";
|
|
1034
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1035
|
+
dataType: "string";
|
|
1036
|
+
columnType: "PgVarchar";
|
|
1037
|
+
data: string;
|
|
1038
|
+
driverParam: string;
|
|
1039
|
+
notNull: true;
|
|
1040
|
+
hasDefault: false;
|
|
1041
|
+
isPrimaryKey: false;
|
|
1042
|
+
isAutoincrement: false;
|
|
1043
|
+
hasRuntimeDefault: false;
|
|
1044
|
+
enumValues: [string, ...string[]];
|
|
1045
|
+
baseColumn: never;
|
|
1046
|
+
identity: undefined;
|
|
1047
|
+
generated: undefined;
|
|
1048
|
+
}, {}, {
|
|
1049
|
+
length: 42;
|
|
1050
|
+
}>;
|
|
1051
|
+
nonce: drizzle_orm_pg_core.PgColumn<{
|
|
1052
|
+
name: "nonce";
|
|
1053
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1054
|
+
dataType: "bigint";
|
|
1055
|
+
columnType: "PgBigInt64";
|
|
1056
|
+
data: bigint;
|
|
1057
|
+
driverParam: string;
|
|
1058
|
+
notNull: true;
|
|
1059
|
+
hasDefault: false;
|
|
1060
|
+
isPrimaryKey: false;
|
|
1061
|
+
isAutoincrement: false;
|
|
1062
|
+
hasRuntimeDefault: false;
|
|
1063
|
+
enumValues: undefined;
|
|
1064
|
+
baseColumn: never;
|
|
1065
|
+
identity: undefined;
|
|
1066
|
+
generated: undefined;
|
|
1067
|
+
}, {}, {}>;
|
|
1068
|
+
consumed: drizzle_orm_pg_core.PgColumn<{
|
|
1069
|
+
name: "consumed";
|
|
1070
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1071
|
+
dataType: "bigint";
|
|
1072
|
+
columnType: "PgBigInt64";
|
|
1073
|
+
data: bigint;
|
|
1074
|
+
driverParam: string;
|
|
1075
|
+
notNull: true;
|
|
1076
|
+
hasDefault: false;
|
|
1077
|
+
isPrimaryKey: false;
|
|
1078
|
+
isAutoincrement: false;
|
|
1079
|
+
hasRuntimeDefault: false;
|
|
1080
|
+
enumValues: undefined;
|
|
1081
|
+
baseColumn: never;
|
|
1082
|
+
identity: undefined;
|
|
1083
|
+
generated: undefined;
|
|
1084
|
+
}, {}, {}>;
|
|
1085
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1086
|
+
name: "created_at";
|
|
1087
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1088
|
+
dataType: "date";
|
|
1089
|
+
columnType: "PgTimestamp";
|
|
1090
|
+
data: Date;
|
|
1091
|
+
driverParam: string;
|
|
1092
|
+
notNull: true;
|
|
1093
|
+
hasDefault: true;
|
|
1094
|
+
isPrimaryKey: false;
|
|
1095
|
+
isAutoincrement: false;
|
|
1096
|
+
hasRuntimeDefault: false;
|
|
1097
|
+
enumValues: undefined;
|
|
1098
|
+
baseColumn: never;
|
|
1099
|
+
identity: undefined;
|
|
1100
|
+
generated: undefined;
|
|
1101
|
+
}, {}, {}>;
|
|
1102
|
+
};
|
|
1103
|
+
dialect: "pg";
|
|
1104
|
+
}>;
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* Start a local router server.
|
|
1108
|
+
* @example
|
|
1109
|
+
* ```ts
|
|
1110
|
+
* import { Router } from "@morpho-dev/router";
|
|
1111
|
+
* await Router.serve(); // local router server running on http://localhost:8081
|
|
1112
|
+
* ```
|
|
1113
|
+
*/
|
|
1114
|
+
declare function serve(parameters: {
|
|
1115
|
+
port: number;
|
|
1116
|
+
store?: OfferRepository;
|
|
1117
|
+
}): Promise<void>;
|
|
1118
|
+
|
|
206
1119
|
type index_Client = Client;
|
|
207
1120
|
type index_GetParameters = GetParameters;
|
|
208
1121
|
type index_HttpForbiddenError = HttpForbiddenError;
|
|
@@ -220,8 +1133,9 @@ type index_RouterClientConfig = RouterClientConfig;
|
|
|
220
1133
|
declare const index_connect: typeof connect;
|
|
221
1134
|
declare const index_get: typeof get;
|
|
222
1135
|
declare const index_match: typeof match;
|
|
1136
|
+
declare const index_serve: typeof serve;
|
|
223
1137
|
declare namespace index {
|
|
224
|
-
export { 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_InvalidUrlError as InvalidUrlError, type index_MatchParameters as MatchParameters, type index_RouterClientConfig as RouterClientConfig, index_connect as connect, index_get as get, index_match as match };
|
|
1138
|
+
export { 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_InvalidUrlError as InvalidUrlError, type index_MatchParameters as MatchParameters, type index_RouterClientConfig as RouterClientConfig, index_connect as connect, index_get as get, index_match as match, index_serve as serve };
|
|
225
1139
|
}
|
|
226
1140
|
|
|
227
1141
|
declare const users: Account[];
|
|
@@ -297,13 +1211,13 @@ declare const types: readonly ["offer_created", "offer_matched", "offer_validati
|
|
|
297
1211
|
type Type = (typeof types)[number];
|
|
298
1212
|
type EventPayload = {
|
|
299
1213
|
offer_created: {
|
|
300
|
-
readonly offer:
|
|
1214
|
+
readonly offer: Offer.Offer;
|
|
301
1215
|
};
|
|
302
1216
|
offer_matched: {
|
|
303
|
-
readonly offer:
|
|
1217
|
+
readonly offer: Offer.Offer;
|
|
304
1218
|
};
|
|
305
1219
|
offer_validation: {
|
|
306
|
-
readonly offer:
|
|
1220
|
+
readonly offer: Offer.Offer;
|
|
307
1221
|
};
|
|
308
1222
|
};
|
|
309
1223
|
type BaseEvent<T extends Type> = {
|
|
@@ -347,6 +1261,19 @@ declare namespace RouterEvent$1 {
|
|
|
347
1261
|
*/
|
|
348
1262
|
declare function batch$1<T>(array: Array<T>, batchSize: number): Generator<T[], void, unknown>;
|
|
349
1263
|
|
|
1264
|
+
type Cursor = {
|
|
1265
|
+
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
1266
|
+
dir: "asc" | "desc";
|
|
1267
|
+
rate?: string;
|
|
1268
|
+
maturity?: number;
|
|
1269
|
+
expiry?: number;
|
|
1270
|
+
assets?: string;
|
|
1271
|
+
hash: string;
|
|
1272
|
+
};
|
|
1273
|
+
declare function validateCursor(cursor: unknown): cursor is Cursor;
|
|
1274
|
+
declare function encodeCursor(c: Cursor): string;
|
|
1275
|
+
declare function decodeCursor(token?: string): Cursor | null;
|
|
1276
|
+
|
|
350
1277
|
/**
|
|
351
1278
|
* Polls a function at a specified interval.
|
|
352
1279
|
* Inspired by https://github.com/wevm/viem/blob/845994d20275d08ff892018e237a4b599eeefb6a/src/utils/poll.ts
|
|
@@ -606,4 +1533,4 @@ declare namespace Validation {
|
|
|
606
1533
|
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
607
1534
|
}
|
|
608
1535
|
|
|
609
|
-
export { Chain$1 as Chain, type Compute, EVM, Logger$1 as Logger, index as Router, RouterEvent$1 as RouterEvent, RouterOffer$1 as RouterOffer, Validation, ValidationRule, batch$1 as batch, poll, wait };
|
|
1536
|
+
export { index$1 as ApiSchema, Chain$1 as Chain, type Compute, type Cursor, EVM, Logger$1 as Logger, OfferDB, OfferRepository$1 as OfferRepository, index as Router, RouterEvent$1 as RouterEvent, RouterOffer$1 as RouterOffer, Validation, ValidationRule, batch$1 as batch, consumed, decodeCursor, encodeCursor, offerCollaterals, offerStatus, offers, poll, validateCursor, wait };
|