diff --git a/demo/react-app/package-lock.json b/demo/react-app/package-lock.json index a41a3991e..5967aa6d8 100644 --- a/demo/react-app/package-lock.json +++ b/demo/react-app/package-lock.json @@ -37,13 +37,13 @@ }, "../../packages/adapters/openlogin-adapter": { "name": "@web3auth/openlogin-adapter", - "version": "8.0.0-alpha.18", + "version": "8.0.0", "license": "ISC", "dependencies": { "@toruslabs/openlogin": "^7.0.4", "@toruslabs/openlogin-utils": "^7.0.4", - "@web3auth/base": "^8.0.0-alpha.17", - "@web3auth/base-provider": "^8.0.0-alpha.18", + "@web3auth/base": "^8.0.0", + "@web3auth/base-provider": "^8.0.0", "lodash.merge": "^4.6.2" }, "devDependencies": { @@ -75,7 +75,7 @@ }, "../../packages/base": { "name": "@web3auth/base", - "version": "8.0.0-alpha.17", + "version": "8.0.0", "license": "ISC", "dependencies": { "@toruslabs/http-helpers": "^6.0.0", @@ -146,20 +146,20 @@ }, "../../packages/modal": { "name": "@web3auth/modal", - "version": "8.0.0-alpha.18", + "version": "8.0.0", "license": "ISC", "dependencies": { - "@web3auth/base": "^8.0.0-alpha.17", - "@web3auth/base-provider": "^8.0.0-alpha.18", - "@web3auth/no-modal": "^8.0.0-alpha.18", - "@web3auth/openlogin-adapter": "^8.0.0-alpha.18", - "@web3auth/ui": "^8.0.0-alpha.17" + "@web3auth/base": "^8.0.0", + "@web3auth/base-provider": "^8.0.0", + "@web3auth/no-modal": "^8.0.0", + "@web3auth/openlogin-adapter": "^8.0.0", + "@web3auth/ui": "^8.0.0" }, "devDependencies": { "@svgr/webpack": "^8.1.0", "@toruslabs/isomorphic-style-loader": "^5.3.3", "@toruslabs/openlogin-utils": "^7.0.4", - "@web3auth/wallet-connect-v2-adapter": "^8.0.0-alpha.18", + "@web3auth/wallet-connect-v2-adapter": "^8.0.0", "css-loader": "^6.10.0", "postcss-prefix-selector": "^1.16.0", "style-loader": "^3.3.4", @@ -198,18 +198,18 @@ }, "../../packages/plugins/wallet-services-plugin": { "name": "@web3auth/wallet-services-plugin", - "version": "8.0.0-alpha.18", + "version": "8.0.0", "license": "ISC", "dependencies": { - "@web3auth/base": "^8.0.0-alpha.17", - "@web3auth/base-plugin": "^8.0.0-alpha.17", - "@web3auth/no-modal": "^8.0.0-alpha.18", - "@web3auth/ws-embed": "^1.0.0", + "@web3auth/base": "^8.0.0", + "@web3auth/base-plugin": "^8.0.0", + "@web3auth/no-modal": "^8.0.0", + "@web3auth/ws-embed": "^1.1.0", "loglevel": "^1.9.1" }, "devDependencies": { "@metamask/rpc-errors": "^6.1.0", - "@web3auth/openlogin-adapter": "^8.0.0-alpha.18" + "@web3auth/openlogin-adapter": "^8.0.0" }, "engines": { "node": ">=18.x", @@ -258,7 +258,7 @@ }, "../../packages/providers/ethereum-provider": { "name": "@web3auth/ethereum-provider", - "version": "8.0.0-alpha.18", + "version": "8.0.0", "license": "ISC", "dependencies": { "@ethereumjs/common": "^4.2.0", @@ -270,8 +270,8 @@ "@toruslabs/http-helpers": "^6.0.0", "@toruslabs/openlogin-jrpc": "^7.0.0", "@walletconnect/utils": "^2.11.1", - "@web3auth/base": "^8.0.0-alpha.17", - "@web3auth/base-provider": "^8.0.0-alpha.18", + "@web3auth/base": "^8.0.0", + "@web3auth/base-provider": "^8.0.0", "assert": "^2.1.0", "bignumber.js": "^9.1.2", "bn.js": "^5.2.1", @@ -326,7 +326,7 @@ }, "../../packages/providers/solana-provider": { "name": "@web3auth/solana-provider", - "version": "8.0.0-alpha.18", + "version": "8.0.0", "license": "ISC", "dependencies": { "@metamask/rpc-errors": "^6.1.0", @@ -334,8 +334,8 @@ "@toruslabs/openlogin-ed25519": "^7.0.0", "@toruslabs/openlogin-jrpc": "^7.0.0", "@toruslabs/tweetnacl-js": "^1.0.4", - "@web3auth/base": "^8.0.0-alpha.17", - "@web3auth/base-provider": "^8.0.0-alpha.18", + "@web3auth/base": "^8.0.0", + "@web3auth/base-provider": "^8.0.0", "bn.js": "^5.2.1", "bs58": "^5.0.0", "json-rpc-random-id": "^1.0.1" diff --git a/demo/react-app/src/services/web3auth.tsx b/demo/react-app/src/services/web3auth.tsx index 2e65ce2ce..dfe455bc4 100644 --- a/demo/react-app/src/services/web3auth.tsx +++ b/demo/react-app/src/services/web3auth.tsx @@ -276,14 +276,14 @@ export const Web3AuthProvider: FunctionComponent = ({ children, return; } const newChain: CustomChainConfig = { + rpcTarget: "https://rpc.ankr.com/polygon", + blockExplorerUrl: "https://polygonscan.com/", + chainId: "0x89", + displayName: "Polygon Mainnet", + ticker: "matic", + tickerName: "Matic", + logo: "https://images.toruswallet.io/matic.svg", chainNamespace: CHAIN_NAMESPACES.EIP155, - chainId: "0xaa36a7", - rpcTarget: "https://rpc.ankr.com/eth_sepolia", - displayName: "Sepolia Testnet", - blockExplorerUrl: "https://sepolia.etherscan.io", - ticker: "ETH", - tickerName: "Ethereum", - logo: "https://images.toruswallet.io/eth.svg", }; await web3Auth?.addChain(newChain); uiConsole("New Chain Added"); @@ -293,7 +293,7 @@ export const Web3AuthProvider: FunctionComponent = ({ children, uiConsole("provider not initialized yet"); return; } - await web3Auth?.switchChain({ chainId: "0xaa36a7" }); + await web3Auth?.switchChain({ chainId: "0x89" }); uiConsole("Chain Switched"); }; diff --git a/packages/no-modal/src/noModal.ts b/packages/no-modal/src/noModal.ts index 1366f7f00..7bdd66676 100644 --- a/packages/no-modal/src/noModal.ts +++ b/packages/no-modal/src/noModal.ts @@ -180,6 +180,8 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth { } public async addChain(chainConfig: CustomChainConfig): Promise { + if (this.status === ADAPTER_STATUS.CONNECTED && this.connectedAdapterName) + return this.walletAdapters[this.connectedAdapterName].addChain(chainConfig); if (this.commonJRPCProvider) { return this.commonJRPCProvider.addChain(chainConfig); } @@ -187,6 +189,8 @@ export class Web3AuthNoModal extends SafeEventEmitter implements IWeb3Auth { } public async switchChain(params: { chainId: string }): Promise { + if (this.status === ADAPTER_STATUS.CONNECTED && this.connectedAdapterName) + return this.walletAdapters[this.connectedAdapterName].switchChain(params); if (this.commonJRPCProvider) { return this.commonJRPCProvider.switchChain(params); } diff --git a/packages/plugins/wallet-services-plugin/src/plugin.ts b/packages/plugins/wallet-services-plugin/src/plugin.ts index 245d5e078..967888953 100644 --- a/packages/plugins/wallet-services-plugin/src/plugin.ts +++ b/packages/plugins/wallet-services-plugin/src/plugin.ts @@ -171,7 +171,7 @@ export class WalletServicesPlugin implements IPlugin { log.warn(`${web3Auth.connectedAdapterName} is not compatible with wallet services connector plugin`); return; } - this.provider = web3Auth.provider; + this.provider = web3Auth.walletAdapters[WALLET_ADAPTERS.OPENLOGIN].provider; if (!this.provider) throw WalletServicesPluginError.web3AuthNotConnected(); this.subscribeToProviderEvents(this.provider); }); @@ -190,7 +190,7 @@ export class WalletServicesPlugin implements IPlugin { const [accounts, chainId, chainConfig] = await Promise.all([ this.provider.request({ method: "eth_accounts" }), this.provider.request({ method: "eth_chainId" }), - this.provider.request({ method: "provider_config" }), + this.provider.request({ method: "eth_provider_config" }), ]); return { chainId: parseInt(chainId as string, 16),