@metamask/keyring-api 6.1.0 → 6.2.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 CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [6.2.0]
11
+
12
+ ### Added
13
+
14
+ - Add `accountNameSuggestion` field to the `AccountCreatedEvent` ([#291](https://github.com/MetaMask/keyring-api/pull/291))
15
+ - Add `displayConfirmation` field to the `AccountCreatedEvent` ([#307](https://github.com/MetaMask/keyring-api/pull/307))
16
+
17
+ ## [6.1.1]
18
+
19
+ ### Changed
20
+
21
+ - Fix `isEvmAccountType` accountType type to `string` or `InternalAccountType` ([#304](https://github.com/MetaMask/keyring-api/pull/304))
22
+ - Bump @metamask/snaps-sdk from ^4.0.0 to ^4.2.0 ([#305](https://github.com/MetaMask/keyring-api/pull/305))
23
+
10
24
  ## [6.1.0]
11
25
 
12
26
  ### Added
@@ -276,7 +290,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
276
290
  - SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
277
291
  - Helper functions to create keyring handler in the snap.
278
292
 
279
- [Unreleased]: https://github.com/MetaMask/keyring-api/compare/v6.1.0...HEAD
293
+ [Unreleased]: https://github.com/MetaMask/keyring-api/compare/v6.2.0...HEAD
294
+ [6.2.0]: https://github.com/MetaMask/keyring-api/compare/v6.1.1...v6.2.0
295
+ [6.1.1]: https://github.com/MetaMask/keyring-api/compare/v6.1.0...v6.1.1
280
296
  [6.1.0]: https://github.com/MetaMask/keyring-api/compare/v6.0.0...v6.1.0
281
297
  [6.0.0]: https://github.com/MetaMask/keyring-api/compare/v5.1.0...v6.0.0
282
298
  [5.1.0]: https://github.com/MetaMask/keyring-api/compare/v5.0.0...v5.1.0
@@ -4,4 +4,4 @@ import type { InternalAccountType } from '../internal';
4
4
  * @param type - The type to check.
5
5
  * @returns Returns true if the type is an EVM account type, false otherwise.
6
6
  */
7
- export declare function isEvmAccountType(type: InternalAccountType): boolean;
7
+ export declare function isEvmAccountType(type: InternalAccountType | string): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":";;;AACA,mCAAyC;AAEzC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAyB;IACxD,OAAO,IAAI,KAAK,sBAAc,CAAC,GAAG,IAAI,IAAI,KAAK,sBAAc,CAAC,OAAO,CAAC;AACxE,CAAC;AAFD,4CAEC","sourcesContent":["import type { InternalAccountType } from '../internal';\nimport { EthAccountType } from './types';\n\n/**\n * Checks if the given type is an EVM account type.\n * @param type - The type to check.\n * @returns Returns true if the type is an EVM account type, false otherwise.\n */\nexport function isEvmAccountType(type: InternalAccountType): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":";;;AACA,mCAAyC;AAEzC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAkC;IACjE,OAAO,IAAI,KAAK,sBAAc,CAAC,GAAG,IAAI,IAAI,KAAK,sBAAc,CAAC,OAAO,CAAC;AACxE,CAAC;AAFD,4CAEC","sourcesContent":["import type { InternalAccountType } from '../internal';\nimport { EthAccountType } from './types';\n\n/**\n * Checks if the given type is an EVM account type.\n * @param type - The type to check.\n * @returns Returns true if the type is an EVM account type, false otherwise.\n */\nexport function isEvmAccountType(type: InternalAccountType | string): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
@@ -20,6 +20,8 @@ export declare const AccountCreatedEventStruct: import("superstruct").Struct<{
20
20
  options: Record<string, import("@metamask/utils").Json>;
21
21
  methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
22
22
  };
23
+ accountNameSuggestion: string | import("../superstruct").ExactOptionalTag;
24
+ displayConfirmation: boolean | import("../superstruct").ExactOptionalTag;
23
25
  };
24
26
  }, {
25
27
  method: import("superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
@@ -43,6 +45,8 @@ export declare const AccountCreatedEventStruct: import("superstruct").Struct<{
43
45
  options: Record<string, import("@metamask/utils").Json>;
44
46
  methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
45
47
  };
48
+ accountNameSuggestion: string | import("../superstruct").ExactOptionalTag;
49
+ displayConfirmation: boolean | import("../superstruct").ExactOptionalTag;
46
50
  }, {
47
51
  /**
48
52
  * New account object.
@@ -66,6 +70,19 @@ export declare const AccountCreatedEventStruct: import("superstruct").Struct<{
66
70
  options: Record<string, import("@metamask/utils").Json>;
67
71
  methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
68
72
  }, null>;
73
+ /**
74
+ * Account name suggestion provided to the MetaMask client.
75
+ *
76
+ * The keyring can suggest a name for the account, but it's up to the
77
+ * client to decide whether to use it. The keyring won't be informed if the
78
+ * client decides to use a different name.
79
+ */
80
+ accountNameSuggestion: import("superstruct").Struct<string | import("../superstruct").ExactOptionalTag, null>;
81
+ /**
82
+ * Instructs MetaMask to display the add account confirmation dialog in the UI.
83
+ * **Note:** This is not guaranteed to be honored by the MetaMask client.
84
+ */
85
+ displayConfirmation: import("superstruct").Struct<boolean | import("../superstruct").ExactOptionalTag, null>;
69
86
  }>;
70
87
  }>;
71
88
  export declare const AccountUpdatedEventStruct: import("superstruct").Struct<{
@@ -5,6 +5,7 @@ const utils_1 = require("@metamask/utils");
5
5
  const superstruct_1 = require("superstruct");
6
6
  const api_1 = require("../api");
7
7
  const events_1 = require("../events");
8
+ const superstruct_2 = require("../superstruct");
8
9
  const utils_2 = require("../utils");
9
10
  exports.AccountCreatedEventStruct = (0, superstruct_1.object)({
10
11
  method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountCreated}`),
@@ -13,6 +14,19 @@ exports.AccountCreatedEventStruct = (0, superstruct_1.object)({
13
14
  * New account object.
14
15
  */
15
16
  account: api_1.KeyringAccountStruct,
17
+ /**
18
+ * Account name suggestion provided to the MetaMask client.
19
+ *
20
+ * The keyring can suggest a name for the account, but it's up to the
21
+ * client to decide whether to use it. The keyring won't be informed if the
22
+ * client decides to use a different name.
23
+ */
24
+ accountNameSuggestion: (0, superstruct_2.exactOptional)((0, superstruct_1.string)()),
25
+ /**
26
+ * Instructs MetaMask to display the add account confirmation dialog in the UI.
27
+ * **Note:** This is not guaranteed to be honored by the MetaMask client.
28
+ */
29
+ displayConfirmation: (0, superstruct_2.exactOptional)((0, superstruct_1.boolean)()),
16
30
  }),
17
31
  });
18
32
  exports.AccountUpdatedEventStruct = (0, superstruct_1.object)({
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,6CAA8C;AAE9C,gCAA8C;AAC9C,sCAAyC;AACzC,oCAAsC;AAEzB,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;QAEd;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { JsonStruct } from '@metamask/utils';\nimport { literal, object } from 'superstruct';\n\nimport { KeyringAccountStruct } from '../api';\nimport { KeyringEvent } from '../events';\nimport { UuidStruct } from '../utils';\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,6CAA+D;AAE/D,gCAA8C;AAC9C,sCAAyC;AACzC,gDAA+C;AAC/C,oCAAsC;AAEzB,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;QAEd;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { JsonStruct } from '@metamask/utils';\nimport { boolean, literal, object, string } from 'superstruct';\n\nimport { KeyringAccountStruct } from '../api';\nimport { KeyringEvent } from '../events';\nimport { exactOptional } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/keyring-api",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -38,7 +38,7 @@
38
38
  "test:watch": "jest --watch"
39
39
  },
40
40
  "dependencies": {
41
- "@metamask/snaps-sdk": "^4.0.0",
41
+ "@metamask/snaps-sdk": "^4.2.0",
42
42
  "@metamask/utils": "^8.3.0",
43
43
  "@types/uuid": "^9.0.1",
44
44
  "bech32": "^2.0.0",
@@ -46,7 +46,7 @@
46
46
  "uuid": "^9.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@lavamoat/allow-scripts": "^2.3.1",
49
+ "@lavamoat/allow-scripts": "^3.0.4",
50
50
  "@lavamoat/preinstall-always-fail": "^1.0.0",
51
51
  "@metamask/auto-changelog": "^3.1.0",
52
52
  "@metamask/eslint-config": "^12.1.0",