When asking for help in this category, please make sure to provide the following details:
- SDK Version(package.json): 8.0.1
- Platform: NextJS
- Browser Console Screenshots:
Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.
I want to know three things:
-
Why do we have to verify the appPubKey server-side? Or the external wallet address that a user connects to? If it’s already embedded in the JWT that anyone can decode, what’s the purpose in this case?
-
Can we add custom adapters? I’m looking to see if it would be possible to support Station Wallet.
-
Is there a procedure to swap chains after the modal has been inited? I’m currently trying to use a constructor like this:
export type ChainConfig = {
ethereum: CustomChainConfig;
solana: CustomChainConfig;
};
type ChainProvider = {
ethereum: typeof EthereumPrivateKeyProvider;
solana: typeof SolanaPrivateKeyProvider;
};
type Adapters = {
openlogin: typeof OpenloginAdapter;
metamask: typeof MetamaskAdapter;
phantom: typeof PhantomAdapter;
};
...
constructor(clientId: string, chain: keyof ChainConfig) {
this.clientId = clientId;
const ChainProviderClass = this.chainProvider[chain];
try {
this.web3auth = new Web3Auth({
clientId: this.clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
privateKeyProvider: new ChainProviderClass({
config: { chainConfig: this.chainConfig[chain] },
}),
});
} catch (e) {
throw new SDKInitializationError(
"Error initializing Web3Auth object" + e
);
}
this.configureAdapter(chain);
}
If I initialize the Web3Auth to Solana, and then later try to initialize another Web3Auth object with Ethereum, I get an error that the adapter Phantom is not configured. More specifically from this line: throw WalletInitializationError.invalidParams(
Adapter ${adapterName} is not configured);
. I’m not passing any arguments to initModal(), could this be the cause?
Or this is a dead end and I should just hard lock the user flow after he’s chosen a chain?