From 413fa8559a6b1886c32be7c2a815fbdaf149959b Mon Sep 17 00:00:00 2001 From: paouvrard Date: Thu, 30 May 2024 12:58:19 +0900 Subject: [PATCH] fix: WalletConnect commonjs support. --- packages/wallet-connect/src/lib/wallet-connect-client.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/wallet-connect/src/lib/wallet-connect-client.ts b/packages/wallet-connect/src/lib/wallet-connect-client.ts index c2c433b83..1f40e624b 100644 --- a/packages/wallet-connect/src/lib/wallet-connect-client.ts +++ b/packages/wallet-connect/src/lib/wallet-connect-client.ts @@ -1,6 +1,10 @@ import Client from "@walletconnect/sign-client"; import type { SignClientTypes, EngineTypes } from "@walletconnect/types"; -import { WalletConnectModal } from "@walletconnect/modal"; +// eslint-disable-next-line @typescript-eslint/consistent-type-imports +let WalletConnectModal: typeof import("@walletconnect/modal").WalletConnectModal; +import("@walletconnect/modal").then((module) => { + WalletConnectModal = module.WalletConnectModal; +}); import type { SessionTypes } from "@walletconnect/types"; import type { EventEmitterService, @@ -10,7 +14,7 @@ import type { class WalletConnectClient { private client: Client; private emitter: EventEmitterService; - private modal: WalletConnectModal; + private modal: typeof WalletConnectModal.prototype; async init(opts: SignClientTypes.Options) { this.client = await Client.init(opts);