Thanks for sharing the details, Daniel! You’re migrating from Web3Auth v9 to v10 using the Plug and Play (PnP) Web SDK and want to set a custom RPC, but are running into two main issues:
chainNamespace issue
initModal is not a valid function in Web3Auth v10
Here’s a breakdown of what’s happening and how you can address it:
1. chainNamespace Issue
In v10, the SDK has introduced some breaking changes in how you configure chains and RPCs.
The chains configuration is now passed as an array, and the structure has changed.
The chainNamespace key is still used, but the way you define the chain and custom RPC is different.
v10 Example for Solana with Custom RPC:
import { Web3Auth } from "@web3auth/modal";
import { CHAIN_NAMESPACES } from "@web3auth/base";
const web3auth = new Web3Auth({
clientId: vars.clientId,
web3AuthNetwork: "mainnet",
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.SOLANA,
chainId: "0x1", // Solana mainnet chainId in hex
rpcTarget: vars.rpcTarget, // Your custom RPC endpoint
},
});
Make sure to use the correct chainId for Solana. For Solana, you can use "0x1" as a placeholder, but it’s mostly the chainNamespace and rpcTarget that matter.
Double-check your chainConfig values, especially chainNamespace and rpcTarget.
If you run into any more errors, please share the specific error messages and your updated code snippet. If possible, a screenshot of your console error would also help!
Let me know if this helps or if you have any other questions!
Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.
Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours