Skip to content

Commit b84ab30

Browse files
committed
refactor: use #getSessionState
1 parent 7643139 commit b84ab30

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/keyring-controller/src/KeyringController.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export type SerializedKeyring = {
324324
/**
325325
* State/data that can be updated during a `withKeyring` operation.
326326
*/
327-
type UpdatableState = {
327+
type SessionState = {
328328
keyrings: SerializedKeyring[];
329329
keyringsMetadata: KeyringMetadata[];
330330
password?: string;
@@ -2167,13 +2167,14 @@ export class KeyringController extends BaseController<
21672167
* @returns An object with serialized keyrings, keyrings metadata,
21682168
* and the user password.
21692169
*/
2170-
async #getControllerSessionState(): Promise<SessionState> {
2170+
async #getSessionState(): Promise<SessionState> {
21712171
return {
21722172
keyrings: await this.#getSerializedKeyrings(),
21732173
keyringsMetadata: this.#keyringsMetadata.slice(), // Force copy.
21742174
password: this.#password,
21752175
};
21762176
}
2177+
21772178
/**
21782179
* Restore a serialized keyrings array.
21792180
*
@@ -2655,9 +2656,9 @@ export class KeyringController extends BaseController<
26552656
callback: MutuallyExclusiveCallback<Result>,
26562657
): Promise<Result> {
26572658
return this.#withRollback(async ({ releaseLock }) => {
2658-
const oldState = await this.#getUpdatableState();
2659+
const oldState = await this.#getSessionState();
26592660
const callbackResult = await callback({ releaseLock });
2660-
const newState = await this.#getUpdatableState();
2661+
const newState = await this.#getSessionState();
26612662

26622663
// State is committed only if the operation is successful and need to trigger a vault update.
26632664
if (!isEqual(oldState, newState)) {

0 commit comments

Comments
 (0)