-
Describe your issue or question:
-
Which platform or framework are you using:VUe2?
-
Prevoioulsy using @web3auth/auth-adapter 9.7.0, @web3auth/no-modal 9.7.0, @web3auth/auth-adapater 9.7.0, migrating to @web3auth/modal 10.5.4 and @web3auth/ethereum-provider:9.7.0 ?
-
What is not working as expected? I can not initialize web3auth although i am following the steps in your migration guide
-
-
Code snippets:
‘import { Web3Auth, WEB3AUTH_NETWORK, CHAIN_NAMESPACES } from ‘@web3auth/modal’;
import { EthereumPrivateKeyProvider } from '@web3auth/ethereum-provider
async initWeb3Auth() {
try {
const clientId = process.env.VUE_APP_CLIENT_ID;
const blockExplorer = this.chainId === 31 ? ‘https://explorer.testnet.rsk.co/’ : ‘https://explorer.rsk.co/’;
const ticker = this.chainId === 31 ? ‘tRBTC’ : ‘RBTC’;
const tickerName = this.chainId === 31 ? ‘rBTC Testnet’ : ‘rBTC Mainnet’;
const rpcTarget = this.chainId === 31
? process.env.VUE_APP_RSK_NODE_TESTNET : process.env.VUE_APP_RSK_NODE;
const displayName = this.chainId === 31 ? ‘RSK Testnet’ : ‘RSK Mainnet’;
const chainIdValue = this.chainId === 31 ? ‘0x1f’ : ‘0x1E’;
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: chainIdValue,
rpcTarget,
displayName,
blockExplorer,
ticker,
tickerName,
};
const privateKeyProvider = new EthereumPrivateKeyProvider({
config: { chainConfig },
});
const web3AuthOptions = {
clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.MAINNET,
privateKeyProvider,
};
const web3AuthInstance = new Web3Auth(web3AuthOptions);
await web3AuthInstance.init();
this.setWeb3AuthInstance(web3AuthInstance);
} catch (error) {
console.error('error: ', error);
}
},
';
-
Exact error and logs: ‘Error: Invalid params passed in, Please provide a valid chainId as hex string in chains for chain 31
at overrideDefaultMethod (loglevel-sentry.js:107:30)
at Logger.eval [as error] (loglevel-sentry.js:153:13)Caused by: WalletInitializationError: Invalid params passed in, Please provide a valid chainId as hex string in chains for chain 31
at WalletInitializationError.fromCode (index.js:54:12)
at WalletInitializationError.invalidParams (index.js:89:38)
at Web3Auth.initChainsConfig (noModal.js:436:92)
at Web3Auth.init (modalManager.js:144:13)
at async VueComponent.initWeb3Auth (index.js??clonedRuleSet-40.use[0]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/lib/config/vue-loader-v15-resolve-compat/vue-loader.js??vue-loader-options!./src/components/container/Container.vue?vue&type=script&lang=js:269:9) ‘Failed to initialize modal’’ -
Package details: ‘ “@web3auth/ethereum-provider”: “^9.7.0”,
"@web3auth/modal": "^10.5.4",'
