@metamask-previews/keyring-api 9.0.0-f9cd26b → 11.0.0-11541a9
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 +24 -1
- package/dist/{api/account.js → account.cjs} +4 -5
- package/dist/account.cjs.map +1 -0
- package/dist/{api/account.d.ts → account.d.cts} +3 -2
- package/dist/account.d.cts.map +1 -0
- package/dist/account.d.mts +70 -0
- package/dist/account.d.mts.map +1 -0
- package/dist/account.mjs +60 -0
- package/dist/account.mjs.map +1 -0
- package/dist/balance.cjs +10 -0
- package/dist/balance.cjs.map +1 -0
- package/dist/{api/balance.d.ts → balance.d.cts} +2 -1
- package/dist/balance.d.cts.map +1 -0
- package/dist/balance.d.mts +10 -0
- package/dist/balance.d.mts.map +1 -0
- package/dist/balance.mjs +7 -0
- package/dist/balance.mjs.map +1 -0
- package/dist/{api/caip.js → caip.cjs} +7 -7
- package/dist/caip.cjs.map +1 -0
- package/dist/{api/caip.d.ts → caip.d.cts} +2 -1
- package/dist/caip.d.cts.map +1 -0
- package/dist/caip.d.mts +38 -0
- package/dist/caip.d.mts.map +1 -0
- package/dist/caip.mjs +43 -0
- package/dist/caip.mjs.map +1 -0
- package/dist/{api/keyring.js → contexts.cjs} +1 -1
- package/dist/contexts.cjs.map +1 -0
- package/dist/{contexts.d.ts → contexts.d.cts} +1 -0
- package/dist/contexts.d.cts.map +1 -0
- package/dist/contexts.d.mts +8 -0
- package/dist/contexts.d.mts.map +1 -0
- package/dist/contexts.mjs +2 -0
- package/dist/contexts.mjs.map +1 -0
- package/dist/{api/export.js → export.cjs} +1 -1
- package/dist/export.cjs.map +1 -0
- package/dist/{api/export.d.ts → export.d.cts} +2 -1
- package/dist/export.d.cts.map +1 -0
- package/dist/export.d.mts +9 -0
- package/dist/export.d.mts.map +1 -0
- package/dist/export.mjs +4 -0
- package/dist/export.mjs.map +1 -0
- package/dist/{btc/index.js → index.cjs} +7 -2
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/keyring.cjs +5 -0
- package/dist/keyring.cjs.map +1 -0
- package/dist/{api/keyring.d.ts → keyring.d.cts} +8 -7
- package/dist/keyring.d.cts.map +1 -0
- package/dist/keyring.d.mts +160 -0
- package/dist/keyring.d.mts.map +1 -0
- package/dist/keyring.mjs +4 -0
- package/dist/keyring.mjs.map +1 -0
- package/dist/{api/request.js → request.cjs} +7 -8
- package/dist/request.cjs.map +1 -0
- package/dist/{api/request.d.ts → request.d.cts} +5 -4
- package/dist/request.d.cts.map +1 -0
- package/dist/request.d.mts +40 -0
- package/dist/request.d.mts.map +1 -0
- package/dist/request.mjs +25 -0
- package/dist/request.mjs.map +1 -0
- package/dist/{api/response.js → response.cjs} +7 -7
- package/dist/response.cjs.map +1 -0
- package/dist/{api/response.d.ts → response.d.cts} +2 -1
- package/dist/response.d.cts.map +1 -0
- package/dist/response.d.mts +25 -0
- package/dist/response.d.mts.map +1 -0
- package/dist/response.mjs +41 -0
- package/dist/response.mjs.map +1 -0
- package/package.json +27 -17
- package/dist/JsonRpcRequest.d.ts +0 -16
- package/dist/JsonRpcRequest.js +0 -13
- package/dist/JsonRpcRequest.js.map +0 -1
- package/dist/KeyringClient.d.ts +0 -28
- package/dist/KeyringClient.js +0 -124
- package/dist/KeyringClient.js.map +0 -1
- package/dist/KeyringSnapRpcClient.d.ts +0 -39
- package/dist/KeyringSnapRpcClient.js +0 -68
- package/dist/KeyringSnapRpcClient.js.map +0 -1
- package/dist/api/account.js.map +0 -1
- package/dist/api/balance.js +0 -11
- package/dist/api/balance.js.map +0 -1
- package/dist/api/caip.js.map +0 -1
- package/dist/api/export.js.map +0 -1
- package/dist/api/index.d.ts +0 -7
- package/dist/api/index.js +0 -23
- package/dist/api/index.js.map +0 -1
- package/dist/api/keyring.js.map +0 -1
- package/dist/api/request.js.map +0 -1
- package/dist/api/response.js.map +0 -1
- package/dist/btc/index.d.ts +0 -1
- package/dist/btc/index.js.map +0 -1
- package/dist/btc/types.d.ts +0 -33
- package/dist/btc/types.js +0 -40
- package/dist/btc/types.js.map +0 -1
- package/dist/contexts.js +0 -3
- package/dist/contexts.js.map +0 -1
- package/dist/eth/erc4337/index.d.ts +0 -1
- package/dist/eth/erc4337/index.js +0 -18
- package/dist/eth/erc4337/index.js.map +0 -1
- package/dist/eth/erc4337/types.d.ts +0 -97
- package/dist/eth/erc4337/types.js +0 -62
- package/dist/eth/erc4337/types.js.map +0 -1
- package/dist/eth/index.d.ts +0 -3
- package/dist/eth/index.js +0 -20
- package/dist/eth/index.js.map +0 -1
- package/dist/eth/types.d.ts +0 -80
- package/dist/eth/types.js +0 -73
- package/dist/eth/types.js.map +0 -1
- package/dist/eth/utils.d.ts +0 -8
- package/dist/eth/utils.js +0 -15
- package/dist/eth/utils.js.map +0 -1
- package/dist/events.d.ts +0 -10
- package/dist/events.js +0 -17
- package/dist/events.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/internal/api.d.ts +0 -419
- package/dist/internal/api.js +0 -139
- package/dist/internal/api.js.map +0 -1
- package/dist/internal/eth/EthKeyring.d.ts +0 -33
- package/dist/internal/eth/EthKeyring.js +0 -3
- package/dist/internal/eth/EthKeyring.js.map +0 -1
- package/dist/internal/eth/index.d.ts +0 -1
- package/dist/internal/eth/index.js +0 -3
- package/dist/internal/eth/index.js.map +0 -1
- package/dist/internal/events.d.ts +0 -161
- package/dist/internal/events.js +0 -72
- package/dist/internal/events.js.map +0 -1
- package/dist/internal/index.d.ts +0 -5
- package/dist/internal/index.js +0 -21
- package/dist/internal/index.js.map +0 -1
- package/dist/internal/rpc.d.ts +0 -25
- package/dist/internal/rpc.js +0 -33
- package/dist/internal/rpc.js.map +0 -1
- package/dist/internal/types.d.ts +0 -391
- package/dist/internal/types.js +0 -52
- package/dist/internal/types.js.map +0 -1
- package/dist/rpc-handler.d.ts +0 -29
- package/dist/rpc-handler.js +0 -136
- package/dist/rpc-handler.js.map +0 -1
- package/dist/snap-utils.d.ts +0 -11
- package/dist/snap-utils.js +0 -21
- package/dist/snap-utils.js.map +0 -1
- package/dist/sol/index.d.ts +0 -1
- package/dist/sol/index.js +0 -18
- package/dist/sol/index.js.map +0 -1
- package/dist/sol/types.d.ts +0 -38
- package/dist/sol/types.js +0 -36
- package/dist/sol/types.js.map +0 -1
- package/dist/superstruct.d.ts +0 -83
- package/dist/superstruct.js +0 -81
- package/dist/superstruct.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -19
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/types.d.ts +0 -17
- package/dist/utils/types.js +0 -29
- package/dist/utils/types.js.map +0 -1
- package/dist/utils/typing.d.ts +0 -32
- package/dist/utils/typing.js +0 -21
- package/dist/utils/typing.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [11.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** Add ESM build ([#40](https://github.com/MetaMask/accounts/pull/40))
|
|
15
|
+
- It's no longer possible to import files from `./dist` directly.
|
|
16
|
+
|
|
17
|
+
## [10.1.0]
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Add `solana:data-account` account support ([#93](https://github.com/MetaMask/accounts/pull/93))
|
|
22
|
+
|
|
23
|
+
## [10.0.0]
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Add proprietary license ([#83](https://github.com/MetaMask/accounts/pull/83))
|
|
28
|
+
- **BREAKING:** Bump peer dependency `@metamask/providers` from `^17.2.0` to `^18.1.0` ([#76](https://github.com/MetaMask/accounts/pull/76))
|
|
29
|
+
|
|
10
30
|
## [9.0.0]
|
|
11
31
|
|
|
12
32
|
### Changed
|
|
@@ -418,7 +438,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
418
438
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
|
419
439
|
- Helper functions to create keyring handler in the snap.
|
|
420
440
|
|
|
421
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@
|
|
441
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@11.0.0...HEAD
|
|
442
|
+
[11.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@10.1.0...@metamask/keyring-api@11.0.0
|
|
443
|
+
[10.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@10.0.0...@metamask/keyring-api@10.1.0
|
|
444
|
+
[10.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@9.0.0...@metamask/keyring-api@10.0.0
|
|
422
445
|
[9.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.3...@metamask/keyring-api@9.0.0
|
|
423
446
|
[8.1.3]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.2...@metamask/keyring-api@8.1.3
|
|
424
447
|
[8.1.2]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.1...@metamask/keyring-api@8.1.2
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KeyringAccountStruct = exports.SolAccountType = exports.BtcAccountType = exports.EthAccountType = void 0;
|
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
4
5
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
6
|
const utils_1 = require("@metamask/utils");
|
|
6
|
-
const superstruct_2 = require("../superstruct");
|
|
7
|
-
const utils_2 = require("../utils");
|
|
8
7
|
/**
|
|
9
8
|
* Supported Ethereum account types.
|
|
10
9
|
*/
|
|
@@ -34,11 +33,11 @@ var SolAccountType;
|
|
|
34
33
|
*
|
|
35
34
|
* See {@link KeyringAccount}.
|
|
36
35
|
*/
|
|
37
|
-
exports.KeyringAccountStruct = (0,
|
|
36
|
+
exports.KeyringAccountStruct = (0, keyring_utils_1.object)({
|
|
38
37
|
/**
|
|
39
38
|
* Account ID (UUIDv4).
|
|
40
39
|
*/
|
|
41
|
-
id:
|
|
40
|
+
id: keyring_utils_1.UuidStruct,
|
|
42
41
|
/**
|
|
43
42
|
* Account type.
|
|
44
43
|
*/
|
|
@@ -61,4 +60,4 @@ exports.KeyringAccountStruct = (0, superstruct_2.object)({
|
|
|
61
60
|
*/
|
|
62
61
|
methods: (0, superstruct_1.array)((0, superstruct_1.string)()),
|
|
63
62
|
});
|
|
64
|
-
//# sourceMappingURL=account.
|
|
63
|
+
//# sourceMappingURL=account.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.cjs","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAE7D,uDAAqE;AACrE,2CAA6C;AAE7C;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,0CAAwB,CAAA;AAC1B,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAWD;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,0BAAU;IAEd;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC;QACV,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;QAC3B,GAAG,cAAc,CAAC,MAAM,EAAE;QAC1B,GAAG,cAAc,CAAC,WAAW,EAAE;KAChC,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,GAAE;IAEjB;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\n/**\n * Supported Ethereum account types.\n */\nexport enum EthAccountType {\n Eoa = 'eip155:eoa',\n Erc4337 = 'eip155:erc4337',\n}\n\n/**\n * Supported Bitcoin account types.\n */\nexport enum BtcAccountType {\n P2wpkh = 'bip122:p2wpkh',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2wpkh}`\n | `${SolAccountType.DataAccount}`;\n\n/**\n * A struct which represents a Keyring account object. It is abstract enough to\n * be used with any blockchain. Specific blockchain account types should extend\n * this struct.\n *\n * See {@link KeyringAccount}.\n */\nexport const KeyringAccountStruct = object({\n /**\n * Account ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2wpkh}`,\n `${SolAccountType.DataAccount}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account options.\n */\n options: record(string(), JsonStruct),\n\n /**\n * Account supported methods.\n */\n methods: array(string()),\n});\n\n/**\n * Keyring Account type represents an account and its properties from the\n * point of view of the keyring.\n */\nexport type KeyringAccount = Infer<typeof KeyringAccountStruct>;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Infer } from
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
/**
|
|
3
3
|
* Supported Ethereum account types.
|
|
4
4
|
*/
|
|
@@ -30,8 +30,8 @@ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc
|
|
|
30
30
|
* See {@link KeyringAccount}.
|
|
31
31
|
*/
|
|
32
32
|
export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
|
|
33
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
34
33
|
id: string;
|
|
34
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
35
35
|
address: string;
|
|
36
36
|
options: Record<string, import("@metamask/utils").Json>;
|
|
37
37
|
methods: string[];
|
|
@@ -67,3 +67,4 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
|
67
67
|
* point of view of the keyring.
|
|
68
68
|
*/
|
|
69
69
|
export type KeyringAccount = Infer<typeof KeyringAccountStruct>;
|
|
70
|
+
//# sourceMappingURL=account.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,MAAM,kBAAkB;CACzB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;IAQH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Supported Ethereum account types.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum EthAccountType {
|
|
6
|
+
Eoa = "eip155:eoa",
|
|
7
|
+
Erc4337 = "eip155:erc4337"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Supported Bitcoin account types.
|
|
11
|
+
*/
|
|
12
|
+
export declare enum BtcAccountType {
|
|
13
|
+
P2wpkh = "bip122:p2wpkh"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Supported Solana account types.
|
|
17
|
+
*/
|
|
18
|
+
export declare enum SolAccountType {
|
|
19
|
+
DataAccount = "solana:data-account"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Supported account types.
|
|
23
|
+
*/
|
|
24
|
+
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2wpkh}` | `${SolAccountType.DataAccount}`;
|
|
25
|
+
/**
|
|
26
|
+
* A struct which represents a Keyring account object. It is abstract enough to
|
|
27
|
+
* be used with any blockchain. Specific blockchain account types should extend
|
|
28
|
+
* this struct.
|
|
29
|
+
*
|
|
30
|
+
* See {@link KeyringAccount}.
|
|
31
|
+
*/
|
|
32
|
+
export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
|
|
33
|
+
id: string;
|
|
34
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
35
|
+
address: string;
|
|
36
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
37
|
+
methods: string[];
|
|
38
|
+
}, {
|
|
39
|
+
/**
|
|
40
|
+
* Account ID (UUIDv4).
|
|
41
|
+
*/
|
|
42
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
43
|
+
/**
|
|
44
|
+
* Account type.
|
|
45
|
+
*/
|
|
46
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
|
47
|
+
"eip155:eoa": "eip155:eoa";
|
|
48
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
49
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
50
|
+
"solana:data-account": "solana:data-account";
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Account main address.
|
|
54
|
+
*/
|
|
55
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
56
|
+
/**
|
|
57
|
+
* Account options.
|
|
58
|
+
*/
|
|
59
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
60
|
+
/**
|
|
61
|
+
* Account supported methods.
|
|
62
|
+
*/
|
|
63
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Keyring Account type represents an account and its properties from the
|
|
67
|
+
* point of view of the keyring.
|
|
68
|
+
*/
|
|
69
|
+
export type KeyringAccount = Infer<typeof KeyringAccountStruct>;
|
|
70
|
+
//# sourceMappingURL=account.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,MAAM,kBAAkB;CACzB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;IAQH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/account.mjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { object, UuidStruct } from "@metamask/keyring-utils";
|
|
2
|
+
import { array, enums, record, string } from "@metamask/superstruct";
|
|
3
|
+
import { JsonStruct } from "@metamask/utils";
|
|
4
|
+
/**
|
|
5
|
+
* Supported Ethereum account types.
|
|
6
|
+
*/
|
|
7
|
+
export var EthAccountType;
|
|
8
|
+
(function (EthAccountType) {
|
|
9
|
+
EthAccountType["Eoa"] = "eip155:eoa";
|
|
10
|
+
EthAccountType["Erc4337"] = "eip155:erc4337";
|
|
11
|
+
})(EthAccountType || (EthAccountType = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Supported Bitcoin account types.
|
|
14
|
+
*/
|
|
15
|
+
export var BtcAccountType;
|
|
16
|
+
(function (BtcAccountType) {
|
|
17
|
+
BtcAccountType["P2wpkh"] = "bip122:p2wpkh";
|
|
18
|
+
})(BtcAccountType || (BtcAccountType = {}));
|
|
19
|
+
/**
|
|
20
|
+
* Supported Solana account types.
|
|
21
|
+
*/
|
|
22
|
+
export var SolAccountType;
|
|
23
|
+
(function (SolAccountType) {
|
|
24
|
+
SolAccountType["DataAccount"] = "solana:data-account";
|
|
25
|
+
})(SolAccountType || (SolAccountType = {}));
|
|
26
|
+
/**
|
|
27
|
+
* A struct which represents a Keyring account object. It is abstract enough to
|
|
28
|
+
* be used with any blockchain. Specific blockchain account types should extend
|
|
29
|
+
* this struct.
|
|
30
|
+
*
|
|
31
|
+
* See {@link KeyringAccount}.
|
|
32
|
+
*/
|
|
33
|
+
export const KeyringAccountStruct = object({
|
|
34
|
+
/**
|
|
35
|
+
* Account ID (UUIDv4).
|
|
36
|
+
*/
|
|
37
|
+
id: UuidStruct,
|
|
38
|
+
/**
|
|
39
|
+
* Account type.
|
|
40
|
+
*/
|
|
41
|
+
type: enums([
|
|
42
|
+
`${EthAccountType.Eoa}`,
|
|
43
|
+
`${EthAccountType.Erc4337}`,
|
|
44
|
+
`${BtcAccountType.P2wpkh}`,
|
|
45
|
+
`${SolAccountType.DataAccount}`,
|
|
46
|
+
]),
|
|
47
|
+
/**
|
|
48
|
+
* Account main address.
|
|
49
|
+
*/
|
|
50
|
+
address: string(),
|
|
51
|
+
/**
|
|
52
|
+
* Account options.
|
|
53
|
+
*/
|
|
54
|
+
options: record(string(), JsonStruct),
|
|
55
|
+
/**
|
|
56
|
+
* Account supported methods.
|
|
57
|
+
*/
|
|
58
|
+
methods: array(string()),
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=account.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.mjs","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE7D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AACrE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C;;GAEG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,0CAAwB,CAAA;AAC1B,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AAWD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,EAAE,EAAE,UAAU;IAEd;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;QACV,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;QAC3B,GAAG,cAAc,CAAC,MAAM,EAAE;QAC1B,GAAG,cAAc,CAAC,WAAW,EAAE;KAChC,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\n/**\n * Supported Ethereum account types.\n */\nexport enum EthAccountType {\n Eoa = 'eip155:eoa',\n Erc4337 = 'eip155:erc4337',\n}\n\n/**\n * Supported Bitcoin account types.\n */\nexport enum BtcAccountType {\n P2wpkh = 'bip122:p2wpkh',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2wpkh}`\n | `${SolAccountType.DataAccount}`;\n\n/**\n * A struct which represents a Keyring account object. It is abstract enough to\n * be used with any blockchain. Specific blockchain account types should extend\n * this struct.\n *\n * See {@link KeyringAccount}.\n */\nexport const KeyringAccountStruct = object({\n /**\n * Account ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2wpkh}`,\n `${SolAccountType.DataAccount}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account options.\n */\n options: record(string(), JsonStruct),\n\n /**\n * Account supported methods.\n */\n methods: array(string()),\n});\n\n/**\n * Keyring Account type represents an account and its properties from the\n * point of view of the keyring.\n */\nexport type KeyringAccount = Infer<typeof KeyringAccountStruct>;\n"]}
|
package/dist/balance.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BalanceStruct = void 0;
|
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
5
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
6
|
+
exports.BalanceStruct = (0, keyring_utils_1.object)({
|
|
7
|
+
amount: keyring_utils_1.StringNumberStruct,
|
|
8
|
+
unit: (0, superstruct_1.string)(),
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=balance.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.cjs","sourceRoot":"","sources":["../src/balance.ts"],"names":[],"mappings":";;;AAAA,2DAAqE;AAErE,uDAA+C;AAElC,QAAA,aAAa,GAAG,IAAA,sBAAM,EAAC;IAClC,MAAM,EAAE,kCAAkB;IAC1B,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CAAC","sourcesContent":["import { object, StringNumberStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { string } from '@metamask/superstruct';\n\nexport const BalanceStruct = object({\n amount: StringNumberStruct,\n unit: string(),\n});\n\nexport type Balance = Infer<typeof BalanceStruct>;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Infer } from
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
export declare const BalanceStruct: import("@metamask/superstruct").Struct<{
|
|
3
3
|
amount: string;
|
|
4
4
|
unit: string;
|
|
@@ -7,3 +7,4 @@ export declare const BalanceStruct: import("@metamask/superstruct").Struct<{
|
|
|
7
7
|
unit: import("@metamask/superstruct").Struct<string, null>;
|
|
8
8
|
}>;
|
|
9
9
|
export type Balance = Infer<typeof BalanceStruct>;
|
|
10
|
+
//# sourceMappingURL=balance.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.d.cts","sourceRoot":"","sources":["../src/balance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,eAAO,MAAM,aAAa;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
export declare const BalanceStruct: import("@metamask/superstruct").Struct<{
|
|
3
|
+
amount: string;
|
|
4
|
+
unit: string;
|
|
5
|
+
}, {
|
|
6
|
+
amount: import("@metamask/superstruct").Struct<string, null>;
|
|
7
|
+
unit: import("@metamask/superstruct").Struct<string, null>;
|
|
8
|
+
}>;
|
|
9
|
+
export type Balance = Infer<typeof BalanceStruct>;
|
|
10
|
+
//# sourceMappingURL=balance.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.d.mts","sourceRoot":"","sources":["../src/balance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,eAAO,MAAM,aAAa;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/dist/balance.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.mjs","sourceRoot":"","sources":["../src/balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,gCAAgC;AAErE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,MAAM,EAAE;CACf,CAAC,CAAC","sourcesContent":["import { object, StringNumberStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { string } from '@metamask/superstruct';\n\nexport const BalanceStruct = object({\n amount: StringNumberStruct,\n unit: string(),\n});\n\nexport type Balance = Infer<typeof BalanceStruct>;\n"]}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CaipAssetIdStruct = exports.CaipAssetTypeStruct = void 0;
|
|
4
|
+
exports.isCaipAssetType = isCaipAssetType;
|
|
5
|
+
exports.isCaipAssetId = isCaipAssetId;
|
|
6
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
4
7
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
-
const superstruct_2 = require("../superstruct");
|
|
6
8
|
const CAIP_ASSET_TYPE_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;
|
|
7
9
|
const CAIP_ASSET_ID_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;
|
|
8
10
|
/**
|
|
9
11
|
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
|
10
12
|
*/
|
|
11
|
-
exports.CaipAssetTypeStruct = (0,
|
|
13
|
+
exports.CaipAssetTypeStruct = (0, keyring_utils_1.definePattern)('CaipAssetType', CAIP_ASSET_TYPE_REGEX);
|
|
12
14
|
/**
|
|
13
15
|
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
|
14
16
|
*/
|
|
15
|
-
exports.CaipAssetIdStruct = (0,
|
|
17
|
+
exports.CaipAssetIdStruct = (0, keyring_utils_1.definePattern)('CaipAssetId', CAIP_ASSET_ID_REGEX);
|
|
16
18
|
/**
|
|
17
19
|
* Check if the given value is a {@link CaipAssetType}.
|
|
18
20
|
*
|
|
@@ -28,7 +30,6 @@ exports.CaipAssetIdStruct = (0, superstruct_2.definePattern)('CaipAssetId', CAIP
|
|
|
28
30
|
function isCaipAssetType(value) {
|
|
29
31
|
return (0, superstruct_1.is)(value, exports.CaipAssetTypeStruct);
|
|
30
32
|
}
|
|
31
|
-
exports.isCaipAssetType = isCaipAssetType;
|
|
32
33
|
/**
|
|
33
34
|
* Check if the given value is a {@link CaipAssetId}.
|
|
34
35
|
*
|
|
@@ -44,5 +45,4 @@ exports.isCaipAssetType = isCaipAssetType;
|
|
|
44
45
|
function isCaipAssetId(value) {
|
|
45
46
|
return (0, superstruct_1.is)(value, exports.CaipAssetIdStruct);
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=caip.js.map
|
|
48
|
+
//# sourceMappingURL=caip.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caip.cjs","sourceRoot":"","sources":["../src/caip.ts"],"names":[],"mappings":";;;AAuCA,0CAEC;AAcD,sCAEC;AAzDD,2DAAwD;AACxD,uDAAuD;AAEvD,MAAM,qBAAqB,GACzB,2JAA2J,CAAC;AAE9J,MAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAEhM;;GAEG;AACU,QAAA,mBAAmB,GAAG,IAAA,6BAAa,EAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAGF;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,6BAAa,EAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAGF;;;;;;;;;;;GAWG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,2BAAmB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,yBAAiB,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { definePattern } from '@metamask/keyring-utils';\nimport { is, type Infer } from '@metamask/superstruct';\n\nconst CAIP_ASSET_TYPE_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;\n\nconst CAIP_ASSET_ID_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;\n\n/**\n * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeStruct = definePattern(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type CaipAssetId = Infer<typeof CaipAssetIdStruct>;\n\n/**\n * Check if the given value is a {@link CaipAssetType}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetType}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // true\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false\n * ```\n */\nexport function isCaipAssetType(value: unknown): value is CaipAssetType {\n return is(value, CaipAssetTypeStruct);\n}\n\n/**\n * Check if the given value is a {@link CaipAssetId}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetId}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // false\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true\n * ```\n */\nexport function isCaipAssetId(value: unknown): value is CaipAssetId {\n return is(value, CaipAssetIdStruct);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Infer } from
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
2
|
/**
|
|
3
3
|
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
|
4
4
|
*/
|
|
@@ -35,3 +35,4 @@ export declare function isCaipAssetType(value: unknown): value is CaipAssetType;
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export declare function isCaipAssetId(value: unknown): value is CaipAssetId;
|
|
38
|
+
//# sourceMappingURL=caip.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caip.d.cts","sourceRoot":"","sources":["../src/caip.ts"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,KAAK,EAAE,8BAA8B;AAQvD;;GAEG;AACH,eAAO,MAAM,mBAAmB,sDAG/B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAG7B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
|
package/dist/caip.d.mts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CaipAssetTypeStruct: import("@metamask/superstruct").Struct<string, null>;
|
|
6
|
+
export type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;
|
|
7
|
+
/**
|
|
8
|
+
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CaipAssetIdStruct: import("@metamask/superstruct").Struct<string, null>;
|
|
11
|
+
export type CaipAssetId = Infer<typeof CaipAssetIdStruct>;
|
|
12
|
+
/**
|
|
13
|
+
* Check if the given value is a {@link CaipAssetType}.
|
|
14
|
+
*
|
|
15
|
+
* @param value - The value to check.
|
|
16
|
+
* @returns Whether the value is a {@link CaipAssetType}.
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* isCaipAssetType('eip155:1/slip44:60'); // true
|
|
20
|
+
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true
|
|
21
|
+
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function isCaipAssetType(value: unknown): value is CaipAssetType;
|
|
25
|
+
/**
|
|
26
|
+
* Check if the given value is a {@link CaipAssetId}.
|
|
27
|
+
*
|
|
28
|
+
* @param value - The value to check.
|
|
29
|
+
* @returns Whether the value is a {@link CaipAssetId}.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* isCaipAssetType('eip155:1/slip44:60'); // false
|
|
33
|
+
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false
|
|
34
|
+
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function isCaipAssetId(value: unknown): value is CaipAssetId;
|
|
38
|
+
//# sourceMappingURL=caip.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../src/caip.ts"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,KAAK,EAAE,8BAA8B;AAQvD;;GAEG;AACH,eAAO,MAAM,mBAAmB,sDAG/B,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAG7B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE"}
|
package/dist/caip.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { definePattern } from "@metamask/keyring-utils";
|
|
2
|
+
import { is } from "@metamask/superstruct";
|
|
3
|
+
const CAIP_ASSET_TYPE_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;
|
|
4
|
+
const CAIP_ASSET_ID_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;
|
|
5
|
+
/**
|
|
6
|
+
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
|
7
|
+
*/
|
|
8
|
+
export const CaipAssetTypeStruct = definePattern('CaipAssetType', CAIP_ASSET_TYPE_REGEX);
|
|
9
|
+
/**
|
|
10
|
+
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
|
11
|
+
*/
|
|
12
|
+
export const CaipAssetIdStruct = definePattern('CaipAssetId', CAIP_ASSET_ID_REGEX);
|
|
13
|
+
/**
|
|
14
|
+
* Check if the given value is a {@link CaipAssetType}.
|
|
15
|
+
*
|
|
16
|
+
* @param value - The value to check.
|
|
17
|
+
* @returns Whether the value is a {@link CaipAssetType}.
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* isCaipAssetType('eip155:1/slip44:60'); // true
|
|
21
|
+
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true
|
|
22
|
+
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function isCaipAssetType(value) {
|
|
26
|
+
return is(value, CaipAssetTypeStruct);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if the given value is a {@link CaipAssetId}.
|
|
30
|
+
*
|
|
31
|
+
* @param value - The value to check.
|
|
32
|
+
* @returns Whether the value is a {@link CaipAssetId}.
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* isCaipAssetType('eip155:1/slip44:60'); // false
|
|
36
|
+
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false
|
|
37
|
+
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export function isCaipAssetId(value) {
|
|
41
|
+
return is(value, CaipAssetIdStruct);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=caip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caip.mjs","sourceRoot":"","sources":["../src/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gCAAgC;AACxD,OAAO,EAAE,EAAE,EAAc,8BAA8B;AAEvD,MAAM,qBAAqB,GACzB,2JAA2J,CAAC;AAE9J,MAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAEhM;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAGF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAGF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { definePattern } from '@metamask/keyring-utils';\nimport { is, type Infer } from '@metamask/superstruct';\n\nconst CAIP_ASSET_TYPE_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;\n\nconst CAIP_ASSET_ID_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;\n\n/**\n * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeStruct = definePattern(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type CaipAssetId = Infer<typeof CaipAssetIdStruct>;\n\n/**\n * Check if the given value is a {@link CaipAssetType}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetType}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // true\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false\n * ```\n */\nexport function isCaipAssetType(value: unknown): value is CaipAssetType {\n return is(value, CaipAssetTypeStruct);\n}\n\n/**\n * Check if the given value is a {@link CaipAssetId}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetId}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // false\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true\n * ```\n */\nexport function isCaipAssetId(value: unknown): value is CaipAssetId {\n return is(value, CaipAssetIdStruct);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.cjs","sourceRoot":"","sources":["../src/contexts.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Context used by a Keyring implementation.\n */\nexport type KeyringExecutionContext = {\n /** The chain ID. */\n chainId: string;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.d.cts","sourceRoot":"","sources":["../src/contexts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.d.mts","sourceRoot":"","sources":["../src/contexts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.mjs","sourceRoot":"","sources":["../src/contexts.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Context used by a Keyring implementation.\n */\nexport type KeyringExecutionContext = {\n /** The chain ID. */\n chainId: string;\n};\n"]}
|
|
@@ -4,4 +4,4 @@ exports.KeyringAccountDataStruct = void 0;
|
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
5
|
const utils_1 = require("@metamask/utils");
|
|
6
6
|
exports.KeyringAccountDataStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct);
|
|
7
|
-
//# sourceMappingURL=export.
|
|
7
|
+
//# sourceMappingURL=export.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.cjs","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AACvD,2CAA6C;AAEhC,QAAA,wBAAwB,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringAccountDataStruct = record(string(), JsonStruct);\n\n/**\n * Response to a call to `exportAccount`.\n *\n * The exact response depends on the keyring implementation.\n */\nexport type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Infer } from
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
export declare const KeyringAccountDataStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
3
3
|
/**
|
|
4
4
|
* Response to a call to `exportAccount`.
|
|
@@ -6,3 +6,4 @@ export declare const KeyringAccountDataStruct: import("@metamask/superstruct").S
|
|
|
6
6
|
* The exact response depends on the keyring implementation.
|
|
7
7
|
*/
|
|
8
8
|
export type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;
|
|
9
|
+
//# sourceMappingURL=export.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.cts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,wBAAwB,8FAA+B,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
export declare const KeyringAccountDataStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
3
|
+
/**
|
|
4
|
+
* Response to a call to `exportAccount`.
|
|
5
|
+
*
|
|
6
|
+
* The exact response depends on the keyring implementation.
|
|
7
|
+
*/
|
|
8
|
+
export type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;
|
|
9
|
+
//# sourceMappingURL=export.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.mts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,wBAAwB,8FAA+B,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
package/dist/export.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.mjs","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AACvD,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringAccountDataStruct = record(string(), JsonStruct);\n\n/**\n * Response to a call to `exportAccount`.\n *\n * The exact response depends on the keyring implementation.\n */\nexport type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;\n"]}
|
|
@@ -14,5 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
|
|
17
|
+
__exportStar(require("./account.cjs"), exports);
|
|
18
|
+
__exportStar(require("./balance.cjs"), exports);
|
|
19
|
+
__exportStar(require("./caip.cjs"), exports);
|
|
20
|
+
__exportStar(require("./export.cjs"), exports);
|
|
21
|
+
__exportStar(require("./request.cjs"), exports);
|
|
22
|
+
__exportStar(require("./response.cjs"), exports);
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,gDAA0B;AAC1B,6CAAuB;AACvB,+CAAyB;AAEzB,gDAA0B;AAC1B,iDAA2B","sourcesContent":["export * from './account';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport type * from './keyring';\nexport * from './request';\nexport * from './response';\nexport type * from './contexts';\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./account.cjs";
|
|
2
|
+
export * from "./balance.cjs";
|
|
3
|
+
export * from "./caip.cjs";
|
|
4
|
+
export * from "./export.cjs";
|
|
5
|
+
export type * from "./keyring.cjs";
|
|
6
|
+
export * from "./request.cjs";
|
|
7
|
+
export * from "./response.cjs";
|
|
8
|
+
export type * from "./contexts.cjs";
|
|
9
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,mCAA+B;AAC/B,8BAA0B;AAC1B,+BAA2B;AAC3B,oCAAgC"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./account.mjs";
|
|
2
|
+
export * from "./balance.mjs";
|
|
3
|
+
export * from "./caip.mjs";
|
|
4
|
+
export * from "./export.mjs";
|
|
5
|
+
export type * from "./keyring.mjs";
|
|
6
|
+
export * from "./request.mjs";
|
|
7
|
+
export * from "./response.mjs";
|
|
8
|
+
export type * from "./contexts.mjs";
|
|
9
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,mCAA+B;AAC/B,8BAA0B;AAC1B,+BAA2B;AAC3B,oCAAgC"}
|