Skip to content

Commit

Permalink
chore(26921): bump @metamask/address-book-controller to 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DDDDDanica committed Sep 12, 2024
1 parent a61b938 commit 1cd2fed
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
10 changes: 5 additions & 5 deletions app/scripts/lib/AddressBookPetnamesBridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@metamask/name-controller';
import {
AddressBookController,
AddressBookState,
AddressBookControllerState,
} from '@metamask/address-book-controller';
import { AddressBookPetnamesBridge } from './AddressBookPetnamesBridge';
import { PetnamesBridgeMessenger } from './AbstractPetnamesBridge';
Expand All @@ -18,10 +18,10 @@ const NAME_2_MOCK = 'testName2';
const CHAIN_ID_MOCK = '0x1';

function createAddressBookControllerMock(
state: AddressBookState,
state: AddressBookControllerState,
): jest.Mocked<AddressBookController> & {
// Override the definition of state. Otherwise state is readonly.
state: AddressBookState;
state: AddressBookControllerState;
} {
return {
state,
Expand Down Expand Up @@ -81,7 +81,7 @@ function createNameState(address: string, name: string): NameControllerState {
};
}

const EMPTY_ADDRESS_BOOK_STATE: AddressBookState = {
const EMPTY_ADDRESS_BOOK_STATE: AddressBookControllerState = {
addressBook: {},
};

Expand All @@ -96,7 +96,7 @@ function createAddressBookState(
address: string,
name: string,
isEns: boolean,
): AddressBookState {
): AddressBookControllerState {
return {
...EMPTY_ADDRESS_BOOK_STATE,
addressBook: {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/lib/AddressBookPetnamesBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ export class AddressBookPetnamesBridge extends AbstractPetnamesBridge {
* @override
*/
onSourceChange(listener: () => void): void {
this.#addressBookController.subscribe(listener);
this.messenger.subscribe('AddressBookController:stateChange', listener);
}
}
16 changes: 12 additions & 4 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1674,10 +1674,17 @@ export default class MetamaskController extends EventEmitter {
),
});

this.addressBookController = new AddressBookController(
undefined,
initState.AddressBookController,
);
const addressBookControllerMessenger =
this.controllerMessenger.getRestricted({
name: 'AddressBookController',
allowedActions: [],
allowedEvents: [],
});

this.addressBookController = new AddressBookController({
messenger: addressBookControllerMessenger,
state: initState.AddressBookController,
});

this.alertController = new AlertController({
initState: initState.AlertController,
Expand Down Expand Up @@ -2082,6 +2089,7 @@ export default class MetamaskController extends EventEmitter {
allowedEvents: [
'NameController:stateChange',
'AccountsController:stateChange',
'AddressBookController:stateChange',
],
allowedActions: ['AccountsController:listAccounts'],
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
"@metamask/abi-utils": "^2.0.2",
"@metamask/account-watcher": "^4.1.0",
"@metamask/accounts-controller": "^18.1.0",
"@metamask/address-book-controller": "^5.0.0",
"@metamask/address-book-controller": "^6.0.0",
"@metamask/announcement-controller": "^7.0.0",
"@metamask/approval-controller": "^7.0.0",
"@metamask/assets-controllers": "^36.0.0",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4775,14 +4775,14 @@ __metadata:
languageName: node
linkType: hard

"@metamask/address-book-controller@npm:^5.0.0":
version: 5.0.0
resolution: "@metamask/address-book-controller@npm:5.0.0"
"@metamask/address-book-controller@npm:^6.0.0":
version: 6.0.0
resolution: "@metamask/address-book-controller@npm:6.0.0"
dependencies:
"@metamask/base-controller": "npm:^6.0.0"
"@metamask/controller-utils": "npm:^11.0.0"
"@metamask/utils": "npm:^8.3.0"
checksum: 10/f4f3ec2c569457243cc4771c2d146a91227114431ecf8bb0d74e42b2e93fcc4d10545c32f865c918c9f1586379016d3ea2d7f2bc056a6b10b6cfd985f2b3c432
"@metamask/base-controller": "npm:^7.0.0"
"@metamask/controller-utils": "npm:^11.2.0"
"@metamask/utils": "npm:^9.1.0"
checksum: 10/e699b97fc798a363390d673b766737dc10f82a1eefcf119823d8f4370846d6708b3b2eadd177c8b2cb826afa7e38b51cf978a0d55cd51e92e7a9ffe83f5f0803
languageName: node
linkType: hard

Expand Down Expand Up @@ -26100,7 +26100,7 @@ __metadata:
"@metamask/abi-utils": "npm:^2.0.2"
"@metamask/account-watcher": "npm:^4.1.0"
"@metamask/accounts-controller": "npm:^18.1.0"
"@metamask/address-book-controller": "npm:^5.0.0"
"@metamask/address-book-controller": "npm:^6.0.0"
"@metamask/announcement-controller": "npm:^7.0.0"
"@metamask/api-specs": "npm:^0.9.3"
"@metamask/approval-controller": "npm:^7.0.0"
Expand Down

0 comments on commit 1cd2fed

Please sign in to comment.