tronprotocol / tronwallet-adapter

MIT License
59 stars 29 forks source link

Dependency conflict with latest WalletConnect with Wagmi 2.X #57

Open JoeLaw91 opened 5 months ago

JoeLaw91 commented 5 months ago

https://docs.walletconnect.com/web3modal/react/about?platform=wagmi

I tried to install latest WalletConnect with Wagmi 2.X with alrd installed tronwallet-adapter, I am getting dependency error from npm install.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: cryptopayment-nextjs@0.1.0
npm ERR! Found: viem@1.21.4
npm ERR! node_modules/viem
npm ERR!   viem@"^1.5.3" from the root project
npm ERR!   peer viem@">=1" from @web3modal/ethereum@2.7.1
npm ERR!   node_modules/@web3modal/ethereum
npm ERR!     @web3modal/ethereum@"^2.7.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer viem@"2.x" from @wagmi/core@2.6.9
npm ERR! node_modules/@wagmi/core
npm ERR!   peer @wagmi/core@">=1" from @web3modal/ethereum@2.7.1
npm ERR!   node_modules/@web3modal/ethereum
npm ERR!     @web3modal/ethereum@"^2.7.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
way2ex commented 5 months ago

You can update the the latest version of adapters and it does not have dependencies on @web3modal/ethereum. If you still have dependency conflict, you can use npm i viem@2.x --force to install your desired version.

JoeLaw91 commented 4 months ago

@way2ex , Hi Justin, good day, I tried to force install, but I am now getting this error:

NotSupportedError: Failed to execute 'define' on 'CustomElementRegistry': the name "w3m-button" has already been used with this registry

Call Stack
legacyCustomElement
node_modules/@lit/reactive-element/development/decorators/custom-element.js (7:0)
eval
node_modules/@lit/reactive-element/development/decorators/custom-element.js (42:0)
nt
node_modules/@web3modal/ui/dist/index.es.js (1:7278)
eval
node_modules/@web3modal/ui/dist/index.es.js (1:8147)
./node_modules/@web3modal/ui/dist/index.es.js
/build/static/chunks/node_modules_web3modal_ui_dist_index_es_js.js (998:1)
options.factory
/_next/static/chunks/webpack.js (712:31)
__webpack_require__```

When I run ```npm ls @web3modal/ui ```

I got:

├─┬ @tronweb3/tronwallet-adapter-walletconnect@1.0.6 │ └─┬ @tronweb3/walletconnect-tron@2.0.0 │ └─┬ @web3modal/standalone@2.4.3 │ └── @web3modal/ui@2.4.3 └─┬ @web3modal/wagmi@4.1.7 └─┬ @web3modal/scaffold@4.1.7 └── @web3modal/ui@4.1.7

way2ex commented 4 months ago

Without the real project i have no idea why the error occurs. It seems that the problem is due to @web3modal/ui . Could you please google the error message or create a minimal reproduction repo ?

lakub-muravlov commented 2 months ago

Without the real project i have no idea why the error occurs. It seems that the problem is due to @web3modal/ui . Could you please google the error message or create a minimal reproduction repo ?

Hi, I have the same issue while using web3modal for EVM based networks and Tron WalletConnectAdapter for tron connections. I've created minimal reproduction repository. Reproduction scenarios are described in readme. It seems that whatever of those modules loaded first sets a w3m-button to customElements registry which creates a conflict.

way2ex commented 2 months ago

Without the real project i have no idea why the error occurs. It seems that the problem is due to @web3modal/ui . Could you please google the error message or create a minimal reproduction repo ?

Hi, I have the same issue while using web3modal for EVM based networks and Tron WalletConnectAdapter for tron connections. I've created minimal reproduction repository. Reproduction scenarios are described in readme. It seems that whatever of those modules loaded first sets a w3m-button to customElements registry which creates a conflict.

Thanks a lot for your reproduction repository. It seems that the error occurs due to @web3modal/ui registry w3m-button twice. We will try to update the @tronweb3/walletconnect-tron to replace @web3modal/standalone with @walletconnect/modal to fix the error.

The upgrade is likely to this resolution. It may take some time before the next version.

way2ex commented 1 month ago

@tronweb3/tronwallet-adapter-walletconnect@2.0.0 is released and it should work fine with ethereum.