browser-evm-signer 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/esm/_dnt.polyfills.d.ts +101 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +127 -0
- package/esm/browser.d.ts +13 -0
- package/esm/browser.d.ts.map +1 -0
- package/esm/browser.js +28 -0
- package/esm/config.d.ts +8 -0
- package/esm/config.d.ts.map +1 -0
- package/esm/config.js +100 -0
- package/esm/http-server.d.ts +17 -0
- package/esm/http-server.d.ts.map +1 -0
- package/esm/http-server.js +341 -0
- package/esm/mod.d.ts +11 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +9 -0
- package/esm/package.json +3 -0
- package/esm/pending-store.d.ts +89 -0
- package/esm/pending-store.d.ts.map +1 -0
- package/esm/pending-store.js +162 -0
- package/esm/transport.d.ts +9 -0
- package/esm/transport.d.ts.map +1 -0
- package/esm/transport.js +60 -0
- package/esm/types.d.ts +79 -0
- package/esm/types.d.ts.map +1 -0
- package/esm/types.js +1 -0
- package/esm/version.d.ts +2 -0
- package/esm/version.d.ts.map +1 -0
- package/esm/version.js +14 -0
- package/esm/viem-account.d.ts +27 -0
- package/esm/viem-account.d.ts.map +1 -0
- package/esm/viem-account.js +36 -0
- package/esm/wallet-signer.d.ts +106 -0
- package/esm/wallet-signer.d.ts.map +1 -0
- package/esm/wallet-signer.js +178 -0
- package/package.json +46 -0
- package/web/assets/index-C17Xxzpm.js +46 -0
- package/web/assets/index-C5BDQo8n.css +1 -0
- package/web/assets/secp256k1-B4KiQCBs.js +1 -0
- package/web/favicon.svg +10 -0
- package/web/index.html +27 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
import { type URL } from "node:url";
|
|
15
|
+
declare global {
|
|
16
|
+
interface ImportMeta {
|
|
17
|
+
/** A string representation of the fully qualified module URL. When the
|
|
18
|
+
* module is loaded locally, the value will be a file URL (e.g.
|
|
19
|
+
* `file:///path/module.ts`).
|
|
20
|
+
*
|
|
21
|
+
* You can also parse the string as a URL to determine more information about
|
|
22
|
+
* how the current module was loaded. For example to determine if a module was
|
|
23
|
+
* local or not:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const url = new URL(import.meta.url);
|
|
27
|
+
* if (url.protocol === "file:") {
|
|
28
|
+
* console.log("this module was loaded locally");
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* A function that returns resolved specifier as if it would be imported
|
|
35
|
+
* using `import(specifier)`.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* console.log(import.meta.resolve("./foo.js"));
|
|
39
|
+
* // file:///dev/foo.js
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param specifier The module specifier to resolve relative to `parent`.
|
|
43
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
44
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
45
|
+
*/
|
|
46
|
+
resolve(specifier: string, parent?: string | URL | undefined): string;
|
|
47
|
+
/** A flag that indicates if the current module is the main module that was
|
|
48
|
+
* called when starting the program under Deno.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* if (import.meta.main) {
|
|
52
|
+
* // this was loaded as the main module, maybe do some bootstrapping
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
main: boolean;
|
|
57
|
+
/** The absolute path of the current module.
|
|
58
|
+
*
|
|
59
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```
|
|
63
|
+
* // Unix
|
|
64
|
+
* console.log(import.meta.filename); // /home/alice/my_module.ts
|
|
65
|
+
*
|
|
66
|
+
* // Windows
|
|
67
|
+
* console.log(import.meta.filename); // C:\alice\my_module.ts
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
filename: string;
|
|
71
|
+
/** The absolute path of the directory containing the current module.
|
|
72
|
+
*
|
|
73
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
74
|
+
*
|
|
75
|
+
* * Example:
|
|
76
|
+
* ```
|
|
77
|
+
* // Unix
|
|
78
|
+
* console.log(import.meta.dirname); // /home/alice
|
|
79
|
+
*
|
|
80
|
+
* // Windows
|
|
81
|
+
* console.log(import.meta.dirname); // C:\alice
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
dirname: string;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
type NodeRequest = ReturnType<typeof createRequire>;
|
|
88
|
+
type NodeModule = NonNullable<NodeRequest["main"]>;
|
|
89
|
+
interface ImportMetaPonyfillCommonjs {
|
|
90
|
+
(require: NodeRequest, module: NodeModule): ImportMeta;
|
|
91
|
+
}
|
|
92
|
+
interface ImportMetaPonyfillEsmodule {
|
|
93
|
+
(importMeta: ImportMeta): ImportMeta;
|
|
94
|
+
}
|
|
95
|
+
interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
|
|
96
|
+
}
|
|
97
|
+
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
98
|
+
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
99
|
+
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=_dnt.polyfills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
//@ts-ignore
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
//@ts-ignore
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
import { dirname } from "node:path";
|
|
19
|
+
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
20
|
+
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
21
|
+
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
22
|
+
configurable: true,
|
|
23
|
+
get() {
|
|
24
|
+
return fn;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export let import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
30
|
+
(() => {
|
|
31
|
+
const moduleImportMetaWM = new WeakMap();
|
|
32
|
+
return (require, module) => {
|
|
33
|
+
let importMetaCache = moduleImportMetaWM.get(module);
|
|
34
|
+
if (importMetaCache == null) {
|
|
35
|
+
const importMeta = Object.assign(Object.create(null), {
|
|
36
|
+
url: pathToFileURL(module.filename).href,
|
|
37
|
+
main: require.main == module,
|
|
38
|
+
resolve: (specifier, parentURL = importMeta.url) => {
|
|
39
|
+
return pathToFileURL((importMeta.url === parentURL
|
|
40
|
+
? require
|
|
41
|
+
: createRequire(parentURL))
|
|
42
|
+
.resolve(specifier)).href;
|
|
43
|
+
},
|
|
44
|
+
filename: module.filename,
|
|
45
|
+
dirname: module.path,
|
|
46
|
+
});
|
|
47
|
+
moduleImportMetaWM.set(module, importMeta);
|
|
48
|
+
importMetaCache = importMeta;
|
|
49
|
+
}
|
|
50
|
+
return importMetaCache;
|
|
51
|
+
};
|
|
52
|
+
})());
|
|
53
|
+
defineGlobalPonyfill("import-meta-ponyfill-commonjs", import_meta_ponyfill_commonjs);
|
|
54
|
+
export let import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
55
|
+
((importMeta) => {
|
|
56
|
+
const resolveFunStr = String(importMeta.resolve);
|
|
57
|
+
const shimWs = new WeakSet();
|
|
58
|
+
//@ts-ignore
|
|
59
|
+
const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
|
|
60
|
+
.replace(/\/{3,}/, "///");
|
|
61
|
+
const commonShim = (importMeta) => {
|
|
62
|
+
if (typeof importMeta.main !== "boolean") {
|
|
63
|
+
importMeta.main = importMeta.url === mainUrl;
|
|
64
|
+
}
|
|
65
|
+
if (typeof importMeta.filename !== "string") {
|
|
66
|
+
importMeta.filename = fileURLToPath(importMeta.url);
|
|
67
|
+
importMeta.dirname = dirname(importMeta.filename);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (
|
|
71
|
+
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
72
|
+
resolveFunStr === "undefined" ||
|
|
73
|
+
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
74
|
+
resolveFunStr.startsWith("async")
|
|
75
|
+
// enable by --experimental-import-meta-resolve flag
|
|
76
|
+
) {
|
|
77
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
78
|
+
if (!shimWs.has(importMeta)) {
|
|
79
|
+
shimWs.add(importMeta);
|
|
80
|
+
const importMetaUrlRequire = {
|
|
81
|
+
url: importMeta.url,
|
|
82
|
+
require: createRequire(importMeta.url),
|
|
83
|
+
};
|
|
84
|
+
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
85
|
+
return pathToFileURL((importMetaUrlRequire.url === parentURL
|
|
86
|
+
? importMetaUrlRequire.require
|
|
87
|
+
: createRequire(parentURL)).resolve(specifier)).href;
|
|
88
|
+
};
|
|
89
|
+
commonShim(importMeta);
|
|
90
|
+
}
|
|
91
|
+
return importMeta;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
/// native support
|
|
96
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
97
|
+
if (!shimWs.has(importMeta)) {
|
|
98
|
+
shimWs.add(importMeta);
|
|
99
|
+
commonShim(importMeta);
|
|
100
|
+
}
|
|
101
|
+
return importMeta;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return import_meta_ponyfill_esmodule(importMeta);
|
|
105
|
+
}));
|
|
106
|
+
defineGlobalPonyfill("import-meta-ponyfill-esmodule", import_meta_ponyfill_esmodule);
|
|
107
|
+
export let import_meta_ponyfill = ((...args) => {
|
|
108
|
+
const _MODULE = (() => {
|
|
109
|
+
if (typeof require === "function" && typeof module === "object") {
|
|
110
|
+
return "commonjs";
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// eval("typeof import.meta");
|
|
114
|
+
return "esmodule";
|
|
115
|
+
}
|
|
116
|
+
})();
|
|
117
|
+
if (_MODULE === "commonjs") {
|
|
118
|
+
//@ts-ignore
|
|
119
|
+
import_meta_ponyfill = (r, m) => import_meta_ponyfill_commonjs(r, m);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
//@ts-ignore
|
|
123
|
+
import_meta_ponyfill = (im) => import_meta_ponyfill_esmodule(im);
|
|
124
|
+
}
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
return import_meta_ponyfill(...args);
|
|
127
|
+
});
|
package/esm/browser.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open a URL in the default browser
|
|
3
|
+
*/
|
|
4
|
+
export declare function openBrowser(url: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Build the URL for a specific signing request
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildSignUrl(port: number, requestId: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Build the URL for wallet connection
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildConnectUrl(port: number, requestId: string): string;
|
|
13
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW5D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvE"}
|
package/esm/browser.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open a URL in the default browser
|
|
3
|
+
*/
|
|
4
|
+
export async function openBrowser(url) {
|
|
5
|
+
try {
|
|
6
|
+
// Dynamic import: avoids pulling in `open` (and its `is-wsl` dep) at module load time,
|
|
7
|
+
// which matters when a consumer provides a custom openBrowser and never needs this default.
|
|
8
|
+
const { default: open } = await import("open");
|
|
9
|
+
await open(url);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
// Log error but don't throw - the user might want to open the URL manually
|
|
13
|
+
console.error(`[mcp-wallet-signer] Failed to open browser: ${error}`);
|
|
14
|
+
console.error(`[mcp-wallet-signer] Please open this URL manually: ${url}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build the URL for a specific signing request
|
|
19
|
+
*/
|
|
20
|
+
export function buildSignUrl(port, requestId) {
|
|
21
|
+
return `http://127.0.0.1:${port}/sign/${requestId}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build the URL for wallet connection
|
|
25
|
+
*/
|
|
26
|
+
export function buildConnectUrl(port, requestId) {
|
|
27
|
+
return `http://127.0.0.1:${port}/connect/${requestId}`;
|
|
28
|
+
}
|
package/esm/config.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChainConfig } from "./types.js";
|
|
2
|
+
export declare const DEFAULT_PORT = 3847;
|
|
3
|
+
export declare function getPort(): number;
|
|
4
|
+
export declare function getDefaultChainId(): number;
|
|
5
|
+
export declare const CHAINS: Record<number, ChainConfig>;
|
|
6
|
+
export declare function getChainConfig(chainId: number): ChainConfig | undefined;
|
|
7
|
+
export declare function getRpcUrl(chainId: number): string | undefined;
|
|
8
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,eAAO,MAAM,YAAY,OAAO,CAAC;AAGjC,wBAAgB,OAAO,IAAI,MAAM,CAShC;AAGD,wBAAgB,iBAAiB,IAAI,MAAM,CAS1C;AAGD,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAiE9C,CAAC;AAGF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEvE;AAGD,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7D"}
|
package/esm/config.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
// Default HTTP server port
|
|
3
|
+
export const DEFAULT_PORT = 3847;
|
|
4
|
+
// Get port from environment or use default
|
|
5
|
+
export function getPort() {
|
|
6
|
+
const envPort = process.env.EVM_MCP_PORT;
|
|
7
|
+
if (envPort) {
|
|
8
|
+
const parsed = parseInt(envPort, 10);
|
|
9
|
+
if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
|
|
10
|
+
return parsed;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return DEFAULT_PORT;
|
|
14
|
+
}
|
|
15
|
+
// Get default chain ID from environment or use mainnet
|
|
16
|
+
export function getDefaultChainId() {
|
|
17
|
+
const envChain = process.env.EVM_MCP_DEFAULT_CHAIN;
|
|
18
|
+
if (envChain) {
|
|
19
|
+
const parsed = parseInt(envChain, 10);
|
|
20
|
+
if (!isNaN(parsed) && parsed > 0) {
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return 1; // Ethereum mainnet
|
|
25
|
+
}
|
|
26
|
+
// Built-in chain configurations
|
|
27
|
+
export const CHAINS = {
|
|
28
|
+
// Ethereum Mainnet
|
|
29
|
+
1: {
|
|
30
|
+
id: 1,
|
|
31
|
+
name: "Ethereum",
|
|
32
|
+
rpcUrl: "https://eth.llamarpc.com",
|
|
33
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
34
|
+
blockExplorer: "https://etherscan.io",
|
|
35
|
+
},
|
|
36
|
+
// Sepolia Testnet
|
|
37
|
+
11155111: {
|
|
38
|
+
id: 11155111,
|
|
39
|
+
name: "Sepolia",
|
|
40
|
+
rpcUrl: "https://rpc.sepolia.org",
|
|
41
|
+
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
42
|
+
blockExplorer: "https://sepolia.etherscan.io",
|
|
43
|
+
},
|
|
44
|
+
// Polygon
|
|
45
|
+
137: {
|
|
46
|
+
id: 137,
|
|
47
|
+
name: "Polygon",
|
|
48
|
+
rpcUrl: "https://polygon-rpc.com",
|
|
49
|
+
nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18 },
|
|
50
|
+
blockExplorer: "https://polygonscan.com",
|
|
51
|
+
},
|
|
52
|
+
// Arbitrum One
|
|
53
|
+
42161: {
|
|
54
|
+
id: 42161,
|
|
55
|
+
name: "Arbitrum One",
|
|
56
|
+
rpcUrl: "https://arb1.arbitrum.io/rpc",
|
|
57
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
58
|
+
blockExplorer: "https://arbiscan.io",
|
|
59
|
+
},
|
|
60
|
+
// Optimism
|
|
61
|
+
10: {
|
|
62
|
+
id: 10,
|
|
63
|
+
name: "Optimism",
|
|
64
|
+
rpcUrl: "https://mainnet.optimism.io",
|
|
65
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
66
|
+
blockExplorer: "https://optimistic.etherscan.io",
|
|
67
|
+
},
|
|
68
|
+
// Base
|
|
69
|
+
8453: {
|
|
70
|
+
id: 8453,
|
|
71
|
+
name: "Base",
|
|
72
|
+
rpcUrl: "https://mainnet.base.org",
|
|
73
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
74
|
+
blockExplorer: "https://basescan.org",
|
|
75
|
+
},
|
|
76
|
+
// Avalanche C-Chain
|
|
77
|
+
43114: {
|
|
78
|
+
id: 43114,
|
|
79
|
+
name: "Avalanche",
|
|
80
|
+
rpcUrl: "https://api.avax.network/ext/bc/C/rpc",
|
|
81
|
+
nativeCurrency: { name: "AVAX", symbol: "AVAX", decimals: 18 },
|
|
82
|
+
blockExplorer: "https://snowtrace.io",
|
|
83
|
+
},
|
|
84
|
+
// BNB Smart Chain
|
|
85
|
+
56: {
|
|
86
|
+
id: 56,
|
|
87
|
+
name: "BNB Smart Chain",
|
|
88
|
+
rpcUrl: "https://bsc-dataseed.binance.org",
|
|
89
|
+
nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },
|
|
90
|
+
blockExplorer: "https://bscscan.com",
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
// Get chain config by ID, with fallback for unknown chains
|
|
94
|
+
export function getChainConfig(chainId) {
|
|
95
|
+
return CHAINS[chainId];
|
|
96
|
+
}
|
|
97
|
+
// Get RPC URL for a chain
|
|
98
|
+
export function getRpcUrl(chainId) {
|
|
99
|
+
return CHAINS[chainId]?.rpcUrl;
|
|
100
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PendingStore } from "./pending-store.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create an HTTP server bound to a PendingStore.
|
|
4
|
+
* Returns the port and a stop function.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createHttpServer(store: PendingStore, port?: number): Promise<{
|
|
7
|
+
port: number;
|
|
8
|
+
stop: () => Promise<void>;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Start a test server on a random port using the default PendingStore.
|
|
12
|
+
*/
|
|
13
|
+
export declare function startTestServer(): Promise<{
|
|
14
|
+
port: number;
|
|
15
|
+
stop: () => Promise<void>;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=http-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../src/http-server.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAuC,MAAM,oBAAoB,CAAC;AA+VvF;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,YAAY,EACnB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAmBtD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAEtF"}
|