Skip to content

Commit cdbb1f2

Browse files
committed
refactor: narrow Bip44AccountProvider
1 parent 5687bcc commit cdbb1f2

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

packages/account-api/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- **BREAKING:** Use new `createAccounts` options for `AccountsProvider.createAccounts` ([#462](https://github.com/MetaMask/accounts/pull/462))
13+
- This will allow to use various ways of constructing accounts (e.g. multiple indexes at once).
14+
- **BREAKING:** Narrow `Bip44AccountProvider.capabilities` to only allow BIP-44 compatible capabilities ([#462](https://github.com/MetaMask/accounts/pull/462))
15+
1016
## [0.12.0]
1117

1218
### Changed

packages/account-api/src/api/provider.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,17 @@ export type AccountProvider<Account extends KeyringAccount> = {
6262
/**
6363
* A BIP-44 provider is a provider that can provide BIP-44 compatible accounts.
6464
*
65-
* Note: This is an alias for the `AccountProvider` type, but with a more specific
66-
* type for the account.
65+
* NOTE: This is a narrow variant of the `AccountProvider` type for BIP-44.
6766
*/
68-
export type Bip44AccountProvider = AccountProvider<
69-
Bip44Account<KeyringAccount>
67+
export type Bip44AccountProvider = Omit<
68+
AccountProvider<Bip44Account<KeyringAccount>>,
69+
'capabilities'
7070
> & {
7171
/**
7272
* BIP-44 capabilities supported by this provider.
7373
*/
7474
get capabilities(): Bip44KeyringCapabilities;
7575

76-
/**
77-
* Creates BIP-44 compatible accounts according to the given options.
78-
*
79-
* @param options - Create accounts options.
80-
* @returns The list of created BIP-44 accounts.
81-
*/
82-
createAccounts: (
83-
options: Bip44CreateAccountOptions,
84-
) => Promise<Bip44Account<KeyringAccount>>[];
76+
// NOTE: We cannot narrow `createAccounts` here, otherwise it would become incompatible
77+
// with the `AccountProvider` type.
8578
};

0 commit comments

Comments
 (0)