@morpho-dev/router 0.0.15 → 0.0.16
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/dist/index.browser.d.cts +21 -17
- package/dist/index.browser.d.ts +21 -17
- package/dist/index.browser.js +24 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +24 -2
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +43 -24
- package/dist/index.node.d.ts +43 -24
- package/dist/index.node.js +35 -7
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +36 -8
- package/dist/index.node.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.node.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _morpho_dev_mempool from '@morpho-dev/mempool';
|
|
2
|
+
import { Compute, Offer, Errors, Format } from '@morpho-dev/mempool';
|
|
2
3
|
export * from '@morpho-dev/mempool';
|
|
3
4
|
import * as viem from 'viem';
|
|
4
5
|
import { Address, Account, Hex, PublicClient } from 'viem';
|
|
@@ -14,10 +15,6 @@ import { Pool } from 'pg';
|
|
|
14
15
|
export * from 'drizzle-orm';
|
|
15
16
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
16
17
|
|
|
17
|
-
type Compute<type> = {
|
|
18
|
-
[key in keyof type]: type[key];
|
|
19
|
-
} & unknown;
|
|
20
|
-
|
|
21
18
|
declare const chainNames: readonly ["ethereum", "base"];
|
|
22
19
|
type ChainName = (typeof chainNames)[number];
|
|
23
20
|
declare const ChainId: {
|
|
@@ -115,13 +112,6 @@ type Action = keyof typeof schemas;
|
|
|
115
112
|
declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
|
|
116
113
|
declare function safeParse<A extends Action>(action: A, query: unknown): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
|
|
117
114
|
|
|
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
|
-
|
|
125
115
|
declare const OfferStatusValues: readonly ["valid", "callback_not_supported", "callback_error", "unverified"];
|
|
126
116
|
type OfferStatus = (typeof OfferStatusValues)[number];
|
|
127
117
|
type OfferMetadata = {
|
|
@@ -138,7 +128,7 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
138
128
|
offering: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
139
129
|
assets: zod_v4.ZodBigInt;
|
|
140
130
|
rate: zod_v4.ZodBigInt;
|
|
141
|
-
maturity: zod_v4.ZodNumber
|
|
131
|
+
maturity: zod_v4.ZodPipe<zod_v4.ZodNumber, zod_v4.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>;
|
|
142
132
|
expiry: zod_v4.ZodNumber;
|
|
143
133
|
start: zod_v4.ZodNumber;
|
|
144
134
|
nonce: zod_v4.ZodBigInt;
|
|
@@ -215,6 +205,35 @@ declare namespace RouterOffer$1 {
|
|
|
215
205
|
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 };
|
|
216
206
|
}
|
|
217
207
|
|
|
208
|
+
type OfferResponse = {
|
|
209
|
+
offer: Offer.Offer;
|
|
210
|
+
consumed: bigint;
|
|
211
|
+
status: OfferStatus;
|
|
212
|
+
metadata?: OfferMetadata;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Transforms a RouterOffer to OfferResponse format.
|
|
216
|
+
* @param routerOffer - The router offer to transform.
|
|
217
|
+
* @returns The router offer response with offer as a nested property.
|
|
218
|
+
*/
|
|
219
|
+
declare function toResponse(routerOffer: RouterOffer): OfferResponse;
|
|
220
|
+
/**
|
|
221
|
+
* Transforms a OfferResponse to RouterOffer format.
|
|
222
|
+
* @param offerResponse - The router offer response to transform.
|
|
223
|
+
* @returns The router offer with all properties at the top level.
|
|
224
|
+
*/
|
|
225
|
+
declare function fromResponse(offerResponse: OfferResponse): RouterOffer;
|
|
226
|
+
|
|
227
|
+
type index$1_OfferResponse = OfferResponse;
|
|
228
|
+
declare const index$1_OpenApi: typeof OpenApi;
|
|
229
|
+
declare const index$1_fromResponse: typeof fromResponse;
|
|
230
|
+
declare const index$1_parse: typeof parse;
|
|
231
|
+
declare const index$1_safeParse: typeof safeParse;
|
|
232
|
+
declare const index$1_toResponse: typeof toResponse;
|
|
233
|
+
declare namespace index$1 {
|
|
234
|
+
export { type index$1_OfferResponse as OfferResponse, index$1_OpenApi as OpenApi, index$1_fromResponse as fromResponse, index$1_parse as parse, index$1_safeParse as safeParse, index$1_toResponse as toResponse };
|
|
235
|
+
}
|
|
236
|
+
|
|
218
237
|
type GetParameters = {
|
|
219
238
|
/** Filter by multiple creator addresses (comma-separated) */
|
|
220
239
|
creators?: string[];
|
|
@@ -304,11 +323,11 @@ type RouterClientConfig = {
|
|
|
304
323
|
type Client = Compute<RouterClientConfig & {
|
|
305
324
|
get: (parameters: GetParameters) => Promise<{
|
|
306
325
|
cursor: string | null;
|
|
307
|
-
offers:
|
|
326
|
+
offers: OfferResponse[];
|
|
308
327
|
}>;
|
|
309
328
|
match: (parameters: MatchParameters) => Promise<{
|
|
310
329
|
cursor: string | null;
|
|
311
|
-
offers:
|
|
330
|
+
offers: OfferResponse[];
|
|
312
331
|
}>;
|
|
313
332
|
}>;
|
|
314
333
|
declare function connect(opts?: {
|
|
@@ -324,7 +343,7 @@ declare namespace connect {
|
|
|
324
343
|
*/
|
|
325
344
|
declare function get(config: RouterClientConfig, parameters: GetParameters): Promise<{
|
|
326
345
|
cursor: string | null;
|
|
327
|
-
offers:
|
|
346
|
+
offers: OfferResponse[];
|
|
328
347
|
}>;
|
|
329
348
|
declare namespace get {
|
|
330
349
|
type ErrorType = GetApiErrorType;
|
|
@@ -335,7 +354,7 @@ declare namespace get {
|
|
|
335
354
|
*/
|
|
336
355
|
declare function match(config: RouterClientConfig, parameters: MatchParameters): Promise<{
|
|
337
356
|
cursor: string | null;
|
|
338
|
-
offers:
|
|
357
|
+
offers: OfferResponse[];
|
|
339
358
|
}>;
|
|
340
359
|
declare namespace match {
|
|
341
360
|
type ErrorType = GetApiErrorType;
|
|
@@ -1338,7 +1357,7 @@ declare function morpho(parameters: {
|
|
|
1338
1357
|
readonly offering: Address;
|
|
1339
1358
|
readonly assets: bigint;
|
|
1340
1359
|
readonly rate: bigint;
|
|
1341
|
-
readonly maturity: number
|
|
1360
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1342
1361
|
readonly expiry: number;
|
|
1343
1362
|
readonly nonce: bigint;
|
|
1344
1363
|
readonly buy: boolean;
|
|
@@ -1362,7 +1381,7 @@ declare function morpho(parameters: {
|
|
|
1362
1381
|
readonly offering: Address;
|
|
1363
1382
|
readonly assets: bigint;
|
|
1364
1383
|
readonly rate: bigint;
|
|
1365
|
-
readonly maturity: number
|
|
1384
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1366
1385
|
readonly expiry: number;
|
|
1367
1386
|
readonly nonce: bigint;
|
|
1368
1387
|
readonly buy: boolean;
|
|
@@ -1386,7 +1405,7 @@ declare function morpho(parameters: {
|
|
|
1386
1405
|
readonly offering: Address;
|
|
1387
1406
|
readonly assets: bigint;
|
|
1388
1407
|
readonly rate: bigint;
|
|
1389
|
-
readonly maturity: number
|
|
1408
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1390
1409
|
readonly expiry: number;
|
|
1391
1410
|
readonly nonce: bigint;
|
|
1392
1411
|
readonly buy: boolean;
|
|
@@ -1410,7 +1429,7 @@ declare function morpho(parameters: {
|
|
|
1410
1429
|
readonly offering: Address;
|
|
1411
1430
|
readonly assets: bigint;
|
|
1412
1431
|
readonly rate: bigint;
|
|
1413
|
-
readonly maturity: number
|
|
1432
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1414
1433
|
readonly expiry: number;
|
|
1415
1434
|
readonly nonce: bigint;
|
|
1416
1435
|
readonly buy: boolean;
|
|
@@ -1434,7 +1453,7 @@ declare function morpho(parameters: {
|
|
|
1434
1453
|
readonly offering: Address;
|
|
1435
1454
|
readonly assets: bigint;
|
|
1436
1455
|
readonly rate: bigint;
|
|
1437
|
-
readonly maturity: number
|
|
1456
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1438
1457
|
readonly expiry: number;
|
|
1439
1458
|
readonly nonce: bigint;
|
|
1440
1459
|
readonly buy: boolean;
|
|
@@ -1458,7 +1477,7 @@ declare function morpho(parameters: {
|
|
|
1458
1477
|
readonly offering: Address;
|
|
1459
1478
|
readonly assets: bigint;
|
|
1460
1479
|
readonly rate: bigint;
|
|
1461
|
-
readonly maturity: number
|
|
1480
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1462
1481
|
readonly expiry: number;
|
|
1463
1482
|
readonly nonce: bigint;
|
|
1464
1483
|
readonly buy: boolean;
|
|
@@ -1533,4 +1552,4 @@ declare namespace Validation {
|
|
|
1533
1552
|
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
1534
1553
|
}
|
|
1535
1554
|
|
|
1536
|
-
export { index$1 as ApiSchema, Chain$1 as Chain, type
|
|
1555
|
+
export { index$1 as ApiSchema, Chain$1 as Chain, 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 };
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _morpho_dev_mempool from '@morpho-dev/mempool';
|
|
2
|
+
import { Compute, Offer, Errors, Format } from '@morpho-dev/mempool';
|
|
2
3
|
export * from '@morpho-dev/mempool';
|
|
3
4
|
import * as viem from 'viem';
|
|
4
5
|
import { Address, Account, Hex, PublicClient } from 'viem';
|
|
@@ -14,10 +15,6 @@ import { Pool } from 'pg';
|
|
|
14
15
|
export * from 'drizzle-orm';
|
|
15
16
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
16
17
|
|
|
17
|
-
type Compute<type> = {
|
|
18
|
-
[key in keyof type]: type[key];
|
|
19
|
-
} & unknown;
|
|
20
|
-
|
|
21
18
|
declare const chainNames: readonly ["ethereum", "base"];
|
|
22
19
|
type ChainName = (typeof chainNames)[number];
|
|
23
20
|
declare const ChainId: {
|
|
@@ -115,13 +112,6 @@ type Action = keyof typeof schemas;
|
|
|
115
112
|
declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
|
|
116
113
|
declare function safeParse<A extends Action>(action: A, query: unknown): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
|
|
117
114
|
|
|
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
|
-
|
|
125
115
|
declare const OfferStatusValues: readonly ["valid", "callback_not_supported", "callback_error", "unverified"];
|
|
126
116
|
type OfferStatus = (typeof OfferStatusValues)[number];
|
|
127
117
|
type OfferMetadata = {
|
|
@@ -138,7 +128,7 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
138
128
|
offering: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
139
129
|
assets: zod_v4.ZodBigInt;
|
|
140
130
|
rate: zod_v4.ZodBigInt;
|
|
141
|
-
maturity: zod_v4.ZodNumber
|
|
131
|
+
maturity: zod_v4.ZodPipe<zod_v4.ZodNumber, zod_v4.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>;
|
|
142
132
|
expiry: zod_v4.ZodNumber;
|
|
143
133
|
start: zod_v4.ZodNumber;
|
|
144
134
|
nonce: zod_v4.ZodBigInt;
|
|
@@ -215,6 +205,35 @@ declare namespace RouterOffer$1 {
|
|
|
215
205
|
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 };
|
|
216
206
|
}
|
|
217
207
|
|
|
208
|
+
type OfferResponse = {
|
|
209
|
+
offer: Offer.Offer;
|
|
210
|
+
consumed: bigint;
|
|
211
|
+
status: OfferStatus;
|
|
212
|
+
metadata?: OfferMetadata;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Transforms a RouterOffer to OfferResponse format.
|
|
216
|
+
* @param routerOffer - The router offer to transform.
|
|
217
|
+
* @returns The router offer response with offer as a nested property.
|
|
218
|
+
*/
|
|
219
|
+
declare function toResponse(routerOffer: RouterOffer): OfferResponse;
|
|
220
|
+
/**
|
|
221
|
+
* Transforms a OfferResponse to RouterOffer format.
|
|
222
|
+
* @param offerResponse - The router offer response to transform.
|
|
223
|
+
* @returns The router offer with all properties at the top level.
|
|
224
|
+
*/
|
|
225
|
+
declare function fromResponse(offerResponse: OfferResponse): RouterOffer;
|
|
226
|
+
|
|
227
|
+
type index$1_OfferResponse = OfferResponse;
|
|
228
|
+
declare const index$1_OpenApi: typeof OpenApi;
|
|
229
|
+
declare const index$1_fromResponse: typeof fromResponse;
|
|
230
|
+
declare const index$1_parse: typeof parse;
|
|
231
|
+
declare const index$1_safeParse: typeof safeParse;
|
|
232
|
+
declare const index$1_toResponse: typeof toResponse;
|
|
233
|
+
declare namespace index$1 {
|
|
234
|
+
export { type index$1_OfferResponse as OfferResponse, index$1_OpenApi as OpenApi, index$1_fromResponse as fromResponse, index$1_parse as parse, index$1_safeParse as safeParse, index$1_toResponse as toResponse };
|
|
235
|
+
}
|
|
236
|
+
|
|
218
237
|
type GetParameters = {
|
|
219
238
|
/** Filter by multiple creator addresses (comma-separated) */
|
|
220
239
|
creators?: string[];
|
|
@@ -304,11 +323,11 @@ type RouterClientConfig = {
|
|
|
304
323
|
type Client = Compute<RouterClientConfig & {
|
|
305
324
|
get: (parameters: GetParameters) => Promise<{
|
|
306
325
|
cursor: string | null;
|
|
307
|
-
offers:
|
|
326
|
+
offers: OfferResponse[];
|
|
308
327
|
}>;
|
|
309
328
|
match: (parameters: MatchParameters) => Promise<{
|
|
310
329
|
cursor: string | null;
|
|
311
|
-
offers:
|
|
330
|
+
offers: OfferResponse[];
|
|
312
331
|
}>;
|
|
313
332
|
}>;
|
|
314
333
|
declare function connect(opts?: {
|
|
@@ -324,7 +343,7 @@ declare namespace connect {
|
|
|
324
343
|
*/
|
|
325
344
|
declare function get(config: RouterClientConfig, parameters: GetParameters): Promise<{
|
|
326
345
|
cursor: string | null;
|
|
327
|
-
offers:
|
|
346
|
+
offers: OfferResponse[];
|
|
328
347
|
}>;
|
|
329
348
|
declare namespace get {
|
|
330
349
|
type ErrorType = GetApiErrorType;
|
|
@@ -335,7 +354,7 @@ declare namespace get {
|
|
|
335
354
|
*/
|
|
336
355
|
declare function match(config: RouterClientConfig, parameters: MatchParameters): Promise<{
|
|
337
356
|
cursor: string | null;
|
|
338
|
-
offers:
|
|
357
|
+
offers: OfferResponse[];
|
|
339
358
|
}>;
|
|
340
359
|
declare namespace match {
|
|
341
360
|
type ErrorType = GetApiErrorType;
|
|
@@ -1338,7 +1357,7 @@ declare function morpho(parameters: {
|
|
|
1338
1357
|
readonly offering: Address;
|
|
1339
1358
|
readonly assets: bigint;
|
|
1340
1359
|
readonly rate: bigint;
|
|
1341
|
-
readonly maturity: number
|
|
1360
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1342
1361
|
readonly expiry: number;
|
|
1343
1362
|
readonly nonce: bigint;
|
|
1344
1363
|
readonly buy: boolean;
|
|
@@ -1362,7 +1381,7 @@ declare function morpho(parameters: {
|
|
|
1362
1381
|
readonly offering: Address;
|
|
1363
1382
|
readonly assets: bigint;
|
|
1364
1383
|
readonly rate: bigint;
|
|
1365
|
-
readonly maturity: number
|
|
1384
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1366
1385
|
readonly expiry: number;
|
|
1367
1386
|
readonly nonce: bigint;
|
|
1368
1387
|
readonly buy: boolean;
|
|
@@ -1386,7 +1405,7 @@ declare function morpho(parameters: {
|
|
|
1386
1405
|
readonly offering: Address;
|
|
1387
1406
|
readonly assets: bigint;
|
|
1388
1407
|
readonly rate: bigint;
|
|
1389
|
-
readonly maturity: number
|
|
1408
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1390
1409
|
readonly expiry: number;
|
|
1391
1410
|
readonly nonce: bigint;
|
|
1392
1411
|
readonly buy: boolean;
|
|
@@ -1410,7 +1429,7 @@ declare function morpho(parameters: {
|
|
|
1410
1429
|
readonly offering: Address;
|
|
1411
1430
|
readonly assets: bigint;
|
|
1412
1431
|
readonly rate: bigint;
|
|
1413
|
-
readonly maturity: number
|
|
1432
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1414
1433
|
readonly expiry: number;
|
|
1415
1434
|
readonly nonce: bigint;
|
|
1416
1435
|
readonly buy: boolean;
|
|
@@ -1434,7 +1453,7 @@ declare function morpho(parameters: {
|
|
|
1434
1453
|
readonly offering: Address;
|
|
1435
1454
|
readonly assets: bigint;
|
|
1436
1455
|
readonly rate: bigint;
|
|
1437
|
-
readonly maturity: number
|
|
1456
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1438
1457
|
readonly expiry: number;
|
|
1439
1458
|
readonly nonce: bigint;
|
|
1440
1459
|
readonly buy: boolean;
|
|
@@ -1458,7 +1477,7 @@ declare function morpho(parameters: {
|
|
|
1458
1477
|
readonly offering: Address;
|
|
1459
1478
|
readonly assets: bigint;
|
|
1460
1479
|
readonly rate: bigint;
|
|
1461
|
-
readonly maturity: number
|
|
1480
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1462
1481
|
readonly expiry: number;
|
|
1463
1482
|
readonly nonce: bigint;
|
|
1464
1483
|
readonly buy: boolean;
|
|
@@ -1533,4 +1552,4 @@ declare namespace Validation {
|
|
|
1533
1552
|
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
1534
1553
|
}
|
|
1535
1554
|
|
|
1536
|
-
export { index$1 as ApiSchema, Chain$1 as Chain, type
|
|
1555
|
+
export { index$1 as ApiSchema, Chain$1 as Chain, 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 };
|
package/dist/index.node.js
CHANGED
|
@@ -8211,8 +8211,10 @@ var chains = {
|
|
|
8211
8211
|
var apiSchema_exports = {};
|
|
8212
8212
|
__export(apiSchema_exports, {
|
|
8213
8213
|
OpenApi: () => OpenApi,
|
|
8214
|
+
fromResponse: () => fromResponse,
|
|
8214
8215
|
parse: () => parse,
|
|
8215
|
-
safeParse: () => safeParse
|
|
8216
|
+
safeParse: () => safeParse,
|
|
8217
|
+
toResponse: () => toResponse
|
|
8216
8218
|
});
|
|
8217
8219
|
|
|
8218
8220
|
// src/RouterOffer.ts
|
|
@@ -8857,6 +8859,26 @@ var OpenApi = zodOpenapi.createDocument({
|
|
|
8857
8859
|
paths
|
|
8858
8860
|
});
|
|
8859
8861
|
|
|
8862
|
+
// src/core/apiSchema/utils.ts
|
|
8863
|
+
function toResponse(routerOffer) {
|
|
8864
|
+
const { consumed: consumed2, status, metadata, ...offer } = routerOffer;
|
|
8865
|
+
return {
|
|
8866
|
+
offer,
|
|
8867
|
+
consumed: consumed2,
|
|
8868
|
+
status,
|
|
8869
|
+
metadata
|
|
8870
|
+
};
|
|
8871
|
+
}
|
|
8872
|
+
function fromResponse(offerResponse) {
|
|
8873
|
+
const { offer, consumed: consumed2, status, metadata } = offerResponse;
|
|
8874
|
+
return {
|
|
8875
|
+
...offer,
|
|
8876
|
+
consumed: consumed2,
|
|
8877
|
+
status,
|
|
8878
|
+
metadata
|
|
8879
|
+
};
|
|
8880
|
+
}
|
|
8881
|
+
|
|
8860
8882
|
// src/core/index.ts
|
|
8861
8883
|
var core_exports = {};
|
|
8862
8884
|
__export(core_exports, {
|
|
@@ -8970,9 +8992,10 @@ async function get(config, parameters) {
|
|
|
8970
8992
|
url.searchParams.set("limit", parameters.limit.toString());
|
|
8971
8993
|
}
|
|
8972
8994
|
const { cursor: returnedCursor, data: offers2 } = await getApi(config, url);
|
|
8995
|
+
const routerOffers = offers2.map(mempool.Format.fromSnakeCase).map(fromResponse);
|
|
8973
8996
|
return {
|
|
8974
8997
|
cursor: returnedCursor,
|
|
8975
|
-
offers:
|
|
8998
|
+
offers: routerOffers.map(from).map(toResponse)
|
|
8976
8999
|
};
|
|
8977
9000
|
}
|
|
8978
9001
|
async function match(config, parameters) {
|
|
@@ -9011,9 +9034,10 @@ async function match(config, parameters) {
|
|
|
9011
9034
|
url.searchParams.set("limit", parameters.limit.toString());
|
|
9012
9035
|
}
|
|
9013
9036
|
const { cursor: returnedCursor, data: offers2 } = await getApi(config, url);
|
|
9037
|
+
const routerOffers = offers2.map(mempool.Format.fromSnakeCase).map(fromResponse);
|
|
9014
9038
|
return {
|
|
9015
9039
|
cursor: returnedCursor,
|
|
9016
|
-
offers:
|
|
9040
|
+
offers: routerOffers.map(from).map(toResponse)
|
|
9017
9041
|
};
|
|
9018
9042
|
}
|
|
9019
9043
|
async function getApi(config, url) {
|
|
@@ -9604,7 +9628,7 @@ function create2(config) {
|
|
|
9604
9628
|
offering: offerData.offering,
|
|
9605
9629
|
assets: offerData.assets,
|
|
9606
9630
|
rate: offerData.rate,
|
|
9607
|
-
maturity: offerData.maturity,
|
|
9631
|
+
maturity: mempool.Maturity.from(offerData.maturity),
|
|
9608
9632
|
expiry: offerData.expiry,
|
|
9609
9633
|
start: offerData.start,
|
|
9610
9634
|
nonce: offerData.nonce,
|
|
@@ -9823,7 +9847,7 @@ function create2(config) {
|
|
|
9823
9847
|
offering: base2.offering,
|
|
9824
9848
|
assets: base2.assets,
|
|
9825
9849
|
rate: base2.rate,
|
|
9826
|
-
maturity: base2.maturity,
|
|
9850
|
+
maturity: mempool.Maturity.from(base2.maturity),
|
|
9827
9851
|
expiry: base2.expiry,
|
|
9828
9852
|
start: base2.start,
|
|
9829
9853
|
nonce: base2.nonce,
|
|
@@ -9937,7 +9961,9 @@ async function serve(parameters) {
|
|
|
9937
9961
|
}
|
|
9938
9962
|
});
|
|
9939
9963
|
return mempool.Mempool.success(c, {
|
|
9940
|
-
data: offers2.offers.map(
|
|
9964
|
+
data: offers2.offers.map(
|
|
9965
|
+
(offer) => mempool.Format.stringifyBigint(mempool.Format.toSnakeCase(toResponse(offer)))
|
|
9966
|
+
),
|
|
9941
9967
|
cursor: offers2.nextCursor ?? null
|
|
9942
9968
|
});
|
|
9943
9969
|
} catch (err) {
|
|
@@ -9963,7 +9989,9 @@ async function serve(parameters) {
|
|
|
9963
9989
|
limit: params.limit
|
|
9964
9990
|
});
|
|
9965
9991
|
return mempool.Mempool.success(c, {
|
|
9966
|
-
data: offers2.offers.map(
|
|
9992
|
+
data: offers2.offers.map(
|
|
9993
|
+
(offer) => mempool.Format.stringifyBigint(mempool.Format.toSnakeCase(toResponse(offer)))
|
|
9994
|
+
),
|
|
9967
9995
|
cursor: offers2.nextCursor ?? null
|
|
9968
9996
|
});
|
|
9969
9997
|
} catch (err) {
|