Web3Auth / web3auth-wagmi-connector

Web3Auth connector for wagmi
25 stars 24 forks source link

Update Connector to support Wagmi v2 #116

Closed yashovardhan closed 8 months ago

yashovardhan commented 8 months ago

Tested in both examples, all scenarios are working correctly. Deleted extra examples. Will test further with alpha release on general examples on examples repository.

Maurechi commented 8 months ago

Hey, have you tried building this? On next.js app there's a build error.

ReferenceError: window is not defined
    at get isDark [as isDark] (/Users/maurechi/repo/node_modules/@web3auth/ui/dist/ui.cjs.js:5139:78)
    at LoginModal.initModal (/Users/maurechi/repo/node_modules/@web3auth/ui/dist/ui.cjs.js:4887:22)
    at Web3Auth.initModal (/Users/maurechi/repo/node_modules/@web3auth/modal/dist/modal.cjs.js:325:27)
    at Object.getProvider (/Users/maurechi/repo/.next/server/chunks/913.js:1:7124)
    at reconnect (file:///Users/maurechi/repo/node_modules/@wagmi/core/dist/esm/actions/reconnect.js:50:43)

Node.js v18.17.1
   Generating static pages (0/15)  [  ==]/Users/maurechi/repo/node_modules/@web3auth/ui/dist/ui.cjs.js:5139
    return this.uiConfig.mode === "dark" || this.uiConfig.mode === "auto" && window.matchMedia("(prefers-color-scheme: dark)").matches;

Shows when trying to build in vercel as well

using latests versions of web3auth

"@web3auth/modal": "^7.3.2",
"@web3auth/openlogin-adapter": "^7.3.2",

even installing to make sure versions are ok

"@web3auth/base": "^7.3.2",
"@web3auth/ui": "^7.3.2",
Screenshot 2024-02-17 at 13 03 50
W3stside commented 8 months ago

Needs a ‘’‘ts typeof globalThis.window === “undefined” ‘’’ top level check

can just be a const

yashovardhan commented 8 months ago

Hey @Maurechi

It might be because of version mismatch of the connector. I've updated everything to Web3Auth v8 and also added the next example testing your usecase. The build and the dev mode both work fine.