PatrickAlphaC / defi-stake-yield-brownie-freecode

53 stars 63 forks source link

error when calling useContractFunction in useStateToken.tsx #1

Closed kavish6 closed 2 years ago

kavish6 commented 2 years ago

when I use this useContractFunction in useStateToken.tsx file const {state:approveErc20State,send:approveErc20Send}= useContractFunction(erc20Contract,'approve',{transactionName:"Approve ERC20 transfer"}) This line I got an error msg

Argument of type 'import("C:/Users/kavis/demos/defi-stake-yield-brownie/front-end/node_modules/@ethersproject/contracts/lib/index").Contract' is not assignable to parameter of type 'import("C:/Users/kavis/demos/defi-stake-yield-brownie/front-end/node_modules/@usedapp/core/node_modules/@ethersproject/contracts/lib/index").Contract'.

I Fixed this issue for me by deleting the @ethersproject folder inside @usedapp folder . I think you should add this to the README file as I could not figure out how to resolve this issue for some time

nicolas-sanch commented 2 years ago

Hi! Following the youtube tutorial, when I try to: yarn add @ethersproject/contract Terminal return: error An unexpected error occurred: "https://registry.yarnpkg.com/@ethersproject%2fcontract: Not found"

Also, I use this stackoverflow solution: Replacing: import {Contract} from '@ethersproject/contracts' By: import {Contract} from '@usedapp/core/node_modules/@ethersproject/contracts'

PatrickAlphaC commented 2 years ago

Yes! We should add this to the chronological issues spot of the main repo....

Thanks both of you! Closing for now.