SDK Version: 6.1.2
Hi there,
i believe there is a bug in the init function of NoModal class.
In case an error is being thrown during the adapter initialization, it is being caught but not being thrown again. which can cause an unstable state where the adapter status is still not ready but you are setting the status of NoModal to ready ( see below)
public async init(): Promise<void> {
const initPromises = Object.keys(this.walletAdapters).map((adapterName) => {
this.subscribeToAdapterEvents(this.walletAdapters[adapterName]);
// if adapter doesn't have any chain config yet thn set it based on provided namespace and chainId.
// if no chainNamespace or chainId is being provided, it will connect with mainnet.
if (!this.walletAdapters[adapterName].chainConfigProxy) {
const providedChainConfig = this.coreOptions.chainConfig;
if (!providedChainConfig.chainNamespace) throw WalletInitializationError.invalidParams("Please provide chainNamespace in chainConfig");
this.walletAdapters[adapterName].setAdapterSettings({
chainConfig: providedChainConfig,
sessionTime: this.coreOptions.sessionTime,
clientId: this.coreOptions.clientId,
web3AuthNetwork: this.coreOptions.web3AuthNetwork,
useCoreKitKey: this.coreOptions.useCoreKitKey,
});
} else {
this.walletAdapters[adapterName].setAdapterSettings({
sessionTime: this.coreOptions.sessionTime,
clientId: this.coreOptions.clientId,
web3AuthNetwork: this.coreOptions.web3AuthNetwork,
useCoreKitKey: this.coreOptions.useCoreKitKey,
});
}
// ***** YOU ARE CATCHING THE ERROR BUT NOT THROWING IT AGAIN *****
return this.walletAdapters[adapterName].init({ autoConnect: this.cachedAdapter === adapterName }).catch((e) => log.error(e));
});
this.status = ADAPTER_STATUS.READY;
await Promise.all(initPromises);
}