The from address may be omitted. For a legacy transaction with gasPrice, the returned tx.maxFeePerGas and tx.maxPriorityFeePerGas are null, while tx.accessList, tx.chainId, and tx.yParity are omitted. For contract creation without a recipient, tx.to is null.
Parameters
- transactionobjectREQUIRED
Transaction to populate with missing gas, fee, and nonce values
- fromstring
Sender address. May be omitted.
- tostring
Recipient address
- valuestring
Value to transfer, as a hexadecimal quantity
- datastring
Transaction input data, as hexadecimal bytes
- gasstring
Gas limit, as a hexadecimal quantity
- noncestring
Sender nonce, as a hexadecimal quantity
- gasPricestring
Legacy gas price, as a hexadecimal quantity
- maxFeePerGasstring
Maximum fee per gas for a type 2 transaction
- maxPriorityFeePerGasstring
Maximum priority fee per gas for a type 2 transaction
Returns
- rawstring
Unsigned serialized transaction, encoded as hexadecimal bytes
- txobject
Populated transaction fields
- accessListarray
Addresses and storage keys to access for a type 2 transaction; omitted for a legacy transaction
- chainIdstring
Chain ID as a hexadecimal quantity for a type 2 transaction; omitted for a legacy transaction
- gasstring
Filled gas limit
- gasPricestring | null
Legacy gas price, or null for a type 2 transaction
- hashstring
Hash of the unsigned transaction
- inputstring
Transaction input data
- maxFeePerGasstring | null
Filled maximum fee per gas for a type 2 transaction, or null for a legacy transaction
- maxPriorityFeePerGasstring | null
Filled maximum priority fee per gas for a type 2 transaction, or null for a legacy transaction
- noncestring
Filled sender nonce
- rstring
Zero before signing
- sstring
Zero before signing
- tostring | null
Recipient address, or null for contract creation
- typestring
Transaction type
- vstring
Zero before signing
- valuestring
Transfer value
- yParitystring
Zero before signing a type 2 transaction; omitted for a legacy transaction
1{2"jsonrpc": "2.0",3"id": 1,4"result": {5"raw": "0x02e801808221db8427ad83a38252089400000000000000000000000000000000000000008080c0808080",6"tx": {7"accessList": [],8"chainId": "0x1",9"gas": "0x5208",10"gasPrice": null,11"hash": "0x130be494cbf2b58faa6757c587bca5027e15c87dc26a74576af28aee14ab80c0",12"input": "0x",13"maxFeePerGas": "0x27ad83a3",14"maxPriorityFeePerGas": "0x21db",15"nonce": "0x0",16"r": "0x0",17"s": "0x0",18"to": "0x0000000000000000000000000000000000000000",19"type": "0x2",20"v": "0x0",21"value": "0x0",22"yParity": "0x0"23}24}25}
1{2"jsonrpc": "2.0",3"id": 1,4"result": {5"raw": "0x02e801808221db8427ad83a38252089400000000000000000000000000000000000000008080c0808080",6"tx": {7"accessList": [],8"chainId": "0x1",9"gas": "0x5208",10"gasPrice": null,11"hash": "0x130be494cbf2b58faa6757c587bca5027e15c87dc26a74576af28aee14ab80c0",12"input": "0x",13"maxFeePerGas": "0x27ad83a3",14"maxPriorityFeePerGas": "0x21db",15"nonce": "0x0",16"r": "0x0",17"s": "0x0",18"to": "0x0000000000000000000000000000000000000000",19"type": "0x2",20"v": "0x0",21"value": "0x0",22"yParity": "0x0"23}24}25}