ethers.js/lib.commonjs/providers/formatting.d.ts

268 lines
6.9 KiB
TypeScript
Raw Permalink Normal View History

2023-03-03 18:25:07 -07:00
/**
* About provider formatting?
*
* @_section: api/providers/formatting:Formatting [provider-formatting]
*/
import type { Signature } from "../crypto/index.js";
import type { AccessList } from "../transaction/index.js";
2023-06-01 17:52:58 -04:00
/**
* a **BlockParams** encodes the minimal required properties for a
* formatted block.
*/
2023-03-03 18:25:07 -07:00
export interface BlockParams {
2023-06-01 17:52:58 -04:00
/**
* The block hash.
*/
2023-03-03 18:25:07 -07:00
hash?: null | string;
2023-06-01 17:52:58 -04:00
/**
* The block number.
*/
2023-03-03 18:25:07 -07:00
number: number;
2023-06-01 17:52:58 -04:00
/**
* The timestamp for this block, which is the number of seconds
* since epoch that this block was included.
*/
2023-03-03 18:25:07 -07:00
timestamp: number;
2023-06-01 17:52:58 -04:00
/**
* The hash of the previous block in the blockchain. The genesis block
* has the parentHash of the [[ZeroHash]].
*/
2023-03-03 18:25:07 -07:00
parentHash: string;
2023-06-01 17:52:58 -04:00
/**
* A random sequence provided during the mining process for
* proof-of-work networks.
*/
2023-03-03 18:25:07 -07:00
nonce: string;
2023-06-01 17:52:58 -04:00
/**
* For proof-of-work networks, the difficulty target is used to
* adjust the difficulty in mining to ensure a expected block rate.
*/
2023-03-03 18:25:07 -07:00
difficulty: bigint;
2023-06-01 17:52:58 -04:00
/**
* The maximum amount of gas a block can consume.
*/
2023-03-03 18:25:07 -07:00
gasLimit: bigint;
2023-06-01 17:52:58 -04:00
/**
* The amount of gas a block consumed.
*/
2023-03-03 18:25:07 -07:00
gasUsed: bigint;
2023-06-01 17:52:58 -04:00
/**
* The miner (or author) of a block.
*/
2023-03-03 18:25:07 -07:00
miner: string;
2023-06-01 17:52:58 -04:00
/**
* Additional data the miner choose to include.
*/
2023-03-03 18:25:07 -07:00
extraData: string;
2023-06-01 17:52:58 -04:00
/**
* The protocol-defined base fee per gas in an [[link-eip-1559]]
* block.
*/
2023-03-03 18:25:07 -07:00
baseFeePerGas: null | bigint;
2023-06-01 17:52:58 -04:00
/**
* The list of transactions in the block.
*/
2023-03-03 18:25:07 -07:00
transactions: ReadonlyArray<string | TransactionResponseParams>;
}
2023-06-01 17:52:58 -04:00
/**
* a **LogParams** encodes the minimal required properties for a
* formatted log.
*/
2023-03-03 18:25:07 -07:00
export interface LogParams {
2023-06-01 17:52:58 -04:00
/**
* The transaction hash for the transaxction the log occurred in.
*/
2023-03-03 18:25:07 -07:00
transactionHash: string;
2023-06-01 17:52:58 -04:00
/**
* The block hash of the block that included the transaction for this
* log.
*/
2023-03-03 18:25:07 -07:00
blockHash: string;
2023-06-01 17:52:58 -04:00
/**
* The block number of the block that included the transaction for this
* log.
*/
2023-03-03 18:25:07 -07:00
blockNumber: number;
2023-06-01 17:52:58 -04:00
/**
* Whether this log was removed due to the transaction it was included
* in being removed dur to an orphaned block.
*/
2023-03-03 18:25:07 -07:00
removed: boolean;
2023-06-01 17:52:58 -04:00
/**
* The address of the contract that emitted this log.
*/
2023-03-03 18:25:07 -07:00
address: string;
2023-06-01 17:52:58 -04:00
/**
* The data emitted with this log.
*/
2023-03-03 18:25:07 -07:00
data: string;
2023-06-01 17:52:58 -04:00
/**
* The topics emitted with this log.
*/
2023-03-03 18:25:07 -07:00
topics: ReadonlyArray<string>;
2023-06-01 17:52:58 -04:00
/**
* The index of this log.
*/
2023-03-03 18:25:07 -07:00
index: number;
2023-06-01 17:52:58 -04:00
/**
* The transaction index of this log.
*/
2023-03-03 18:25:07 -07:00
transactionIndex: number;
}
2023-06-01 17:52:58 -04:00
/**
* a **TransactionReceiptParams** encodes the minimal required properties
* for a formatted transaction receipt.
*/
2023-03-03 18:25:07 -07:00
export interface TransactionReceiptParams {
2023-06-01 17:52:58 -04:00
/**
* The target of the transaction. If null, the transaction was trying
* to deploy a transaction with the ``data`` as the initi=code.
*/
2023-03-03 18:25:07 -07:00
to: null | string;
2023-06-01 17:52:58 -04:00
/**
* The sender of the transaction.
*/
2023-03-03 18:25:07 -07:00
from: string;
2023-06-01 17:52:58 -04:00
/**
* 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.
*/
2023-03-03 18:25:07 -07:00
contractAddress: null | string;
2023-06-01 17:52:58 -04:00
/**
* The transaction hash.
*/
2023-03-03 18:25:07 -07:00
hash: string;
2023-06-01 17:52:58 -04:00
/**
* The transaction index.
*/
2023-03-03 18:25:07 -07:00
index: number;
2023-06-01 17:52:58 -04:00
/**
* The block hash of the block that included this transaction.
*/
2023-03-03 18:25:07 -07:00
blockHash: string;
2023-06-01 17:52:58 -04:00
/**
* The block number of the block that included this transaction.
*/
2023-03-03 18:25:07 -07:00
blockNumber: number;
2023-06-01 17:52:58 -04:00
/**
* The bloom filter for the logs emitted during execution of this
* transaction.
*/
2023-03-03 18:25:07 -07:00
logsBloom: string;
2023-06-01 17:52:58 -04:00
/**
* The logs emitted during the execution of this transaction.
*/
2023-03-03 18:25:07 -07:00
logs: ReadonlyArray<LogParams>;
2023-06-01 17:52:58 -04:00
/**
* The amount of gas consumed executing this transaciton.
*/
2023-03-03 18:25:07 -07:00
gasUsed: bigint;
2023-06-01 17:52:58 -04:00
/**
* The total amount of gas consumed during the entire block up to
* and including this transaction.
*/
2023-03-03 18:25:07 -07:00
cumulativeGasUsed: bigint;
2023-06-01 17:52:58 -04:00
/**
* The actual gas price per gas charged for this transaction.
*/
2023-03-03 18:25:07 -07:00
gasPrice?: null | bigint;
2023-06-01 17:52:58 -04:00
/**
* The actual gas price per gas charged for this transaction.
*/
2023-03-03 18:25:07 -07:00
effectiveGasPrice?: null | bigint;
2023-06-01 17:52:58 -04:00
/**
* The [[link-eip-2718]] envelope type.
*/
2023-03-03 18:25:07 -07:00
type: number;
2023-06-01 17:52:58 -04:00
/**
* 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.
*/
2023-03-03 18:25:07 -07:00
status: null | number;
2023-06-01 17:52:58 -04:00
/**
* The root of this transaction in a pre-bazatium block. In
* post-byzantium blocks this is null.
*/
2023-03-03 18:25:07 -07:00
root: null | string;
}
2023-06-01 17:52:58 -04:00
/**
* a **TransactionResponseParams** encodes the minimal required properties
* for a formatted transaction response.
*/
2023-03-03 18:25:07 -07:00
export interface TransactionResponseParams {
2023-06-01 17:52:58 -04:00
/**
* The block number of the block that included this transaction.
*/
2023-03-03 18:25:07 -07:00
blockNumber: null | number;
2023-06-01 17:52:58 -04:00
/**
* The block hash of the block that included this transaction.
*/
2023-03-03 18:25:07 -07:00
blockHash: null | string;
2023-06-01 17:52:58 -04:00
/**
* The transaction hash.
*/
2023-03-03 18:25:07 -07:00
hash: string;
2023-06-01 17:52:58 -04:00
/**
* The transaction index.
*/
2023-03-03 18:25:07 -07:00
index: number;
2023-06-01 17:52:58 -04:00
/**
* The [[link-eip-2718]] transaction type.
*/
2023-03-03 18:25:07 -07:00
type: number;
2023-06-01 17:52:58 -04:00
/**
* The target of the transaction. If ``null``, the ``data`` is initcode
* and this transaction is a deployment transaction.
*/
2023-03-03 18:25:07 -07:00
to: null | string;
2023-06-01 17:52:58 -04:00
/**
* The sender of the transaction.
*/
2023-03-03 18:25:07 -07:00
from: string;
2023-06-01 17:52:58 -04:00
/**
* The nonce of the transaction, used for replay protection.
*/
2023-03-03 18:25:07 -07:00
nonce: number;
2023-06-01 17:52:58 -04:00
/**
* The maximum amount of gas this transaction is authorized to consume.
*/
2023-03-03 18:25:07 -07:00
gasLimit: bigint;
2023-06-01 17:52:58 -04:00
/**
* For legacy transactions, this is the gas price per gas to pay.
*/
2023-03-03 18:25:07 -07:00
gasPrice: bigint;
2023-06-01 17:52:58 -04:00
/**
* For [[link-eip-1559]] transactions, this is the maximum priority
* fee to allow a producer to claim.
*/
2023-03-03 18:25:07 -07:00
maxPriorityFeePerGas: null | bigint;
2023-06-01 17:52:58 -04:00
/**
* For [[link-eip-1559]] transactions, this is the maximum fee that
* will be paid.
*/
2023-03-03 18:25:07 -07:00
maxFeePerGas: null | bigint;
2023-06-01 17:52:58 -04:00
/**
* The transaction data.
*/
2023-03-03 18:25:07 -07:00
data: string;
2023-06-01 17:52:58 -04:00
/**
* The transaction value (in wei).
*/
2023-03-03 18:25:07 -07:00
value: bigint;
2023-06-01 17:52:58 -04:00
/**
* The chain ID this transaction is valid on.
*/
2023-03-03 18:25:07 -07:00
chainId: bigint;
2023-06-01 17:52:58 -04:00
/**
* The signature of the transaction.
*/
2023-03-03 18:25:07 -07:00
signature: Signature;
2023-06-01 17:52:58 -04:00
/**
* The transaction access list.
*/
2023-03-03 18:25:07 -07:00
accessList: null | AccessList;
}
//# sourceMappingURL=formatting.d.ts.map