PatrickAlphaC / defi-stake-yield-brownie-freecode

52 stars 62 forks source link

supportedChain is deprecated, please pass networks instead #6

Closed SuperZooper3 closed 2 years ago

SuperZooper3 commented 2 years ago

App.tsx uses supportedChains: [ChainId.Kovan], here. When I use this same code snippet, I get my console bombarded with supportedChain is deprecated, please pass networks instead making debugging quite hard. I haven't been able to figure out how to fix it with "pass networks".

PatrickAlphaC commented 2 years ago

That's really annoying... can you just use a different version of usedapp for the time being?

  1. Delete your node_modules folder
  2. Delete your yarn.lock.
  3. change the line package.lock to "@usedapp/core": "0.4.2"
  4. Run yarn and then run everything.
SuperZooper3 commented 2 years ago

For those who might stumble across this later, I figured it out:

  1. Import Rinkeby or any other networks you need from usedapp/core import { DAppProvider, Rinkeby} from '@usedapp/core';
  2. In your DApp provider in the html, change it to <DAppProvider config={{ networks: [Rinkeby], whatever else you need}}>

This should ensure that you don't have a thousand messages a second in your console!

PatrickAlphaC commented 2 years ago

Oh nice!! Thanks for following up!!

AnneCh commented 2 years ago

Hi @SuperZooper3 ,

I'm stuck at this exact spot, where my console only logs "undefined" and "dev".

I've tried what you did, and it doesn't work at all, it actually won't compile. Is there anything else you had done? Had you change something in the Main file as well?

Thanks

AnneCh commented 2 years ago

I've also tried Patrick's solution, and it doesn't work either. On top of that, I have an error message from const networkName = chainId ? helperConfig[chainId] : "dev"

which says:


Element implicitly has an 'any' type because expression of type 'ChainId' can't be used to index type '{ "42": string; "4": string; "1337": string; "1": string; }'.
  Property '[ChainId.Ropsten]' does not exist on type '{ "42": string; "4": string; "1337": string; "1": string; }'.ts(7053)```