From 5f9ebbf9f58bf4635a3a55108eb22881c1b87b74 Mon Sep 17 00:00:00 2001 From: Archit Date: Tue, 16 Apr 2024 14:31:29 +0530 Subject: [PATCH] fixes wallet connect id check --- .../adapters/default-evm-adapter/src/index.ts | 5 +---- packages/modal/src/modalManager.ts | 16 +++++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/adapters/default-evm-adapter/src/index.ts b/packages/adapters/default-evm-adapter/src/index.ts index aa793692e..85a024497 100644 --- a/packages/adapters/default-evm-adapter/src/index.ts +++ b/packages/adapters/default-evm-adapter/src/index.ts @@ -25,10 +25,7 @@ export const getDefaultExternalAdapters = async (params: { options: Web3AuthNoMo web3AuthNetwork, useCoreKitKey, adapterSettings: { - walletConnectInitOptions: { - // Using a default wallet connect project id for web3auth modal integration - projectId: "d3c63f19f9582f8ba48e982057eb096b", - }, + walletConnectInitOptions: {}, }, }); diff --git a/packages/modal/src/modalManager.ts b/packages/modal/src/modalManager.ts index 2ead652be..05fdf7e81 100644 --- a/packages/modal/src/modalManager.ts +++ b/packages/modal/src/modalManager.ts @@ -241,16 +241,18 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal { } as Record; this.modalConfig.adapters[WALLET_ADAPTERS.WALLET_CONNECT_V2].showOnModal = false; } else { - if (!walletConnectProjectId) + if (!walletConnectAdapter?.adapterOptions?.adapterSettings?.walletConnectInitOptions?.projectId && !walletConnectProjectId) throw WalletInitializationError.invalidParams("Invalid wallet connect project id. Please configure it on the dashboard"); - walletConnectAdapter.setAdapterSettings({ - adapterSettings: { - walletConnectInitOptions: { - projectId: walletConnectProjectId, + if (walletConnectProjectId) { + walletConnectAdapter.setAdapterSettings({ + adapterSettings: { + walletConnectInitOptions: { + projectId: walletConnectProjectId, + }, }, - }, - }); + }); + } } }