@morpho-dev/router 0.0.26 → 0.1.0
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 +11 -9
- package/dist/index.browser.d.ts +11 -9
- package/dist/index.browser.js +38 -89
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +39 -90
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +22 -18
- package/dist/index.node.d.ts +22 -18
- package/dist/index.node.js +78 -98
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +79 -99
- package/dist/index.node.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.node.d.cts
CHANGED
|
@@ -27,7 +27,6 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
|
|
|
27
27
|
name: ChainName;
|
|
28
28
|
whitelistedAssets: Set<Address>;
|
|
29
29
|
morpho: Address;
|
|
30
|
-
termsContract: Address;
|
|
31
30
|
mempool?: {
|
|
32
31
|
address: Address;
|
|
33
32
|
deploymentBlock: number;
|
|
@@ -35,6 +34,7 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
|
|
|
35
34
|
};
|
|
36
35
|
}>;
|
|
37
36
|
declare function getChain(chainId: ChainId): Chain | undefined;
|
|
37
|
+
declare const getWhitelistedChains: () => Chain[];
|
|
38
38
|
declare const chains: Record<ChainName, Chain>;
|
|
39
39
|
|
|
40
40
|
type Chain$1_Chain = Chain;
|
|
@@ -44,8 +44,9 @@ declare const Chain$1_chainIds: typeof chainIds;
|
|
|
44
44
|
declare const Chain$1_chainNames: typeof chainNames;
|
|
45
45
|
declare const Chain$1_chains: typeof chains;
|
|
46
46
|
declare const Chain$1_getChain: typeof getChain;
|
|
47
|
+
declare const Chain$1_getWhitelistedChains: typeof getWhitelistedChains;
|
|
47
48
|
declare namespace Chain$1 {
|
|
48
|
-
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 };
|
|
49
|
+
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, Chain$1_getWhitelistedChains as getWhitelistedChains };
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
|
|
@@ -65,8 +66,8 @@ declare const schemas: {
|
|
|
65
66
|
max_amount: z.ZodOptional<z.ZodBigInt>;
|
|
66
67
|
min_rate: z.ZodOptional<z.ZodBigInt>;
|
|
67
68
|
max_rate: z.ZodOptional<z.ZodBigInt>;
|
|
68
|
-
min_maturity: z.ZodOptional<z.
|
|
69
|
-
max_maturity: z.ZodOptional<z.
|
|
69
|
+
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
70
|
+
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
70
71
|
min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
71
72
|
max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
72
73
|
collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
@@ -76,8 +77,8 @@ declare const schemas: {
|
|
|
76
77
|
oracle: string | undefined;
|
|
77
78
|
lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
|
|
78
79
|
}[], string>>>;
|
|
79
|
-
min_lltv: z.ZodOptional<z.
|
|
80
|
-
max_lltv: z.ZodOptional<z.
|
|
80
|
+
min_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
81
|
+
max_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
81
82
|
sort_by: z.ZodOptional<z.ZodEnum<{
|
|
82
83
|
amount: "amount";
|
|
83
84
|
rate: "rate";
|
|
@@ -103,9 +104,9 @@ declare const schemas: {
|
|
|
103
104
|
oracle: string;
|
|
104
105
|
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
105
106
|
}[], string>>>;
|
|
106
|
-
maturity: z.ZodOptional<z.
|
|
107
|
-
min_maturity: z.ZodOptional<z.
|
|
108
|
-
max_maturity: z.ZodOptional<z.
|
|
107
|
+
maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
108
|
+
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
109
|
+
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
109
110
|
loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
110
111
|
creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
111
112
|
status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
|
|
@@ -380,6 +381,7 @@ type Client = Compute<RouterClientConfig & {
|
|
|
380
381
|
declare function connect(opts?: {
|
|
381
382
|
url?: string;
|
|
382
383
|
apiKey?: string;
|
|
384
|
+
headers?: Headers;
|
|
383
385
|
}): Client;
|
|
384
386
|
declare namespace connect {
|
|
385
387
|
type ErrorType = InvalidUrlError;
|
|
@@ -498,8 +500,8 @@ type GetOffersFilters = {
|
|
|
498
500
|
maxAmount?: bigint;
|
|
499
501
|
minRate?: bigint;
|
|
500
502
|
maxRate?: bigint;
|
|
501
|
-
minMaturity?:
|
|
502
|
-
maxMaturity?:
|
|
503
|
+
minMaturity?: number;
|
|
504
|
+
maxMaturity?: number;
|
|
503
505
|
minExpiry?: number;
|
|
504
506
|
maxExpiry?: number;
|
|
505
507
|
collateralAssets?: string[];
|
|
@@ -509,8 +511,8 @@ type GetOffersFilters = {
|
|
|
509
511
|
oracle?: string;
|
|
510
512
|
lltv?: LLTV.LLTV;
|
|
511
513
|
}>;
|
|
512
|
-
minLltv?:
|
|
513
|
-
maxLltv?:
|
|
514
|
+
minLltv?: number;
|
|
515
|
+
maxLltv?: number;
|
|
514
516
|
sortBy?: "rate" | "maturity" | "expiry" | "amount";
|
|
515
517
|
sortOrder?: "asc" | "desc";
|
|
516
518
|
cursor?: string;
|
|
@@ -525,9 +527,9 @@ type FindMatchingOffersParams = {
|
|
|
525
527
|
oracle: string;
|
|
526
528
|
lltv: LLTV.LLTV;
|
|
527
529
|
}>;
|
|
528
|
-
maturity?:
|
|
529
|
-
minMaturity?:
|
|
530
|
-
maxMaturity?:
|
|
530
|
+
maturity?: number;
|
|
531
|
+
minMaturity?: number;
|
|
532
|
+
maxMaturity?: number;
|
|
531
533
|
loanToken?: string;
|
|
532
534
|
creator?: string;
|
|
533
535
|
/** Filter by offer status; if omitted defaults to ["valid"] */
|
|
@@ -704,7 +706,8 @@ type Logger = {
|
|
|
704
706
|
error: LogFn;
|
|
705
707
|
fatal: LogFn;
|
|
706
708
|
};
|
|
707
|
-
declare function defaultLogger(): Logger;
|
|
709
|
+
declare function defaultLogger(minLevel?: LogLevel): Logger;
|
|
710
|
+
declare function silentLogger(): Logger;
|
|
708
711
|
declare function runWithLogger<T>(logger: Logger, fn: () => Promise<T>): Promise<T>;
|
|
709
712
|
declare function getLogger(): Logger;
|
|
710
713
|
|
|
@@ -715,8 +718,9 @@ type Logger$1_Logger = Logger;
|
|
|
715
718
|
declare const Logger$1_defaultLogger: typeof defaultLogger;
|
|
716
719
|
declare const Logger$1_getLogger: typeof getLogger;
|
|
717
720
|
declare const Logger$1_runWithLogger: typeof runWithLogger;
|
|
721
|
+
declare const Logger$1_silentLogger: typeof silentLogger;
|
|
718
722
|
declare namespace Logger$1 {
|
|
719
|
-
export { 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 };
|
|
723
|
+
export { 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 };
|
|
720
724
|
}
|
|
721
725
|
|
|
722
726
|
declare const types: readonly ["offer_created", "offer_consumed", "offer_validation"];
|
package/dist/index.node.d.ts
CHANGED
|
@@ -27,7 +27,6 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
|
|
|
27
27
|
name: ChainName;
|
|
28
28
|
whitelistedAssets: Set<Address>;
|
|
29
29
|
morpho: Address;
|
|
30
|
-
termsContract: Address;
|
|
31
30
|
mempool?: {
|
|
32
31
|
address: Address;
|
|
33
32
|
deploymentBlock: number;
|
|
@@ -35,6 +34,7 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
|
|
|
35
34
|
};
|
|
36
35
|
}>;
|
|
37
36
|
declare function getChain(chainId: ChainId): Chain | undefined;
|
|
37
|
+
declare const getWhitelistedChains: () => Chain[];
|
|
38
38
|
declare const chains: Record<ChainName, Chain>;
|
|
39
39
|
|
|
40
40
|
type Chain$1_Chain = Chain;
|
|
@@ -44,8 +44,9 @@ declare const Chain$1_chainIds: typeof chainIds;
|
|
|
44
44
|
declare const Chain$1_chainNames: typeof chainNames;
|
|
45
45
|
declare const Chain$1_chains: typeof chains;
|
|
46
46
|
declare const Chain$1_getChain: typeof getChain;
|
|
47
|
+
declare const Chain$1_getWhitelistedChains: typeof getWhitelistedChains;
|
|
47
48
|
declare namespace Chain$1 {
|
|
48
|
-
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 };
|
|
49
|
+
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, Chain$1_getWhitelistedChains as getWhitelistedChains };
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
|
|
@@ -65,8 +66,8 @@ declare const schemas: {
|
|
|
65
66
|
max_amount: z.ZodOptional<z.ZodBigInt>;
|
|
66
67
|
min_rate: z.ZodOptional<z.ZodBigInt>;
|
|
67
68
|
max_rate: z.ZodOptional<z.ZodBigInt>;
|
|
68
|
-
min_maturity: z.ZodOptional<z.
|
|
69
|
-
max_maturity: z.ZodOptional<z.
|
|
69
|
+
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
70
|
+
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
70
71
|
min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
71
72
|
max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
72
73
|
collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
@@ -76,8 +77,8 @@ declare const schemas: {
|
|
|
76
77
|
oracle: string | undefined;
|
|
77
78
|
lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
|
|
78
79
|
}[], string>>>;
|
|
79
|
-
min_lltv: z.ZodOptional<z.
|
|
80
|
-
max_lltv: z.ZodOptional<z.
|
|
80
|
+
min_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
81
|
+
max_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
81
82
|
sort_by: z.ZodOptional<z.ZodEnum<{
|
|
82
83
|
amount: "amount";
|
|
83
84
|
rate: "rate";
|
|
@@ -103,9 +104,9 @@ declare const schemas: {
|
|
|
103
104
|
oracle: string;
|
|
104
105
|
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
105
106
|
}[], string>>>;
|
|
106
|
-
maturity: z.ZodOptional<z.
|
|
107
|
-
min_maturity: z.ZodOptional<z.
|
|
108
|
-
max_maturity: z.ZodOptional<z.
|
|
107
|
+
maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
108
|
+
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
109
|
+
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
109
110
|
loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
110
111
|
creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
111
112
|
status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
|
|
@@ -380,6 +381,7 @@ type Client = Compute<RouterClientConfig & {
|
|
|
380
381
|
declare function connect(opts?: {
|
|
381
382
|
url?: string;
|
|
382
383
|
apiKey?: string;
|
|
384
|
+
headers?: Headers;
|
|
383
385
|
}): Client;
|
|
384
386
|
declare namespace connect {
|
|
385
387
|
type ErrorType = InvalidUrlError;
|
|
@@ -498,8 +500,8 @@ type GetOffersFilters = {
|
|
|
498
500
|
maxAmount?: bigint;
|
|
499
501
|
minRate?: bigint;
|
|
500
502
|
maxRate?: bigint;
|
|
501
|
-
minMaturity?:
|
|
502
|
-
maxMaturity?:
|
|
503
|
+
minMaturity?: number;
|
|
504
|
+
maxMaturity?: number;
|
|
503
505
|
minExpiry?: number;
|
|
504
506
|
maxExpiry?: number;
|
|
505
507
|
collateralAssets?: string[];
|
|
@@ -509,8 +511,8 @@ type GetOffersFilters = {
|
|
|
509
511
|
oracle?: string;
|
|
510
512
|
lltv?: LLTV.LLTV;
|
|
511
513
|
}>;
|
|
512
|
-
minLltv?:
|
|
513
|
-
maxLltv?:
|
|
514
|
+
minLltv?: number;
|
|
515
|
+
maxLltv?: number;
|
|
514
516
|
sortBy?: "rate" | "maturity" | "expiry" | "amount";
|
|
515
517
|
sortOrder?: "asc" | "desc";
|
|
516
518
|
cursor?: string;
|
|
@@ -525,9 +527,9 @@ type FindMatchingOffersParams = {
|
|
|
525
527
|
oracle: string;
|
|
526
528
|
lltv: LLTV.LLTV;
|
|
527
529
|
}>;
|
|
528
|
-
maturity?:
|
|
529
|
-
minMaturity?:
|
|
530
|
-
maxMaturity?:
|
|
530
|
+
maturity?: number;
|
|
531
|
+
minMaturity?: number;
|
|
532
|
+
maxMaturity?: number;
|
|
531
533
|
loanToken?: string;
|
|
532
534
|
creator?: string;
|
|
533
535
|
/** Filter by offer status; if omitted defaults to ["valid"] */
|
|
@@ -704,7 +706,8 @@ type Logger = {
|
|
|
704
706
|
error: LogFn;
|
|
705
707
|
fatal: LogFn;
|
|
706
708
|
};
|
|
707
|
-
declare function defaultLogger(): Logger;
|
|
709
|
+
declare function defaultLogger(minLevel?: LogLevel): Logger;
|
|
710
|
+
declare function silentLogger(): Logger;
|
|
708
711
|
declare function runWithLogger<T>(logger: Logger, fn: () => Promise<T>): Promise<T>;
|
|
709
712
|
declare function getLogger(): Logger;
|
|
710
713
|
|
|
@@ -715,8 +718,9 @@ type Logger$1_Logger = Logger;
|
|
|
715
718
|
declare const Logger$1_defaultLogger: typeof defaultLogger;
|
|
716
719
|
declare const Logger$1_getLogger: typeof getLogger;
|
|
717
720
|
declare const Logger$1_runWithLogger: typeof runWithLogger;
|
|
721
|
+
declare const Logger$1_silentLogger: typeof silentLogger;
|
|
718
722
|
declare namespace Logger$1 {
|
|
719
|
-
export { 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 };
|
|
723
|
+
export { 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 };
|
|
720
724
|
}
|
|
721
725
|
|
|
722
726
|
declare const types: readonly ["offer_created", "offer_consumed", "offer_validation"];
|
package/dist/index.node.js
CHANGED
|
@@ -23,7 +23,8 @@ __export(Chain_exports, {
|
|
|
23
23
|
chainIds: () => chainIds,
|
|
24
24
|
chainNames: () => chainNames,
|
|
25
25
|
chains: () => chains,
|
|
26
|
-
getChain: () => getChain
|
|
26
|
+
getChain: () => getChain,
|
|
27
|
+
getWhitelistedChains: () => getWhitelistedChains
|
|
27
28
|
});
|
|
28
29
|
var chainNames = ["ethereum", "base", "ethereum-virtual-testnet"];
|
|
29
30
|
var ChainId = {
|
|
@@ -40,6 +41,9 @@ function getChain(chainId) {
|
|
|
40
41
|
}
|
|
41
42
|
return chains[chainName];
|
|
42
43
|
}
|
|
44
|
+
var getWhitelistedChains = () => {
|
|
45
|
+
return [chains.ethereum, chains.base, chains["ethereum-virtual-testnet"]];
|
|
46
|
+
};
|
|
43
47
|
var chains = {
|
|
44
48
|
ethereum: {
|
|
45
49
|
...chains$1.mainnet,
|
|
@@ -53,8 +57,7 @@ var chains = {
|
|
|
53
57
|
// DAI
|
|
54
58
|
].map((address) => address.toLowerCase())
|
|
55
59
|
),
|
|
56
|
-
morpho: "0x0000000000000000000000000000000000000000"
|
|
57
|
-
termsContract: "0x0000000000000000000000000000000000000000"
|
|
60
|
+
morpho: "0x0000000000000000000000000000000000000000"
|
|
58
61
|
},
|
|
59
62
|
base: {
|
|
60
63
|
...chains$1.base,
|
|
@@ -68,8 +71,7 @@ var chains = {
|
|
|
68
71
|
// DAI
|
|
69
72
|
].map((address) => address.toLowerCase())
|
|
70
73
|
),
|
|
71
|
-
morpho: "0x0000000000000000000000000000000000000000"
|
|
72
|
-
termsContract: "0x0000000000000000000000000000000000000000"
|
|
74
|
+
morpho: "0x0000000000000000000000000000000000000000"
|
|
73
75
|
},
|
|
74
76
|
"ethereum-virtual-testnet": {
|
|
75
77
|
...chains$1.mainnet,
|
|
@@ -83,8 +85,8 @@ var chains = {
|
|
|
83
85
|
// DAI
|
|
84
86
|
].map((address) => address.toLowerCase())
|
|
85
87
|
),
|
|
86
|
-
morpho: "
|
|
87
|
-
|
|
88
|
+
morpho: "0x11a002d45db720ed47a80d2f3489cba5b833eaf5",
|
|
89
|
+
// @TODO: This is mock Consumed contract, update with Terms once stable
|
|
88
90
|
mempool: {
|
|
89
91
|
address: "0x7be3164eeee8b35092f6128ec32c2e6ff8f6c890",
|
|
90
92
|
deploymentBlock: 23223727,
|
|
@@ -387,28 +389,14 @@ var GetOffersQueryParams = v4.z.object({
|
|
|
387
389
|
example: "1500000000000000000"
|
|
388
390
|
}),
|
|
389
391
|
// Time range
|
|
390
|
-
min_maturity: v4.z.coerce.number().int().
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
return v4.z.NEVER;
|
|
399
|
-
}
|
|
400
|
-
}).optional(),
|
|
401
|
-
max_maturity: v4.z.coerce.number().int().positive().transform((maturity, ctx) => {
|
|
402
|
-
try {
|
|
403
|
-
return mempool.Maturity.from(maturity);
|
|
404
|
-
} catch (e) {
|
|
405
|
-
ctx.addIssue({
|
|
406
|
-
code: "custom",
|
|
407
|
-
message: e.message
|
|
408
|
-
});
|
|
409
|
-
return v4.z.NEVER;
|
|
410
|
-
}
|
|
411
|
-
}).optional(),
|
|
392
|
+
min_maturity: v4.z.coerce.number().int().min(0).optional().meta({
|
|
393
|
+
description: "Minimum maturity timestamp (Unix timestamp in seconds)",
|
|
394
|
+
example: "1700000000"
|
|
395
|
+
}),
|
|
396
|
+
max_maturity: v4.z.coerce.number().int().min(0).optional().meta({
|
|
397
|
+
description: "Maximum maturity timestamp (Unix timestamp in seconds)",
|
|
398
|
+
example: "1800000000"
|
|
399
|
+
}),
|
|
412
400
|
min_expiry: v4.z.coerce.number().int().optional().meta({
|
|
413
401
|
description: "Minimum expiry timestamp (Unix timestamp in seconds)",
|
|
414
402
|
example: "1700000000"
|
|
@@ -483,33 +471,11 @@ var GetOffersQueryParams = v4.z.object({
|
|
|
483
471
|
description: "Filter by collateral combinations in format: asset:oracle:lltv#asset2:oracle2:lltv2. Oracle and lltv are optional. Use # to separate multiple combinations.",
|
|
484
472
|
example: "0x1234567890123456789012345678901234567890:0xabcdefabcdefabcdefabcdefabcdefabcdefabcd:86#0x9876543210987654321098765432109876543210:94.5"
|
|
485
473
|
}),
|
|
486
|
-
min_lltv: v4.z.coerce.number().min(0, { message: "LLTV must be above 0" }).max(100, { message: "LLTV must be below 100" }).
|
|
487
|
-
try {
|
|
488
|
-
return mempool.LLTV.from(viem.parseUnits(lltv.toString(), 16));
|
|
489
|
-
} catch (e) {
|
|
490
|
-
ctx.addIssue({
|
|
491
|
-
code: "custom",
|
|
492
|
-
message: e.message,
|
|
493
|
-
input: lltv
|
|
494
|
-
});
|
|
495
|
-
return v4.z.NEVER;
|
|
496
|
-
}
|
|
497
|
-
}).optional().meta({
|
|
474
|
+
min_lltv: v4.z.coerce.number().min(0, { message: "LLTV must be above 0" }).max(100, { message: "LLTV must be below 100" }).optional().meta({
|
|
498
475
|
description: "Minimum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal, e.g., 80.5 = 80.5%)",
|
|
499
476
|
example: "80.5"
|
|
500
477
|
}),
|
|
501
|
-
max_lltv: v4.z.coerce.number().min(0, { message: "LLTV must be above 0" }).max(100, { message: "LLTV must be below 100" }).
|
|
502
|
-
try {
|
|
503
|
-
return mempool.LLTV.from(viem.parseUnits(lltv.toString(), 16));
|
|
504
|
-
} catch (e) {
|
|
505
|
-
ctx.addIssue({
|
|
506
|
-
code: "custom",
|
|
507
|
-
message: e.message,
|
|
508
|
-
input: lltv
|
|
509
|
-
});
|
|
510
|
-
return v4.z.NEVER;
|
|
511
|
-
}
|
|
512
|
-
}).optional().meta({
|
|
478
|
+
max_lltv: v4.z.coerce.number().min(0, { message: "LLTV must be above 0" }).max(100, { message: "LLTV must be below 100" }).optional().meta({
|
|
513
479
|
description: "Maximum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal, e.g., 95.5 = 95.5%)",
|
|
514
480
|
example: "95.5"
|
|
515
481
|
}),
|
|
@@ -652,39 +618,18 @@ var MatchOffersQueryParams = v4.z.object({
|
|
|
652
618
|
example: "0x1234567890123456789012345678901234567890:0xabcdefabcdefabcdefabcdefabcdefabcdefabcd:86#0x9876543210987654321098765432109876543210:0xfedcbafedcbafedcbafedcbafedcbafedcbafedc:94.5"
|
|
653
619
|
}),
|
|
654
620
|
// Maturity filtering
|
|
655
|
-
maturity: v4.z.coerce.number().int().
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
try {
|
|
668
|
-
return mempool.Maturity.from(maturity);
|
|
669
|
-
} catch (e) {
|
|
670
|
-
ctx.addIssue({
|
|
671
|
-
code: "custom",
|
|
672
|
-
message: e.message
|
|
673
|
-
});
|
|
674
|
-
return v4.z.NEVER;
|
|
675
|
-
}
|
|
676
|
-
}).optional(),
|
|
677
|
-
max_maturity: v4.z.coerce.number().int().positive().transform((maturity, ctx) => {
|
|
678
|
-
try {
|
|
679
|
-
return mempool.Maturity.from(maturity);
|
|
680
|
-
} catch (e) {
|
|
681
|
-
ctx.addIssue({
|
|
682
|
-
code: "custom",
|
|
683
|
-
message: e.message
|
|
684
|
-
});
|
|
685
|
-
return v4.z.NEVER;
|
|
686
|
-
}
|
|
687
|
-
}).optional(),
|
|
621
|
+
maturity: v4.z.coerce.number().int().min(0).optional().meta({
|
|
622
|
+
description: "Maturity timestamp (Unix timestamp in seconds)",
|
|
623
|
+
example: "1700000000"
|
|
624
|
+
}),
|
|
625
|
+
min_maturity: v4.z.coerce.number().int().min(0).optional().meta({
|
|
626
|
+
description: "Minimum maturity timestamp (Unix timestamp in seconds)",
|
|
627
|
+
example: "1700000000"
|
|
628
|
+
}),
|
|
629
|
+
max_maturity: v4.z.coerce.number().int().min(0).optional().meta({
|
|
630
|
+
description: "Maximum maturity timestamp (Unix timestamp in seconds)",
|
|
631
|
+
example: "1800000000"
|
|
632
|
+
}),
|
|
688
633
|
// Asset and creator filtering
|
|
689
634
|
loan_token: v4.z.string().regex(/^0x[a-fA-F0-9]{40}$/, {
|
|
690
635
|
message: "Loan asset must be a valid Ethereum address"
|
|
@@ -904,7 +849,7 @@ function connect(opts) {
|
|
|
904
849
|
if (u.protocol !== "http:" && u.protocol !== "https:") {
|
|
905
850
|
throw new InvalidUrlError(u.toString());
|
|
906
851
|
}
|
|
907
|
-
const headers = new Headers();
|
|
852
|
+
const headers = opts?.headers ?? new Headers();
|
|
908
853
|
headers.set("Content-Type", "application/json");
|
|
909
854
|
opts?.apiKey !== void 0 ? headers.set("X-API-Key", opts.apiKey) : null;
|
|
910
855
|
const config = {
|
|
@@ -1306,8 +1251,12 @@ function memory(parameters) {
|
|
|
1306
1251
|
)
|
|
1307
1252
|
)
|
|
1308
1253
|
));
|
|
1309
|
-
minLltv && (offers = offers.filter(
|
|
1310
|
-
|
|
1254
|
+
minLltv && (offers = offers.filter(
|
|
1255
|
+
(o) => o.collaterals.every((c) => c.lltv >= viem.parseUnits(minLltv.toString(), 16))
|
|
1256
|
+
));
|
|
1257
|
+
maxLltv && (offers = offers.filter(
|
|
1258
|
+
(o) => o.collaterals.every((c) => c.lltv <= viem.parseUnits(maxLltv.toString(), 16))
|
|
1259
|
+
));
|
|
1311
1260
|
offers = offers.sort((a, b) => sort(sortBy, sortOrder, a, b));
|
|
1312
1261
|
let nextCursor = null;
|
|
1313
1262
|
if (offers.length > limit) {
|
|
@@ -1677,7 +1626,8 @@ __export(Logger_exports, {
|
|
|
1677
1626
|
LogLevelValues: () => LogLevelValues,
|
|
1678
1627
|
defaultLogger: () => defaultLogger,
|
|
1679
1628
|
getLogger: () => getLogger,
|
|
1680
|
-
runWithLogger: () => runWithLogger
|
|
1629
|
+
runWithLogger: () => runWithLogger,
|
|
1630
|
+
silentLogger: () => silentLogger
|
|
1681
1631
|
});
|
|
1682
1632
|
var LogLevelValues = [
|
|
1683
1633
|
"silent",
|
|
@@ -1688,20 +1638,50 @@ var LogLevelValues = [
|
|
|
1688
1638
|
"error",
|
|
1689
1639
|
"fatal"
|
|
1690
1640
|
];
|
|
1691
|
-
function defaultLogger() {
|
|
1641
|
+
function defaultLogger(minLevel) {
|
|
1642
|
+
const threshold = minLevel ?? "trace";
|
|
1643
|
+
const levelIndexByName = LogLevelValues.reduce(
|
|
1644
|
+
(acc, lvl, idx) => {
|
|
1645
|
+
acc[lvl] = idx;
|
|
1646
|
+
return acc;
|
|
1647
|
+
},
|
|
1648
|
+
{}
|
|
1649
|
+
);
|
|
1650
|
+
const isEnabled = (methodLevel) => levelIndexByName[methodLevel] >= levelIndexByName[threshold];
|
|
1692
1651
|
return {
|
|
1693
1652
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1694
|
-
trace: console.trace.bind(console)
|
|
1653
|
+
trace: isEnabled("trace") ? console.trace.bind(console) : () => {
|
|
1654
|
+
},
|
|
1695
1655
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1696
|
-
debug: console.debug.bind(console)
|
|
1656
|
+
debug: isEnabled("debug") ? console.debug.bind(console) : () => {
|
|
1657
|
+
},
|
|
1697
1658
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1698
|
-
info: console.info.bind(console)
|
|
1659
|
+
info: isEnabled("info") ? console.info.bind(console) : () => {
|
|
1660
|
+
},
|
|
1699
1661
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1700
|
-
warn: console.warn.bind(console)
|
|
1662
|
+
warn: isEnabled("warn") ? console.warn.bind(console) : () => {
|
|
1663
|
+
},
|
|
1701
1664
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1702
|
-
error: console.error.bind(console)
|
|
1703
|
-
|
|
1704
|
-
fatal: (...args) => console.error("[fatal]", ...args)
|
|
1665
|
+
error: isEnabled("error") ? console.error.bind(console) : () => {
|
|
1666
|
+
},
|
|
1667
|
+
fatal: isEnabled("fatal") ? (...args) => console.error("[fatal]", ...args) : () => {
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
}
|
|
1671
|
+
function silentLogger() {
|
|
1672
|
+
return {
|
|
1673
|
+
trace: () => {
|
|
1674
|
+
},
|
|
1675
|
+
debug: () => {
|
|
1676
|
+
},
|
|
1677
|
+
info: () => {
|
|
1678
|
+
},
|
|
1679
|
+
warn: () => {
|
|
1680
|
+
},
|
|
1681
|
+
error: () => {
|
|
1682
|
+
},
|
|
1683
|
+
fatal: () => {
|
|
1684
|
+
}
|
|
1705
1685
|
};
|
|
1706
1686
|
}
|
|
1707
1687
|
var loggerContext = new async_hooks.AsyncLocalStorage();
|