@morpho-dev/router 0.0.27 → 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 +1 -0
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.js +2 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +5 -2
- package/dist/index.node.d.ts +5 -2
- package/dist/index.node.js +42 -11
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +42 -11
- package/dist/index.node.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.node.d.cts
CHANGED
|
@@ -381,6 +381,7 @@ type Client = Compute<RouterClientConfig & {
|
|
|
381
381
|
declare function connect(opts?: {
|
|
382
382
|
url?: string;
|
|
383
383
|
apiKey?: string;
|
|
384
|
+
headers?: Headers;
|
|
384
385
|
}): Client;
|
|
385
386
|
declare namespace connect {
|
|
386
387
|
type ErrorType = InvalidUrlError;
|
|
@@ -705,7 +706,8 @@ type Logger = {
|
|
|
705
706
|
error: LogFn;
|
|
706
707
|
fatal: LogFn;
|
|
707
708
|
};
|
|
708
|
-
declare function defaultLogger(): Logger;
|
|
709
|
+
declare function defaultLogger(minLevel?: LogLevel): Logger;
|
|
710
|
+
declare function silentLogger(): Logger;
|
|
709
711
|
declare function runWithLogger<T>(logger: Logger, fn: () => Promise<T>): Promise<T>;
|
|
710
712
|
declare function getLogger(): Logger;
|
|
711
713
|
|
|
@@ -716,8 +718,9 @@ type Logger$1_Logger = Logger;
|
|
|
716
718
|
declare const Logger$1_defaultLogger: typeof defaultLogger;
|
|
717
719
|
declare const Logger$1_getLogger: typeof getLogger;
|
|
718
720
|
declare const Logger$1_runWithLogger: typeof runWithLogger;
|
|
721
|
+
declare const Logger$1_silentLogger: typeof silentLogger;
|
|
719
722
|
declare namespace Logger$1 {
|
|
720
|
-
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 };
|
|
721
724
|
}
|
|
722
725
|
|
|
723
726
|
declare const types: readonly ["offer_created", "offer_consumed", "offer_validation"];
|
package/dist/index.node.d.ts
CHANGED
|
@@ -381,6 +381,7 @@ type Client = Compute<RouterClientConfig & {
|
|
|
381
381
|
declare function connect(opts?: {
|
|
382
382
|
url?: string;
|
|
383
383
|
apiKey?: string;
|
|
384
|
+
headers?: Headers;
|
|
384
385
|
}): Client;
|
|
385
386
|
declare namespace connect {
|
|
386
387
|
type ErrorType = InvalidUrlError;
|
|
@@ -705,7 +706,8 @@ type Logger = {
|
|
|
705
706
|
error: LogFn;
|
|
706
707
|
fatal: LogFn;
|
|
707
708
|
};
|
|
708
|
-
declare function defaultLogger(): Logger;
|
|
709
|
+
declare function defaultLogger(minLevel?: LogLevel): Logger;
|
|
710
|
+
declare function silentLogger(): Logger;
|
|
709
711
|
declare function runWithLogger<T>(logger: Logger, fn: () => Promise<T>): Promise<T>;
|
|
710
712
|
declare function getLogger(): Logger;
|
|
711
713
|
|
|
@@ -716,8 +718,9 @@ type Logger$1_Logger = Logger;
|
|
|
716
718
|
declare const Logger$1_defaultLogger: typeof defaultLogger;
|
|
717
719
|
declare const Logger$1_getLogger: typeof getLogger;
|
|
718
720
|
declare const Logger$1_runWithLogger: typeof runWithLogger;
|
|
721
|
+
declare const Logger$1_silentLogger: typeof silentLogger;
|
|
719
722
|
declare namespace Logger$1 {
|
|
720
|
-
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 };
|
|
721
724
|
}
|
|
722
725
|
|
|
723
726
|
declare const types: readonly ["offer_created", "offer_consumed", "offer_validation"];
|
package/dist/index.node.js
CHANGED
|
@@ -42,7 +42,7 @@ function getChain(chainId) {
|
|
|
42
42
|
return chains[chainName];
|
|
43
43
|
}
|
|
44
44
|
var getWhitelistedChains = () => {
|
|
45
|
-
return [chains.ethereum, chains["ethereum-virtual-testnet"]];
|
|
45
|
+
return [chains.ethereum, chains.base, chains["ethereum-virtual-testnet"]];
|
|
46
46
|
};
|
|
47
47
|
var chains = {
|
|
48
48
|
ethereum: {
|
|
@@ -849,7 +849,7 @@ function connect(opts) {
|
|
|
849
849
|
if (u.protocol !== "http:" && u.protocol !== "https:") {
|
|
850
850
|
throw new InvalidUrlError(u.toString());
|
|
851
851
|
}
|
|
852
|
-
const headers = new Headers();
|
|
852
|
+
const headers = opts?.headers ?? new Headers();
|
|
853
853
|
headers.set("Content-Type", "application/json");
|
|
854
854
|
opts?.apiKey !== void 0 ? headers.set("X-API-Key", opts.apiKey) : null;
|
|
855
855
|
const config = {
|
|
@@ -1626,7 +1626,8 @@ __export(Logger_exports, {
|
|
|
1626
1626
|
LogLevelValues: () => LogLevelValues,
|
|
1627
1627
|
defaultLogger: () => defaultLogger,
|
|
1628
1628
|
getLogger: () => getLogger,
|
|
1629
|
-
runWithLogger: () => runWithLogger
|
|
1629
|
+
runWithLogger: () => runWithLogger,
|
|
1630
|
+
silentLogger: () => silentLogger
|
|
1630
1631
|
});
|
|
1631
1632
|
var LogLevelValues = [
|
|
1632
1633
|
"silent",
|
|
@@ -1637,20 +1638,50 @@ var LogLevelValues = [
|
|
|
1637
1638
|
"error",
|
|
1638
1639
|
"fatal"
|
|
1639
1640
|
];
|
|
1640
|
-
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];
|
|
1641
1651
|
return {
|
|
1642
1652
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1643
|
-
trace: console.trace.bind(console)
|
|
1653
|
+
trace: isEnabled("trace") ? console.trace.bind(console) : () => {
|
|
1654
|
+
},
|
|
1644
1655
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1645
|
-
debug: console.debug.bind(console)
|
|
1656
|
+
debug: isEnabled("debug") ? console.debug.bind(console) : () => {
|
|
1657
|
+
},
|
|
1646
1658
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1647
|
-
info: console.info.bind(console)
|
|
1659
|
+
info: isEnabled("info") ? console.info.bind(console) : () => {
|
|
1660
|
+
},
|
|
1648
1661
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1649
|
-
warn: console.warn.bind(console)
|
|
1662
|
+
warn: isEnabled("warn") ? console.warn.bind(console) : () => {
|
|
1663
|
+
},
|
|
1650
1664
|
// biome-ignore lint/suspicious/noConsole: console is used for logging
|
|
1651
|
-
error: console.error.bind(console)
|
|
1652
|
-
|
|
1653
|
-
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
|
+
}
|
|
1654
1685
|
};
|
|
1655
1686
|
}
|
|
1656
1687
|
var loggerContext = new async_hooks.AsyncLocalStorage();
|