eth_sendTransaction
Send a transaction from the wallet to the blockchain.
Instructs the Wallet to broadcast a transaction to the network.
This method is deprecated and exists for compatibility. Please use wallet_sendCalls
instead.
Request#
_15type Request = {_15 method: 'eth_sendTransaction',_15 params: [{_15 /** Target chain ID. Defaults to the connected chain. */_15 chainId?: `0x${string}`,_15 /** Calldata to send with the transaction. */_15 data?: `0x${string}`,_15 /** Address of the sender. */_15 from: `0x${string}`,_15 /** Address of the recipient. */_15 to: `0x${string}`,_15 /** Value to transfer. Defaults to 0. */_15 value?: `0x${string}`,_15 }]_15}
Response#
Transaction hash.
_10type Response = `0x${string}`
Example#
To make these instructions concrete, we have created a sample cross-app wallet called Rapidfire ID. To interact with it, you can find its SDK in the NPM package directory: @rapidfire/id.
You can check out the GitHub repository for Rapidfire Wallet to learn how to create your own wallet.
_13import RapidfireID from '@rapidfire/id'_13_13const rapidfire = new RapidfireID()_13const provider = rapidfire.getEthereumProvider()_13_13const hash = await provider.request({_13 method: 'eth_sendTransaction',_13 params: [{_13 from: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',_13 to: '0xcafebabecafebabecafebabecafebabecafebabe',_13 value: '0x1',_13 }],_13})
Mint ERC20 Tokens#
The example below demonstrates minting 100 EXP on the Odyssey testnet.
_24import RapidfireID from '@rapidfire/id'_24_24const rapidfire = new RapidfireID()_24const provider = rapidfire.getEthereumProvider()_24import { encodeFunctionData, parseAbi, parseEther } from 'viem'_24_24const [account] = await provider.request({_24 method: 'eth_accounts',_24})_24_24const hash = await provider.request({_24 method: 'eth_sendTransaction',_24 params: [{_24 from: account,_24 to: '0x706aa5c8e5cc2c67da21ee220718f6f6b154e75c',_24 data: encodeFunctionData({_24 abi: parseAbi([_24 'function mint(address, uint256)',_24 ]),_24 functionName: 'mint',_24 args: [account, parseEther('100')],_24 }),_24 }],_24})