Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

how to make transactions use web3-react #744

Unanswered
WLyKan asked this question in Q&A
Discussion options

I read metamask doc, it says:

const txHash = await ethereum.request({
 method: 'eth_sendTransaction',
 params: [transactionParameters],
});

how to perform this in web3-react?

You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

Use the ethers library

You must be logged in to vote
2 replies
Comment options

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

Comment options

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /