skip to Main Content

This is the code in v6 of "@web3-react/core" package

const { chainId, library } = useWeb3ReactCore<Web3Provider>()

In v8 library doesn’t exist, how can I get it?

I need to use following methods:

await library.getBlockNumber()
const result = await library.call({
  to: call.address,
  data: call.callData,
})

2

Answers


  1. Chosen as BEST ANSWER

    I found the answer:

    const { chainId, provider } = useWeb3ReactCore<Web3Provider>()
    

    This worked for me.


  2. I replaced all library with provider, and it works for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search