{"id":22164837,"url":"https://github.com/net2devcrypto/viem-ethers-replace-web3modal-nextjs","last_synced_at":"2026-02-08T05:02:34.157Z","repository":{"id":181335229,"uuid":"666604524","full_name":"net2devcrypto/Viem-Ethers-Replace-Web3Modal-NextJS","owner":"net2devcrypto","description":"A simple straightforward addon using Viem to replace the deprecated Web3Modal on your NextJS Web3 Project with Ethers","archived":false,"fork":false,"pushed_at":"2023-07-15T01:34:43.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-30T07:40:38.215Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/net2devcrypto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-15T01:15:12.000Z","updated_at":"2023-07-15T01:15:12.000Z","dependencies_parsed_at":"2023-07-15T02:50:19.575Z","dependency_job_id":null,"html_url":"https://github.com/net2devcrypto/Viem-Ethers-Replace-Web3Modal-NextJS","commit_stats":null,"previous_names":["net2devcrypto/viem-ethers-replace-web3modal-nextjs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/net2devcrypto/Viem-Ethers-Replace-Web3Modal-NextJS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FViem-Ethers-Replace-Web3Modal-NextJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FViem-Ethers-Replace-Web3Modal-NextJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FViem-Ethers-Replace-Web3Modal-NextJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FViem-Ethers-Replace-Web3Modal-NextJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/net2devcrypto","download_url":"https://codeload.github.com/net2devcrypto/Viem-Ethers-Replace-Web3Modal-NextJS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FViem-Ethers-Replace-Web3Modal-NextJS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29221718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T03:18:47.732Z","status":"ssl_error","status_checked_at":"2026-02-08T03:15:31.985Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T05:10:59.013Z","updated_at":"2026-02-08T05:02:34.140Z","avatar_url":"https://github.com/net2devcrypto.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Viem-Ethers-Replace-Web3Modal-NextJS\nA simple straightforward addon using Viem to replace the deprecated Web3Modal on your NextJS Web3 Project with Ethers\n\n\u003ch3\u003eStep 1\u003c/h3\u003e\n\nNavigate to your NextJS Project and Install Viem.\n\n```shell\ncd myproject\nnpm i viem\n```\n\n\u003ch3\u003eStep 2\u003c/h3\u003e\n\nCreate a new js file 'web3provider.js' on your NextJS project \"components\" folder.\nand paste the following:\n\nFYI if you don't have a components folder, please create one.\n\n```shell\nimport { createWalletClient, custom } from \"viem\";\nimport { polygonMumbai } from \"viem/chains\";\n\nexport const web3Provider = async () =\u003e {\n  const [account] = await window.ethereum.request({\n    method: \"eth_requestAccounts\",\n  });\n\n  const client = createWalletClient({\n    account,\n    chain: polygonMumbai,\n    transport: custom(window.ethereum),\n  });\n  return client;\n};\n\n```\n\nImportant, in the code, modify the chain to your preferred choice:\n\n```shell\nimport { polygonMumbai } from \"viem/chains\";\n\n//under client: \n chain: polygonMumbai,\n```\nSave file.\n\n\u003ch3\u003eStep 3\u003c/h3\u003e\n\nimport the function where needed:\n\n```shell\n// example index.js\nimport { web3Provider } from '@/components/web3provider';\n```\nReplace web3modal and pass directly web3Provider\n\nExample, This is before with web3modal:\n\n```shell\nasync function ethConnect() {\n    const web3Modal = new Web3Modal()\n    const connection = await web3Modal.connect()\n    const provider = new ethers.providers.Web3Provider(connection);\n\n```\n\nAfter replacing with web3Provider:\n\n```shell\nasync function ethConnect() {\n    const connection = await web3Provider()\n    const provider = new ethers.providers.Web3Provider(connection);\n\n```\n\nDont forget to save and test! \n\nEnjoy!!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnet2devcrypto%2Fviem-ethers-replace-web3modal-nextjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnet2devcrypto%2Fviem-ethers-replace-web3modal-nextjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnet2devcrypto%2Fviem-ethers-replace-web3modal-nextjs/lists"}