-
Notifications
You must be signed in to change notification settings - Fork 1.5k
-
I read metamask doc, it says:
const txHash = await ethereum.request({ method: 'eth_sendTransaction', params: [transactionParameters], });
how to perform this in web3-react?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
Use the ethers library
Beta Was this translation helpful? Give feedback.
All reactions
-
after connect the MetaMask, I find the doc:
https://docs.metamask.io/guide/sending-transactions.html#example
I guess ethereum.request
equal to provider.request
, but got TypeError: provider.request is not a function
Beta Was this translation helpful? Give feedback.
All reactions
-
@WLyKan if you deconstruct the provider object from const context = useWeb3React()
like so:
const { isActive, account, chainId, provider } = context;
Apparently the provider you are looking for is sitting on provider
, so provider.provider.request
will work.
Beta Was this translation helpful? Give feedback.