@metamask-previews/account-api 0.12.0-feb98c5 → 1.0.0-fd40efd

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,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING:** Use new `createAccounts` options for `AccountsProvider.createAccounts` ([#462](https://github.com/MetaMask/accounts/pull/462))
15
+ - This will allow to use various ways of constructing accounts (e.g. multiple indexes at once).
16
+ - Bump `@metamask/keyring-api` to `^21.4.0` ([#460](https://github.com/MetaMask/accounts/pull/460))
17
+ - Bump `@metamask/keyring-utils` to `^7.2.0` ([#460](https://github.com/MetaMask/accounts/pull/460))
18
+
10
19
  ## [0.12.0]
11
20
 
12
21
  ### Changed
@@ -130,7 +139,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
130
139
 
131
140
  - Add `AccountGroup` and `AccountWallet` ([#307](https://github.com/MetaMask/accounts/pull/307))
132
141
 
133
- [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/account-api@0.12.0...HEAD
142
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/account-api@1.0.0...HEAD
143
+ [1.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/account-api@0.12.0...@metamask/account-api@1.0.0
134
144
  [0.12.0]: https://github.com/MetaMask/accounts/compare/@metamask/account-api@0.11.0...@metamask/account-api@0.12.0
135
145
  [0.11.0]: https://github.com/MetaMask/accounts/compare/@metamask/account-api@0.10.0...@metamask/account-api@0.11.0
136
146
  [0.10.0]: https://github.com/MetaMask/accounts/compare/@metamask/account-api@0.9.0...@metamask/account-api@0.10.0
@@ -1 +1 @@
1
- {"version":3,"file":"provider.cjs","sourceRoot":"","sources":["../../src/api/provider.ts"],"names":[],"mappings":"","sourcesContent":["import type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\n\nimport type { Bip44Account } from './bip44';\n\n/**\n * An account provider is reponsible of providing accounts to an account group.\n */\nexport type AccountProvider<Account extends KeyringAccount> = {\n /**\n * Gets an account for a given ID.\n *\n * @returns An account, or undefined if not found.\n */\n getAccount: (id: Account['id']) => Account | undefined;\n\n /**\n * Gets all accounts for this provider.\n *\n * @returns A list of all account for this provider.\n */\n getAccounts: () => Account[];\n\n /**\n * Creates accounts for a given entropy source and a given group\n * index.\n *\n * @param options - Options.\n * @param options.entropySource - Entropy source to use.\n * @param options.groupIndex - Group index to use.\n * @returns The list of created accounts.\n */\n createAccounts: (options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => Promise<Account[]>;\n\n /**\n * Discover accounts for a given entropy source and a given group\n * index.\n *\n * NOTE: This method needs to also create the discovered accounts.\n *\n * @param options - Options.\n * @param options.entropySource - Entropy source to use.\n * @param options.groupIndex - Group index to use.\n * @returns The list of discovered and created accounts.\n */\n discoverAccounts: (options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => Promise<Account[]>;\n};\n\n/**\n * A BIP-44 provider is a provider that can provide BIP-44 compatible accounts.\n *\n * Note: This is an alias for the `AccountProvider` type, but with a more specific\n * type for the account.\n */\nexport type Bip44AccountProvider = AccountProvider<\n Bip44Account<KeyringAccount>\n>;\n"]}
1
+ {"version":3,"file":"provider.cjs","sourceRoot":"","sources":["../../src/api/provider.ts"],"names":[],"mappings":"","sourcesContent":["import {\n type CreateAccountOptions,\n type EntropySourceId,\n type KeyringAccount,\n type KeyringCapabilities,\n} from '@metamask/keyring-api';\n\nimport type { Bip44Account } from './bip44';\n\n/**\n * An account provider is reponsible of providing accounts to an account group.\n */\nexport type AccountProvider<Account extends KeyringAccount> = {\n /**\n * Capabilities supported by this provider.\n */\n get capabilities(): KeyringCapabilities;\n\n /**\n * Gets an account for a given ID.\n *\n * @returns An account, or undefined if not found.\n */\n getAccount: (id: Account['id']) => Account | undefined;\n\n /**\n * Gets all accounts for this provider.\n *\n * @returns A list of all account for this provider.\n */\n getAccounts: () => Account[];\n\n /**\n * Creates accounts according to the given options.\n *\n * @param options - Create accounts options.\n * @returns The list of created accounts.\n */\n createAccounts: (options: CreateAccountOptions) => Promise<Account[]>;\n\n /**\n * Discover accounts for a given entropy source and a given group\n * index.\n *\n * NOTE: This method needs to also create the discovered accounts.\n *\n * @param options - Options.\n * @param options.entropySource - Entropy source to use.\n * @param options.groupIndex - Group index to use.\n * @returns The list of discovered and created accounts.\n */\n discoverAccounts: (options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => Promise<Account[]>;\n};\n\n/**\n * A BIP-44 provider is a provider that can provide BIP-44 compatible accounts.\n *\n * NOTE: This is an alias for the `AccountProvider` type, but with a more specific\n * type for the account.\n */\nexport type Bip44AccountProvider = AccountProvider<\n Bip44Account<KeyringAccount>\n>;\n"]}
@@ -1,9 +1,13 @@
1
- import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
1
+ import { type CreateAccountOptions, type EntropySourceId, type KeyringAccount, type KeyringCapabilities } from "@metamask/keyring-api";
2
2
  import type { Bip44Account } from "./bip44.cjs";
3
3
  /**
4
4
  * An account provider is reponsible of providing accounts to an account group.
5
5
  */
6
6
  export type AccountProvider<Account extends KeyringAccount> = {
7
+ /**
8
+ * Capabilities supported by this provider.
9
+ */
10
+ get capabilities(): KeyringCapabilities;
7
11
  /**
8
12
  * Gets an account for a given ID.
9
13
  *
@@ -17,18 +21,12 @@ export type AccountProvider<Account extends KeyringAccount> = {
17
21
  */
18
22
  getAccounts: () => Account[];
19
23
  /**
20
- * Creates accounts for a given entropy source and a given group
21
- * index.
24
+ * Creates accounts according to the given options.
22
25
  *
23
- * @param options - Options.
24
- * @param options.entropySource - Entropy source to use.
25
- * @param options.groupIndex - Group index to use.
26
+ * @param options - Create accounts options.
26
27
  * @returns The list of created accounts.
27
28
  */
28
- createAccounts: (options: {
29
- entropySource: EntropySourceId;
30
- groupIndex: number;
31
- }) => Promise<Account[]>;
29
+ createAccounts: (options: CreateAccountOptions) => Promise<Account[]>;
32
30
  /**
33
31
  * Discover accounts for a given entropy source and a given group
34
32
  * index.
@@ -48,7 +46,7 @@ export type AccountProvider<Account extends KeyringAccount> = {
48
46
  /**
49
47
  * A BIP-44 provider is a provider that can provide BIP-44 compatible accounts.
50
48
  *
51
- * Note: This is an alias for the `AccountProvider` type, but with a more specific
49
+ * NOTE: This is an alias for the `AccountProvider` type, but with a more specific
52
50
  * type for the account.
53
51
  */
54
52
  export type Bip44AccountProvider = AccountProvider<Bip44Account<KeyringAccount>>;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.cts","sourceRoot":"","sources":["../../src/api/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAE7E,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAE5C;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,cAAc,IAAI;IAC5D;;;;OAIG;IACH,UAAU,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,GAAG,SAAS,CAAC;IAEvD;;;;OAIG;IACH,WAAW,EAAE,MAAM,OAAO,EAAE,CAAC;IAE7B;;;;;;;;OAQG;IACH,cAAc,EAAE,CAAC,OAAO,EAAE;QACxB,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEzB;;;;;;;;;;OAUG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE;QAC1B,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAChD,YAAY,CAAC,cAAc,CAAC,CAC7B,CAAC"}
1
+ {"version":3,"file":"provider.d.cts","sourceRoot":"","sources":["../../src/api/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,8BAA8B;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAE5C;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,cAAc,IAAI;IAC5D;;OAEG;IACH,IAAI,YAAY,IAAI,mBAAmB,CAAC;IAExC;;;;OAIG;IACH,UAAU,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,GAAG,SAAS,CAAC;IAEvD;;;;OAIG;IACH,WAAW,EAAE,MAAM,OAAO,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,cAAc,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtE;;;;;;;;;;OAUG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE;QAC1B,aAAa,EAAE,eAAe,CAAC;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAChD,YAAY,CAAC,cAAc,CAAC,CAC7B,CAAC"}
@@ -1,9 +1,13 @@
1
- import type { EntropySourceId, KeyringAccount } from "@metamask/keyring-api";
1
+ import { type CreateAccountOptions, type EntropySourceId, type KeyringAccount, type KeyringCapabilities } from "@metamask/keyring-api";
2
2
  import type { Bip44Account } from "./bip44.mjs";
3
3
  /**
4
4
  * An account provider is reponsible of providing accounts to an account group.
5
5
  */
6
6
  export type AccountProvider<Account extends KeyringAccount> = {
7
+ /**
8
+ * Capabilities supported by this provider.
9
+ */
10
+ get capabilities(): KeyringCapabilities;
7
11
  /**
8
12
  * Gets an account for a given ID.
9
13
  *
@@ -17,18 +21,12 @@ export type AccountProvider<Account extends KeyringAccount> = {
17
21
  */
18
22
  getAccounts: () => Account[];
19
23
  /**
20
- * Creates accounts for a given entropy source and a given group
21
- * index.
24
+ * Creates accounts according to the given options.
22
25
  *
23
- * @param options - Options.
24
- * @param options.entropySource - Entropy source to use.
25
- * @param options.groupIndex - Group index to use.
26
+ * @param options - Create accounts options.
26
27
  * @returns The list of created accounts.
27
28
  */
28
- createAccounts: (options: {
29
- entropySource: EntropySourceId;
30
- groupIndex: number;
31
- }) => Promise<Account[]>;
29
+ createAccounts: (options: CreateAccountOptions) => Promise<Account[]>;
32
30
  /**
33
31
  * Discover accounts for a given entropy source and a given group
34
32
  * index.
@@ -48,7 +46,7 @@ export type AccountProvider<Account extends KeyringAccount> = {
48
46
  /**
49
47
  * A BIP-44 provider is a provider that can provide BIP-44 compatible accounts.
50
48
  *
51
- * Note: This is an alias for the `AccountProvider` type, but with a more specific
49
+ * NOTE: This is an alias for the `AccountProvider` type, but with a more specific
52
50
  * type for the account.
53
51
  */
54
52
  export type Bip44AccountProvider = AccountProvider<Bip44Account<KeyringAccount>>;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.mts","sourceRoot":"","sources":["../../src/api/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,8BAA8B;AAE7E,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;AAE5C;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,cAAc,IAAI;IAC5D;;;;OAIG;IACH,UAAU,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,GAAG,SAAS,CAAC;IAEvD;;;;OAIG;IACH,WAAW,EAAE,MAAM,OAAO,EAAE,CAAC;IAE7B;;;;;;;;OAQG;IACH,cAAc,EAAE,CAAC,OAAO,EAAE;QACxB,aAAa,EAAE,eAAe,CAAC;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CAAC,CAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider.mjs","sourceRoot":"","sources":["../../src/api/provider.ts"],"names":[],"mappings":"","sourcesContent":["import type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';\n\nimport type { Bip44Account } from './bip44';\n\n/**\n * An account provider is reponsible of providing accounts to an account group.\n */\nexport type AccountProvider<Account extends KeyringAccount> = {\n /**\n * Gets an account for a given ID.\n *\n * @returns An account, or undefined if not found.\n */\n getAccount: (id: Account['id']) => Account | undefined;\n\n /**\n * Gets all accounts for this provider.\n *\n * @returns A list of all account for this provider.\n */\n getAccounts: () => Account[];\n\n /**\n * Creates accounts for a given entropy source and a given group\n * index.\n *\n * @param options - Options.\n * @param options.entropySource - Entropy source to use.\n * @param options.groupIndex - Group index to use.\n * @returns The list of created accounts.\n */\n createAccounts: (options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => Promise<Account[]>;\n\n /**\n * Discover accounts for a given entropy source and a given group\n * index.\n *\n * NOTE: This method needs to also create the discovered accounts.\n *\n * @param options - Options.\n * @param options.entropySource - Entropy source to use.\n * @param options.groupIndex - Group index to use.\n * @returns The list of discovered and created accounts.\n */\n discoverAccounts: (options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => Promise<Account[]>;\n};\n\n/**\n * A BIP-44 provider is a provider that can provide BIP-44 compatible accounts.\n *\n * Note: This is an alias for the `AccountProvider` type, but with a more specific\n * type for the account.\n */\nexport type Bip44AccountProvider = AccountProvider<\n Bip44Account<KeyringAccount>\n>;\n"]}
1
+ {"version":3,"file":"provider.mjs","sourceRoot":"","sources":["../../src/api/provider.ts"],"names":[],"mappings":"","sourcesContent":["import {\n type CreateAccountOptions,\n type EntropySourceId,\n type KeyringAccount,\n type KeyringCapabilities,\n} from '@metamask/keyring-api';\n\nimport type { Bip44Account } from './bip44';\n\n/**\n * An account provider is reponsible of providing accounts to an account group.\n */\nexport type AccountProvider<Account extends KeyringAccount> = {\n /**\n * Capabilities supported by this provider.\n */\n get capabilities(): KeyringCapabilities;\n\n /**\n * Gets an account for a given ID.\n *\n * @returns An account, or undefined if not found.\n */\n getAccount: (id: Account['id']) => Account | undefined;\n\n /**\n * Gets all accounts for this provider.\n *\n * @returns A list of all account for this provider.\n */\n getAccounts: () => Account[];\n\n /**\n * Creates accounts according to the given options.\n *\n * @param options - Create accounts options.\n * @returns The list of created accounts.\n */\n createAccounts: (options: CreateAccountOptions) => Promise<Account[]>;\n\n /**\n * Discover accounts for a given entropy source and a given group\n * index.\n *\n * NOTE: This method needs to also create the discovered accounts.\n *\n * @param options - Options.\n * @param options.entropySource - Entropy source to use.\n * @param options.groupIndex - Group index to use.\n * @returns The list of discovered and created accounts.\n */\n discoverAccounts: (options: {\n entropySource: EntropySourceId;\n groupIndex: number;\n }) => Promise<Account[]>;\n};\n\n/**\n * A BIP-44 provider is a provider that can provide BIP-44 compatible accounts.\n *\n * NOTE: This is an alias for the `AccountProvider` type, but with a more specific\n * type for the account.\n */\nexport type Bip44AccountProvider = AccountProvider<\n Bip44Account<KeyringAccount>\n>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/account-api",
3
- "version": "0.12.0-feb98c5",
3
+ "version": "1.0.0-fd40efd",
4
4
  "description": "MetaMask Account API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -56,8 +56,8 @@
56
56
  "test:watch": "jest --watch"
57
57
  },
58
58
  "dependencies": {
59
- "@metamask/keyring-api": "21.3.0",
60
- "@metamask/keyring-utils": "3.1.0",
59
+ "@metamask/keyring-api": "21.5.0",
60
+ "@metamask/keyring-utils": "3.2.0",
61
61
  "uuid": "^9.0.1"
62
62
  },
63
63
  "devDependencies": {