<tbody><tr class="border-0">
<td id="L113" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="113"></td>
<td id="LC113" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">const</span> <span class="pl-kos">{</span> chainId <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">torusInstance</span><span class="pl-kos">.</span><span class="pl-c1">provider</span><span class="pl-kos">;</span> </td>
</tr>
</tbody></table>
It should be
const chainId = this.torusInstance.provider.chainId;
Because of this bug, torus asks for chain switch confirmation every time the user refreshes browser (i.e. when web3auth.init()
is called)
How to reproduce
- Go to https://app.vrynt.io/login
- Click
SIGN IN WITH...
button - Log in with google
- You will be redirected to https://app.vrynt.io/discover
- Reload the page
- Observe that it asks for chain switch confirmation
Web3auth init code
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export function getAVAXChainConfig(): CustomChainConfig { return { displayName: config.chainDisplayName, chainNamespace: CHAIN_NAMESPACES.EIP155, chainId: config.chainId, rpcTarget: config.rpcUrl, blockExplorer: config.blockExplorerUrl, ticker: "AVAX", tickerName: "Avalanche", }; }const web3auth = new Web3AuthCore({
clientId: config.web3AuthClientId,
chainConfig: getAVAXChainConfig(),
});
const torusAdapter = new TorusWalletAdapter({
sessionTime: 86400 * 7,
});
web3auth.configureAdapter(torusAdapter);
await web3auth.init();">
export function getAVAXChainConfig(): CustomChainConfig {
return {
displayName: config.chainDisplayName,
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: config.chainId,
rpcTarget: config.rpcUrl,
blockExplorer: config.blockExplorerUrl,
ticker: “AVAX”,
tickerName: “Avalanche”,
};
}
const web3auth = new Web3AuthCore({
clientId: config.web3AuthClientId,
chainConfig: getAVAXChainConfig(),
});
const torusAdapter = new TorusWalletAdapter({
sessionTime: 86400 * 7,
});
web3auth.configureAdapter(torusAdapter);
await web3auth.init();
Originally posted by: softcheetah
Check the discussion at: https://github.com/orgs/Web3Auth/discussions/1055