@metamask-previews/keyring-api 14.0.0-7ba2de1 → 15.0.0-0aca2ee

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/btc/constants.cjs +10 -10
  3. package/dist/btc/constants.cjs.map +1 -1
  4. package/dist/btc/constants.d.cts +1 -1
  5. package/dist/btc/constants.d.cts.map +1 -1
  6. package/dist/btc/constants.d.mts +1 -1
  7. package/dist/btc/constants.d.mts.map +1 -1
  8. package/dist/btc/constants.mjs +9 -9
  9. package/dist/btc/constants.mjs.map +1 -1
  10. package/dist/btc/types.cjs +4 -2
  11. package/dist/btc/types.cjs.map +1 -1
  12. package/dist/btc/types.d.cts +3 -1
  13. package/dist/btc/types.d.cts.map +1 -1
  14. package/dist/btc/types.d.mts +3 -1
  15. package/dist/btc/types.d.mts.map +1 -1
  16. package/dist/btc/types.mjs +5 -3
  17. package/dist/btc/types.mjs.map +1 -1
  18. package/dist/eth/constants.cjs +7 -6
  19. package/dist/eth/constants.cjs.map +1 -1
  20. package/dist/eth/constants.d.cts +3 -2
  21. package/dist/eth/constants.d.cts.map +1 -1
  22. package/dist/eth/constants.d.mts +3 -2
  23. package/dist/eth/constants.d.mts.map +1 -1
  24. package/dist/eth/constants.mjs +6 -5
  25. package/dist/eth/constants.mjs.map +1 -1
  26. package/dist/eth/types.cjs +1 -1
  27. package/dist/eth/types.cjs.map +1 -1
  28. package/dist/eth/types.d.cts +3 -3
  29. package/dist/eth/types.d.cts.map +1 -1
  30. package/dist/eth/types.d.mts +3 -3
  31. package/dist/eth/types.d.mts.map +1 -1
  32. package/dist/eth/types.mjs +2 -2
  33. package/dist/eth/types.mjs.map +1 -1
  34. package/dist/sol/constants.cjs +8 -8
  35. package/dist/sol/constants.cjs.map +1 -1
  36. package/dist/sol/constants.d.cts +1 -1
  37. package/dist/sol/constants.d.cts.map +1 -1
  38. package/dist/sol/constants.d.mts +1 -1
  39. package/dist/sol/constants.d.mts.map +1 -1
  40. package/dist/sol/constants.mjs +7 -7
  41. package/dist/sol/constants.mjs.map +1 -1
  42. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [15.0.0]
