Skip to content

Commit 4390b9d

Browse files
committed
refactor: remove entropy rule match logic
1 parent 33052da commit 4390b9d

File tree

1 file changed

+3
-53
lines changed
  • packages/account-tree-controller/src/rules

1 file changed

+3
-53
lines changed

packages/account-tree-controller/src/rules/entropy.ts

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
import {
2-
AccountGroupType,
3-
AccountWalletType,
4-
isBip44Account,
5-
toMultichainAccountGroupId,
6-
toMultichainAccountWalletId,
7-
} from '@metamask/account-api';
1+
import { AccountGroupType, AccountWalletType } from '@metamask/account-api';
82
import { isEvmAccountType } from '@metamask/keyring-api';
93
import { KeyringTypes } from '@metamask/keyring-controller';
10-
import type { InternalAccount } from '@metamask/keyring-internal-api';
114

125
import type { AccountGroupObjectOf } from '../group';
136
import { BaseRule, type Rule, type RuleResult } from '../rule';
@@ -29,53 +22,10 @@ export class EntropyRule
2922
.findIndex((keyring) => keyring.metadata.id === entropySource);
3023
}
3124

32-
match(
33-
account: InternalAccount,
34-
):
25+
match():
3526
| RuleResult<AccountWalletType.Entropy, AccountGroupType.MultichainAccount>
3627
| undefined {
37-
if (!isBip44Account(account)) {
38-
return undefined;
39-
}
40-
41-
const entropySource = account.options.entropy.id;
42-
const entropySourceIndex = this.getEntropySourceIndex(entropySource);
43-
if (entropySourceIndex === -1) {
44-
console.warn(
45-
`! Found an unknown entropy ID: "${entropySource}", account "${account.id}" won't be grouped by entropy.`,
46-
);
47-
return undefined;
48-
}
49-
50-
const walletId = toMultichainAccountWalletId(entropySource);
51-
const groupId = toMultichainAccountGroupId(
52-
walletId,
53-
account.options.entropy.groupIndex,
54-
);
55-
56-
return {
57-
wallet: {
58-
type: this.walletType,
59-
id: walletId,
60-
metadata: {
61-
entropy: {
62-
id: entropySource,
63-
},
64-
},
65-
},
66-
67-
group: {
68-
type: this.groupType,
69-
id: groupId,
70-
metadata: {
71-
entropy: {
72-
groupIndex: account.options.entropy.groupIndex,
73-
},
74-
pinned: false,
75-
hidden: false,
76-
},
77-
},
78-
};
28+
throw new Error('Entropy rule is no longer supported');
7929
}
8030

8131
getDefaultAccountWalletName(

0 commit comments

Comments
 (0)