@metamask/keyring-api 12.0.0 → 14.0.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 +24 -1
- package/dist/api/account.cjs +4 -0
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +5 -0
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +5 -0
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +6 -2
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/caip.cjs +9 -36
- package/dist/api/caip.cjs.map +1 -1
- package/dist/api/caip.d.cts +11 -28
- package/dist/api/caip.d.cts.map +1 -1
- package/dist/api/caip.d.mts +11 -28
- package/dist/api/caip.d.mts.map +1 -1
- package/dist/api/caip.mjs +6 -31
- package/dist/api/caip.mjs.map +1 -1
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +11 -1
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +11 -1
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/btc/constants.cjs +17 -0
- package/dist/btc/constants.cjs.map +1 -0
- package/dist/btc/constants.d.cts +12 -0
- package/dist/btc/constants.d.cts.map +1 -0
- package/dist/btc/constants.d.mts +12 -0
- package/dist/btc/constants.d.mts.map +1 -0
- package/dist/btc/constants.mjs +14 -0
- package/dist/btc/constants.mjs.map +1 -0
- package/dist/btc/index.cjs +1 -0
- package/dist/btc/index.cjs.map +1 -1
- package/dist/btc/index.d.cts +1 -0
- package/dist/btc/index.d.cts.map +1 -1
- package/dist/btc/index.d.mts +1 -0
- package/dist/btc/index.d.mts.map +1 -1
- package/dist/btc/index.mjs +1 -0
- package/dist/btc/index.mjs.map +1 -1
- package/dist/btc/types.d.cts +2 -0
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +2 -0
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/eth/constants.cjs +13 -0
- package/dist/eth/constants.cjs.map +1 -0
- package/dist/eth/constants.d.cts +8 -0
- package/dist/eth/constants.d.cts.map +1 -0
- package/dist/eth/constants.d.mts +8 -0
- package/dist/eth/constants.d.mts.map +1 -0
- package/dist/eth/constants.mjs +10 -0
- package/dist/eth/constants.mjs.map +1 -0
- package/dist/eth/index.cjs +1 -0
- package/dist/eth/index.cjs.map +1 -1
- package/dist/eth/index.d.cts +1 -0
- package/dist/eth/index.d.cts.map +1 -1
- package/dist/eth/index.d.mts +1 -0
- package/dist/eth/index.d.mts.map +1 -1
- package/dist/eth/index.mjs +1 -0
- package/dist/eth/index.mjs.map +1 -1
- package/dist/eth/types.cjs +5 -0
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +8 -0
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +8 -0
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +6 -1
- package/dist/eth/types.mjs.map +1 -1
- package/dist/events.d.cts +8 -0
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +8 -0
- package/dist/events.d.mts.map +1 -1
- package/dist/rpc.cjs +12 -1
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +36 -4
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +36 -4
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs +12 -1
- package/dist/rpc.mjs.map +1 -1
- package/dist/sol/constants.cjs +15 -0
- package/dist/sol/constants.cjs.map +1 -0
- package/dist/sol/constants.d.cts +10 -0
- package/dist/sol/constants.d.cts.map +1 -0
- package/dist/sol/constants.d.mts +10 -0
- package/dist/sol/constants.d.mts.map +1 -0
- package/dist/sol/constants.mjs +12 -0
- package/dist/sol/constants.mjs.map +1 -0
- package/dist/sol/index.cjs +1 -0
- package/dist/sol/index.cjs.map +1 -1
- package/dist/sol/index.d.cts +1 -0
- package/dist/sol/index.d.cts.map +1 -1
- package/dist/sol/index.d.mts +1 -0
- package/dist/sol/index.d.mts.map +1 -1
- package/dist/sol/index.mjs +1 -0
- package/dist/sol/index.mjs.map +1 -1
- package/dist/sol/types.d.cts +2 -0
- package/dist/sol/types.d.cts.map +1 -1
- package/dist/sol/types.d.mts +2 -0
- package/dist/sol/types.d.mts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [14.0.0]
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Add `listAccountAssets` keyring method ([#148](https://github.com/MetaMask/accounts/pull/148))
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
|
18
|
+
- **BREAKING:** Make `CaipAssetType` type more restritive ([#150](https://github.com/MetaMask/accounts/pull/150))
|
19
|
+
- It used to be a `string` but it has been restricted with a template literal type that matches CAIP-19 asset type.
|
20
|
+
|
21
|
+
## [13.0.0]
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- New scope constant values added for Ethereum, Bitcoin, and Solana ([#101](https://github.com/MetaMask/accounts/pull/101))
|
26
|
+
|
27
|
+
### Changed
|
28
|
+
|
29
|
+
- **BREAKING:** Add `scopes` field to `KeyringAccount` ([#101](https://github.com/MetaMask/accounts/pull/101))
|
30
|
+
|
10
31
|
## [12.0.0]
|
11
32
|
|
12
33
|
### Changed
|
@@ -456,7 +477,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
456
477
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
457
478
|
- Helper functions to create keyring handler in the snap.
|
458
479
|
|
459
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@
|
480
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@14.0.0...HEAD
|
481
|
+
[14.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@13.0.0...@metamask/keyring-api@14.0.0
|
482
|
+
[13.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@12.0.0...@metamask/keyring-api@13.0.0
|
460
483
|
[12.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@11.1.0...@metamask/keyring-api@12.0.0
|
461
484
|
[11.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@11.0.0...@metamask/keyring-api@11.1.0
|
462
485
|
[11.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@10.1.0...@metamask/keyring-api@11.0.0
|
package/dist/api/account.cjs
CHANGED
@@ -51,6 +51,10 @@ exports.KeyringAccountStruct = (0, keyring_utils_1.object)({
|
|
51
51
|
* Account main address.
|
52
52
|
*/
|
53
53
|
address: (0, superstruct_1.string)(),
|
54
|
+
/**
|
55
|
+
* Account supported scopes (CAIP-2 chain IDs).
|
56
|
+
*/
|
57
|
+
scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)((0, superstruct_1.union)([utils_1.CaipNamespaceStruct, utils_1.CaipChainIdStruct]))),
|
54
58
|
/**
|
55
59
|
* Account options.
|
56
60
|
*/
|
package/dist/api/account.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.cjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAE7D,
|
1
|
+
{"version":3,"file":"account.cjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAE7D,uDAO+B;AAC/B,2CAIyB;AAEzB;;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,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,2BAAmB,EAAE,yBAAiB,CAAC,CAAC,CAAC,CAAC;IAExE;;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 {\n nonempty,\n array,\n enums,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport {\n CaipChainIdStruct,\n CaipNamespaceStruct,\n JsonStruct,\n} 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 supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(union([CaipNamespaceStruct, CaipChainIdStruct]))),\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/api/account.d.cts
CHANGED
@@ -34,6 +34,7 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
34
34
|
id: string;
|
35
35
|
options: Record<string, import("@metamask/utils").Json>;
|
36
36
|
address: string;
|
37
|
+
scopes: string[];
|
37
38
|
methods: string[];
|
38
39
|
}, {
|
39
40
|
/**
|
@@ -53,6 +54,10 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
53
54
|
* Account main address.
|
54
55
|
*/
|
55
56
|
address: import("@metamask/superstruct").Struct<string, null>;
|
57
|
+
/**
|
58
|
+
* Account supported scopes (CAIP-2 chain IDs).
|
59
|
+
*/
|
60
|
+
scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
56
61
|
/**
|
57
62
|
* Account options.
|
58
63
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
1
|
+
{"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD;;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;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/api/account.d.mts
CHANGED
@@ -34,6 +34,7 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
34
34
|
id: string;
|
35
35
|
options: Record<string, import("@metamask/utils").Json>;
|
36
36
|
address: string;
|
37
|
+
scopes: string[];
|
37
38
|
methods: string[];
|
38
39
|
}, {
|
39
40
|
/**
|
@@ -53,6 +54,10 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
53
54
|
* Account main address.
|
54
55
|
*/
|
55
56
|
address: import("@metamask/superstruct").Struct<string, null>;
|
57
|
+
/**
|
58
|
+
* Account supported scopes (CAIP-2 chain IDs).
|
59
|
+
*/
|
60
|
+
scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
56
61
|
/**
|
57
62
|
* Account options.
|
58
63
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
1
|
+
{"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD;;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;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/api/account.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { object, UuidStruct } from "@metamask/keyring-utils";
|
2
|
-
import { array, enums, record, string } from "@metamask/superstruct";
|
3
|
-
import { JsonStruct } from "@metamask/utils";
|
2
|
+
import { nonempty, array, enums, record, string, union } from "@metamask/superstruct";
|
3
|
+
import { CaipChainIdStruct, CaipNamespaceStruct, JsonStruct } from "@metamask/utils";
|
4
4
|
/**
|
5
5
|
* Supported Ethereum account types.
|
6
6
|
*/
|
@@ -48,6 +48,10 @@ export const KeyringAccountStruct = object({
|
|
48
48
|
* Account main address.
|
49
49
|
*/
|
50
50
|
address: string(),
|
51
|
+
/**
|
52
|
+
* Account supported scopes (CAIP-2 chain IDs).
|
53
|
+
*/
|
54
|
+
scopes: nonempty(array(union([CaipNamespaceStruct, CaipChainIdStruct]))),
|
51
55
|
/**
|
52
56
|
* Account options.
|
53
57
|
*/
|
package/dist/api/account.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.mjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE7D,OAAO,
|
1
|
+
{"version":3,"file":"account.mjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE7D,OAAO,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAC/B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACX,wBAAwB;AAEzB;;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,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAExE;;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 {\n nonempty,\n array,\n enums,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport {\n CaipChainIdStruct,\n CaipNamespaceStruct,\n JsonStruct,\n} 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 supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(union([CaipNamespaceStruct, CaipChainIdStruct]))),\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/api/caip.cjs
CHANGED
@@ -1,48 +1,21 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.CaipAssetIdStruct = exports.CaipAssetTypeStruct = void 0;
|
4
|
-
exports.isCaipAssetType = isCaipAssetType;
|
5
|
-
exports.isCaipAssetId = isCaipAssetId;
|
3
|
+
exports.CaipAssetTypeOrIdStruct = exports.isCaipAssetId = exports.CaipAssetIdStruct = exports.isCaipAssetType = exports.CaipAssetTypeStruct = void 0;
|
6
4
|
const keyring_utils_1 = require("@metamask/keyring-utils");
|
7
|
-
const
|
8
|
-
|
9
|
-
|
5
|
+
const utils_1 = require("@metamask/utils");
|
6
|
+
Object.defineProperty(exports, "isCaipAssetType", { enumerable: true, get: function () { return utils_1.isCaipAssetType; } });
|
7
|
+
Object.defineProperty(exports, "isCaipAssetId", { enumerable: true, get: function () { return utils_1.isCaipAssetId; } });
|
8
|
+
const CAIP_ASSET_TYPE_OR_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;
|
10
9
|
/**
|
11
10
|
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
12
11
|
*/
|
13
|
-
exports.CaipAssetTypeStruct = (0, keyring_utils_1.definePattern)('CaipAssetType', CAIP_ASSET_TYPE_REGEX);
|
12
|
+
exports.CaipAssetTypeStruct = (0, keyring_utils_1.definePattern)('CaipAssetType', utils_1.CAIP_ASSET_TYPE_REGEX);
|
14
13
|
/**
|
15
14
|
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
16
15
|
*/
|
17
|
-
exports.CaipAssetIdStruct = (0, keyring_utils_1.definePattern)('CaipAssetId', CAIP_ASSET_ID_REGEX);
|
16
|
+
exports.CaipAssetIdStruct = (0, keyring_utils_1.definePattern)('CaipAssetId', utils_1.CAIP_ASSET_ID_REGEX);
|
18
17
|
/**
|
19
|
-
*
|
20
|
-
*
|
21
|
-
* @param value - The value to check.
|
22
|
-
* @returns Whether the value is a {@link CaipAssetType}.
|
23
|
-
* @example
|
24
|
-
* ```ts
|
25
|
-
* isCaipAssetType('eip155:1/slip44:60'); // true
|
26
|
-
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true
|
27
|
-
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false
|
28
|
-
* ```
|
18
|
+
* A CAIP-19 asset type or asset ID identifier, i.e., a human-readable type of asset identifier.
|
29
19
|
*/
|
30
|
-
|
31
|
-
return (0, superstruct_1.is)(value, exports.CaipAssetTypeStruct);
|
32
|
-
}
|
33
|
-
/**
|
34
|
-
* Check if the given value is a {@link CaipAssetId}.
|
35
|
-
*
|
36
|
-
* @param value - The value to check.
|
37
|
-
* @returns Whether the value is a {@link CaipAssetId}.
|
38
|
-
* @example
|
39
|
-
* ```ts
|
40
|
-
* isCaipAssetType('eip155:1/slip44:60'); // false
|
41
|
-
* isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false
|
42
|
-
* isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true
|
43
|
-
* ```
|
44
|
-
*/
|
45
|
-
function isCaipAssetId(value) {
|
46
|
-
return (0, superstruct_1.is)(value, exports.CaipAssetIdStruct);
|
47
|
-
}
|
20
|
+
exports.CaipAssetTypeOrIdStruct = (0, keyring_utils_1.definePattern)('CaipAssetTypeOrId', CAIP_ASSET_TYPE_OR_ID_REGEX);
|
48
21
|
//# sourceMappingURL=caip.cjs.map
|
package/dist/api/caip.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"caip.cjs","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"caip.cjs","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAGxD,2CAKyB;AAahB,gGAfP,uBAAe,OAeO;AAUf,8FAxBP,qBAAa,OAwBO;AArBtB,MAAM,2BAA2B,GAC/B,gMAAgM,CAAC;AAEnM;;GAEG;AACU,QAAA,mBAAmB,GAAG,IAAA,6BAAa,EAC9C,eAAe,EACf,6BAAqB,CACtB,CAAC;AAIF;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,6BAAa,EAC5C,aAAa,EACb,2BAAmB,CACpB,CAAC;AAIF;;GAEG;AACU,QAAA,uBAAuB,GAAG,IAAA,6BAAa,EAElD,mBAAmB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { definePattern } from '@metamask/keyring-utils';\nimport { type Infer } from '@metamask/superstruct';\nimport type { CaipAssetId, CaipAssetType } from '@metamask/utils';\nimport {\n CAIP_ASSET_TYPE_REGEX,\n CAIP_ASSET_ID_REGEX,\n isCaipAssetType,\n isCaipAssetId,\n} from '@metamask/utils';\n\nconst CAIP_ASSET_TYPE_OR_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<CaipAssetType>(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type { CaipAssetType };\nexport { isCaipAssetType };\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern<CaipAssetId>(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type { CaipAssetId };\nexport { isCaipAssetId };\n\n/**\n * A CAIP-19 asset type or asset ID identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeOrIdStruct = definePattern<\n CaipAssetType | CaipAssetId\n>('CaipAssetTypeOrId', CAIP_ASSET_TYPE_OR_ID_REGEX);\nexport type CaipAssetTypeOrId = Infer<typeof CaipAssetTypeOrIdStruct>;\n"]}
|
package/dist/api/caip.d.cts
CHANGED
@@ -1,38 +1,21 @@
|
|
1
1
|
import { type Infer } from "@metamask/superstruct";
|
2
|
+
import type { CaipAssetId, CaipAssetType } from "@metamask/utils";
|
3
|
+
import { isCaipAssetType, isCaipAssetId } from "@metamask/utils";
|
2
4
|
/**
|
3
5
|
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
4
6
|
*/
|
5
|
-
export declare const CaipAssetTypeStruct: import("@metamask/superstruct").Struct
|
6
|
-
export type CaipAssetType
|
7
|
+
export declare const CaipAssetTypeStruct: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}`, null>;
|
8
|
+
export type { CaipAssetType };
|
9
|
+
export { isCaipAssetType };
|
7
10
|
/**
|
8
11
|
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
9
12
|
*/
|
10
|
-
export declare const CaipAssetIdStruct: import("@metamask/superstruct").Struct
|
11
|
-
export type CaipAssetId
|
13
|
+
export declare const CaipAssetIdStruct: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}/${string}`, null>;
|
14
|
+
export type { CaipAssetId };
|
15
|
+
export { isCaipAssetId };
|
12
16
|
/**
|
13
|
-
*
|
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
|
-
* ```
|
17
|
+
* A CAIP-19 asset type or asset ID identifier, i.e., a human-readable type of asset identifier.
|
23
18
|
*/
|
24
|
-
export declare
|
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;
|
19
|
+
export declare const CaipAssetTypeOrIdStruct: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}` | `${string}:${string}/${string}:${string}/${string}`, null>;
|
20
|
+
export type CaipAssetTypeOrId = Infer<typeof CaipAssetTypeOrIdStruct>;
|
38
21
|
//# sourceMappingURL=caip.d.cts.map
|
package/dist/api/caip.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"caip.d.cts","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AACA,OAAO,
|
1
|
+
{"version":3,"file":"caip.d.cts","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,wBAAwB;AAClE,OAAO,EAGL,eAAe,EACf,aAAa,EACd,wBAAwB;AAKzB;;GAEG;AACH,eAAO,MAAM,mBAAmB,yFAG/B,CAAC;AACF,YAAY,EAAE,aAAa,EAAE,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,iBAAiB,mGAG7B,CAAC;AACF,YAAY,EAAE,WAAW,EAAE,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB;;GAEG;AACH,eAAO,MAAM,uBAAuB,+IAEe,CAAC;AACpD,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
package/dist/api/caip.d.mts
CHANGED
@@ -1,38 +1,21 @@
|
|
1
1
|
import { type Infer } from "@metamask/superstruct";
|
2
|
+
import type { CaipAssetId, CaipAssetType } from "@metamask/utils";
|
3
|
+
import { isCaipAssetType, isCaipAssetId } from "@metamask/utils";
|
2
4
|
/**
|
3
5
|
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
4
6
|
*/
|
5
|
-
export declare const CaipAssetTypeStruct: import("@metamask/superstruct").Struct
|
6
|
-
export type CaipAssetType
|
7
|
+
export declare const CaipAssetTypeStruct: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}`, null>;
|
8
|
+
export type { CaipAssetType };
|
9
|
+
export { isCaipAssetType };
|
7
10
|
/**
|
8
11
|
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
9
12
|
*/
|
10
|
-
export declare const CaipAssetIdStruct: import("@metamask/superstruct").Struct
|
11
|
-
export type CaipAssetId
|
13
|
+
export declare const CaipAssetIdStruct: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}/${string}`, null>;
|
14
|
+
export type { CaipAssetId };
|
15
|
+
export { isCaipAssetId };
|
12
16
|
/**
|
13
|
-
*
|
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
|
-
* ```
|
17
|
+
* A CAIP-19 asset type or asset ID identifier, i.e., a human-readable type of asset identifier.
|
23
18
|
*/
|
24
|
-
export declare
|
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;
|
19
|
+
export declare const CaipAssetTypeOrIdStruct: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}` | `${string}:${string}/${string}:${string}/${string}`, null>;
|
20
|
+
export type CaipAssetTypeOrId = Infer<typeof CaipAssetTypeOrIdStruct>;
|
38
21
|
//# sourceMappingURL=caip.d.mts.map
|
package/dist/api/caip.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AACA,OAAO,
|
1
|
+
{"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,wBAAwB;AAClE,OAAO,EAGL,eAAe,EACf,aAAa,EACd,wBAAwB;AAKzB;;GAEG;AACH,eAAO,MAAM,mBAAmB,yFAG/B,CAAC;AACF,YAAY,EAAE,aAAa,EAAE,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,iBAAiB,mGAG7B,CAAC;AACF,YAAY,EAAE,WAAW,EAAE,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB;;GAEG;AACH,eAAO,MAAM,uBAAuB,+IAEe,CAAC;AACpD,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
package/dist/api/caip.mjs
CHANGED
@@ -1,43 +1,18 @@
|
|
1
1
|
import { definePattern } from "@metamask/keyring-utils";
|
2
|
-
import {
|
3
|
-
const
|
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;
|
2
|
+
import { CAIP_ASSET_TYPE_REGEX, CAIP_ASSET_ID_REGEX, isCaipAssetType, isCaipAssetId } from "@metamask/utils";
|
3
|
+
const CAIP_ASSET_TYPE_OR_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
4
|
/**
|
6
5
|
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
7
6
|
*/
|
8
7
|
export const CaipAssetTypeStruct = definePattern('CaipAssetType', CAIP_ASSET_TYPE_REGEX);
|
8
|
+
export { isCaipAssetType };
|
9
9
|
/**
|
10
10
|
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
11
11
|
*/
|
12
12
|
export const CaipAssetIdStruct = definePattern('CaipAssetId', CAIP_ASSET_ID_REGEX);
|
13
|
+
export { isCaipAssetId };
|
13
14
|
/**
|
14
|
-
*
|
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
|
-
* ```
|
15
|
+
* A CAIP-19 asset type or asset ID identifier, i.e., a human-readable type of asset identifier.
|
24
16
|
*/
|
25
|
-
export
|
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
|
-
}
|
17
|
+
export const CaipAssetTypeOrIdStruct = definePattern('CaipAssetTypeOrId', CAIP_ASSET_TYPE_OR_ID_REGEX);
|
43
18
|
//# sourceMappingURL=caip.mjs.map
|
package/dist/api/caip.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"caip.mjs","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gCAAgC;
|
1
|
+
{"version":3,"file":"caip.mjs","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gCAAgC;AAGxD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACd,wBAAwB;AAEzB,MAAM,2BAA2B,GAC/B,gMAAgM,CAAC;AAEnM;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAElD,mBAAmB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { definePattern } from '@metamask/keyring-utils';\nimport { type Infer } from '@metamask/superstruct';\nimport type { CaipAssetId, CaipAssetType } from '@metamask/utils';\nimport {\n CAIP_ASSET_TYPE_REGEX,\n CAIP_ASSET_ID_REGEX,\n isCaipAssetType,\n isCaipAssetId,\n} from '@metamask/utils';\n\nconst CAIP_ASSET_TYPE_OR_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<CaipAssetType>(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type { CaipAssetType };\nexport { isCaipAssetType };\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern<CaipAssetId>(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type { CaipAssetId };\nexport { isCaipAssetId };\n\n/**\n * A CAIP-19 asset type or asset ID identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeOrIdStruct = definePattern<\n CaipAssetType | CaipAssetId\n>('CaipAssetTypeOrId', CAIP_ASSET_TYPE_OR_ID_REGEX);\nexport type CaipAssetTypeOrId = Infer<typeof CaipAssetTypeOrIdStruct>;\n"]}
|
package/dist/api/keyring.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
|
1
|
+
{"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
|
package/dist/api/keyring.d.cts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Json } from "@metamask/utils";
|
2
2
|
import type { KeyringAccount } from "./account.cjs";
|
3
3
|
import type { Balance } from "./balance.cjs";
|
4
|
-
import type { CaipAssetType } from "./caip.cjs";
|
4
|
+
import type { CaipAssetType, CaipAssetTypeOrId } from "./caip.cjs";
|
5
5
|
import type { KeyringAccountData } from "./export.cjs";
|
6
6
|
import type { Paginated, Pagination } from "./pagination.cjs";
|
7
7
|
import type { KeyringRequest } from "./request.cjs";
|
@@ -43,6 +43,16 @@ export type Keyring = {
|
|
43
43
|
* object without any private information.
|
44
44
|
*/
|
45
45
|
createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
|
46
|
+
/**
|
47
|
+
* Lists the assets of an account (fungibles and non-fungibles) represented
|
48
|
+
* by their respective CAIP-19:
|
49
|
+
* - Asset types for fungibles assets.
|
50
|
+
* - Asset IDs for non-fungible ones.
|
51
|
+
*
|
52
|
+
* @param id - The ID of the account to list the assets for.
|
53
|
+
* @returns A promise that resolves to list of assets for that account.
|
54
|
+
*/
|
55
|
+
listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;
|
46
56
|
/**
|
47
57
|
* Lists the transactions of an account, paginated and ordered by the most
|
48
58
|
* recent first.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAe;
|
1
|
+
{"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAe;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAqB;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,0BAAsB;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1C;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE5D;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;;;;;OAQG;IACH,iBAAiB,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAE7D;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,CACtB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,kBAAkB,CAAC,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErE;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
|
package/dist/api/keyring.d.mts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Json } from "@metamask/utils";
|
2
2
|
import type { KeyringAccount } from "./account.mjs";
|
3
3
|
import type { Balance } from "./balance.mjs";
|
4
|
-
import type { CaipAssetType } from "./caip.mjs";
|
4
|
+
import type { CaipAssetType, CaipAssetTypeOrId } from "./caip.mjs";
|
5
5
|
import type { KeyringAccountData } from "./export.mjs";
|
6
6
|
import type { Paginated, Pagination } from "./pagination.mjs";
|
7
7
|
import type { KeyringRequest } from "./request.mjs";
|
@@ -43,6 +43,16 @@ export type Keyring = {
|
|
43
43
|
* object without any private information.
|
44
44
|
*/
|
45
45
|
createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
|
46
|
+
/**
|
47
|
+
* Lists the assets of an account (fungibles and non-fungibles) represented
|
48
|
+
* by their respective CAIP-19:
|
49
|
+
* - Asset types for fungibles assets.
|
50
|
+
* - Asset IDs for non-fungible ones.
|
51
|
+
*
|
52
|
+
* @param id - The ID of the account to list the assets for.
|
53
|
+
* @returns A promise that resolves to list of assets for that account.
|
54
|
+
*/
|
55
|
+
listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;
|
46
56
|
/**
|
47
57
|
* Lists the transactions of an account, paginated and ordered by the most
|
48
58
|
* recent first.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAe;
|
1
|
+
{"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAe;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAqB;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,0BAAsB;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1C;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE5D;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;;;;;OAQG;IACH,iBAAiB,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAE7D;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,CACtB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,kBAAkB,CAAC,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErE;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
|
package/dist/api/keyring.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
|
1
|
+
{"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
/* istanbul ignore file */
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.BtcScopes = void 0;
|
5
|
+
/**
|
6
|
+
* Scopes for Bitcoin account type. See {@link KeyringAccount.scopes}.
|
7
|
+
*/
|
8
|
+
var BtcScopes;
|
9
|
+
(function (BtcScopes) {
|
10
|
+
BtcScopes["Namespace"] = "bip122";
|
11
|
+
BtcScopes["Mainnet"] = "bip122:000000000019d6689c085ae165831e93";
|
12
|
+
BtcScopes["Testnet"] = "bip122:000000000933ea01ad0ee984209779ba";
|
13
|
+
BtcScopes["Testnet4"] = "bip122:00000000da84f2bafbbc53dee25a72ae";
|
14
|
+
BtcScopes["Signet"] = "bip122:00000008819873e925422c1ff0f99f7c";
|
15
|
+
BtcScopes["Regtest"] = "bip122:regtest";
|
16
|
+
})(BtcScopes || (exports.BtcScopes = BtcScopes = {}));
|
17
|
+
//# sourceMappingURL=constants.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/btc/constants.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B;;GAEG;AACH,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,iCAAoB,CAAA;IACpB,gEAAmD,CAAA;IACnD,gEAAmD,CAAA;IACnD,iEAAoD,CAAA;IACpD,+DAAkD,CAAA;IAClD,uCAA0B,CAAA;AAC5B,CAAC,EAPW,SAAS,yBAAT,SAAS,QAOpB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for Bitcoin account type. See {@link KeyringAccount.scopes}.\n */\nexport enum BtcScopes {\n Namespace = 'bip122',\n Mainnet = 'bip122:000000000019d6689c085ae165831e93',\n Testnet = 'bip122:000000000933ea01ad0ee984209779ba',\n Testnet4 = 'bip122:00000000da84f2bafbbc53dee25a72ae',\n Signet = 'bip122:00000008819873e925422c1ff0f99f7c',\n Regtest = 'bip122:regtest',\n}\n"]}
|