Skip to main content

eth_sendTransaction

Creates new message call transaction or a contract creation, if the data field contains code.

Params

  1. Transaction: Object. A standard Ethereum transaction object. Only the following properties will be referenced:
    1. to: string. The destination address of the message.
    2. data: string (optional). Either a byte string containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code.
    3. value: string (optional). The value transferred for the transaction in wei, encoded as a hex string.

This method does not support the gas, gasPrice, maxPriorityFeePerGas, or maxFeePerGas properties as the relayer abstracts these away from the user. Additionally, the from property is not supported as the user's Passport wallet address is used instead.

Result

  1. TransactionHash: string. A promise that resolves with a 32-byte hex string containing the transaction hash.

Method Specific Errors

Error CodeMessageResolution
-32602eth_sendTransaction requires a "to" fieldEnsure that a valid to property has been specified
4100Unauthorised - call eth_requestAccounts firstEnsure that eth_requestAccounts is called before calling eth_sendTransaction

Example

const transactionHash = await provider.request({
method: 'eth_sendTransaction',
params: [
{
to: '0x...',
data: '0x...',
value: '0x...'
}
]
});
console.log(transactionHash); // ['0x...']