TransactionReceipt.toRpc
Converts a TransactionReceipt.TransactionReceipt
to a TransactionReceipt.Rpc
.
Imports
import { TransactionReceipt } from 'ox'
Examples
import { TransactionReceipt } from 'ox'
const receipt = TransactionReceipt.toRpc({
blobGasPrice: 270441n,
blobGasUsed: 4919n,
blockHash:
'0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
blockNumber: 19868015n,
contractAddress: null,
cumulativeGasUsed: 533781n,
effectiveGasPrice: 9062804489n,
from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
gasUsed: 175034n,
logs: [],
logsBloom:
'0x00200000000000000000008080000000000000000040000000000000000000000000000000000000000000000000000022000000080000000000000000000000000000080000000000000008000000200000000000000000000200008020400000000000000000280000000000100000000000000000000000000010000000000000000000020000000000000020000000000001000000080000004000000000000000000000000000000000000000000000400000000000001000000000000000000002000000000000000020000000000000000000001000000000000000000000200000000000000000000000000000001000000000c00000000000000000',
root: undefined,
status: 'success',
to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
transactionHash:
'0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
transactionIndex: 2,
type: 'eip1559',
})
{ blobGasPrice: "0x042069", blobGasUsed: "0x1337", blockHash: "0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b", blockNumber: "0x012f296f", contractAddress: null, cumulativeGasUsed: "0x082515", effectiveGasPrice: "0x021c2f6c09", from: "0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6", gasUsed: "0x02abba", logs: [], logsBloom: "0x00200000000000000000008080000000000000000040000000000000000000000000000000000000000000000000000022000000080000000000000000000000000000080000000000000008000000200000000000000000000200008020400000000000000000280000000000100000000000000000000000000010000000000000000000020000000000000020000000000001000000080000004000000000000000000000000000000000000000000000400000000000001000000000000000000002000000000000000020000000000000000000001000000000000000000000200000000000000000000000000000001000000000c00000000000000000", root: undefined, status: "0x1", to: "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", transactionHash: "0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0", transactionIndex: "0x02", type: "eip1559", }
Definition
function toRpc(
receipt: TransactionReceipt,
): Rpc
Source: src/TransactionReceipt.ts
Parameters
receipt
- Type:
TransactionReceipt
The receipt to convert.
receipt.blobGasPrice
- Type:
bigintType
- Optional
The actual value per gas deducted from the sender's account for blob gas. Only specified for blob transactions as defined by EIP-4844.
receipt.blobGasUsed
- Type:
bigintType
- Optional
The amount of blob gas used. Only specified for blob transactions as defined by EIP-4844.
receipt.blockHash
- Type:
0x${string}
Hash of block containing this transaction
receipt.blockNumber
- Type:
bigintType
Number of block containing this transaction
receipt.contractAddress
- Type:
Address.Address | null | undefined
- Optional
Address of new contract or null
if no contract was created
receipt.cumulativeGasUsed
- Type:
bigintType
Gas used by this and all preceding transactions in this block
receipt.effectiveGasPrice
- Type:
bigintType
Pre-London, it is equal to the transaction's gasPrice. Post-London, it is equal to the actual gas price paid for inclusion.
receipt.from
- Type:
abitype_Address
Transaction sender
receipt.gasUsed
- Type:
bigintType
Gas used by this transaction
receipt.logs
- Type:
{ address: abitype_Address; blockHash: 0x${string}; blockNumber: bigintType; data: 0x${string}; logIndex: numberType; topics: [0x${string}, ...0x${string}[]]; transactionHash: 0x${string}; transactionIndex: numberType; removed: boolean; }[]
List of log objects generated by this transaction
receipt.logsBloom
- Type:
0x${string}
Logs bloom filter
receipt.root
- Type:
0x${string}
- Optional
The post-transaction state root. Only specified for transactions included before the Byzantium upgrade.
receipt.status
- Type:
status
success
if this transaction was successful or reverted
if it failed
receipt.to
- Type:
Address.Address | null
Transaction recipient or null
if deploying a contract
receipt.transactionHash
- Type:
0x${string}
Hash of this transaction
receipt.transactionIndex
- Type:
numberType
Index of this transaction in the block
receipt.type
- Type:
type
Transaction type
Return Type
An RPC receipt.
Rpc
Error Type
TransactionReceipt.toRpc.ErrorType