Web3Auth / web3auth-wagmi-connector

Web3Auth connector for wagmi
25 stars 24 forks source link

Type 'Web3AuthConnector' is not assignable to type 'Connector<any, any, any>'. #12

Closed aalmada closed 1 year ago

aalmada commented 2 years ago

I have in my packages.json the following:

"@web3auth/web3auth-wagmi-connector": "^1.0.0",
"wagmi": "^0.7.7",

I added the Web3AuthConnector as shown in the READ.ME but I'm getting the following compilation error:

TS2322: Type 'Web3AuthConnector' is not assignable to type 'Connector<any, any, any>'.
  Types of property 'chains' are incompatible.
    Type 'import("/Users/antao.almada/Projects/test/node_modules/@web3auth/web3auth-wagmi-connector/node_modules/@wagmi/core/dist/declarations/src/types/index").Chain[]' is not assignable to type 'import("/Users/antao.almada/Projects/test/packages/launchwebsite/node_modules/@wagmi/core/dist/declarations/src/types/index").Chain[]'.
      Type 'import("/Users/antao.almada/Projects/test/node_modules/@web3auth/web3auth-wagmi-connector/node_modules/@wagmi/core/dist/declarations/src/types/index").Chain' is not assignable to type 'import("/Users/antao.almada/Projects/test/packages/launchwebsite/node_modules/@wagmi/core/dist/declarations/src/types/index").Chain'.
        Types of property 'ens' are incompatible.
          Type '{ address: string; } | undefined' is not assignable to type '{ address: `0x${string}`; } | undefined'.
            Type '{ address: string; }' is not assignable to type '{ address: `0x${string}`; }'.
              Types of property 'address' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
    35 |                        },
    36 |                }),
  > 37 |                new Web3AuthConnector({
       |                ^^^^^^^^^^^^^^^^^^^^^^^
  > 38 |                        chains,
       | ^^^^^^^^^^
  > 39 |                        options: {
       | ^^^^^^^^^^
  > 40 |                                enableLogging: true,
       | ^^^^^^^^^^
  > 41 |                                clientId:
       | ^^^^^^^^^^
  > 42 |                                        'OUR_CLIENT_ID', // Get your own client id from https://dashboard.web3auth.io
       | ^^^^^^^^^^
  > 43 |                                network: 'testnet', // web3auth network
       | ^^^^^^^^^^
  > 44 |                                chainId: '0x1', // chainId that you want to connect with
       | ^^^^^^^^^^
  > 45 |                        },
       | ^^^^^^^^^^
 > 46 |                }),
       | ^^^^^
    47 |        ],
    48 |        provider,
    49 |        webSocketProvider,

I see that you only support "@wagmi/core": "^0.5.7" Do you plan to support a newer version any time soon?

grmkris commented 2 years ago

I can still use wagmi and ignore this error and things work on first glance... but first issue that I encountered is that

useNetwork hook returns no data

would be great if we can get this sorted

myssynglynx commented 2 years ago

This breaks the connector. Currently iterating through all versions of Wagmi since 2 versions ago until I find one that doesn't break... Either the connector needs to be updated or someone needs to denote which range of versions it is compatible with.

UPDATE: I was able to get it to not entirely break by switching wagmi to v0.6.3 (the same in the example), and by adding the socialLoginConfig: {mfaLevel: 'default'} to the Web3AuthConnector constructor... but now there's no Connect Wallet option on the Web3Modal.

yashovardhan commented 1 year ago

Can you all test the latest version? socialLoginConfig should not be required

ryanberckmans commented 1 year ago

@chaitanyapotti this error still occurs with wagmi v0.11.2 and @web3auth/web3auth-wagmi-connector v2.1.1.

@wagmi/core latest is v0.9.x and web3auth-wagmi-connector is built against v0.8.x.

chaitanyapotti commented 1 year ago

That's because we follow the release pattern of rainbowkit which is still dependent on wagmi/core@0.8.x Once they update, we will update this library

ryanberckmans commented 1 year ago

Ok, thanks.

On Thu, Feb 9, 2023, 7:37 AM Chaitanya Potti @.***> wrote:

That's because we follow the release pattern of rainbowkit which is still dependent on @.*** Once they update, we will update this library

— Reply to this email directly, view it on GitHub https://github.com/Web3Auth/web3auth-wagmi-connector/issues/12#issuecomment-1424129989, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACJCPFQF66CA6VCKBO7RLLWWTQJJANCNFSM6AAAAAARREE3DY . You are receiving this because you commented.Message ID: @.***>

ander-db commented 1 year ago

Hey everyone! I've encouter the same issue. RainbowKit it's already using wagmi 0.9.0. Any predition of when this library is going to be updated??

yashovardhan commented 1 year ago

We will be updating it as soon as possible.

ander-db commented 1 year ago

That's great!!

Thanks for the fast response!

benjileibo commented 1 year ago

@yashovardhan do you have a PR we can follow? Do you have a time estimate here and are there any workarounds?

yashovardhan commented 1 year ago

In the meantime, you can use wagmi library on the previous version.

benjileibo commented 1 year ago

In the meantime, you can use wagmi library on the previous version.

Thanks for the quick reply @yashovardhan. Still getting the following error rolling back to wagmi 0.5.7

Error: require() of ES Module /Users/benleibowitz/Github/PatientPortal/node_modules/@web3auth/web3auth-wagmi-connector/node_modules/@wagmi/core/dist/index.js from /Users/benleibowitz/Github/PatientPortal/node_modules/@web3auth/web3auth-wagmi-connector/dist/web3authWagmiConnector.cjs.js not supported. Instead change the require of index.js in /Users/benleibowitz/Github/PatientPortal/node_modules/@web3auth/web3auth-wagmi-connector/dist/web3authWagmiConnector.cjs.js to a dynamic import() which is available in all CommonJS modules.

benjileibo commented 1 year ago

Any sense of what's happening here @yashovardhan? Sorry to bug you - this is pressing on our side

yashovardhan commented 1 year ago

@benjileibo can you check the wagmi version in our sample apps and use that version.

https://github.com/Web3Auth/examples/tree/main/wagmi-connector

LyghtCode commented 1 year ago

In the meantime, you can use wagmi library on the previous version.

Thanks for the quick reply @yashovardhan. Still getting the following error rolling back to wagmi 0.5.7

Error: require() of ES Module /Users/benleibowitz/Github/PatientPortal/node_modules/@web3auth/web3auth-wagmi-connector/node_modules/@wagmi/core/dist/index.js from /Users/benleibowitz/Github/PatientPortal/node_modules/@web3auth/web3auth-wagmi-connector/dist/web3authWagmiConnector.cjs.js not supported. Instead change the require of index.js in /Users/benleibowitz/Github/PatientPortal/node_modules/@web3auth/web3auth-wagmi-connector/dist/web3authWagmiConnector.cjs.js to a dynamic import() which is available in all CommonJS modules.

Also getting this error and I am following the example repo you linked^ same versions.

chaitanyapotti commented 1 year ago

Please update to 3.0.0 and report if you face any issues

ryanberckmans commented 1 year ago

@chaitanyapotti this issue has been resolved for me with 3.0.0 and wagmi 0.11.x and 0.12.x.

yashovardhan commented 1 year ago

Awesome @ryanberckmans thanks for letting us know. Closing this issue.

ryanberckmans commented 1 year ago

@yashovardhan great thanks. I am going to hijack your attention here and request that you investigate this issue https://github.com/Web3Auth/web3auth-wagmi-connector/issues/45 as it is preventing me from signing ordinary erc20 transfers in dev with chainId param set.