From 8572b263b1f3bf9f3ca8a30a167801b4631ce483 Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Fri, 6 Dec 2024 10:40:34 +0200 Subject: [PATCH] Fix setting custom provider --- src/core/providers/ProviderFactory.ts | 4 ++-- .../helpers/crossWindow/createCrossWindowProvider.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/providers/ProviderFactory.ts b/src/core/providers/ProviderFactory.ts index aa37f76..44fd66e 100644 --- a/src/core/providers/ProviderFactory.ts +++ b/src/core/providers/ProviderFactory.ts @@ -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; } } diff --git a/src/core/providers/helpers/crossWindow/createCrossWindowProvider.ts b/src/core/providers/helpers/crossWindow/createCrossWindowProvider.ts index 80f5473..29b778f 100644 --- a/src/core/providers/helpers/crossWindow/createCrossWindowProvider.ts +++ b/src/core/providers/helpers/crossWindow/createCrossWindowProvider.ts @@ -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) {