Hey, I could keep due with some help, Im trying to set up a Web3auth instance to support Solana wallets via the “default-solana-adapter” but I keep getting this error:
“WalletLoginError: Failed to connect with wallet. Chain null not supported. Supported chains are solana:mainnet, solana:devnet, solana:testnet
at WalletLoginError.fromCode (index.js:133:1)
at WalletLoginError.connectionError (index.js:136:1)
at WalletStandardAdapter.connect (walletStandardAdapter.js:69:89)”
It happens whenever I click on any recognized and injected Solana wallet in the Modal
A full breakdown of my ContextConfig
// Chain config for Solana
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.SOLANA,
chainId: "solana:devnet",
rpcTarget: "https://api.devnet.solana.com",
displayName: "Solana Devnet",
blockExplorer: "https://explorer.solana.com/?cluster=devnet",
ticker: "SOL",
tickerName: "Solana"
};
// Initialize private key provider
const privateKeyProvider = new SolanaPrivateKeyProvider({
config: { chainConfig }
});
// Web3Auth Options
const web3AuthOptions: Web3AuthOptions = {
clientId,
web3AuthNetwork: "sapphire_devnet" as WEB3AUTH_NETWORK_TYPE,
chainConfig,
enableLogging: true,
sessionTime: 3600 * 7,
privateKeyProvider,
storageKey: "local",
uiConfig: {
theme: "dark",
loginMethodsOrder: ["google", "facebook", "twitter"],
defaultLanguage: "en",
}
};
// External Adapters
const ExternalAdapters = {
clientId,
chainConfig,
web3AuthNetwork: "sapphire_devnet" as WEB3AUTH_NETWORK_TYPE,
};
// Initialize Auth Adapter (formerly OpenloginAdapter)
const authAdapter = new AuthAdapter({
adapterSettings: {
chainConfig: chainConfig,
network: "sapphire_devnet" as WEB3AUTH_NETWORK_TYPE,
uxMode: UX_MODE.POPUP,
mfaLevel: MFA_LEVELS.OPTIONAL,
whiteLabel: {
logoLight: process.env.NEXT_PUBLIC_WEB3AUTH_LOGO_URL,
logoDark: process.env.NEXT_PUBLIC_WEB3AUTH_LOGO_URL,
defaultLanguage: "en",
dark: true
}
}
});
const adapters = getDefaultExternalAdapters({ options: ExternalAdapters });
// Web3Auth Context Configuration
export const web3AuthConfig: Web3AuthContextConfig = {
web3AuthOptions,
modalConfig: {
[WALLET_ADAPTERS.AUTH]: {
label: "auth",
showOnModal: true,
loginMethods: {
google: {
name: "google",
showOnModal: true,
},
facebook: {
name: "facebook",
showOnModal: true,
},
twitter: {
name: "twitter",
showOnModal: true,
}
}
}
},
adapters: [authAdapter, ...adapters]
};
-
SDK Version(package.json):
“@web3auth/auth-adapter”: “^9.6.0”,
“@web3auth/base”: “^9.6.0”,
“@web3auth/modal”: “^9.6.0”,
“@web3auth/modal-react-hooks”: “^9.6.0”,
“@web3auth/default-solana-adapter”: “^9.6.0”,
“@web3auth/solana-provider”: “^9.6.0”, -
Platform:
-
Framework: Next.js 13+ (App Router)
-
Web3Auth Version: v9.6.0
-
React: 18
-
TypeScript: 5.x
-
Browser Console Screenshots: