File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212- Add ` assertIsBip44Account ` ([ #339 ] ( https://github.com/MetaMask/accounts/pull/339 ) )
1313
14+ ### Changed
15+
16+ - ** BREAKING:** Move ` get ` and ` select ` methods to the ` AccountGroup ` type ([ #343 ] ( https://github.com/MetaMask/accounts/pull/343 ) )
17+
1418## [ 0.7.0]
1519
1620### Added
Original file line number Diff line number Diff line change 11import type { KeyringAccount } from '@metamask/keyring-api' ;
22
33// Circular import are allowed when using `import type`.
4+ import type { AccountSelector } from './selector' ;
45import type {
56 AccountWallet ,
67 AccountWalletId ,
@@ -67,6 +68,23 @@ export type AccountGroup<Account extends KeyringAccount> = {
6768 * @returns The account or undefined if not found.
6869 */
6970 getAccount ( id : Account [ 'id' ] ) : Account | undefined ;
71+
72+ /**
73+ * Query an account matching the selector.
74+ *
75+ * @param selector - Query selector.
76+ * @returns The account matching the selector or undefined if not matching.
77+ * @throws If multiple accounts match the selector.
78+ */
79+ get ( selector : AccountSelector < Account > ) : Account | undefined ;
80+
81+ /**
82+ * Query accounts matching the selector.
83+ *
84+ * @param selector - Query selector.
85+ * @returns The accounts matching the selector.
86+ */
87+ select ( selector : AccountSelector < Account > ) : Account [ ] ;
7088} ;
7189
7290/**
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import type {
66} from './wallet' ;
77import type { Bip44Account } from '../bip44' ;
88import type { AccountGroup , AccountGroupType } from '../group' ;
9- import type { AccountSelector } from '../selector' ;
109import { AccountWalletType } from '../wallet' ;
1110
1211const MULTICHAIN_ACCOUNT_GROUP_ID_REGEX = new RegExp (
@@ -44,23 +43,6 @@ export type MultichainAccountGroup<
4443 * Multichain account group index.
4544 */
4645 get index ( ) : number ;
47-
48- /**
49- * Query an account matching the selector.
50- *
51- * @param selector - Query selector.
52- * @returns The account matching the selector or undefined if not matching.
53- * @throws If multiple accounts match the selector.
54- */
55- get ( selector : AccountSelector < Account > ) : Account | undefined ;
56-
57- /**
58- * Query accounts matching the selector.
59- *
60- * @param selector - Query selector.
61- * @returns The accounts matching the selector.
62- */
63- select ( selector : AccountSelector < Account > ) : Account [ ] ;
6446} ;
6547
6648/**
You can’t perform that action at this time.
0 commit comments