11
+
12
+ ### Added
13
+
14
+ - Add `account{AssetList,Balances,Transactions}UpdatedEventStruct` keyring events ([#154](https://github.com/MetaMask/accounts/pull/154))
15
+
16
+ ### Changed
17
+
18
+ - **BREAKING:** Make specific `*AccountStruct.scopes` more strict ([#159](https://github.com/MetaMask/accounts/pull/159))
19
+
10
20
  ## [14.0.0]
11
21
 
12
22
  ### Added
@@ -477,7 +487,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
477
487
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
478
488
  - Helper functions to create keyring handler in the snap.
479
489
 
480
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@14.0.0...HEAD
490
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@15.0.0...HEAD
491
+ [15.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@14.0.0...@metamask/keyring-api@15.0.0
481
492
  [14.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@13.0.0...@metamask/keyring-api@14.0.0
482
493
  [13.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@12.0.0...@metamask/keyring-api@13.0.0
483
494
  [12.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@11.1.0...@metamask/keyring-api@12.0.0
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  /* istanbul ignore file */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.BtcScopes = void 0;
4
+ exports.BtcScope = void 0;
5
5
  /**
6
6
  * Scopes for Bitcoin account type. See {@link KeyringAccount.scopes}.
7
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 = {}));
8
+ var BtcScope;
9
+ (function (BtcScope) {
10
+ BtcScope["Namespace"] = "bip122";
11
+ BtcScope["Mainnet"] = "bip122:000000000019d6689c085ae165831e93";
12
+ BtcScope["Testnet"] = "bip122:000000000933ea01ad0ee984209779ba";
13
+ BtcScope["Testnet4"] = "bip122:00000000da84f2bafbbc53dee25a72ae";
14
+ BtcScope["Signet"] = "bip122:00000008819873e925422c1ff0f99f7c";
15
+ BtcScope["Regtest"] = "bip122:regtest";
16
+ })(BtcScope || (exports.BtcScope = BtcScope = {}));
17
17
  //# sourceMappingURL=constants.cjs.map
@@ -1 +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"]}
1
+ {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/btc/constants.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B;;GAEG;AACH,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,gCAAoB,CAAA;IACpB,+DAAmD,CAAA;IACnD,+DAAmD,CAAA;IACnD,gEAAoD,CAAA;IACpD,8DAAkD,CAAA;IAClD,sCAA0B,CAAA;AAC5B,CAAC,EAPW,QAAQ,wBAAR,QAAQ,QAOnB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for Bitcoin account type. See {@link KeyringAccount.scopes}.\n */\nexport enum BtcScope {\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"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Scopes for Bitcoin account type. See {@link KeyringAccount.scopes}.
3
3
  */
4
- export declare enum BtcScopes {
4
+ export declare enum BtcScope {
5
5
  Namespace = "bip122",
6
6
  Mainnet = "bip122:000000000019d6689c085ae165831e93",
7
7
  Testnet = "bip122:000000000933ea01ad0ee984209779ba",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/btc/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,SAAS;IACnB,SAAS,WAAW;IACpB,OAAO,4CAA4C;IACnD,OAAO,4CAA4C;IACnD,QAAQ,4CAA4C;IACpD,MAAM,4CAA4C;IAClD,OAAO,mBAAmB;CAC3B"}
1
+ {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/btc/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,SAAS,WAAW;IACpB,OAAO,4CAA4C;IACnD,OAAO,4CAA4C;IACnD,QAAQ,4CAA4C;IACpD,MAAM,4CAA4C;IAClD,OAAO,mBAAmB;CAC3B"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Scopes for Bitcoin account type. See {@link KeyringAccount.scopes}.
3
3
  */
4
- export declare enum BtcScopes {
4
+ export declare enum BtcScope {
5
5
  Namespace = "bip122",
6
6
  Mainnet = "bip122:000000000019d6689c085ae165831e93",
7
7
  Testnet = "bip122:000000000933ea01ad0ee984209779ba",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/btc/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,SAAS;IACnB,SAAS,WAAW;IACpB,OAAO,4CAA4C;IACnD,OAAO,4CAA4C;IACnD,QAAQ,4CAA4C;IACpD,MAAM,4CAA4C;IAClD,OAAO,mBAAmB;CAC3B"}
1
+ {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/btc/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,SAAS,WAAW;IACpB,OAAO,4CAA4C;IACnD,OAAO,4CAA4C;IACnD,QAAQ,4CAA4C;IACpD,MAAM,4CAA4C;IAClD,OAAO,mBAAmB;CAC3B"}
@@ -2,13 +2,13 @@
2
2
  /**
3
3
  * Scopes for Bitcoin account type. See {@link KeyringAccount.scopes}.
4
4
  */
5
- export var BtcScopes;
6
- (function (BtcScopes) {
7
- BtcScopes["Namespace"] = "bip122";
8
- BtcScopes["Mainnet"] = "bip122:000000000019d6689c085ae165831e93";
9
- BtcScopes["Testnet"] = "bip122:000000000933ea01ad0ee984209779ba";
10
- BtcScopes["Testnet4"] = "bip122:00000000da84f2bafbbc53dee25a72ae";
11
- BtcScopes["Signet"] = "bip122:00000008819873e925422c1ff0f99f7c";
12
- BtcScopes["Regtest"] = "bip122:regtest";
13
- })(BtcScopes || (BtcScopes = {}));
5
+ export var BtcScope;
6
+ (function (BtcScope) {
7
+ BtcScope["Namespace"] = "bip122";
8
+ BtcScope["Mainnet"] = "bip122:000000000019d6689c085ae165831e93";
9
+ BtcScope["Testnet"] = "bip122:000000000933ea01ad0ee984209779ba";
10
+ BtcScope["Testnet4"] = "bip122:00000000da84f2bafbbc53dee25a72ae";
11
+ BtcScope["Signet"] = "bip122:00000008819873e925422c1ff0f99f7c";
12
+ BtcScope["Regtest"] = "bip122:regtest";
13
+ })(BtcScope || (BtcScope = {}));
14
14
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/btc/constants.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,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,KAAT,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"]}
1
+ {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/btc/constants.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,gCAAoB,CAAA;IACpB,+DAAmD,CAAA;IACnD,+DAAmD,CAAA;IACnD,gEAAoD,CAAA;IACpD,8DAAkD,CAAA;IAClD,sCAA0B,CAAA;AAC5B,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for Bitcoin account type. See {@link KeyringAccount.scopes}.\n */\nexport enum BtcScope {\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"]}
@@ -34,9 +34,11 @@ exports.BtcP2wpkhAccountStruct = (0, keyring_utils_1.object)({
34
34
  */
35
35
  type: (0, superstruct_1.literal)(`${api_1.BtcAccountType.P2wpkh}`),
36
36
  /**
37
- * Account supported scopes (CAIP-2 chain IDs).
37
+ * Account supported scope (CAIP-2 chain ID).
38
+ *
39
+ * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.
38
40
  */
39
- scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)(utils_1.CaipChainIdStruct)), // TODO: Would be great to further restrict this to be an array of 1 element?
41
+ scopes: (0, superstruct_1.size)((0, superstruct_1.array)(utils_1.CaipChainIdStruct), 1),
40
42
  /**
41
43
  * Account supported methods.
42
44
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAEjD,uDAO+B;AAC/B,2CAAoD;AACpD,mCAAgC;AAEhC,0CAA8D;AAEjD,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAC1C,IAAA,oBAAM,GAAE,EACR,wBAAwB,EACxB,CAAC,OAAe,EAAE,EAAE;IAClB,IAAI,CAAC;QACH,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAI,KAAK,CACd,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,wCAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAEY,QAAA,sBAAsB,GAAG,IAAA,sBAAM,EAAC;IAC3C,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,8BAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC;IAEzC;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,yBAAiB,CAAC,CAAC,EAAE,6EAA6E;IAEzH;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n array,\n enums,\n refine,\n literal,\n nonempty,\n} from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\nimport { bech32 } from 'bech32';\n\nimport { BtcAccountType, KeyringAccountStruct } from '../api';\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n try {\n bech32.decode(address);\n } catch (error) {\n return new Error(\n `Could not decode P2WPKH address: ${(error as Error).message}`,\n );\n }\n return true;\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendBitcoin = 'sendBitcoin',\n}\n\nexport const BtcP2wpkhAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)), // TODO: Would be great to further restrict this to be an array of 1 element?\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendBitcoin}`])),\n});\n\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAEjD,uDAO+B;AAC/B,2CAAoD;AACpD,mCAAgC;AAEhC,0CAA8D;AAEjD,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAC1C,IAAA,oBAAM,GAAE,EACR,wBAAwB,EACxB,CAAC,OAAe,EAAE,EAAE;IAClB,IAAI,CAAC;QACH,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAI,KAAK,CACd,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,wCAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAEY,QAAA,sBAAsB,GAAG,IAAA,sBAAM,EAAC;IAC3C,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,8BAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC;IAEzC;;;;OAIG;IACH,MAAM,EAAE,IAAA,kBAAI,EAAC,IAAA,mBAAK,EAAC,yBAAiB,CAAC,EAAE,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n array,\n enums,\n refine,\n literal,\n size,\n} from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\nimport { bech32 } from 'bech32';\n\nimport { BtcAccountType, KeyringAccountStruct } from '../api';\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n try {\n bech32.decode(address);\n } catch (error) {\n return new Error(\n `Could not decode P2WPKH address: ${(error as Error).message}`,\n );\n }\n return true;\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendBitcoin = 'sendBitcoin',\n}\n\nexport const BtcP2wpkhAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n\n /**\n * Account supported scope (CAIP-2 chain ID).\n *\n * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.\n */\n scopes: size(array(CaipChainIdStruct), 1),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendBitcoin}`])),\n});\n\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\n"]}
@@ -23,7 +23,9 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
23
23
  */
24
24
  type: import("@metamask/superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
25
25
  /**
26
- * Account supported scopes (CAIP-2 chain IDs).
26
+ * Account supported scope (CAIP-2 chain ID).
27
+ *
28
+ * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.
27
29
  */
28
30
  scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
29
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD,eAAO,MAAM,sBAAsB,sDAalC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,WAAW,gBAAgB;CAC5B;AAED,eAAO,MAAM,sBAAsB;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD,eAAO,MAAM,sBAAsB,sDAalC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,WAAW,gBAAgB;CAC5B;AAED,eAAO,MAAM,sBAAsB;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAGH;;;;OAIG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -23,7 +23,9 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
23
23
  */
24
24
  type: import("@metamask/superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
25
25
  /**
26
- * Account supported scopes (CAIP-2 chain IDs).
26
+ * Account supported scope (CAIP-2 chain ID).
27
+ *
28
+ * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.
27
29
  */
28
30
  scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
29
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD,eAAO,MAAM,sBAAsB,sDAalC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,WAAW,gBAAgB;CAC5B;AAED,eAAO,MAAM,sBAAsB;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD,eAAO,MAAM,sBAAsB,sDAalC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,WAAW,gBAAgB;CAC5B;AAED,eAAO,MAAM,sBAAsB;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAGH;;;;OAIG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { object } from "@metamask/keyring-utils";
2
- import { string, array, enums, refine, literal, nonempty } from "@metamask/superstruct";
2
+ import { string, array, enums, refine, literal, size } from "@metamask/superstruct";
3
3
  import { CaipChainIdStruct } from "@metamask/utils";
4
4
  import { bech32 } from "bech32";
5
5
  import { BtcAccountType, KeyringAccountStruct } from "../api/index.mjs";
@@ -31,9 +31,11 @@ export const BtcP2wpkhAccountStruct = object({
31
31
  */
32
32
  type: literal(`${BtcAccountType.P2wpkh}`),
33
33
  /**
34
- * Account supported scopes (CAIP-2 chain IDs).
34
+ * Account supported scope (CAIP-2 chain ID).
35
+ *
36
+ * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.
35
37
  */
36
- scopes: nonempty(array(CaipChainIdStruct)), // TODO: Would be great to further restrict this to be an array of 1 element?
38
+ scopes: size(array(CaipChainIdStruct), 1),
37
39
  /**
38
40
  * Account supported methods.
39
41
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACT,8BAA8B;AAC/B,OAAO,EAAE,iBAAiB,EAAE,wBAAwB;AACpD,OAAO,EAAE,MAAM,EAAE,eAAe;AAEhC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,yBAAe;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,MAAM,EAAE,EACR,wBAAwB,EACxB,CAAC,OAAe,EAAE,EAAE;IAClB,IAAI,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAI,KAAK,CACd,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,wCAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,sBAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;IAEzC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,6EAA6E;IAEzH;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n array,\n enums,\n refine,\n literal,\n nonempty,\n} from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\nimport { bech32 } from 'bech32';\n\nimport { BtcAccountType, KeyringAccountStruct } from '../api';\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n try {\n bech32.decode(address);\n } catch (error) {\n return new Error(\n `Could not decode P2WPKH address: ${(error as Error).message}`,\n );\n }\n return true;\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendBitcoin = 'sendBitcoin',\n}\n\nexport const BtcP2wpkhAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)), // TODO: Would be great to further restrict this to be an array of 1 element?\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendBitcoin}`])),\n});\n\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACL,8BAA8B;AAC/B,OAAO,EAAE,iBAAiB,EAAE,wBAAwB;AACpD,OAAO,EAAE,MAAM,EAAE,eAAe;AAEhC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,yBAAe;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,MAAM,EAAE,EACR,wBAAwB,EACxB,CAAC,OAAe,EAAE,EAAE;IAClB,IAAI,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAI,KAAK,CACd,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,wCAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,sBAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;IAEzC;;;;OAIG;IACH,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n array,\n enums,\n refine,\n literal,\n size,\n} from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\nimport { bech32 } from 'bech32';\n\nimport { BtcAccountType, KeyringAccountStruct } from '../api';\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n try {\n bech32.decode(address);\n } catch (error) {\n return new Error(\n `Could not decode P2WPKH address: ${(error as Error).message}`,\n );\n }\n return true;\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendBitcoin = 'sendBitcoin',\n}\n\nexport const BtcP2wpkhAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n\n /**\n * Account supported scope (CAIP-2 chain ID).\n *\n * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.\n */\n scopes: size(array(CaipChainIdStruct), 1),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendBitcoin}`])),\n});\n\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\n"]}
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  /* istanbul ignore file */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.EthScopes = void 0;
4
+ exports.EthScope = void 0;
5
5
  /**
6
6
  * Scopes for EVM account type. See {@link KeyringAccount.scopes}.
7
7
  */
8
- var EthScopes;
9
- (function (EthScopes) {
10
- EthScopes["Namespace"] = "eip155";
11
- EthScopes["Mainnet"] = "eip155:1";
12
- })(EthScopes || (exports.EthScopes = EthScopes = {}));
8
+ var EthScope;
9
+ (function (EthScope) {
10
+ EthScope["Namespace"] = "eip155";
11
+ EthScope["Mainnet"] = "eip155:1";
12
+ EthScope["Testnet"] = "eip155:11155111";
13
+ })(EthScope || (exports.EthScope = EthScope = {}));
13
14
  //# sourceMappingURL=constants.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,iCAAoB,CAAA;IACpB,iCAAoB,CAAA;AACtB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for EVM account type. See {@link KeyringAccount.scopes}.\n */\nexport enum EthScopes {\n Namespace = 'eip155',\n Mainnet = 'eip155:1',\n}\n"]}
1
+ {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B;;GAEG;AACH,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,gCAAoB,CAAA;IACpB,gCAAoB,CAAA;IACpB,uCAA2B,CAAA;AAC7B,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for EVM account type. See {@link KeyringAccount.scopes}.\n */\nexport enum EthScope {\n Namespace = 'eip155',\n Mainnet = 'eip155:1',\n Testnet = 'eip155:11155111',\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Scopes for EVM account type. See {@link KeyringAccount.scopes}.
3
3
  */
4
- export declare enum EthScopes {
4
+ export declare enum EthScope {
5
5
  Namespace = "eip155",
6
- Mainnet = "eip155:1"
6
+ Mainnet = "eip155:1",
7
+ Testnet = "eip155:11155111"
7
8
  }
8
9
  //# sourceMappingURL=constants.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,SAAS;IACnB,SAAS,WAAW;IACpB,OAAO,aAAa;CACrB"}
1
+ {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,SAAS,WAAW;IACpB,OAAO,aAAa;IACpB,OAAO,oBAAoB;CAC5B"}
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Scopes for EVM account type. See {@link KeyringAccount.scopes}.
3
3
  */
4
- export declare enum EthScopes {
4
+ export declare enum EthScope {
5
5
  Namespace = "eip155",
6
- Mainnet = "eip155:1"
6
+ Mainnet = "eip155:1",
7
+ Testnet = "eip155:11155111"
7
8
  }
8
9
  //# sourceMappingURL=constants.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,SAAS;IACnB,SAAS,WAAW;IACpB,OAAO,aAAa;CACrB"}
1
+ {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,SAAS,WAAW;IACpB,OAAO,aAAa;IACpB,OAAO,oBAAoB;CAC5B"}
@@ -2,9 +2,10 @@
2
2
  /**
3
3
  * Scopes for EVM account type. See {@link KeyringAccount.scopes}.
4
4
  */
5
- export var EthScopes;
6
- (function (EthScopes) {
7
- EthScopes["Namespace"] = "eip155";
8
- EthScopes["Mainnet"] = "eip155:1";
9
- })(EthScopes || (EthScopes = {}));
5
+ export var EthScope;
6
+ (function (EthScope) {
7
+ EthScope["Namespace"] = "eip155";
8
+ EthScope["Mainnet"] = "eip155:1";
9
+ EthScope["Testnet"] = "eip155:11155111";
10
+ })(EthScope || (EthScope = {}));
10
11
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,iCAAoB,CAAA;IACpB,iCAAoB,CAAA;AACtB,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for EVM account type. See {@link KeyringAccount.scopes}.\n */\nexport enum EthScopes {\n Namespace = 'eip155',\n Mainnet = 'eip155:1',\n}\n"]}
1
+ {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,gCAAoB,CAAA;IACpB,gCAAoB,CAAA;IACpB,uCAA2B,CAAA;AAC7B,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for EVM account type. See {@link KeyringAccount.scopes}.\n */\nexport enum EthScope {\n Namespace = 'eip155',\n Mainnet = 'eip155:1',\n Testnet = 'eip155:11155111',\n}\n"]}
@@ -39,7 +39,7 @@ exports.EthEoaAccountStruct = (0, keyring_utils_1.object)({
39
39
  /**
40
40
  * Account scopes (must be ['eip155']).
41
41
  */
42
- scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)((0, superstruct_1.literal)(_1.EthScopes.Namespace))),
42
+ scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)((0, superstruct_1.literal)(_1.EthScope.Namespace))),
43
43
  /**
44
44
  * Account supported methods.
45
45
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAAwE;AACxE,2CAAoD;AAEpD,kCAA8B;AAC9B,0CAA8D;AAEjD,QAAA,cAAc,GAAG,IAAA,6BAAa,EAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE9D,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,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EACZ,IAAA,mBAAK,EAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { EthScopes } from '.';\nimport { EthAccountType, KeyringAccountStruct } from '../api';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nexport const EthAddressStruct = definePattern(\n 'EthAddress',\n /^0x[0-9a-f]{40}$/iu,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155']).\n */\n scopes: nonempty(array(literal(EthScopes.Namespace))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAAwE;AACxE,2CAAoD;AAEpD,kCAA6B;AAC7B,0CAA8D;AAEjD,QAAA,cAAc,GAAG,IAAA,6BAAa,EAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE9D,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;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,IAAA,mBAAK,EAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { EthScope } from '.';\nimport { EthAccountType, KeyringAccountStruct } from '../api';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nexport const EthAddressStruct = definePattern(\n 'EthAddress',\n /^0x[0-9a-f]{40}$/iu,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155']).\n */\n scopes: nonempty(array(literal(EthScope.Namespace))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
- import { EthScopes } from "./index.cjs";
2
+ import { EthScope } from "./index.cjs";
3
3
  export declare const EthBytesStruct: import("@metamask/superstruct").Struct<string, null>;
4
4
  export declare const EthAddressStruct: import("@metamask/superstruct").Struct<string, null>;
5
5
  export declare const EthUint256Struct: import("@metamask/superstruct").Struct<string, null>;
@@ -22,7 +22,7 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
22
22
  id: string;
23
23
  options: Record<string, import("@metamask/utils").Json>;
24
24
  address: string;
25
- scopes: EthScopes.Namespace[];
25
+ scopes: EthScope.Namespace[];
26
26
  methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
27
27
  }, {
28
28
  /**
@@ -36,7 +36,7 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
36
36
  /**
37
37
  * Account scopes (must be ['eip155']).
38
38
  */
39
- scopes: import("@metamask/superstruct").Struct<EthScopes.Namespace[], import("@metamask/superstruct").Struct<EthScopes.Namespace, EthScopes.Namespace>>;
39
+ scopes: import("@metamask/superstruct").Struct<EthScope.Namespace[], import("@metamask/superstruct").Struct<EthScope.Namespace, EthScope.Namespace>>;
40
40
  /**
41
41
  * Account supported methods.
42
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAE,SAAS,EAAE,oBAAU;AAG9B,eAAO,MAAM,cAAc,sDAA+C,CAAC;AAE3E,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,YAAY,kBAAkB;IAC9B,IAAI,aAAa;IACjB,eAAe,wBAAwB;IACvC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IAExC,oBAAoB,6BAA6B;IACjD,kBAAkB,2BAA2B;IAC7C,iBAAiB,0BAA0B;CAC5C;AAED,eAAO,MAAM,mBAAmB;;;;;;;;IAG9B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;EAWH,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB;;;;;;;;IAGlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAG7B,eAAO,MAAM,cAAc,sDAA+C,CAAC;AAE3E,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,YAAY,kBAAkB;IAC9B,IAAI,aAAa;IACjB,eAAe,wBAAwB;IACvC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IAExC,oBAAoB,6BAA6B;IACjD,kBAAkB,2BAA2B;IAC7C,iBAAiB,0BAA0B;CAC5C;AAED,eAAO,MAAM,mBAAmB;;;;;;;;IAG9B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;EAWH,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB;;;;;;;;IAGlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
- import { EthScopes } from "./index.mjs";
2
+ import { EthScope } from "./index.mjs";
3
3
  export declare const EthBytesStruct: import("@metamask/superstruct").Struct<string, null>;
4
4
  export declare const EthAddressStruct: import("@metamask/superstruct").Struct<string, null>;
5
5
  export declare const EthUint256Struct: import("@metamask/superstruct").Struct<string, null>;
@@ -22,7 +22,7 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
22
22
  id: string;
23
23
  options: Record<string, import("@metamask/utils").Json>;
24
24
  address: string;
25
- scopes: EthScopes.Namespace[];
25
+ scopes: EthScope.Namespace[];
26
26
  methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
27
27
  }, {
28
28
  /**
@@ -36,7 +36,7 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
36
36
  /**
37
37
  * Account scopes (must be ['eip155']).
38
38
  */
39
- scopes: import("@metamask/superstruct").Struct<EthScopes.Namespace[], import("@metamask/superstruct").Struct<EthScopes.Namespace, EthScopes.Namespace>>;
39
+ scopes: import("@metamask/superstruct").Struct<EthScope.Namespace[], import("@metamask/superstruct").Struct<EthScope.Namespace, EthScope.Namespace>>;
40
40
  /**
41
41
  * Account supported methods.
42
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAE,SAAS,EAAE,oBAAU;AAG9B,eAAO,MAAM,cAAc,sDAA+C,CAAC;AAE3E,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,YAAY,kBAAkB;IAC9B,IAAI,aAAa;IACjB,eAAe,wBAAwB;IACvC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IAExC,oBAAoB,6BAA6B;IACjD,kBAAkB,2BAA2B;IAC7C,iBAAiB,0BAA0B;CAC5C;AAED,eAAO,MAAM,mBAAmB;;;;;;;;IAG9B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;EAWH,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB;;;;;;;;IAGlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAG7B,eAAO,MAAM,cAAc,sDAA+C,CAAC;AAE3E,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,YAAY,kBAAkB;IAC9B,IAAI,aAAa;IACjB,eAAe,wBAAwB;IACvC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IAExC,oBAAoB,6BAA6B;IACjD,kBAAkB,2BAA2B;IAC7C,iBAAiB,0BAA0B;CAC5C;AAED,eAAO,MAAM,mBAAmB;;;;;;;;IAG9B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;EAWH,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB;;;;;;;;IAGlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { object, definePattern } from "@metamask/keyring-utils";
2
2
  import { nonempty, array, enums, literal } from "@metamask/superstruct";
3
3
  import { CaipChainIdStruct } from "@metamask/utils";
4
- import { EthScopes } from "./index.mjs";
4
+ import { EthScope } from "./index.mjs";
5
5
  import { EthAccountType, KeyringAccountStruct } from "../api/index.mjs";
6
6
  export const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);
7
7
  export const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);
@@ -36,7 +36,7 @@ export const EthEoaAccountStruct = object({
36
36
  /**
37
37
  * Account scopes (must be ['eip155']).
38
38
  */
39
- scopes: nonempty(array(literal(EthScopes.Namespace))),
39
+ scopes: nonempty(array(literal(EthScope.Namespace))),
40
40
  /**
41
41
  * Account supported methods.
42
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gCAAgC;AAEhE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AACxE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB;AAEpD,OAAO,EAAE,SAAS,EAAE,oBAAU;AAC9B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,yBAAe;AAE9D,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAAuC,CAAA;IACvC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,mBAAmB;IACnB,8DAAiD,CAAA;IACjD,0DAA6C,CAAA;IAC7C,wDAA2C,CAA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G,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { EthScopes } from '.';\nimport { EthAccountType, KeyringAccountStruct } from '../api';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nexport const EthAddressStruct = definePattern(\n 'EthAddress',\n /^0x[0-9a-f]{40}$/iu,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155']).\n */\n scopes: nonempty(array(literal(EthScopes.Namespace))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gCAAgC;AAEhE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AACxE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB;AAEpD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAC7B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,yBAAe;AAE9D,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAAuC,CAAA;IACvC,q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,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { EthScope } from '.';\nimport { EthAccountType, KeyringAccountStruct } from '../api';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nexport const EthAddressStruct = definePattern(\n 'EthAddress',\n /^0x[0-9a-f]{40}$/iu,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155']).\n */\n scopes: nonempty(array(literal(EthScope.Namespace))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  /* istanbul ignore file */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SolScopes = void 0;
4
+ exports.SolScope = void 0;
5
5
  /**
6
6
  * Scopes for Solana account type. See {@link KeyringAccount.scopes}.
7
7
  */
8
- var SolScopes;
9
- (function (SolScopes) {
10
- SolScopes["Namespace"] = "solana";
11
- SolScopes["Devnet"] = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
12
- SolScopes["Mainnet"] = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
13
- SolScopes["Testnet"] = "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
14
- })(SolScopes || (exports.SolScopes = SolScopes = {}));
8
+ var SolScope;
9
+ (function (SolScope) {
10
+ SolScope["Namespace"] = "solana";
11
+ SolScope["Devnet"] = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
12
+ SolScope["Mainnet"] = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
13
+ SolScope["Testnet"] = "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
14
+ })(SolScope || (exports.SolScope = SolScope = {}));
15
15
  //# sourceMappingURL=constants.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/sol/constants.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B;;GAEG;AACH,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,iCAAoB,CAAA;IACpB,+DAAkD,CAAA;IAClD,gEAAmD,CAAA;IACnD,gEAAmD,CAAA;AACrD,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for Solana account type. See {@link KeyringAccount.scopes}.\n */\nexport enum SolScopes {\n Namespace = 'solana',\n Devnet = 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n Mainnet = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n Testnet = 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n}\n"]}
1
+ {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/sol/constants.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B;;GAEG;AACH,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,gCAAoB,CAAA;IACpB,8DAAkD,CAAA;IAClD,+DAAmD,CAAA;IACnD,+DAAmD,CAAA;AACrD,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for Solana account type. See {@link KeyringAccount.scopes}.\n */\nexport enum SolScope {\n Namespace = 'solana',\n Devnet = 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n Mainnet = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n Testnet = 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Scopes for Solana account type. See {@link KeyringAccount.scopes}.
3
3
  */
4
- export declare enum SolScopes {
4
+ export declare enum SolScope {
5
5
  Namespace = "solana",
6
6
  Devnet = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
7
7
  Mainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/sol/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,SAAS;IACnB,SAAS,WAAW;IACpB,MAAM,4CAA4C;IAClD,OAAO,4CAA4C;IACnD,OAAO,4CAA4C;CACpD"}
1
+ {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/sol/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,SAAS,WAAW;IACpB,MAAM,4CAA4C;IAClD,OAAO,4CAA4C;IACnD,OAAO,4CAA4C;CACpD"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Scopes for Solana account type. See {@link KeyringAccount.scopes}.
3
3
  */
4
- export declare enum SolScopes {
4
+ export declare enum SolScope {
5
5
  Namespace = "solana",
6
6
  Devnet = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
7
7
  Mainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/sol/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,SAAS;IACnB,SAAS,WAAW;IACpB,MAAM,4CAA4C;IAClD,OAAO,4CAA4C;IACnD,OAAO,4CAA4C;CACpD"}
1
+ {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/sol/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,SAAS,WAAW;IACpB,MAAM,4CAA4C;IAClD,OAAO,4CAA4C;IACnD,OAAO,4CAA4C;CACpD"}
@@ -2,11 +2,11 @@
2
2
  /**
3
3
  * Scopes for Solana account type. See {@link KeyringAccount.scopes}.
4
4
  */
5
- export var SolScopes;
6
- (function (SolScopes) {
7
- SolScopes["Namespace"] = "solana";
8
- SolScopes["Devnet"] = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
9
- SolScopes["Mainnet"] = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
10
- SolScopes["Testnet"] = "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
11
- })(SolScopes || (SolScopes = {}));
5
+ export var SolScope;
6
+ (function (SolScope) {
7
+ SolScope["Namespace"] = "solana";
8
+ SolScope["Devnet"] = "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
9
+ SolScope["Mainnet"] = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
10
+ SolScope["Testnet"] = "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
11
+ })(SolScope || (SolScope = {}));
12
12
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/sol/constants.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,iCAAoB,CAAA;IACpB,+DAAkD,CAAA;IAClD,gEAAmD,CAAA;IACnD,gEAAmD,CAAA;AACrD,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for Solana account type. See {@link KeyringAccount.scopes}.\n */\nexport enum SolScopes {\n Namespace = 'solana',\n Devnet = 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n Mainnet = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n Testnet = 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n}\n"]}
1
+ {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/sol/constants.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,gCAAoB,CAAA;IACpB,8DAAkD,CAAA;IAClD,+DAAmD,CAAA;IACnD,+DAAmD,CAAA;AACrD,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for Solana account type. See {@link KeyringAccount.scopes}.\n */\nexport enum SolScope {\n Namespace = 'solana',\n Devnet = 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n Mainnet = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n Testnet = 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/keyring-api",
3
- "version": "14.0.0-7ba2de1",
3
+ "version": "15.0.0-0aca2ee",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -46,7 +46,7 @@
46
46
  "test:watch": "jest --watch"
47
47
  },
48
48
  "dependencies": {
49
- "@metamask/keyring-utils": "1.2.0",
49
+ "@metamask/keyring-utils": "1.3.0",
50
50
  "@metamask/superstruct": "^3.1.0",
51
51
  "@metamask/utils": "^11.0.1",
52
52
  "bech32": "^2.0.0"
@@ -55,7 +55,7 @@
55
55
  "@lavamoat/allow-scripts": "^3.2.1",
56
56
  "@lavamoat/preinstall-always-fail": "^2.1.0",
57
57
  "@metamask/auto-changelog": "^3.4.4",
58
- "@metamask/keyring-utils": "1.2.0",
58
+ "@metamask/keyring-utils": "1.3.0",
59
59
  "@ts-bridge/cli": "^0.6.1",
60
60
  "@types/jest": "^29.5.12",
61
61
  "@types/node": "^20.12.12",