Hi, what is the working version for WAGMI with React Scripts 5.0?
Jul 16, 2023, 12:14 AM
there is any non working version?
Jul 16, 2023, 12:15 AM
yes, dependency problems and things with wagmi 1.3 and react 5.0
Jul 16, 2023, 12:16 AM
which node version are u using?
Jul 16, 2023, 12:17 AM
also walletconnect v.2 does not work fine with react 5.0
18.16.1
Jul 16, 2023, 12:17 AM
thats weird coz react 5.01 was released over 1 year ago
same with react 18.2
Jul 16, 2023, 12:19 AM
react-scripts *
like:
npm ERR! While resolving: [email protected] ERR! Found: [email protected]
npm ERR! node_modules/typescriptnpm ERR! peerOptional typescript@">=5.0.4" from @wagmi/[email protected]
npm ERR! node_modules/@wagmi/corenpm ERR! peer @wagmi/core@">=1" from @web3modal/[email protected]
npm ERR! node_modules/@web3modal/ethereumnpm ERR! @web3modal/ethereum@"^2.0.0" from the root project
npm ERR! peerOptional typescript@">=5.0.4" from [email protected] ERR! node_modules/viem
npm ERR! peer viem@">=1" from @web3modal/[email protected] ERR! node_modules/@web3modal/ethereum
npm ERR! @web3modal/ethereum@"^2.0.0" from the root projectnpm ERR! peer viem@">=0.3.35" from @wagmi/[email protected]
npm ERR! node_modules/@wagmi/corenpm ERR! peer @wagmi/core@">=1" from @web3modal/[email protected]
npm ERR! node_modules/@web3modal/ethereumnpm ERR! @web3modal/ethereum@"^2.0.0" from the root project
npm ERR! 2 more (@wagmi/connectors, @safe-global/safe-apps-sdk)npm ERR! 4 more (wagmi, @wagmi/chains, @wagmi/connectors, abitype)
npm ERR!npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from [email protected] ERR! node_modules/react-scripts
npm ERR! react-scripts@"^4.0.3" from the root projectnpm ERR!
npm ERR! Conflicting peer dependency: [email protected] ERR! node_modules/typescript
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from [email protected] ERR! node_modules/react-scripts
npm ERR! react-scripts@"^4.0.3" from the root projectnpm ERR!
npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! While resolving: [email protected] ERR! Found: [email protected]
npm ERR! node_modules/typescriptnpm ERR! peerOptional typescript@">=5.0.4" from @wagmi/[email protected]
npm ERR! node_modules/@wagmi/corenpm ERR! peer @wagmi/core@">=1" from @web3modal/[email protected]
npm ERR! node_modules/@web3modal/ethereumnpm ERR! @web3modal/ethereum@"^2.0.0" from the root project
npm ERR! peerOptional typescript@">=5.0.4" from [email protected] ERR! node_modules/viem
npm ERR! peer viem@">=1" from @web3modal/[email protected] ERR! node_modules/@web3modal/ethereum
npm ERR! @web3modal/ethereum@"^2.0.0" from the root projectnpm ERR! peer viem@">=0.3.35" from @wagmi/[email protected]
npm ERR! node_modules/@wagmi/corenpm ERR! peer @wagmi/core@">=1" from @web3modal/[email protected]
npm ERR! node_modules/@web3modal/ethereumnpm ERR! @web3modal/ethereum@"^2.0.0" from the root project
npm ERR! 2 more (@wagmi/connectors, @safe-global/safe-apps-sdk)npm ERR! 4 more (wagmi, @wagmi/chains, @wagmi/connectors, abitype)
npm ERR!npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from [email protected] ERR! node_modules/react-scripts
npm ERR! react-scripts@"^4.0.3" from the root projectnpm ERR!
npm ERR! Conflicting peer dependency: [email protected] ERR! node_modules/typescript
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from [email protected] ERR! node_modules/react-scripts
npm ERR! react-scripts@"^4.0.3" from the root projectnpm ERR!
npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Jul 16, 2023, 12:21 AM
you are installing v4
use v5
Jul 16, 2023, 12:21 AM
trying now
Jul 16, 2023, 12:22 AM
use always latest versions
Jul 16, 2023, 12:22 AM
i tried with 5.0 before, retrying now
Jul 16, 2023, 12:22 AM
check which version of react app are you using also
use 18.2
Jul 16, 2023, 12:22 AM
it's this version
by the way, i think there will be issues with walletconnect v2 by using react v5.0.1
Jul 16, 2023, 12:24 AM
if there are, its coz walletconnect didnt fix it, reactscripts its more than 1 year old, they should fix it
check on their repository issues
maybe someone mentioned something there
Jul 16, 2023, 12:26 AM
Ok, changing the argument, for example, in a different folder project for debug i am using:
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-ga4": "^2.1.0",
"react-router-dom": "^6.14.1",
"react-scripts": "^5.0.1",
"@web3modal/ethereum": "^2.7.0",
"@web3modal/react": "^2.7.0",
"viem": "^1.2.15",
"wagmi": "^1.3.8",
It works well when i start it, gives me just warnings but not errors
--
The only issue here is that when i try to connect with TrustWallet by scanning the QRCode it does not close the QRModal when the confirmation is given on TrustWallet, i think it does not give the callback to the isConnect props. In the useEffect below it should automatically close the modal when isConnected is automatically updated by useAccount()
const {address, isConnected} = useAccount()
useEffect(()=>{
console.log('DEBUG: IsConnected', isConnected);
if(isConnected){
console.log('DEBUG: Chain Identified', chain.id, __CHAIN_ID__);
if(( chain.id ?? 0) !== CHAIN_ID ){
__SETWALLETDATA__( {
Provider: _provider,
connected: false,
address : address,
state : 9,
errorRes:'wrongnet_wc',
errorHeader: 'Change Network',
errormessage: 'Please connect to Ethereum Mainnet, wrong chain id!',
isReturningUser:false
} )
_walletStates({
Provider: _provider,
connected: false,
address : address,
state : 9,
errorRes:'wrongnet_wc',
errorHeader: 'Change Network',
errormessage: 'Please connect to Ethereum Mainnet, wrong chain id!',
isReturningUser:false
});
}else if(( chain.id ?? 0) === CHAIN_ID ){
// setStrictlyNecessaryCookies(3);
close()
// console.log('DEBUG: Provider: ', _provider)
__SETWALLETDATA__({
provider: _provider,
connected:true,
address: address,
state: 4,
errorRes:'',
errorHeader: '',
errormessage: '',
isReturningUser: true
})
_walletStates({
provider: _provider,
connected:true,
address: address,
state: 4,
errorRes:'',
errorHeader: '',
errormessage: '',
isReturningUser: true
});
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [address,close,isConnected , _provider ]); //address,close,isConnected , _provider
The issue is more likely with wagmi because with wagmi 0.11 it worked fine back then, Any suggestion on how to resolve this issue ? Am i missing any dependency ?
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-ga4": "^2.1.0",
"react-router-dom": "^6.14.1",
"react-scripts": "^5.0.1",
"@web3modal/ethereum": "^2.7.0",
"@web3modal/react": "^2.7.0",
"viem": "^1.2.15",
"wagmi": "^1.3.8",
It works well when i start it, gives me just warnings but not errors
--
The only issue here is that when i try to connect with TrustWallet by scanning the QRCode it does not close the QRModal when the confirmation is given on TrustWallet, i think it does not give the callback to the isConnect props. In the useEffect below it should automatically close the modal when isConnected is automatically updated by useAccount()
const {address, isConnected} = useAccount()
useEffect(()=>{
console.log('DEBUG: IsConnected', isConnected);
if(isConnected){
console.log('DEBUG: Chain Identified', chain.id, __CHAIN_ID__);
if(( chain.id ?? 0) !== CHAIN_ID ){
__SETWALLETDATA__( {
Provider: _provider,
connected: false,
address : address,
state : 9,
errorRes:'wrongnet_wc',
errorHeader: 'Change Network',
errormessage: 'Please connect to Ethereum Mainnet, wrong chain id!',
isReturningUser:false
} )
_walletStates({
Provider: _provider,
connected: false,
address : address,
state : 9,
errorRes:'wrongnet_wc',
errorHeader: 'Change Network',
errormessage: 'Please connect to Ethereum Mainnet, wrong chain id!',
isReturningUser:false
});
}else if(( chain.id ?? 0) === CHAIN_ID ){
// setStrictlyNecessaryCookies(3);
close()
// console.log('DEBUG: Provider: ', _provider)
__SETWALLETDATA__({
provider: _provider,
connected:true,
address: address,
state: 4,
errorRes:'',
errorHeader: '',
errormessage: '',
isReturningUser: true
})
_walletStates({
provider: _provider,
connected:true,
address: address,
state: 4,
errorRes:'',
errorHeader: '',
errormessage: '',
isReturningUser: true
});
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [address,close,isConnected , _provider ]); //address,close,isConnected , _provider
The issue is more likely with wagmi because with wagmi 0.11 it worked fine back then, Any suggestion on how to resolve this issue ? Am i missing any dependency ?
already checked but not finded
Any suggestion here?
Jul 16, 2023, 10:29 AM
no idea, never used trustwallet
Jul 16, 2023, 11:03 AM
No idea but have you tried to use the last version of it?
Also wagmi use Viem now
Also wagmi use Viem now
Jul 16, 2023, 12:14 PM
Yeah
Jul 16, 2023, 1:14 PM
Hey
Could I ask you something in dm?
Could I ask you something in dm?
Jul 20, 2023, 10:40 AM