@metamask-previews/eth-snap-keyring 7.0.0-fb72e65 → 8.0.0-515dc3a
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/CHANGELOG.md +23 -1
- package/dist/SnapKeyring.cjs +47 -17
- package/dist/SnapKeyring.cjs.map +1 -1
- package/dist/SnapKeyring.d.cts.map +1 -1
- package/dist/SnapKeyring.d.mts.map +1 -1
- package/dist/SnapKeyring.mjs +38 -8
- package/dist/SnapKeyring.mjs.map +1 -1
- package/dist/account.cjs +16 -0
- package/dist/account.cjs.map +1 -0
- package/dist/account.d.cts +27 -0
- package/dist/account.d.cts.map +1 -0
- package/dist/account.d.mts +27 -0
- package/dist/account.d.mts.map +1 -0
- package/dist/account.mjs +13 -0
- package/dist/account.mjs.map +1 -0
- package/dist/events.cjs +24 -0
- package/dist/events.cjs.map +1 -0
- package/dist/events.d.cts +101 -0
- package/dist/events.d.cts.map +1 -0
- package/dist/events.d.mts +101 -0
- package/dist/events.d.mts.map +1 -0
- package/dist/events.mjs +21 -0
- package/dist/events.mjs.map +1 -0
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/util.cjs +0 -17
- package/dist/util.cjs.map +1 -1
- package/dist/util.d.cts +0 -13
- package/dist/util.d.cts.map +1 -1
- package/dist/util.d.mts +0 -13
- package/dist/util.d.mts.map +1 -1
- package/dist/util.mjs +0 -16
- package/dist/util.mjs.map +1 -1
- package/package.json +17 -14
package/dist/types.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
export declare const SnapMessageStruct: import("@metamask/superstruct").Struct<{
|
|
3
3
|
method: string;
|
|
4
|
-
params?: import("@metamask/utils").Json
|
|
4
|
+
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | undefined;
|
|
5
5
|
}, {
|
|
6
6
|
method: import("@metamask/superstruct").Struct<string, null>;
|
|
7
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/utils").Json
|
|
7
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | undefined, null>;
|
|
8
8
|
}>;
|
|
9
9
|
/**
|
|
10
10
|
* Message sent by the snap to manage accounts and requests.
|
package/dist/types.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
export declare const SnapMessageStruct: import("@metamask/superstruct").Struct<{
|
|
3
3
|
method: string;
|
|
4
|
-
params?: import("@metamask/utils").Json
|
|
4
|
+
params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | undefined;
|
|
5
5
|
}, {
|
|
6
6
|
method: import("@metamask/superstruct").Struct<string, null>;
|
|
7
|
-
params: import("@metamask/superstruct").Struct<import("@metamask/utils").Json
|
|
7
|
+
params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | undefined, null>;
|
|
8
8
|
}>;
|
|
9
9
|
/**
|
|
10
10
|
* Message sent by the snap to manage accounts and requests.
|
package/dist/util.cjs
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.strictMask = strictMask;
|
|
4
3
|
exports.unique = unique;
|
|
5
4
|
exports.toJson = toJson;
|
|
6
5
|
exports.ensureDefined = ensureDefined;
|
|
7
6
|
exports.throwError = throwError;
|
|
8
7
|
exports.equalsIgnoreCase = equalsIgnoreCase;
|
|
9
8
|
exports.sanitizeUrl = sanitizeUrl;
|
|
10
|
-
const superstruct_1 = require("@metamask/superstruct");
|
|
11
|
-
/**
|
|
12
|
-
* Assert that a value is valid according to a struct.
|
|
13
|
-
*
|
|
14
|
-
* It is similar to superstruct's mask function, but it does not ignore extra
|
|
15
|
-
* properties.
|
|
16
|
-
*
|
|
17
|
-
* @param value - Value to check.
|
|
18
|
-
* @param struct - Struct to validate the value against.
|
|
19
|
-
* @param message - Error message to throw if the value is not valid.
|
|
20
|
-
* @returns The value if it is valid.
|
|
21
|
-
*/
|
|
22
|
-
function strictMask(value, struct, message) {
|
|
23
|
-
(0, superstruct_1.assert)(value, struct, message);
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
9
|
/**
|
|
27
10
|
* Remove duplicate entries from an array.
|
|
28
11
|
*
|
package/dist/util.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.cjs","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"util.cjs","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;AAQA,wBAEC;AAYD,wBAEC;AAOD,sCAMC;AAOD,gCAEC;AASD,4CAEC;AAQD,kCAIC;AAnED;;;;;GAKG;AACH,SAAgB,MAAM,CAAO,KAA8B;IACzD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,MAAM,CAA2B,KAAU;IACzD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAS,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,KAAuB;IAEvB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,OAAe;IACxC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,CAAS,EAAE,CAAS;IACnD,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,0FAA0F;IAC1F,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * Remove duplicate entries from an array.\n *\n * @param array - Array to remove duplicates from.\n * @returns Array with duplicates removed.\n */\nexport function unique<Type>(array: Type[] | Iterable<Type>): Type[] {\n return [...new Set(array)];\n}\n\n/**\n * Convert a value to a valid JSON object.\n *\n * The function chains JSON.stringify and JSON.parse to ensure that the result\n * is a valid JSON object. In objects, undefined values are removed, and in\n * arrays, they are replaced with null.\n *\n * @param value - Value to convert to JSON.\n * @returns JSON representation of the value.\n */\nexport function toJson<Type extends Json = Json>(value: any): Type {\n return JSON.parse(JSON.stringify(value)) as Type;\n}\n\n/**\n * Asserts that the given value is defined.\n *\n * @param value - Value to check.\n */\nexport function ensureDefined<Type>(\n value: Type | undefined,\n): asserts value is Type {\n if (value === undefined) {\n throw new Error('Argument is undefined');\n }\n}\n\n/**\n * Helper function that throws an error.\n *\n * @param message - Error message to throw.\n */\nexport function throwError(message: string): never {\n throw new Error(message);\n}\n\n/**\n * Compares two strings for equality, ignoring case.\n *\n * @param a - The first string to compare.\n * @param b - The second string to compare.\n * @returns `true` if the strings are equal, ignoring case. `false` otherwise.\n */\nexport function equalsIgnoreCase(a: string, b: string): boolean {\n return a.toLowerCase() === b.toLowerCase();\n}\n\n/**\n * Sanitize a URL.\n *\n * @param url - The URL to sanitize.\n * @returns The new sanitized redirect URL.\n */\nexport function sanitizeUrl(url: string): string {\n // We use a `URL` object to detect any badly formatted URL and to normalize/sanitize them.\n const saferUrl = new URL(url);\n return saferUrl.toString();\n}\n"]}
|
package/dist/util.d.cts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import type { Struct } from "@metamask/superstruct";
|
|
2
1
|
import type { Json } from "@metamask/utils";
|
|
3
|
-
/**
|
|
4
|
-
* Assert that a value is valid according to a struct.
|
|
5
|
-
*
|
|
6
|
-
* It is similar to superstruct's mask function, but it does not ignore extra
|
|
7
|
-
* properties.
|
|
8
|
-
*
|
|
9
|
-
* @param value - Value to check.
|
|
10
|
-
* @param struct - Struct to validate the value against.
|
|
11
|
-
* @param message - Error message to throw if the value is not valid.
|
|
12
|
-
* @returns The value if it is valid.
|
|
13
|
-
*/
|
|
14
|
-
export declare function strictMask<Type, Schema>(value: unknown, struct: Struct<Type, Schema>, message?: string): Type;
|
|
15
2
|
/**
|
|
16
3
|
* Remove duplicate entries from an array.
|
|
17
4
|
*
|
package/dist/util.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.cts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"util.d.cts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAEnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,IAAI,SAAS,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAChC,KAAK,EAAE,IAAI,GAAG,SAAS,GACtB,OAAO,CAAC,KAAK,IAAI,IAAI,CAIvB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI/C"}
|
package/dist/util.d.mts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import type { Struct } from "@metamask/superstruct";
|
|
2
1
|
import type { Json } from "@metamask/utils";
|
|
3
|
-
/**
|
|
4
|
-
* Assert that a value is valid according to a struct.
|
|
5
|
-
*
|
|
6
|
-
* It is similar to superstruct's mask function, but it does not ignore extra
|
|
7
|
-
* properties.
|
|
8
|
-
*
|
|
9
|
-
* @param value - Value to check.
|
|
10
|
-
* @param struct - Struct to validate the value against.
|
|
11
|
-
* @param message - Error message to throw if the value is not valid.
|
|
12
|
-
* @returns The value if it is valid.
|
|
13
|
-
*/
|
|
14
|
-
export declare function strictMask<Type, Schema>(value: unknown, struct: Struct<Type, Schema>, message?: string): Type;
|
|
15
2
|
/**
|
|
16
3
|
* Remove duplicate entries from an array.
|
|
17
4
|
*
|
package/dist/util.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.mts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"util.d.mts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAEnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,IAAI,SAAS,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAChC,KAAK,EAAE,IAAI,GAAG,SAAS,GACtB,OAAO,CAAC,KAAK,IAAI,IAAI,CAIvB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI/C"}
|
package/dist/util.mjs
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
import { assert } from "@metamask/superstruct";
|
|
2
|
-
/**
|
|
3
|
-
* Assert that a value is valid according to a struct.
|
|
4
|
-
*
|
|
5
|
-
* It is similar to superstruct's mask function, but it does not ignore extra
|
|
6
|
-
* properties.
|
|
7
|
-
*
|
|
8
|
-
* @param value - Value to check.
|
|
9
|
-
* @param struct - Struct to validate the value against.
|
|
10
|
-
* @param message - Error message to throw if the value is not valid.
|
|
11
|
-
* @returns The value if it is valid.
|
|
12
|
-
*/
|
|
13
|
-
export function strictMask(value, struct, message) {
|
|
14
|
-
assert(value, struct, message);
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
1
|
/**
|
|
18
2
|
* Remove duplicate entries from an array.
|
|
19
3
|
*
|
package/dist/util.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.mjs","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.mjs","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAO,KAA8B;IACzD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAA2B,KAAU;IACzD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAS,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAuB;IAEvB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAS,EAAE,CAAS;IACnD,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,0FAA0F;IAC1F,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * Remove duplicate entries from an array.\n *\n * @param array - Array to remove duplicates from.\n * @returns Array with duplicates removed.\n */\nexport function unique<Type>(array: Type[] | Iterable<Type>): Type[] {\n return [...new Set(array)];\n}\n\n/**\n * Convert a value to a valid JSON object.\n *\n * The function chains JSON.stringify and JSON.parse to ensure that the result\n * is a valid JSON object. In objects, undefined values are removed, and in\n * arrays, they are replaced with null.\n *\n * @param value - Value to convert to JSON.\n * @returns JSON representation of the value.\n */\nexport function toJson<Type extends Json = Json>(value: any): Type {\n return JSON.parse(JSON.stringify(value)) as Type;\n}\n\n/**\n * Asserts that the given value is defined.\n *\n * @param value - Value to check.\n */\nexport function ensureDefined<Type>(\n value: Type | undefined,\n): asserts value is Type {\n if (value === undefined) {\n throw new Error('Argument is undefined');\n }\n}\n\n/**\n * Helper function that throws an error.\n *\n * @param message - Error message to throw.\n */\nexport function throwError(message: string): never {\n throw new Error(message);\n}\n\n/**\n * Compares two strings for equality, ignoring case.\n *\n * @param a - The first string to compare.\n * @param b - The second string to compare.\n * @returns `true` if the strings are equal, ignoring case. `false` otherwise.\n */\nexport function equalsIgnoreCase(a: string, b: string): boolean {\n return a.toLowerCase() === b.toLowerCase();\n}\n\n/**\n * Sanitize a URL.\n *\n * @param url - The URL to sanitize.\n * @returns The new sanitized redirect URL.\n */\nexport function sanitizeUrl(url: string): string {\n // We use a `URL` object to detect any badly formatted URL and to normalize/sanitize them.\n const saferUrl = new URL(url);\n return saferUrl.toString();\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/eth-snap-keyring",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-515dc3a",
|
|
4
4
|
"description": "Snaps keyring bridge.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,28 +38,28 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@ethereumjs/tx": "^4.2.0",
|
|
41
|
-
"@metamask/eth-sig-util": "^8.
|
|
42
|
-
"@metamask/keyring-api": "
|
|
43
|
-
"@metamask/keyring-internal-api": "
|
|
44
|
-
"@metamask/keyring-internal-snap-client": "
|
|
41
|
+
"@metamask/eth-sig-util": "^8.1.2",
|
|
42
|
+
"@metamask/keyring-api": "13.0.0",
|
|
43
|
+
"@metamask/keyring-internal-api": "2.0.0",
|
|
44
|
+
"@metamask/keyring-internal-snap-client": "2.0.0",
|
|
45
|
+
"@metamask/keyring-utils": "1.0.0",
|
|
46
|
+
"@metamask/snaps-controllers": "^9.10.0",
|
|
47
|
+
"@metamask/snaps-sdk": "^6.7.0",
|
|
48
|
+
"@metamask/snaps-utils": "^8.3.0",
|
|
45
49
|
"@metamask/superstruct": "^3.1.0",
|
|
46
|
-
"@metamask/utils": "^
|
|
47
|
-
"uuid": "^9.0.
|
|
50
|
+
"@metamask/utils": "^11.0.1",
|
|
51
|
+
"@types/uuid": "^9.0.8",
|
|
52
|
+
"uuid": "^9.0.1",
|
|
53
|
+
"webextension-polyfill": "^0.12.0"
|
|
48
54
|
},
|
|
49
55
|
"devDependencies": {
|
|
50
56
|
"@lavamoat/allow-scripts": "^3.2.1",
|
|
51
57
|
"@lavamoat/preinstall-always-fail": "^2.1.0",
|
|
52
58
|
"@metamask/auto-changelog": "^3.4.4",
|
|
53
|
-
"@metamask/
|
|
54
|
-
"@metamask/keyring-internal-api": "1.0.0",
|
|
55
|
-
"@metamask/keyring-internal-snap-client": "1.0.0",
|
|
56
|
-
"@metamask/snaps-controllers": "^9.10.0",
|
|
57
|
-
"@metamask/snaps-sdk": "^6.7.0",
|
|
58
|
-
"@metamask/snaps-utils": "^8.3.0",
|
|
59
|
+
"@metamask/providers": "^18.3.1",
|
|
59
60
|
"@ts-bridge/cli": "^0.6.1",
|
|
60
61
|
"@types/jest": "^29.5.12",
|
|
61
62
|
"@types/node": "^20.12.12",
|
|
62
|
-
"@types/uuid": "^9.0.8",
|
|
63
63
|
"deepmerge": "^4.2.2",
|
|
64
64
|
"depcheck": "^1.4.7",
|
|
65
65
|
"jest": "^29.5.0",
|
|
@@ -70,6 +70,9 @@
|
|
|
70
70
|
"typedoc": "^0.25.13",
|
|
71
71
|
"typescript": "~5.6.3"
|
|
72
72
|
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"@metamask/providers": "^18.3.1"
|
|
75
|
+
},
|
|
73
76
|
"engines": {
|
|
74
77
|
"node": "^18.18 || >=20"
|
|
75
78
|
},
|