Skip to content

Commit

Permalink
make internal function public
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1995 committed Sep 11, 2023
1 parent da89ba0 commit f653328
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions packages/providers/base-provider/src/baseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ export abstract class BaseProvider<C extends BaseProviderConfig, S extends BaseP
return chainConfig;
}

protected getProviderEngineProxy(): SafeEventEmitterProvider | null {
return this._providerEngineProxy;
}

protected updateProviderEngineProxy(provider: SafeEventEmitterProvider) {
public updateProviderEngineProxy(provider: SafeEventEmitterProvider): void {
if (this._providerEngineProxy) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this._providerEngineProxy as any).setTarget(provider);
Expand All @@ -127,6 +123,10 @@ export abstract class BaseProvider<C extends BaseProviderConfig, S extends BaseP
}
}

protected getProviderEngineProxy(): SafeEventEmitterProvider | null {
return this._providerEngineProxy;
}

abstract setupProvider(provider: P): Promise<void>;

abstract switchChain(params: { chainId: string }): Promise<void>;
Expand Down
18 changes: 9 additions & 9 deletions packages/providers/base-provider/src/commonPrivateKeyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ export class CommonPrivateKeyProvider extends BaseProvider<BaseProviderConfig, C
this.updateProviderEngineProxy(provider);
}

public updateProviderEngineProxy(provider: SafeEventEmitterProvider) {
if (this._providerEngineProxy) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this._providerEngineProxy as any).setTarget(provider);
} else {
this._providerEngineProxy = createEventEmitterProxy<SafeEventEmitterProvider>(provider);
}
}

public async switchChain(_: { chainId: string }): Promise<void> {
return Promise.resolve();
}
Expand All @@ -69,15 +78,6 @@ export class CommonPrivateKeyProvider extends BaseProvider<BaseProviderConfig, C
return Promise.resolve("");
}

protected updateProviderEngineProxy(provider: SafeEventEmitterProvider) {
if (this._providerEngineProxy) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this._providerEngineProxy as any).setTarget(provider);
} else {
this._providerEngineProxy = createEventEmitterProxy<SafeEventEmitterProvider>(provider);
}
}

private getPrivKeyMiddleware(privKey: string): JRPCMiddleware<unknown, unknown> {
const middleware = {
getPrivatekey: async (): Promise<string> => {
Expand Down

0 comments on commit f653328

Please sign in to comment.