Hi!
I am using @web3auth/no-modal-react-hooks and I need to implement a switch from Polygon to Solana, as my application supports multichain. However, when I click on
<button onClick={() => addAndSwitchChain(solanaTestnetChainConfig)}>
Add and Switch Chain
</button>
const solanaTestnetChainConfig: CustomChainConfig = {
chainNamespace: CHAIN_NAMESPACES.SOLANA,
chainId: "0x2",
rpcTarget: "",
displayName: "Solana TestNet",
blockExplorerUrl: "",
ticker: "SOL",
tickerName: "Solana",
};
I get an error: undefined, This adapter doesn’t support this chainNamespace. WalletOperationsError: undefined, This adapter doesn’t support this chainNamespace.
Question: How can I switch from Polygon to Solana?
My Web3AuthProviderConfig
const privateKeyProvider = new EthereumPrivateKeyProvider({
config: {
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x13882",
rpcTarget: mumbaiRpcUrl,
blockExplorerUrl: "",
displayName: "Polygon Testnet",
ticker: "MATIC",
tickerName: "Matic",
},
},
});
const web3AuthOptions: IWeb3AuthCoreOptions = {
clientId,
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x13882",
rpcTarget: mumbaiRpcUrl,
blockExplorerUrl: "",
displayName: "Polygon Testnet",
ticker: "MATIC",
tickerName: "Matic",
},
web3AuthNetwork: "sapphire_devnet",
privateKeyProvider,
};
const openloginAdapter = new OpenloginAdapter({
privateKeyProvider: privateKeyProvider,
adapterSettings: {
loginConfig: {
google: {
....
},
},
},
});
const web3AuthContextConfig = {
web3AuthOptions,
adapters: [openloginAdapter],
};
Versions:
"@web3auth/base": "^8.6.2",
"@web3auth/ethereum-provider": "^8.6.2",
"@web3auth/no-modal": "^8.6.2",
"@web3auth/no-modal-react-hooks": "^8.6.2",
"@web3auth/openlogin-adapter": "^8.6.2",
"@web3auth/solana-provider": "^8.6.2",