1- import { StaticJsonRpcProvider } from '@ethersproject/providers'
1+ import type { StaticJsonRpcProvider as StaticJsonRpcProviderType } from '@ethersproject/providers'
22
3- import {
3+ import type {
44 Chain ,
55 ProviderAccounts ,
66 WalletInit ,
7- EIP1193Provider ,
8- ProviderRpcError ,
9- ProviderRpcErrorCode
7+ EIP1193Provider
108} from '@web3-onboard/common'
119
1210interface WalletConnectOptions {
@@ -25,12 +23,26 @@ function walletConnect(options?: WalletConnectOptions): WalletInit {
2523 label : 'WalletConnect' ,
2624 getIcon : async ( ) => ( await import ( './icon.js' ) ) . default ,
2725 getInterface : async ( { chains, EventEmitter } ) => {
28- const { default : WalletConnect } = await import ( '@walletconnect/client' )
26+ const { StaticJsonRpcProvider } = await import (
27+ '@ethersproject/providers'
28+ )
2929
30- const { default : QRCodeModal } = await import (
31- '@walletconnect/qrcode-modal '
30+ const { ProviderRpcError , ProviderRpcErrorCode } = await import (
31+ '@web3-onboard/common '
3232 )
3333
34+ const { default : WalletConnect } = await import ( '@walletconnect/client' )
35+
36+ // This is a cjs module and therefor depending on build tooling
37+ // sometimes it will be nested in the { default } object and
38+ // other times it will be the actual import
39+ // @ts -ignore - It thinks it is missing properties since it expect it to be nested under default
40+ let QRCodeModal : typeof import ( '@walletconnect/qrcode-modal' ) . default =
41+ await import ( '@walletconnect/qrcode-modal' )
42+
43+ // @ts -ignore - TS thinks that there is no default property on the `QRCodeModal` but sometimes there is
44+ QRCodeModal = QRCodeModal . default || QRCodeModal
45+
3446 const { Subject, fromEvent } = await import ( 'rxjs' )
3547 const { takeUntil, take } = await import ( 'rxjs/operators' )
3648
@@ -50,7 +62,7 @@ function walletConnect(options?: WalletConnectOptions): WalletInit {
5062 public removeListener : typeof EventEmitter [ 'removeListener' ]
5163
5264 private disconnected$ : InstanceType < typeof Subject >
53- private providers : Record < string , StaticJsonRpcProvider >
65+ private providers : Record < string , StaticJsonRpcProviderType >
5466
5567 constructor ( {
5668 connector,
0 commit comments