eth_sendTransaction

Creates a new wallet confirmation to make an Ethereum transaction from the user's account. This method requires that the user has granted permission to interact with their account first, so make sure to call eth_requestAccounts first.

Params

1. Transaction

The transaction object to sign and send.

The parameters to customize a transaction. If a to address is not provided, it will be assumed that the transaction is a contract creation transaction, and the data field of the transaction will be used as the contract initialization code. gasPrice cannot be used together with maxPriorityFeePerGas and maxFeePerGas.

interface TransactionParameters {
  from: string; // Match pattern: ^0x[0-9a-fA-F]{40}$
  to?: string; // Match pattern: ^0x[0-9a-fA-F]{40}$
  gas?: string; // Match pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
  value?: string; // // Match pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
  data?: string; // Match pattern: ^0x[0-9a-f]*$
  // The gas price the sender is willing to pay to miners in wei. Used in pre-1559 transactions.
  gasPrice?: string; // Match pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
  // Maximum fee per gas the sender is willing to pay to miners in wei. Used in 1559 transactions.
  maxPriorityFeePerGas?: string; // Match pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
  // The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei. Used in 1559 transactions.
  maxFeePerGas?: string; // Match pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
}

Example

Request

await window.NEOLineNeoX.request({
  method: 'eth_sendTransaction',
  params: [
    {
      from: '0xE45e9AdC2B51514849ea5B38dF37d1a65e6D52f5',
      to: '0x7Cd07BCbcCF30d71E768F5228b56d5B7Cc07f674',
      value: '0x3b9aca00', // 1_000_000_000
    },
  ],
});

Result

"0x204563226de98e20e4e98ec40c334dd1a2d6f03388ed7a5d9a7523518c3b277b"

最后更新于