@morpho-dev/router 0.0.18 → 0.0.20

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.
@@ -1,5 +1,5 @@
1
1
  import * as _morpho_dev_mempool from '@morpho-dev/mempool';
2
- import { Compute, Offer, Errors, Format } from '@morpho-dev/mempool';
2
+ import { Compute, Offer, Errors, Format, Maturity, LLTV } from '@morpho-dev/mempool';
3
3
  export * from '@morpho-dev/mempool';
4
4
  import * as viem from 'viem';
5
5
  import { Address, Hex, Account, PublicClient } from 'viem';
@@ -54,19 +54,19 @@ declare const schemas: {
54
54
  max_amount: z.ZodOptional<z.ZodBigInt>;
55
55
  min_rate: z.ZodOptional<z.ZodBigInt>;
56
56
  max_rate: z.ZodOptional<z.ZodBigInt>;
57
- min_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
58
- max_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
59
- min_expiry: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
60
- max_expiry: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
57
+ min_maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
58
+ max_maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
59
+ min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
60
+ max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
61
61
  collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
62
62
  collateral_oracles: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
63
63
  collateral_tuple: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
64
64
  asset: string;
65
65
  oracle: string | undefined;
66
- lltv: number | undefined;
66
+ lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
67
67
  }[], string>>>;
