Send a transaction
To request a transaction from a wallet, first find your desired wallet from the wallets
array and get its EIP-1193 provider via its getEthereumProvider
method:
Then, using the provider’s request
method, send a eth_sendTransaction
JSON-RPC to the wallet. In the params
array, include as the first entry an object containing the transaction’s parameters, such as to
, value
, data
, gasLimit
, maxPriorityFeePerGas
, maxFeePerGas
, and gasPrice
.
See these docs for the parameters that can be passed in eth_sendTransaction
.
You do not need to specify from
as we populate it from the user’s connected wallet, and you can pass either a number
, bigint
, or a hexadecimal string
into the value
parameter.
If you’ve integrated Privy with another web3 library, you can also use that library’s syntax for requesting a transaction from the wallet:
Library | Method |
---|---|
Viem | Use the wallet client’s sendTransaction method. |
Ethers | Use the signer’s sendTransaction method. |
Wagmi | Use the useSendTransaction hook. |
When requesting a transaction from an embedded wallet, you can customize the transaction prompt by using Privy’s native sendTransaction method.
Was this page helpful?