Skip to content

Commit

Permalink
Fix create provider (#40)
Browse files Browse the repository at this point in the history
Prepare detectProvider
  • Loading branch information
arhtudormorar authored Dec 6, 2024
1 parent 660fb1c commit 15c1972
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/providers/ProviderFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ export class ProviderFactory {
}

default: {
this._customProviders.forEach(async (customProvider) => {
for (const customProvider of this._customProviders) {
if (customProvider.type === type) {
createdProvider = await customProvider.constructor(config);
createdProvider.getType = () => type;
}
});
}
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import { getState } from 'store/store';

interface ICreateCrossWindowProviderProps {
address?: string;
walletAddress?: string;
}

export async function createCrossWindowProvider({
address = ''
address = '',
walletAddress = ''
}: ICreateCrossWindowProviderProps) {
const network = networkSelector(getState());
const provider = CrossWindowProvider.getInstance();
await provider.init();
provider.setWalletUrl(String(network.walletAddress));
provider.setWalletUrl(walletAddress || network.walletAddress);
provider.setAddress(address);

if (isBrowserWithPopupConfirmation) {
Expand Down
15 changes: 14 additions & 1 deletion src/core/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
export { getAccountProvider } from './accountProvider';
export * from './helpers/ledger/getLedgerConfiguration';

/*
// TODO: create detectProvider function
(window as any).multiversx = {};
(window as any).multiversx.providers = [
{
name: "PEM",
icon: "",
class: (config) => {
return new PEMProvider(config);
},
},
];
*/

0 comments on commit 15c1972

Please sign in to comment.