Cannot switch networks using WalletConnect/web3Modal Torus app

OS: Linux 22.04
Browser: Brave 1.60.114 Chromium: 119.0.6045.124 (Official Build) (64-bit)

On our application we have implemented WalletConnect and web3Modal to allow connections from many different types of wallets.

We have tried to integrate the torus wallet app and it doesn’t seem to be working very well. :frowning:

I can connect successfully to our dapp using the wallet connect feature from the torus webpage UI - Torus

however when I try to switch networks it doesn’t seem to work…

I open up the web3modal UI for switching networks and choose a common network such as Polygon

It then generates the request on the torus webUI - however the new chain ID is wrong (10 is Gnosis Chain - the current connected chain on Torus, Polygon is 137)

I click confirm - nothing happens - I go back to my dapp UI and it says the switch was declined.

Also somehow my dapp is connected to Optimism but the torus webUI is connected to gnosis chain - they don’t match up.



On our application we use web3Modal for other wallets such as metamask or trust wallet and do not experience any issues with switching network

@mitch Welcome Aboard!

Are you using the latest WalletConnect V2 with your integration? https://web3auth.io/docs/sdk/pnp/web/adapters/wallet-connect-v2

Could you please share the below details:

  1. SDK & version
  2. Impementation code
  3. Console logs (if any)

We’re not using any torus or web3auth SDK - this is pure web3Modal from WalletConnect - yes we are using v2

Here’s the relevant code:

	wagmiConfig,
	projectId,
	chains,
	featuredWalletIds: [
		'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96',
// this is the torus app Id according to wallet connect
		'3fecad5e2f0a30aba97edea69ebf015884a9b8a9aec93e66d4b4b695fee1f010',
	],
	includeWalletIds: [
		'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96',
// this is the torus app Id according to wallet connect
		'3fecad5e2f0a30aba97edea69ebf015884a9b8a9aec93e66d4b4b695fee1f010',
	],
	chainImages: {
		[classicNetworkNumber]: '/images/currencies/classic/32.svg',
	},
});

I’m trying this out this morning and it seems to be totally non-responsive the web wallet now -

I am signed into Torus on my app but the wallet connect connection doesn’t appear on the torus web wallet UI - I can’t even get to the step where the switch network fails. I can see there’s a couple errors in the console:

If I redo the wallet connect connection on the torus web wallet UI then try to switch networks I see this error now:

Hey @mitch
Could you please share the packages and their versions from your package.json ?

Here’s our package.json

{
	"name": "givethdapp",
	"version": "2.20.1",
	"private": true,
	"scripts": {
		"build": "next build",
		"dev": "next dev",
		"lint": "eslint . --ext .ts --ext .tsx",
		"lint:fix": "eslint . --ext .ts --ext .tsx --fix",
		"start": "next start",
		"test": "jest --watch",
		"cypress": "cypress open"
	},
	"resolutions": {
		"styled-components": "^5",
		"@types/react": "^18.0.15",
		"@types/react-dom": "^18.0.6"
	},
	"dependencies": {
		"@apollo/client": "^3.8.3",
		"@giveth/ui-design-system": "^1.11.17",
		"@reduxjs/toolkit": "^1.9.5",
		"@segment/snippet": "^4.15.3",
		"@sentry/nextjs": "^7.69.0",
		"@uniswap/v3-sdk": "^3.10.0",
		"@web3modal/wagmi": "^3.1.0",
		"apollo-upload-client": "^17.0.0",
		"bignumber.js": "^9.1.2",
		"deepmerge": "^4.2.2",
		"ethers": "^6.7.1",
		"framer-motion": "^10.12.12",
		"graphql": "^16.8.0",
		"lodash.isequal": "^4.5.0",
		"lottie-react": "^2.3.1",
		"next": "^13.5.1",
		"nprogress": "^0.2.0",
		"quill": "^1.3.7",
		"quill-emoji": "^0.2.0",
		"quill-image-resize-module": "^3.0.0",
		"quill-magic-url": "^4.2.0",
		"rc-slider": "^10.0.1",
		"react": "^18.2.0",
		"react-custom-scrollbars": "^4.2.1",
		"react-datepicker": "^4.8.0",
		"react-dom": "^18.2.0",
		"react-dropzone": "^14.2.2",
		"react-google-maps": "^9.4.5",
		"react-hook-form": "^7.46.1",
		"react-hot-toast": "^2.4.1",
		"react-intl": "^6.2.1",
		"react-places-autocomplete": "^7.3.0",
		"react-quill": "^2.0.0",
		"react-redux": "^8.0.1",
		"react-select": "^5.2.1",
		"react-share": "^4.4.1",
		"sharp": "^0.30.5",
		"siwe": "^2.1.4",
		"styled-components": "^5.3.6",
		"swiper": "^10.2.0",
		"unsplash-js": "^7.0.15",
		"viem": "^1.16.6",
		"wagmi": "^1.4.5"
	},
	"devDependencies": {
		"@next/bundle-analyzer": "^12.1.4",
		"@testing-library/cypress": "^8.0.3",
		"@testing-library/jest-dom": "^5.16.4",
		"@testing-library/react": "^13.3.0",
		"@types/apollo-upload-client": "^14.1.0",
		"@types/axios": "^0.14.0",
		"@types/jest": "^28.1.4",
		"@types/jest-axe": "^3.5.4",
		"@types/lodash.isequal": "^4.5.5",
		"@types/node": "^18.11.18",
		"@types/nprogress": "^0.2.0",
		"@types/react": "^18.0.28",
		"@types/react-custom-scrollbars": "^4.0.9",
		"@types/react-datepicker": "^4.4.1",
		"@types/react-dom": "^18.0.11",
		"@types/react-html-parser": "^2.0.2",
		"@types/react-modal": "^3.13.1",
		"@types/react-places-autocomplete": "^7.2.9",
		"@types/styled-components": "^5.1.26",
		"@typescript-eslint/eslint-plugin": "^6.7.2",
		"@typescript-eslint/parser": "^6.7.2",
		"babel-plugin-styled-components": "^2.0.7",
		"cypress": "^10.6.0",
		"eslint": "^8.49.0",
		"eslint-config-next": "^13.5.1",
		"eslint-config-prettier": "^9.0.0",
		"eslint-import-resolver-jest": "^3.0.2",
		"eslint-import-resolver-typescript": "^3.6.0",
		"eslint-plugin-cypress": "^2.14.0",
		"eslint-plugin-import": "^2.28.1",
		"eslint-plugin-prettier": "^5.0.1",
		"eslint-plugin-unused-imports": "^3.0.0",
		"jest": "^28.1.2",
		"jest-axe": "^6.0.0",
		"jest-canvas-mock": "^2.4.0",
		"jest-environment-jsdom": "^28.1.2",
		"jest-extended": "^3.0.2",
		"jest-watch-typeahead": "^2.0.0",
		"msw": "^0.49.2",
		"prettier": "^3.0.3",
		"test-data-bot": "^0.8.0",
		"ts-jest": "^28.0.5",
		"typescript": "^5.2.2"
	}
}

@vjgee @maharshi

Any updates on this one?

Hey @mitch

It looks like the native integration of Torus Wallet is currently broken for Wallet Connect V2. We will soon be shipping a new version of the Torus Wallet for mitigating this issue. In the meantime, we’d recommend you to rather use our connector for Torus Wallet and WAGMI directly inside your Web3Modal integration: GitHub - torusresearch/torus-wagmi-connector

This integration will help you use it properly within Web3Modal itself.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.