Send a transaction request
This guide explains how to send a transaction request from your app to Ronin
Wallet using the provider
obtained from the connector
from Tanto Connect.
Prerequisites
Before requesting a transaction, your app must know which wallet address the user is using. To retrieve the user's addresses, see Get user wallet addresses.
Request a send RON transaction
To request a transaction, you must get the provider
object from the connector
.
const provider = await connector.getProvider();
Then, call the eth_requestTransaction
method using the provider.request
with a valid transaction
object. For example, the following script requests a send RON transaction:
const sendRON = async () => {
const userAddresses = await connector.getAddresses()
const provider = await connector.getProvider()
try {
await provider.request({
method: "eth_sendTransaction",
params: [{
to: "0xaddress",
from: userAddresses[0],
value: "0xDE0B6B3A7640000", // 1000000000000000000, 1 RON
gas: "0x5208",
data: "",
}],
})
} catch (error) {
console.error(error)
}
}
Was this helpful?
Happy React is loading...