Skip to content

Commit

Permalink
Make #isUnlocked property non-optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Jan 24, 2024
1 parent 68533dd commit e217169
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/assets-controllers/src/TokenDetectionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class TokenDetectionController extends StaticIntervalPollingController<

#disabled: boolean;

#isUnlocked?: boolean;
#isUnlocked: boolean;

#isDetectionEnabledFromPreferences: boolean;

Expand Down Expand Up @@ -228,6 +228,11 @@ export class TokenDetectionController extends StaticIntervalPollingController<

this.#trackMetaMetricsEvent = trackMetaMetricsEvent;

const { isUnlocked } = this.messagingSystem.call(
'KeyringController:getState',
);
this.#isUnlocked = isUnlocked;

this.messagingSystem.subscribe(
'TokenListController:stateChange',
async ({ tokenList }) => {
Expand Down Expand Up @@ -325,11 +330,6 @@ export class TokenDetectionController extends StaticIntervalPollingController<
* to the keyring locked state changes
*/
async #registerKeyringListeners() {
const { isUnlocked } = this.messagingSystem.call(
'KeyringController:getState',
);
this.#isUnlocked = isUnlocked;

this.messagingSystem.subscribe('KeyringController:unlock', async () => {
this.#isUnlocked = true;
await this.#restartTokenDetection();
Expand Down

0 comments on commit e217169

Please sign in to comment.