Skip to content

Commit

Permalink
Improve custom providers
Browse files Browse the repository at this point in the history
  • Loading branch information
arhtudormorar committed Dec 5, 2024
1 parent bcfa723 commit d1b1d93
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
8 changes: 2 additions & 6 deletions src/core/methods/initApp/initApp.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IProvider } from 'core/providers/types/providerFactory.types';
import { ICustomProvider } from 'core/providers/types/providerFactory.types';
import { NativeAuthConfigType } from 'services/nativeAuth/nativeAuth.types';
import { StorageCallback } from 'store/storage';
import { EnvironmentsEnum } from 'types/enums.types';
Expand Down Expand Up @@ -50,9 +50,5 @@ export type InitAppType = {
getStorageCallback: StorageCallback;
};
dAppConfig: DappConfigType;
customProviders?: Array<{
name: string;
icon: string;
class: IProvider;
}>;
customProviders?: ICustomProvider[];
};
17 changes: 4 additions & 13 deletions src/core/providers/ProviderFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,16 @@ import { getConfig } from './helpers/getConfig';
import { createIframeProvider } from './helpers/iframe/createIframeProvider';
import { createLedgerProvider } from './helpers/ledger/createLedgerProvider';
import {
ICustomProvider,
IProvider,
IProviderFactory,
ProviderTypeEnum
} from './types/providerFactory.types';

export class ProviderFactory {
private static _customProviders: Array<{
name: string;
icon: string;
class: IProvider;
}> = [];

public static customProviders(
providers: {
name: string;
icon: string;
class: IProvider;
}[]
) {
private static _customProviders: ICustomProvider[] = [];

public static customProviders(providers: ICustomProvider[]) {
this._customProviders = providers;
}

Expand Down
6 changes: 6 additions & 0 deletions src/core/providers/types/providerFactory.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ export interface IProviderFactory {
type: ProviderTypeEnum;
config?: IProviderConfig;
}

export interface ICustomProvider {
name: string;
icon: string;
class: IProvider;
}

0 comments on commit d1b1d93

Please sign in to comment.