Skip to content

Commit 466e167

Browse files
committed
Merge branch 'mikesposito/messenger/approval-controller' into mikesposito/messenger/polling-controllers
2 parents cb415e8 + 0e9ca2d commit 466e167

File tree

17 files changed

+117
-26
lines changed

17 files changed

+117
-26
lines changed

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ npmMinimalAgeGate: 4320 # 3 days (in minutes)
2424
# regardless of their publish age.
2525
npmPreapprovedPackages:
2626
- "@metamask/*"
27+
- "@metamask-previews/*"
2728
- "@lavamoat/*"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/core-monorepo",
3-
"version": "638.0.0",
3+
"version": "639.0.0",
44
"private": true,
55
"description": "Monorepo for packages shared between MetaMask clients",
66
"repository": {

packages/accounts-controller/CHANGELOG.md

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

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add a `getAccounts` method (and its associated action) that is the plural version of `getAccount` ([#6927](https://github.com/MetaMask/core/pull/6927))
13+
- This method is added to primarily be consumed in the `MultichainAccountService`.
14+
1015
### Changed
1116

1217
- Bump `@metamask/base-controller` from `^8.4.1` to `^8.4.2` ([#6917](https://github.com/MetaMask/core/pull/6917))

packages/accounts-controller/src/AccountsController.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,6 +2777,30 @@ describe('AccountsController', () => {
27772777
});
27782778
});
27792779

2780+
describe('getAccounts', () => {
2781+
it('returns a list of accounts based on the given account IDs', () => {
2782+
const { accountsController } = setupAccountsController({
2783+
initialState: {
2784+
internalAccounts: {
2785+
accounts: {
2786+
[mockAccount.id]: mockAccount,
2787+
[mockAccount2.id]: mockAccount2,
2788+
[mockAccount3.id]: mockAccount3,
2789+
},
2790+
selectedAccount: mockAccount.id,
2791+
},
2792+
},
2793+
});
2794+
2795+
const result = accountsController.getAccounts([
2796+
mockAccount.id,
2797+
mockAccount3.id,
2798+
]);
2799+
2800+
expect(result).toStrictEqual([mockAccount, mockAccount3]);
2801+
});
2802+
});
2803+
27802804
describe('getSelectedAccount', () => {
27812805
it.each([
27822806
{

packages/accounts-controller/src/AccountsController.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ export type AccountsControllerGetAccountAction = {
124124
handler: AccountsController['getAccount'];
125125
};
126126

127+
export type AccountsControllerGetAccountsAction = {
128+
type: `${typeof controllerName}:getAccounts`;
129+
handler: AccountsController['getAccounts'];
130+
};
131+
127132
export type AccountsControllerUpdateAccountMetadataAction = {
128133
type: `${typeof controllerName}:updateAccountMetadata`;
129134
handler: AccountsController['updateAccountMetadata'];
@@ -145,6 +150,7 @@ export type AccountsControllerActions =
145150
| AccountsControllerGetSelectedAccountAction
146151
| AccountsControllerGetNextAvailableAccountNameAction
147152
| AccountsControllerGetAccountAction
153+
| AccountsControllerGetAccountsAction
148154
| AccountsControllerGetSelectedMultichainAccountAction
149155
| AccountsControllerUpdateAccountMetadataAction;
150156

@@ -303,6 +309,16 @@ export class AccountsController extends BaseController<
303309
return this.state.internalAccounts.accounts[accountId];
304310
}
305311

312+
/**
313+
* Returns the internal account objects for the given account IDs, if they exist.
314+
*
315+
* @param accountIds - The IDs of the accounts to retrieve.
316+
* @returns The internal account objects, or undefined if the account(s) do not exist.
317+
*/
318+
getAccounts(accountIds: string[]): (InternalAccount | undefined)[] {
319+
return accountIds.map((accountId) => this.getAccount(accountId));
320+
}
321+
306322
/**
307323
* Returns an array of all evm internal accounts.
308324
*
@@ -1305,6 +1321,11 @@ export class AccountsController extends BaseController<
13051321
this.getAccount.bind(this),
13061322
);
13071323

1324+
this.messagingSystem.registerActionHandler(
1325+
`AccountsController:getAccounts`,
1326+
this.getAccounts.bind(this),
1327+
);
1328+
13081329
this.messagingSystem.registerActionHandler(
13091330
`AccountsController:updateAccountMetadata`,
13101331
this.updateAccountMetadata.bind(this),

packages/accounts-controller/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type {
1313
AccountsControllerGetAccountByAddressAction,
1414
AccountsControllerGetNextAvailableAccountNameAction,
1515
AccountsControllerGetAccountAction,
16+
AccountsControllerGetAccountsAction,
1617
AccountsControllerUpdateAccountMetadataAction,
1718
AllowedActions,
1819
AccountsControllerActions,

packages/assets-controllers/CHANGELOG.md

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

88
## [Unreleased]
99

10+
## [83.1.0]
11+
12+
### Added
13+
14+
- Add `Monad Mainnet` into `SUPPORTED_NETWORKS_ACCOUNTS_API_V4`
15+
16+
### Fixed
17+
18+
- Fix incorrect balance scan contract address for `Monad Mainnet`
19+
- Remove `Monad Mainnet` in `SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID` ([#6929](https://github.com/MetaMask/core/pull/6929))
20+
1021
## [83.0.0]
1122

1223
### Changed
@@ -2168,7 +2179,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21682179
21692180
- Use Ethers for AssetsContractController ([#845](https://github.com/MetaMask/core/pull/845))
21702181
2171-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
2182+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
2183+
[83.1.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
21722184
[83.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
21732185
[82.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
21742186
[81.0.1]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]

packages/assets-controllers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/assets-controllers",
3-
"version": "83.0.0",
3+
"version": "83.1.0",
44
"description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)",
55
"keywords": [
66
"MetaMask",

packages/assets-controllers/src/AssetsContractController.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ export const SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID = {
7171
'0x6aa75276052d96696134252587894ef5ffa520af',
7272
[SupportedTokenDetectionNetworks.moonriver]:
7373
'0x6aa75276052d96696134252587894ef5ffa520af',
74-
[SupportedTokenDetectionNetworks.monad_mainnet]:
75-
'0xC856736BFe4DcB217F6678Ff2C4D7A7939B29A88',
7674
} as const satisfies Record<Hex, string>;
7775

7876
export const STAKING_CONTRACT_ADDRESS_BY_CHAINID = {

packages/assets-controllers/src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export const SUPPORTED_NETWORKS_ACCOUNTS_API_V4 = [
1515
'0xa4b1', // 42161
1616
'0x82750', // 534352
1717
'0x531', // 1329
18+
'0x8f', // 143
1819
];

0 commit comments

Comments
 (0)