123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
- /**
- * About provider formatting?
- *
- * @_section: api/providers/formatting:Formatting [provider-formatting]
- */
- import type { Signature } from "../crypto/index.js";
- import type { AccessList } from "../transaction/index.js";
- //////////////////////
- // Block
- /**
- * a **BlockParams** encodes the minimal required properties for a
- * formatted block.
- */
- export interface BlockParams {
- /**
- * The block hash.
- */
- hash?: null | string;
- /**
- * The block number.
- */
- number: number;
- /**
- * The timestamp for this block, which is the number of seconds
- * since epoch that this block was included.
- */
- timestamp: number;
- /**
- * The hash of the previous block in the blockchain. The genesis block
- * has the parentHash of the [[ZeroHash]].
- */
- parentHash: string;
- /**
- * The hash tree root of the parent beacon block for the given
- * execution block. See [[link-eip-4788]].
- */
- parentBeaconBlockRoot?: null | string;
- /**
- * A random sequence provided during the mining process for
- * proof-of-work networks.
- */
- nonce: string;
- /**
- * For proof-of-work networks, the difficulty target is used to
- * adjust the difficulty in mining to ensure a expected block rate.
- */
- difficulty: bigint;
- /**
- * The maximum amount of gas a block can consume.
- */
- gasLimit: bigint;
- /**
- * The amount of gas a block consumed.
- */
- gasUsed: bigint;
- /**
- * The total amount of BLOb gas consumed by transactions within
- * the block. See [[link-eip4844].
- */
- blobGasUsed?: null | bigint;
- /**
- * The running total of BLOb gas consumed in excess of the target
- * prior to the block. See [[link-eip-4844]].
- */
- excessBlobGas?: null | bigint;
- /**
- * The miner (or author) of a block.
- */
- miner: string;
- /**
- * The latest RANDAO mix of the post beacon state of
- * the previous block.
- */
- prevRandao?: null | string;
- /**
- * Additional data the miner choose to include.
- */
- extraData: string;
- /**
- * The protocol-defined base fee per gas in an [[link-eip-1559]]
- * block.
- */
- baseFeePerGas: null | bigint;
- /**
- * The root hash for the global state after applying changes
- * in this block.
- */
- stateRoot?: null | string;
- /**
- * The hash of the transaction receipts trie.
- */
- receiptsRoot?: null | string;
- /**
- * The list of transactions in the block.
- */
- transactions: ReadonlyArray<string | TransactionResponseParams>;
- };
- //////////////////////
- // Log
- /**
- * a **LogParams** encodes the minimal required properties for a
- * formatted log.
- */
- export interface LogParams {
- /**
- * The transaction hash for the transaxction the log occurred in.
- */
- transactionHash: string;
- /**
- * The block hash of the block that included the transaction for this
- * log.
- */
- blockHash: string;
- /**
- * The block number of the block that included the transaction for this
- * log.
- */
- blockNumber: number;
- /**
- * Whether this log was removed due to the transaction it was included
- * in being removed dur to an orphaned block.
- */
- removed: boolean;
- /**
- * The address of the contract that emitted this log.
- */
- address: string;
- /**
- * The data emitted with this log.
- */
- data: string;
- /**
- * The topics emitted with this log.
- */
- topics: ReadonlyArray<string>;
- /**
- * The index of this log.
- */
- index: number;
- /**
- * The transaction index of this log.
- */
- transactionIndex: number;
- }
- //////////////////////
- // Transaction Receipt
- /**
- * a **TransactionReceiptParams** encodes the minimal required properties
- * for a formatted transaction receipt.
- */
- export interface TransactionReceiptParams {
- /**
- * The target of the transaction. If null, the transaction was trying
- * to deploy a transaction with the ``data`` as the initi=code.
- */
- to: null | string;
- /**
- * The sender of the transaction.
- */
- from: string;
- /**
- * If the transaction was directly deploying a contract, the [[to]]
- * will be null, the ``data`` will be initcode and if successful, this
- * will be the address of the contract deployed.
- */
- contractAddress: null | string;
- /**
- * The transaction hash.
- */
- hash: string;
- /**
- * The transaction index.
- */
- index: number;
- /**
- * The block hash of the block that included this transaction.
- */
- blockHash: string;
- /**
- * The block number of the block that included this transaction.
- */
- blockNumber: number;
- /**
- * The bloom filter for the logs emitted during execution of this
- * transaction.
- */
- logsBloom: string;
- /**
- * The logs emitted during the execution of this transaction.
- */
- logs: ReadonlyArray<LogParams>;
- /**
- * The amount of gas consumed executing this transaciton.
- */
- gasUsed: bigint;
- /**
- * The amount of BLOb gas used. See [[link-eip-4844]].
- */
- blobGasUsed?: null | bigint;
- /**
- * The total amount of gas consumed during the entire block up to
- * and including this transaction.
- */
- cumulativeGasUsed: bigint;
- /**
- * The actual gas price per gas charged for this transaction.
- */
- gasPrice?: null | bigint;
- /**
- * The actual BLOb gas price that was charged. See [[link-eip-4844]].
- */
- blobGasPrice?: null | bigint;
- /**
- * The actual gas price per gas charged for this transaction.
- */
- effectiveGasPrice?: null | bigint;
- /**
- * The [[link-eip-2718]] envelope type.
- */
- type: number;
- //byzantium: boolean;
- /**
- * The status of the transaction execution. If ``1`` then the
- * the transaction returned success, if ``0`` then the transaction
- * was reverted. For pre-byzantium blocks, this is usually null, but
- * some nodes may have backfilled this data.
- */
- status: null | number;
- /**
- * The root of this transaction in a pre-bazatium block. In
- * post-byzantium blocks this is null.
- */
- root: null | string;
- }
- /*
- export interface LegacyTransactionReceipt {
- byzantium: false;
- status: null;
- root: string;
- }
- export interface ByzantiumTransactionReceipt {
- byzantium: true;
- status: number;
- root: null;
- }
- */
- //////////////////////
- // Transaction Response
- /**
- * a **TransactionResponseParams** encodes the minimal required properties
- * for a formatted transaction response.
- */
- export interface TransactionResponseParams {
- /**
- * The block number of the block that included this transaction.
- */
- blockNumber: null | number;
- /**
- * The block hash of the block that included this transaction.
- */
- blockHash: null | string;
- /**
- * The transaction hash.
- */
- hash: string;
- /**
- * The transaction index.
- */
- index: number;
- /**
- * The [[link-eip-2718]] transaction type.
- */
- type: number;
- /**
- * The target of the transaction. If ``null``, the ``data`` is initcode
- * and this transaction is a deployment transaction.
- */
- to: null | string;
- /**
- * The sender of the transaction.
- */
- from: string;
- /**
- * The nonce of the transaction, used for replay protection.
- */
- nonce: number;
- /**
- * The maximum amount of gas this transaction is authorized to consume.
- */
- gasLimit: bigint;
- /**
- * For legacy transactions, this is the gas price per gas to pay.
- */
- gasPrice: bigint;
- /**
- * For [[link-eip-1559]] transactions, this is the maximum priority
- * fee to allow a producer to claim.
- */
- maxPriorityFeePerGas: null | bigint;
- /**
- * For [[link-eip-1559]] transactions, this is the maximum fee that
- * will be paid.
- */
- maxFeePerGas: null | bigint;
- /**
- * For [[link-eip-4844]] transactions, this is the maximum fee that
- * will be paid per BLOb.
- */
- maxFeePerBlobGas?: null | bigint;
- /**
- * The transaction data.
- */
- data: string;
- /**
- * The transaction value (in wei).
- */
- value: bigint;
- /**
- * The chain ID this transaction is valid on.
- */
- chainId: bigint;
- /**
- * The signature of the transaction.
- */
- signature: Signature;
- /**
- * The transaction access list.
- */
- accessList: null | AccessList;
- /**
- * The [[link-eip-4844]] BLOb versioned hashes.
- */
- blobVersionedHashes?: null | Array<string>;
- };
|