File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,18 @@ describe('Wallet', () => {
4646 } ) ;
4747 } ) ;
4848
49+ it ( 'exposes instances' , async ( ) => {
50+ const wallet = await setupWallet ( ) ;
51+
52+ expect ( wallet . getInstance ( 'KeyringController' ) . state ) . toStrictEqual ( {
53+ isUnlocked : true ,
54+ keyrings : expect . any ( Array ) ,
55+ encryptionKey : expect . any ( String ) ,
56+ encryptionSalt : expect . any ( String ) ,
57+ vault : expect . any ( String ) ,
58+ } ) ;
59+ } ) ;
60+
4961 it ( 'supports passing instance options' , async ( ) => {
5062 const wallet = new Wallet ( {
5163 instanceOptions : {
Original file line number Diff line number Diff line change @@ -61,6 +61,17 @@ export class Wallet {
6161 return this . #controllerMetadata;
6262 }
6363
64+ /**
65+ * Get an instantiated controller or service.
66+ *
67+ * @param name - The name.
68+ * @returns - The instance.
69+ * @deprecated - Please use the messenger instead of direct access.
70+ */
71+ getInstance ( name : keyof DefaultInstances ) {
72+ return this . #instances[ name ] ;
73+ }
74+
6475 async destroy ( ) : Promise < void > {
6576 if ( this . #destroyed) {
6677 return ;
You can’t perform that action at this time.
0 commit comments