Skip to content

Commit 56f4b2a

Browse files
committed
changes from review
1 parent 95b9566 commit 56f4b2a

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

index.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,15 @@ class KeyringController extends EventEmitter {
880880
}
881881
}
882882

883+
/**
884+
* Instantiate, initialize and return a new keyring
885+
*
886+
* The keyring instantiated is of the given `type`.
887+
*
888+
* @param {string} type - The type of keyring to add.
889+
* @param {Object} data - The data to restore a previously serialized keyring.
890+
* @returns {Promise<Keyring>} The new keyring.
891+
*/
883892
async _newKeyring(type, data) {
884893
const keyringBuilder = this.getKeyringBuilderForType(type);
885894

@@ -899,13 +908,18 @@ class KeyringController extends EventEmitter {
899908
}
900909
}
901910

902-
function keyringBuilderFactory(KeyringClass, BridgeClass) {
903-
const builder = () => {
904-
const constructorDependencies = BridgeClass ? new BridgeClass() : undefined;
905-
return new KeyringClass(constructorDependencies);
906-
};
911+
/**
912+
* Get builder function for `Keyring`
913+
*
914+
* Returns a builder function for `Keyring` with a `type` property.
915+
*
916+
* @param {typeof Keyring} Keyring - The Keyring class for the builder.
917+
* @returns {function: Keyring} A builder function for the given Keyring.
918+
*/
919+
function keyringBuilderFactory(Keyring) {
920+
const builder = () => new Keyring();
907921

908-
builder.type = KeyringClass.type;
922+
builder.type = Keyring.type;
909923

910924
return builder;
911925
}

0 commit comments

Comments
 (0)