68
- min_lltv: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
69
- max_lltv: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
68
+ min_lltv: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<bigint & _morpho_dev_mempool.Brand<"LLTV">, number>>>;
69
+ max_lltv: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<bigint & _morpho_dev_mempool.Brand<"LLTV">, number>>>;
70
70
  sort_by: z.ZodOptional<z.ZodEnum<{
71
71
  rate: "rate";
72
72
  maturity: "maturity";
@@ -90,11 +90,11 @@ declare const schemas: {
90
90
  collaterals: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
91
91
  asset: string;
92
92
  oracle: string;
93
- lltv: bigint;
93
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
94
94
  }[], string>>>;
95
- maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
96
- min_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
97
- max_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
95
+ maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
96
+ min_maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
97
+ max_maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
98
98
  loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
99
99
  creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
100
100
  status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
@@ -104,7 +104,7 @@ declare const schemas: {
104
104
  };
105
105
  type Action = keyof typeof schemas;
106
106
  declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
107
- declare function safeParse<A extends Action>(action: A, query: unknown): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
107
+ declare function safeParse<A extends Action>(action: A, query: unknown, error?: z.core.$ZodErrorMap<z.core.$ZodIssue>): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
108
108
 
109
109
  declare const OfferStatusValues: readonly ["valid", "callback_not_supported", "callback_error", "unverified"];
110
110
  type OfferStatus = (typeof OfferStatusValues)[number];
@@ -250,9 +250,9 @@ type GetParameters = {
250
250
  /** Maximum rate per asset (in wei) */
251
251
  maxRate?: bigint;
252
252
  /** Minimum maturity timestamp (Unix timestamp in seconds) */
253
- minMaturity?: number;
253
+ minMaturity?: Maturity.Maturity;
254
254
  /** Maximum maturity timestamp (Unix timestamp in seconds) */
255
- maxMaturity?: number;
255
+ maxMaturity?: Maturity.Maturity;
256
256
  /** Minimum expiry timestamp (Unix timestamp in seconds) */
257
257
  minExpiry?: number;
258
258
  /** Maximum expiry timestamp (Unix timestamp in seconds) */
@@ -265,12 +265,12 @@ type GetParameters = {
265
265
  collateralTuple?: Array<{
266
266
  asset: string;
267
267
  oracle?: string;
268
- lltv?: number;
268
+ lltv?: LLTV.LLTV;
269
269
  }>;
270
270
  /** Minimum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
271
- minLltv?: number;
271
+ minLltv?: LLTV.LLTV;
272
272
  /** Maximum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
273
- maxLltv?: number;
273
+ maxLltv?: LLTV.LLTV;
274
274
  /** Field to sort results by */
275
275
  sortBy?: "rate" | "maturity" | "expiry" | "amount";
276
276
  /** Sort direction: asc (ascending) or desc (descending, default) */
@@ -291,14 +291,14 @@ type MatchParameters = {
291
291
  collaterals?: Array<{
292
292
  asset: string;
293
293
  oracle: string;
294
- lltv: bigint;
294
+ lltv: LLTV.LLTV;
295
295
  }>;
296
296
  /** Exact maturity timestamp (Unix timestamp in seconds) */
297
- maturity?: number;
297
+ maturity?: Maturity.Maturity;
298
298
  /** Minimum maturity timestamp (Unix timestamp in seconds, inclusive) */
299
- minMaturity?: number;
299
+ minMaturity?: Maturity.Maturity;
300
300
  /** Maximum maturity timestamp (Unix timestamp in seconds, inclusive) */
301
- maxMaturity?: number;
301
+ maxMaturity?: Maturity.Maturity;
302
302
  /** The loan asset address to match against */
303
303
  loanToken?: string;
304
304
  /** Filter by a specific offer creator address */
@@ -431,8 +431,8 @@ type GetOffersFilters = {
431
431
  maxAmount?: bigint;
432
432
  minRate?: bigint;
433
433
  maxRate?: bigint;
434
- minMaturity?: number;
435
- maxMaturity?: number;
434
+ minMaturity?: Maturity.Maturity;
435
+ maxMaturity?: Maturity.Maturity;
436
436
  minExpiry?: number;
437
437
  maxExpiry?: number;
438
438
  collateralAssets?: string[];
@@ -440,10 +440,10 @@ type GetOffersFilters = {
440
440
  collateralTuple?: Array<{
441
441
  asset: string;
442
442
  oracle?: string;
443
- lltv?: number;
443
+ lltv?: LLTV.LLTV;
444
444
  }>;
445
- minLltv?: number;
446
- maxLltv?: number;
445
+ minLltv?: LLTV.LLTV;
446
+ maxLltv?: LLTV.LLTV;
447
447
  sortBy?: "rate" | "maturity" | "expiry" | "amount";
448
448
  sortOrder?: "asc" | "desc";
449
449
  cursor?: string;
@@ -456,11 +456,11 @@ type FindMatchingOffersParams = {
456
456
  collaterals?: Array<{
457
457
  asset: string;
458
458
  oracle: string;
459
- lltv: bigint;
459
+ lltv: LLTV.LLTV;
460
460
  }>;
461
- maturity?: number;
462
- minMaturity?: number;
463
- maxMaturity?: number;
461
+ maturity?: Maturity.Maturity;
462
+ minMaturity?: Maturity.Maturity;
463
+ maxMaturity?: Maturity.Maturity;
464
464
  loanToken?: string;
465
465
  creator?: string;
466
466
  /** Filter by offer status; if omitted defaults to ["valid"] */
@@ -1,5 +1,5 @@
1
1
  import * as _morpho_dev_mempool from '@morpho-dev/mempool';
2
- import { Compute, Offer, Errors, Format } from '@morpho-dev/mempool';
2
+ import { Compute, Offer, Errors, Format, Maturity, LLTV } from '@morpho-dev/mempool';
3
3
  export * from '@morpho-dev/mempool';
4
4
  import * as viem from 'viem';
5
5
  import { Address, Hex, Account, PublicClient } from 'viem';
@@ -54,19 +54,19 @@ declare const schemas: {
54
54
  max_amount: z.ZodOptional<z.ZodBigInt>;
55
55
  min_rate: z.ZodOptional<z.ZodBigInt>;
56
56
  max_rate: z.ZodOptional<z.ZodBigInt>;
57
- min_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
58
- max_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
59
- min_expiry: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
60
- max_expiry: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
57
+ min_maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
58
+ max_maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
59
+ min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
60
+ max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
61
61
  collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
62
62
  collateral_oracles: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
63
63
  collateral_tuple: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
64
64
  asset: string;
65
65
  oracle: string | undefined;
66
- lltv: number | undefined;
66
+ lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
67
67
  }[], string>>>;
68
- min_lltv: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
69
- max_lltv: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
68
+ min_lltv: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<bigint & _morpho_dev_mempool.Brand<"LLTV">, number>>>;
69
+ max_lltv: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<bigint & _morpho_dev_mempool.Brand<"LLTV">, number>>>;
70
70
  sort_by: z.ZodOptional<z.ZodEnum<{
71
71
  rate: "rate";
72
72
  maturity: "maturity";
@@ -90,11 +90,11 @@ declare const schemas: {
90
90
  collaterals: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
91
91
  asset: string;
92
92
  oracle: string;
93
- lltv: bigint;
93
+ lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
94
94
  }[], string>>>;
95
- maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
96
- min_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
97
- max_maturity: z.ZodPipe<z.ZodOptional<z.ZodBigInt>, z.ZodTransform<number | undefined, bigint | undefined>>;
95
+ maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
96
+ min_maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
97
+ max_maturity: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number & _morpho_dev_mempool.Brand<"Maturity">, number>>>;
98
98
  loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
99
99
  creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
100
100
  status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
@@ -104,7 +104,7 @@ declare const schemas: {
104
104
  };
105
105
  type Action = keyof typeof schemas;
106
106
  declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
107
- declare function safeParse<A extends Action>(action: A, query: unknown): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
107
+ declare function safeParse<A extends Action>(action: A, query: unknown, error?: z.core.$ZodErrorMap<z.core.$ZodIssue>): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
108
108
 
109
109
  declare const OfferStatusValues: readonly ["valid", "callback_not_supported", "callback_error", "unverified"];
110
110
  type OfferStatus = (typeof OfferStatusValues)[number];
@@ -250,9 +250,9 @@ type GetParameters = {
250
250
  /** Maximum rate per asset (in wei) */
251
251
  maxRate?: bigint;
252
252
  /** Minimum maturity timestamp (Unix timestamp in seconds) */
253
- minMaturity?: number;
253
+ minMaturity?: Maturity.Maturity;
254
254
  /** Maximum maturity timestamp (Unix timestamp in seconds) */
255
- maxMaturity?: number;
255
+ maxMaturity?: Maturity.Maturity;
256
256
  /** Minimum expiry timestamp (Unix timestamp in seconds) */
257
257
  minExpiry?: number;
258
258
  /** Maximum expiry timestamp (Unix timestamp in seconds) */
@@ -265,12 +265,12 @@ type GetParameters = {
265
265
  collateralTuple?: Array<{
266
266
  asset: string;
267
267
  oracle?: string;
268
- lltv?: number;
268
+ lltv?: LLTV.LLTV;
269
269
  }>;
270
270
  /** Minimum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
271
- minLltv?: number;
271
+ minLltv?: LLTV.LLTV;
272
272
  /** Maximum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
273
- maxLltv?: number;
273
+ maxLltv?: LLTV.LLTV;
274
274
  /** Field to sort results by */
275
275
  sortBy?: "rate" | "maturity" | "expiry" | "amount";
276
276
  /** Sort direction: asc (ascending) or desc (descending, default) */
@@ -291,14 +291,14 @@ type MatchParameters = {
291
291
  collaterals?: Array<{
292
292
  asset: string;
293
293
  oracle: string;
294
- lltv: bigint;
294
+ lltv: LLTV.LLTV;
295
295
  }>;
296
296
  /** Exact maturity timestamp (Unix timestamp in seconds) */
297
- maturity?: number;
297
+ maturity?: Maturity.Maturity;
298
298
  /** Minimum maturity timestamp (Unix timestamp in seconds, inclusive) */
299
- minMaturity?: number;
299
+ minMaturity?: Maturity.Maturity;
300
300
  /** Maximum maturity timestamp (Unix timestamp in seconds, inclusive) */
301
- maxMaturity?: number;
301
+ maxMaturity?: Maturity.Maturity;
302
302
  /** The loan asset address to match against */
303
303
  loanToken?: string;
304
304
  /** Filter by a specific offer creator address */
@@ -431,8 +431,8 @@ type GetOffersFilters = {
431
431
  maxAmount?: bigint;
432
432
  minRate?: bigint;
433
433
  maxRate?: bigint;
434
- minMaturity?: number;
435
- maxMaturity?: number;
434
+ minMaturity?: Maturity.Maturity;
435
+ maxMaturity?: Maturity.Maturity;
436
436
  minExpiry?: number;
437
437
  maxExpiry?: number;
438
438
  collateralAssets?: string[];
@@ -440,10 +440,10 @@ type GetOffersFilters = {
440
440
  collateralTuple?: Array<{
441
441
  asset: string;
442
442
  oracle?: string;
443
- lltv?: number;
443
+ lltv?: LLTV.LLTV;
444
444
  }>;
445
- minLltv?: number;
446
- maxLltv?: number;
445
+ minLltv?: LLTV.LLTV;
446
+ maxLltv?: LLTV.LLTV;
447
447
  sortBy?: "rate" | "maturity" | "expiry" | "amount";
448
448
  sortOrder?: "asc" | "desc";
449
449
  cursor?: string;
@@ -456,11 +456,11 @@ type FindMatchingOffersParams = {
456
456
  collaterals?: Array<{
457
457
  asset: string;
458
458
  oracle: string;
459
- lltv: bigint;
459
+ lltv: LLTV.LLTV;
460
460
  }>;
461
- maturity?: number;
462
- minMaturity?: number;
463
- maxMaturity?: number;
461
+ maturity?: Maturity.Maturity;
462
+ minMaturity?: Maturity.Maturity;
463
+ maxMaturity?: Maturity.Maturity;
464
464
  loanToken?: string;
465
465
  creator?: string;
466
466
  /** Filter by offer status; if omitted defaults to ["valid"] */