-1

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,
})
TylerH
  • 20,799
  • 66
  • 75
  • 101
realplay
  • 2,078
  • 20
  • 32

2 Answers2

0

I found the answer: replacing library with provider

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

This worked.

realplay
  • 2,078
  • 20
  • 32
0

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

Ting-Yu Su
  • 21
  • 1
  • 5