@metamask/keyring-api 11.0.0 → 11.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/CHANGELOG.md +8 -1
- package/dist/KeyringClient.cjs +6 -0
- package/dist/KeyringClient.cjs.map +1 -1
- package/dist/KeyringClient.d.cts +3 -1
- package/dist/KeyringClient.d.cts.map +1 -1
- package/dist/KeyringClient.d.mts +3 -1
- package/dist/KeyringClient.d.mts.map +1 -1
- package/dist/KeyringClient.mjs +7 -1
- package/dist/KeyringClient.mjs.map +1 -1
- package/dist/api/asset.cjs +83 -0
- package/dist/api/asset.cjs.map +1 -0
- package/dist/api/asset.d.cts +93 -0
- package/dist/api/asset.d.cts.map +1 -0
- package/dist/api/asset.d.mts +93 -0
- package/dist/api/asset.d.mts.map +1 -0
- package/dist/api/asset.mjs +80 -0
- package/dist/api/asset.mjs.map +1 -0
- package/dist/api/balance.d.cts +1 -1
- package/dist/api/balance.d.mts +1 -1
- package/dist/api/index.cjs +2 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +3 -1
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +3 -1
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +2 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +14 -0
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +14 -0
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/transaction.cjs +295 -0
- package/dist/api/transaction.cjs.map +1 -0
- package/dist/api/transaction.d.cts +773 -0
- package/dist/api/transaction.d.cts.map +1 -0
- package/dist/api/transaction.d.mts +773 -0
- package/dist/api/transaction.d.mts.map +1 -0
- package/dist/api/transaction.mjs +292 -0
- package/dist/api/transaction.mjs.map +1 -0
- package/dist/eth/erc4337/types.d.cts +1 -1
- package/dist/eth/erc4337/types.d.mts +1 -1
- package/dist/internal/api.cjs +12 -1
- package/dist/internal/api.cjs.map +1 -1
- package/dist/internal/api.d.cts +318 -1
- package/dist/internal/api.d.cts.map +1 -1
- package/dist/internal/api.d.mts +318 -1
- package/dist/internal/api.d.mts.map +1 -1
- package/dist/internal/api.mjs +13 -2
- package/dist/internal/api.mjs.map +1 -1
- package/dist/internal/rpc.cjs +1 -0
- package/dist/internal/rpc.cjs.map +1 -1
- package/dist/internal/rpc.d.cts +1 -0
- package/dist/internal/rpc.d.cts.map +1 -1
- package/dist/internal/rpc.d.mts +1 -0
- package/dist/internal/rpc.d.mts.map +1 -1
- package/dist/internal/rpc.mjs +1 -0
- package/dist/internal/rpc.mjs.map +1 -1
- package/dist/rpc-handler.cjs +7 -0
- package/dist/rpc-handler.cjs.map +1 -1
- package/dist/rpc-handler.d.cts.map +1 -1
- package/dist/rpc-handler.d.mts.map +1 -1
- package/dist/rpc-handler.mjs +8 -1
- package/dist/rpc-handler.mjs.map +1 -1
- package/dist/superstruct.cjs +29 -0
- package/dist/superstruct.cjs.map +1 -1
- package/dist/superstruct.d.cts +19 -1
- package/dist/superstruct.d.cts.map +1 -1
- package/dist/superstruct.d.mts +19 -1
- package/dist/superstruct.d.mts.map +1 -1
- package/dist/superstruct.mjs +28 -0
- package/dist/superstruct.mjs.map +1 -1
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +1 -0
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +1 -0
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/pagination.cjs +28 -0
- package/dist/utils/pagination.cjs.map +1 -0
- package/dist/utils/pagination.d.cts +59 -0
- package/dist/utils/pagination.d.cts.map +1 -0
- package/dist/utils/pagination.d.mts +59 -0
- package/dist/utils/pagination.d.mts.map +1 -0
- package/dist/utils/pagination.mjs +25 -0
- package/dist/utils/pagination.mjs.map +1 -0
- package/dist/utils/types.cjs.map +1 -1
- package/dist/utils/types.d.cts +24 -0
- package/dist/utils/types.d.cts.map +1 -1
- package/dist/utils/types.d.mts +24 -0
- package/dist/utils/types.d.mts.map +1 -1
- package/dist/utils/types.mjs.map +1 -1
- package/package.json +2 -2
package/dist/utils/index.mjs
CHANGED
package/dist/utils/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,4BAAwB;AACxB,6BAAyB","sourcesContent":["export * from './types';\nexport * from './typing';\n"]}
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,iCAA6B;AAC7B,4BAAwB;AACxB,6BAAyB","sourcesContent":["export * from './pagination';\nexport * from './types';\nexport * from './typing';\n"]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PaginationStruct = void 0;
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
5
|
+
const superstruct_2 = require("../superstruct.cjs");
|
6
|
+
/**
|
7
|
+
* Pagination struct. This struct is used to specify the limit of items to
|
8
|
+
* return and the next cursor to iterate over the results.
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* ```ts
|
12
|
+
* {
|
13
|
+
* limit: 10,
|
14
|
+
* next: 'c3y1Q6QtqtstbxKX+oqVdEW6',
|
15
|
+
* }
|
16
|
+
* ```
|
17
|
+
*/
|
18
|
+
exports.PaginationStruct = (0, superstruct_2.object)({
|
19
|
+
/**
|
20
|
+
* Maximum number of items to return.
|
21
|
+
*/
|
22
|
+
limit: (0, superstruct_1.number)(),
|
23
|
+
/**
|
24
|
+
* Next cursor to iterate over the results.
|
25
|
+
*/
|
26
|
+
next: (0, superstruct_2.exactOptional)((0, superstruct_1.nullable)((0, superstruct_1.string)())),
|
27
|
+
});
|
28
|
+
//# sourceMappingURL=pagination.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pagination.cjs","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":";;;AACA,uDAAiE;AAEjE,oDAAuD;AAEvD;;;;;;;;;;;GAWG;AACU,QAAA,gBAAgB,GAAG,IAAA,oBAAM,EAAC;IACrC;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,IAAI,EAAE,IAAA,2BAAa,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,CAAC;CACxC,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { nullable, number, string } from '@metamask/superstruct';\n\nimport { exactOptional, object } from '../superstruct';\n\n/**\n * Pagination struct. This struct is used to specify the limit of items to\n * return and the next cursor to iterate over the results.\n *\n * @example\n * ```ts\n * {\n * limit: 10,\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n */\nexport const PaginationStruct = object({\n /**\n * Maximum number of items to return.\n */\n limit: number(),\n\n /**\n * Next cursor to iterate over the results.\n */\n next: exactOptional(nullable(string())),\n});\n\n/**\n * Pagination object.\n *\n * See {@link PaginationStruct}.\n */\nexport type Pagination = Infer<typeof PaginationStruct>;\n\n/**\n * Page of results. It includes the data and the next cursor to iterate over\n * the results.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Item object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n */\nexport type Paginated<Type> = {\n /**\n * The list of items for this page.\n */\n data: Type[];\n\n /**\n * Next cursor to iterate over the results if any, will be `null` otherwise.\n */\n next: string | null;\n};\n"]}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
2
|
+
/**
|
3
|
+
* Pagination struct. This struct is used to specify the limit of items to
|
4
|
+
* return and the next cursor to iterate over the results.
|
5
|
+
*
|
6
|
+
* @example
|
7
|
+
* ```ts
|
8
|
+
* {
|
9
|
+
* limit: 10,
|
10
|
+
* next: 'c3y1Q6QtqtstbxKX+oqVdEW6',
|
11
|
+
* }
|
12
|
+
* ```
|
13
|
+
*/
|
14
|
+
export declare const PaginationStruct: import("@metamask/superstruct").Struct<{
|
15
|
+
limit: number;
|
16
|
+
next?: string | null;
|
17
|
+
}, {
|
18
|
+
/**
|
19
|
+
* Maximum number of items to return.
|
20
|
+
*/
|
21
|
+
limit: import("@metamask/superstruct").Struct<number, null>;
|
22
|
+
/**
|
23
|
+
* Next cursor to iterate over the results.
|
24
|
+
*/
|
25
|
+
next: import("@metamask/superstruct").Struct<string | import("../superstruct.cjs").ExactOptionalTag | null, null>;
|
26
|
+
}>;
|
27
|
+
/**
|
28
|
+
* Pagination object.
|
29
|
+
*
|
30
|
+
* See {@link PaginationStruct}.
|
31
|
+
*/
|
32
|
+
export type Pagination = Infer<typeof PaginationStruct>;
|
33
|
+
/**
|
34
|
+
* Page of results. It includes the data and the next cursor to iterate over
|
35
|
+
* the results.
|
36
|
+
*
|
37
|
+
* @example
|
38
|
+
* ```ts
|
39
|
+
* {
|
40
|
+
* data: [
|
41
|
+
* {
|
42
|
+
* // Item object
|
43
|
+
* }
|
44
|
+
* ],
|
45
|
+
* next: 'c3y1Q6QtqtstbxKX+oqVdEW6',
|
46
|
+
* }
|
47
|
+
* ```
|
48
|
+
*/
|
49
|
+
export type Paginated<Type> = {
|
50
|
+
/**
|
51
|
+
* The list of items for this page.
|
52
|
+
*/
|
53
|
+
data: Type[];
|
54
|
+
/**
|
55
|
+
* Next cursor to iterate over the results if any, will be `null` otherwise.
|
56
|
+
*/
|
57
|
+
next: string | null;
|
58
|
+
};
|
59
|
+
//# sourceMappingURL=pagination.d.cts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pagination.d.cts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB;;;;IAC3B;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,IAAI;IAC5B;;OAEG;IACH,IAAI,EAAE,IAAI,EAAE,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC"}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
2
|
+
/**
|
3
|
+
* Pagination struct. This struct is used to specify the limit of items to
|
4
|
+
* return and the next cursor to iterate over the results.
|
5
|
+
*
|
6
|
+
* @example
|
7
|
+
* ```ts
|
8
|
+
* {
|
9
|
+
* limit: 10,
|
10
|
+
* next: 'c3y1Q6QtqtstbxKX+oqVdEW6',
|
11
|
+
* }
|
12
|
+
* ```
|
13
|
+
*/
|
14
|
+
export declare const PaginationStruct: import("@metamask/superstruct").Struct<{
|
15
|
+
limit: number;
|
16
|
+
next?: string | null;
|
17
|
+
}, {
|
18
|
+
/**
|
19
|
+
* Maximum number of items to return.
|
20
|
+
*/
|
21
|
+
limit: import("@metamask/superstruct").Struct<number, null>;
|
22
|
+
/**
|
23
|
+
* Next cursor to iterate over the results.
|
24
|
+
*/
|
25
|
+
next: import("@metamask/superstruct").Struct<string | import("../superstruct.mjs").ExactOptionalTag | null, null>;
|
26
|
+
}>;
|
27
|
+
/**
|
28
|
+
* Pagination object.
|
29
|
+
*
|
30
|
+
* See {@link PaginationStruct}.
|
31
|
+
*/
|
32
|
+
export type Pagination = Infer<typeof PaginationStruct>;
|
33
|
+
/**
|
34
|
+
* Page of results. It includes the data and the next cursor to iterate over
|
35
|
+
* the results.
|
36
|
+
*
|
37
|
+
* @example
|
38
|
+
* ```ts
|
39
|
+
* {
|
40
|
+
* data: [
|
41
|
+
* {
|
42
|
+
* // Item object
|
43
|
+
* }
|
44
|
+
* ],
|
45
|
+
* next: 'c3y1Q6QtqtstbxKX+oqVdEW6',
|
46
|
+
* }
|
47
|
+
* ```
|
48
|
+
*/
|
49
|
+
export type Paginated<Type> = {
|
50
|
+
/**
|
51
|
+
* The list of items for this page.
|
52
|
+
*/
|
53
|
+
data: Type[];
|
54
|
+
/**
|
55
|
+
* Next cursor to iterate over the results if any, will be `null` otherwise.
|
56
|
+
*/
|
57
|
+
next: string | null;
|
58
|
+
};
|
59
|
+
//# sourceMappingURL=pagination.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pagination.d.mts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB;;;;IAC3B;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,IAAI;IAC5B;;OAEG;IACH,IAAI,EAAE,IAAI,EAAE,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { nullable, number, string } from "@metamask/superstruct";
|
2
|
+
import { exactOptional, object } from "../superstruct.mjs";
|
3
|
+
/**
|
4
|
+
* Pagination struct. This struct is used to specify the limit of items to
|
5
|
+
* return and the next cursor to iterate over the results.
|
6
|
+
*
|
7
|
+
* @example
|
8
|
+
* ```ts
|
9
|
+
* {
|
10
|
+
* limit: 10,
|
11
|
+
* next: 'c3y1Q6QtqtstbxKX+oqVdEW6',
|
12
|
+
* }
|
13
|
+
* ```
|
14
|
+
*/
|
15
|
+
export const PaginationStruct = object({
|
16
|
+
/**
|
17
|
+
* Maximum number of items to return.
|
18
|
+
*/
|
19
|
+
limit: number(),
|
20
|
+
/**
|
21
|
+
* Next cursor to iterate over the results.
|
22
|
+
*/
|
23
|
+
next: exactOptional(nullable(string())),
|
24
|
+
});
|
25
|
+
//# sourceMappingURL=pagination.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,2BAAuB;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE;IAEf;;OAEG;IACH,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;CACxC,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { nullable, number, string } from '@metamask/superstruct';\n\nimport { exactOptional, object } from '../superstruct';\n\n/**\n * Pagination struct. This struct is used to specify the limit of items to\n * return and the next cursor to iterate over the results.\n *\n * @example\n * ```ts\n * {\n * limit: 10,\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n */\nexport const PaginationStruct = object({\n /**\n * Maximum number of items to return.\n */\n limit: number(),\n\n /**\n * Next cursor to iterate over the results.\n */\n next: exactOptional(nullable(string())),\n});\n\n/**\n * Pagination object.\n *\n * See {@link PaginationStruct}.\n */\nexport type Pagination = Infer<typeof PaginationStruct>;\n\n/**\n * Page of results. It includes the data and the next cursor to iterate over\n * the results.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Item object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n */\nexport type Paginated<Type> = {\n /**\n * The list of items for this page.\n */\n data: Type[];\n\n /**\n * Next cursor to iterate over the results if any, will be `null` otherwise.\n */\n next: string | null;\n};\n"]}
|
package/dist/utils/types.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":";;;AAAA,uDAA2D;AAE3D,oDAA+C;AAE/C;;GAEG;AACU,QAAA,UAAU,GAAG,IAAA,2BAAa,EACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AAEF;;;;;GAKG;AACU,QAAA,SAAS,GAAG,IAAA,oBAAM,EAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAA,2BAAa,EAC7C,cAAc,EACd,gBAAgB,CACjB,CAAC","sourcesContent":["import { define, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\n/**\n * UUIDv4 struct.\n */\nexport const UuidStruct = definePattern(\n 'UuidV4',\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,\n);\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define<string>('Url', (value: unknown) => {\n try {\n const url = new URL(value as string);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n});\n\n/**\n * A string which contains a positive float number.\n */\nexport const StringNumberStruct = definePattern(\n 'StringNumber',\n /^\\d+(\\.\\d+)?$/u,\n);\nexport type StringNumber = Infer<typeof StringNumberStruct>;\n"]}
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":";;;AAAA,uDAA2D;AAE3D,oDAA+C;AAE/C;;GAEG;AACU,QAAA,UAAU,GAAG,IAAA,2BAAa,EACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AAEF;;;;;GAKG;AACU,QAAA,SAAS,GAAG,IAAA,oBAAM,EAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAA,2BAAa,EAC7C,cAAc,EACd,gBAAgB,CACjB,CAAC","sourcesContent":["import { define, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\n/**\n * UUIDv4 struct.\n */\nexport const UuidStruct = definePattern(\n 'UuidV4',\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,\n);\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define<string>('Url', (value: unknown) => {\n try {\n const url = new URL(value as string);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n});\n\n/**\n * A string which contains a positive float number.\n */\nexport const StringNumberStruct = definePattern(\n 'StringNumber',\n /^\\d+(\\.\\d+)?$/u,\n);\nexport type StringNumber = Infer<typeof StringNumberStruct>;\n\n/**\n * This is a helper type used by the {@link Equals} type.\n */\ntype EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;\n\n/**\n * A utility type that checks whether two types are exactly the same.\n *\n * This type evaluates to `true` if `TypeA` and `TypeB` are identical,\n * otherwise it evaluates to `false`.\n *\n * @template TypeA - The first type to compare.\n * @template TypeB - The second type to compare.\n *\n * @example\n * ```ts\n * // Example usage:\n * type Test1 = Equals<number, number>; // true\n * type Test2 = Equals<number, string>; // false\n * type Test3 = Equals<{ a: string }, { a: string }>; // true\n * type Test4 = Equals<{ a: string }, { a: number }>; // false\n * ```\n */\nexport type Equals<TypeA, TypeB> =\n EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;\n"]}
|
package/dist/utils/types.d.cts
CHANGED
@@ -15,4 +15,28 @@ export declare const UrlStruct: import("@metamask/superstruct").Struct<string, n
|
|
15
15
|
*/
|
16
16
|
export declare const StringNumberStruct: import("@metamask/superstruct").Struct<string, null>;
|
17
17
|
export type StringNumber = Infer<typeof StringNumberStruct>;
|
18
|
+
/**
|
19
|
+
* This is a helper type used by the {@link Equals} type.
|
20
|
+
*/
|
21
|
+
type EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;
|
22
|
+
/**
|
23
|
+
* A utility type that checks whether two types are exactly the same.
|
24
|
+
*
|
25
|
+
* This type evaluates to `true` if `TypeA` and `TypeB` are identical,
|
26
|
+
* otherwise it evaluates to `false`.
|
27
|
+
*
|
28
|
+
* @template TypeA - The first type to compare.
|
29
|
+
* @template TypeB - The second type to compare.
|
30
|
+
*
|
31
|
+
* @example
|
32
|
+
* ```ts
|
33
|
+
* // Example usage:
|
34
|
+
* type Test1 = Equals<number, number>; // true
|
35
|
+
* type Test2 = Equals<number, string>; // false
|
36
|
+
* type Test3 = Equals<{ a: string }, { a: string }>; // true
|
37
|
+
* type Test4 = Equals<{ a: string }, { a: number }>; // false
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
export type Equals<TypeA, TypeB> = EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;
|
41
|
+
export {};
|
18
42
|
//# sourceMappingURL=types.d.cts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAI3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,sDAOpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAG9B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAI3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,sDAOpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAG9B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5D;;GAEG;AACH,KAAK,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,IAC7B,YAAY,CAAC,KAAK,CAAC,SAAS,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
|
package/dist/utils/types.d.mts
CHANGED
@@ -15,4 +15,28 @@ export declare const UrlStruct: import("@metamask/superstruct").Struct<string, n
|
|
15
15
|
*/
|
16
16
|
export declare const StringNumberStruct: import("@metamask/superstruct").Struct<string, null>;
|
17
17
|
export type StringNumber = Infer<typeof StringNumberStruct>;
|
18
|
+
/**
|
19
|
+
* This is a helper type used by the {@link Equals} type.
|
20
|
+
*/
|
21
|
+
type EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;
|
22
|
+
/**
|
23
|
+
* A utility type that checks whether two types are exactly the same.
|
24
|
+
*
|
25
|
+
* This type evaluates to `true` if `TypeA` and `TypeB` are identical,
|
26
|
+
* otherwise it evaluates to `false`.
|
27
|
+
*
|
28
|
+
* @template TypeA - The first type to compare.
|
29
|
+
* @template TypeB - The second type to compare.
|
30
|
+
*
|
31
|
+
* @example
|
32
|
+
* ```ts
|
33
|
+
* // Example usage:
|
34
|
+
* type Test1 = Equals<number, number>; // true
|
35
|
+
* type Test2 = Equals<number, string>; // false
|
36
|
+
* type Test3 = Equals<{ a: string }, { a: string }>; // true
|
37
|
+
* type Test4 = Equals<{ a: string }, { a: number }>; // false
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
export type Equals<TypeA, TypeB> = EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;
|
41
|
+
export {};
|
18
42
|
//# sourceMappingURL=types.d.mts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAI3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,sDAOpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAG9B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAI3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,sDAOpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAG9B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5D;;GAEG;AACH,KAAK,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,IAC7B,YAAY,CAAC,KAAK,CAAC,SAAS,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
|
package/dist/utils/types.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,8BAA8B;AAE3D,OAAO,EAAE,aAAa,EAAE,2BAAuB;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAC7C,cAAc,EACd,gBAAgB,CACjB,CAAC","sourcesContent":["import { define, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\n/**\n * UUIDv4 struct.\n */\nexport const UuidStruct = definePattern(\n 'UuidV4',\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,\n);\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define<string>('Url', (value: unknown) => {\n try {\n const url = new URL(value as string);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n});\n\n/**\n * A string which contains a positive float number.\n */\nexport const StringNumberStruct = definePattern(\n 'StringNumber',\n /^\\d+(\\.\\d+)?$/u,\n);\nexport type StringNumber = Infer<typeof StringNumberStruct>;\n"]}
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,8BAA8B;AAE3D,OAAO,EAAE,aAAa,EAAE,2BAAuB;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAC7C,cAAc,EACd,gBAAgB,CACjB,CAAC","sourcesContent":["import { define, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\n/**\n * UUIDv4 struct.\n */\nexport const UuidStruct = definePattern(\n 'UuidV4',\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,\n);\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define<string>('Url', (value: unknown) => {\n try {\n const url = new URL(value as string);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n});\n\n/**\n * A string which contains a positive float number.\n */\nexport const StringNumberStruct = definePattern(\n 'StringNumber',\n /^\\d+(\\.\\d+)?$/u,\n);\nexport type StringNumber = Infer<typeof StringNumberStruct>;\n\n/**\n * This is a helper type used by the {@link Equals} type.\n */\ntype EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;\n\n/**\n * A utility type that checks whether two types are exactly the same.\n *\n * This type evaluates to `true` if `TypeA` and `TypeB` are identical,\n * otherwise it evaluates to `false`.\n *\n * @template TypeA - The first type to compare.\n * @template TypeB - The second type to compare.\n *\n * @example\n * ```ts\n * // Example usage:\n * type Test1 = Equals<number, number>; // true\n * type Test2 = Equals<number, string>; // false\n * type Test3 = Equals<{ a: string }, { a: string }>; // true\n * type Test4 = Equals<{ a: string }, { a: number }>; // false\n * ```\n */\nexport type Equals<TypeA, TypeB> =\n EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@metamask/keyring-api",
|
3
|
-
"version": "11.
|
3
|
+
"version": "11.1.0",
|
4
4
|
"description": "MetaMask Keyring API",
|
5
5
|
"keywords": [
|
6
6
|
"metamask",
|
@@ -48,7 +48,7 @@
|
|
48
48
|
"dependencies": {
|
49
49
|
"@metamask/snaps-sdk": "^6.7.0",
|
50
50
|
"@metamask/superstruct": "^3.1.0",
|
51
|
-
"@metamask/utils": "^9.
|
51
|
+
"@metamask/utils": "^9.3.0",
|
52
52
|
"@types/uuid": "^9.0.8",
|
53
53
|
"bech32": "^2.0.0",
|
54
54
|
"uuid": "^9.0.1",
|