Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

eth_sendTransaction

Broadcast a transaction to the network.

Authentication Required: Yes

Request

await jaw.provider.request({
  method: 'eth_sendTransaction',
  params: [{
    to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
    value: '0x9184e72a000',
    data: '0x',
  }],
});

Parameters

NameTypeRequiredDescription
to0x${string}YesRecipient address
value0x${string}NoAmount in wei (hexadecimal)
data0x${string}NoTransaction data (hexadecimal)
chainId0x${string}NoTarget chain ID (defaults to connected chain)

Example

[{
  "to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
  "value": "0x9184e72a000",
  "data": "0x"
}]

Response

Returns the transaction hash after the transaction is submitted.

Type: 0x${string}

Example

"0xabc123def456..."

Behavior

  • Opens popup for user approval
  • Uses ERC-4337 UserOperation under the hood
  • Transaction is sponsored by paymaster if configured
  • Returns transaction hash after submission

Errors

CodeDescription
4001User rejected the request
4100Unauthorized (not authenticated)
-32602Invalid params

Example Usage

Send Native Token (ETH)

const txHash = await jaw.provider.request({
  method: 'eth_sendTransaction',
  params: [{
    to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
    value: '0xde0b6b3a7640000', // 1 ETH in wei (hex)
  }],
});
 
console.log('Transaction hash:', txHash);

Call Contract Function

import { encodeFunctionData } from 'viem';
 
// Encode ERC-20 transfer function
const data = encodeFunctionData({
  abi: [{
    name: 'transfer',
    type: 'function',
    inputs: [
      { name: 'to', type: 'address' },
      { name: 'amount', type: 'uint256' },
    ],
  }],
  functionName: 'transfer',
  args: ['0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', 1000000n],
});
 
const txHash = await jaw.provider.request({
  method: 'eth_sendTransaction',
  params: [{
    to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
    data,
  }],
});

Related Methods