1- import { type EthereumProviderConfig } from "@toruslabs/ethereum -controllers" ;
1+ import { ProviderConfig } from "@toruslabs/base -controllers" ;
22import { Auth , LOGIN_PROVIDER , LoginParams , SUPPORTED_KEY_CURVES , UX_MODE , WEB3AUTH_NETWORK } from "@web3auth/auth" ;
33import { type default as WsEmbed } from "@web3auth/ws-embed" ;
44import deepmerge from "deepmerge" ;
@@ -51,7 +51,7 @@ class AuthConnector extends BaseConnector<AuthLoginParams> {
5151
5252 private loginSettings : LoginSettings = { loginProvider : "" } ;
5353
54- private wsSettings : WalletServicesSettings = { } ;
54+ private wsSettings : WalletServicesSettings ;
5555
5656 private wsEmbedInstance : WsEmbed | null = null ;
5757
@@ -60,7 +60,7 @@ class AuthConnector extends BaseConnector<AuthLoginParams> {
6060
6161 this . authOptions = params . connectorSettings ;
6262 this . loginSettings = params . loginSettings || { loginProvider : "" } ;
63- this . wsSettings = params . walletServicesSettings || { } ;
63+ this . wsSettings = params . walletServicesSettings ;
6464 }
6565
6666 get provider ( ) : IProvider | null {
@@ -81,7 +81,9 @@ class AuthConnector extends BaseConnector<AuthLoginParams> {
8181 }
8282
8383 async init ( options : ConnectorInitOptions ) : Promise < void > {
84- const chainConfig = this . coreOptions . chains . find ( ( x ) => x . chainId === options . chainId ) ;
84+ const { chains } = this . coreOptions ;
85+ const { chainId } = options ;
86+ const chainConfig = chains . find ( ( x ) => x . chainId === chainId ) ;
8587
8688 super . checkInitializationRequirements ( { chainConfig } ) ;
8789 if ( ! this . coreOptions . clientId ) throw WalletInitializationError . invalidParams ( "clientId is required before auth's initialization" ) ;
@@ -113,10 +115,13 @@ class AuthConnector extends BaseConnector<AuthLoginParams> {
113115 web3AuthNetwork,
114116 modalZIndex : this . wsSettings . modalZIndex ,
115117 } ) ;
116- // TODO: once support multiple chains, only pass chains of solana and EVM
118+ const wsSupportedChains = chains . filter (
119+ ( x ) => x . chainNamespace === CHAIN_NAMESPACES . EIP155 || x . chainNamespace === CHAIN_NAMESPACES . SOLANA
120+ ) ;
117121 await this . wsEmbedInstance . init ( {
118122 ...this . wsSettings ,
119- chainConfig : chainConfig as EthereumProviderConfig , // TODO: upgrade ws-embed to support custom chain config
123+ chains : wsSupportedChains as ProviderConfig [ ] ,
124+ chainId,
120125 whiteLabel : {
121126 ...this . authOptions . whiteLabel ,
122127 ...this . wsSettings . whiteLabel ,
0 commit comments