2022-09-05 23:57:11 +03:00
|
|
|
import type { AddressLike, NameResolver } from "../address/index.js";
|
2022-09-27 10:45:27 +03:00
|
|
|
import type { BigNumberish, EventEmitterable } from "../utils/index.js";
|
2022-09-05 23:57:11 +03:00
|
|
|
import type { Signature } from "../crypto/index.js";
|
|
|
|
import type { AccessList, AccessListish, TransactionLike } from "../transaction/index.js";
|
|
|
|
import type { ContractRunner } from "./contracts.js";
|
|
|
|
import type { Network } from "./network.js";
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **BlockTag** specifies a specific block.
|
|
|
|
*
|
|
|
|
* **numeric value** - specifies the block height, where
|
|
|
|
* the genesis block is block 0; many operations accept a negative
|
|
|
|
* value which indicates the block number should be deducted from
|
|
|
|
* the most recent block. A numeric value may be a ``number``, ``bigint``,
|
|
|
|
* or a decimal of hex string.
|
|
|
|
*
|
|
|
|
* **blockhash** - specifies a specific block by its blockhash; this allows
|
|
|
|
* potentially orphaned blocks to be specifed, without ambiguity, but many
|
|
|
|
* backends do not support this for some operations.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
export type BlockTag = BigNumberish | string;
|
2022-11-30 23:44:23 +03:00
|
|
|
import { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js";
|
|
|
|
/**
|
|
|
|
* A **FeeData** wraps all the fee-related values associated with
|
|
|
|
* the network.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export declare class FeeData {
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The gas price for legacy networks.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly gasPrice: null | bigint;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The maximum fee to pay per gas.
|
|
|
|
*
|
|
|
|
* The base fee per gas is defined by the network and based on
|
|
|
|
* congestion, increasing the cost during times of heavy load
|
|
|
|
* and lowering when less busy.
|
|
|
|
*
|
|
|
|
* The actual fee per gas will be the base fee for the block
|
|
|
|
* and the priority fee, up to the max fee per gas.
|
|
|
|
*
|
|
|
|
* This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly maxFeePerGas: null | bigint;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The additional amout to pay per gas to encourage a validator
|
|
|
|
* to include the transaction.
|
|
|
|
*
|
|
|
|
* The purpose of this is to compensate the validator for the
|
|
|
|
* adjusted risk for including a given transaction.
|
|
|
|
*
|
|
|
|
* This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly maxPriorityFeePerGas: null | bigint;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and
|
|
|
|
* %%maxPriorityFeePerGas%%.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
constructor(gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint);
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Returns a JSON-friendly value.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
toJSON(): any;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **TransactionRequest** is a transactions with potentially various
|
|
|
|
* properties not defined, or with less strict types for its values.
|
|
|
|
*
|
|
|
|
* This is used to pass to various operations, which will internally
|
|
|
|
* coerce any types and populate any necessary values.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export interface TransactionRequest {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The transaction type.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
type?: null | number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The target of the transaction.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
to?: null | AddressLike;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The sender of the transaction.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
from?: null | AddressLike;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The nonce of the transaction, used to prevent replay attacks.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
nonce?: null | number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
2024-02-02 11:25:03 +03:00
|
|
|
* The maximum amount of gas to allow this transaction to consume.
|
2023-06-02 00:52:58 +03:00
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
gasLimit?: null | BigNumberish;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The gas price to use for legacy transactions or transactions on
|
|
|
|
* legacy networks.
|
|
|
|
*
|
|
|
|
* Most of the time the ``max*FeePerGas`` is preferred.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
gasPrice?: null | BigNumberish;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-1559]] maximum priority fee to pay per gas.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
maxPriorityFeePerGas?: null | BigNumberish;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-1559]] maximum total fee to pay per gas. The actual
|
|
|
|
* value used is protocol enforced to be the block's base fee.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
maxFeePerGas?: null | BigNumberish;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The transaction data.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
data?: null | string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The transaction value (in wei).
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
value?: null | BigNumberish;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The chain ID for the network this transaction is valid on.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
chainId?: null | BigNumberish;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-2930]] access list. Storage slots included in the access
|
|
|
|
* list are //warmed// by pre-loading them, so their initial cost to
|
|
|
|
* fetch is guaranteed, but then each additional access is cheaper.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
accessList?: null | AccessListish;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A custom object, which can be passed along for network-specific
|
|
|
|
* values.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
customData?: any;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* When using ``call`` or ``estimateGas``, this allows a specific
|
|
|
|
* block to be queried. Many backends do not support this and when
|
|
|
|
* unsupported errors are silently squelched and ``"latest"`` is used.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
blockTag?: BlockTag;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* When using ``call``, this enables CCIP-read, which permits the
|
|
|
|
* provider to be redirected to web-based content during execution,
|
|
|
|
* which is then further validated by the contract.
|
|
|
|
*
|
|
|
|
* There are potential security implications allowing CCIP-read, as
|
|
|
|
* it could be used to expose the IP address or user activity during
|
|
|
|
* the fetch to unexpected parties.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
enableCcipRead?: boolean;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **PreparedTransactionRequest** is identical to a [[TransactionRequest]]
|
|
|
|
* except all the property types are strictly enforced.
|
|
|
|
*/
|
2022-09-27 10:45:27 +03:00
|
|
|
export interface PreparedTransactionRequest {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The transaction type.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
type?: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The target of the transaction.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
to?: AddressLike;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The sender of the transaction.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
from?: AddressLike;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The nonce of the transaction, used to prevent replay attacks.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
nonce?: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The maximum amount of gas to allow this transaction to consime.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
gasLimit?: bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The gas price to use for legacy transactions or transactions on
|
|
|
|
* legacy networks.
|
|
|
|
*
|
|
|
|
* Most of the time the ``max*FeePerGas`` is preferred.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
gasPrice?: bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-1559]] maximum priority fee to pay per gas.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
maxPriorityFeePerGas?: bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-1559]] maximum total fee to pay per gas. The actual
|
|
|
|
* value used is protocol enforced to be the block's base fee.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
maxFeePerGas?: bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The transaction data.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
data?: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The transaction value (in wei).
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
value?: bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The chain ID for the network this transaction is valid on.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
chainId?: bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-2930]] access list. Storage slots included in the access
|
|
|
|
* list are //warmed// by pre-loading them, so their initial cost to
|
|
|
|
* fetch is guaranteed, but then each additional access is cheaper.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
accessList?: AccessList;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A custom object, which can be passed along for network-specific
|
|
|
|
* values.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
customData?: any;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* When using ``call`` or ``estimateGas``, this allows a specific
|
|
|
|
* block to be queried. Many backends do not support this and when
|
|
|
|
* unsupported errors are silently squelched and ``"latest"`` is used.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
blockTag?: BlockTag;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* When using ``call``, this enables CCIP-read, which permits the
|
|
|
|
* provider to be redirected to web-based content during execution,
|
|
|
|
* which is then further validated by the contract.
|
|
|
|
*
|
|
|
|
* There are potential security implications allowing CCIP-read, as
|
|
|
|
* it could be used to expose the IP address or user activity during
|
|
|
|
* the fetch to unexpected parties.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
enableCcipRead?: boolean;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Returns a copy of %%req%% with all properties coerced to their strict
|
|
|
|
* types.
|
|
|
|
*/
|
2022-09-27 10:45:27 +03:00
|
|
|
export declare function copyRequest(req: TransactionRequest): PreparedTransactionRequest;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* An Interface to indicate a [[Block]] has been included in the
|
|
|
|
* blockchain. This asserts a Type Guard that necessary properties
|
|
|
|
* are non-null.
|
|
|
|
*
|
|
|
|
* Before a block is included, it is a //pending// block.
|
|
|
|
*/
|
2022-11-30 23:44:23 +03:00
|
|
|
export interface MinedBlock extends Block {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block number also known as the block height.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly number: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block hash.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly hash: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block timestamp, in seconds from epoch.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly timestamp: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block date, created from the [[timestamp]].
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly date: Date;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The miner of the block, also known as the ``author`` or
|
|
|
|
* block ``producer``.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly miner: string;
|
|
|
|
}
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* A **Block** represents the data associated with a full block on
|
|
|
|
* Ethereum.
|
|
|
|
*/
|
|
|
|
export declare class Block implements BlockParams, Iterable<string> {
|
2022-09-05 23:57:11 +03:00
|
|
|
#private;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The provider connected to the block used to fetch additional details
|
|
|
|
* if necessary.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly provider: Provider;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The block number, sometimes called the block height. This is a
|
|
|
|
* sequential number that is one higher than the parent block.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly number: number;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The block hash.
|
2023-06-02 00:52:58 +03:00
|
|
|
*
|
|
|
|
* This hash includes all properties, so can be safely used to identify
|
|
|
|
* an exact set of block properties.
|
2022-11-30 23:44:23 +03:00
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly hash: null | string;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The timestamp for this block, which is the number of seconds since
|
|
|
|
* epoch that this block was included.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly timestamp: number;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The block hash of the parent block.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly parentHash: string;
|
2024-02-06 03:59:21 +03:00
|
|
|
/**
|
|
|
|
* The hash tree root of the parent beacon block for the given
|
|
|
|
* execution block. See [[link-eip-4788]].
|
|
|
|
*/
|
|
|
|
parentBeaconBlockRoot: null | string;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The nonce.
|
|
|
|
*
|
|
|
|
* On legacy networks, this is the random number inserted which
|
|
|
|
* permitted the difficulty target to be reached.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly nonce: string;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The difficulty target.
|
|
|
|
*
|
|
|
|
* On legacy networks, this is the proof-of-work target required
|
|
|
|
* for a block to meet the protocol rules to be included.
|
|
|
|
*
|
|
|
|
* On modern networks, this is a random number arrived at using
|
|
|
|
* randao. @TODO: Find links?
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly difficulty: bigint;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The total gas limit for this block.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly gasLimit: bigint;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The total gas used in this block.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly gasUsed: bigint;
|
2024-02-06 03:59:21 +03:00
|
|
|
/**
|
|
|
|
* The root hash for the global state after applying changes
|
|
|
|
* in this block.
|
|
|
|
*/
|
|
|
|
readonly stateRoot: null | string;
|
|
|
|
/**
|
|
|
|
* The hash of the transaction receipts trie.
|
|
|
|
*/
|
|
|
|
readonly receiptsRoot: null | string;
|
2024-02-03 08:19:51 +03:00
|
|
|
/**
|
|
|
|
* The total amount of blob gas consumed by the transactions
|
|
|
|
* within the block. See [[link-eip-4844]].
|
|
|
|
*/
|
|
|
|
readonly blobGasUsed: null | bigint;
|
|
|
|
/**
|
|
|
|
* The running total of blob gas consumed in excess of the
|
|
|
|
* target, prior to the block. See [[link-eip-4844]].
|
|
|
|
*/
|
|
|
|
readonly excessBlobGas: null | bigint;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The miner coinbase address, wihch receives any subsidies for
|
|
|
|
* including this block.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly miner: string;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Any extra data the validator wished to include.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly extraData: string;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The base fee per gas that all transactions in this block were
|
|
|
|
* charged.
|
|
|
|
*
|
|
|
|
* This adjusts after each block, depending on how congested the network
|
|
|
|
* is.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly baseFeePerGas: null | bigint;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Create a new **Block** object.
|
|
|
|
*
|
|
|
|
* This should generally not be necessary as the unless implementing a
|
|
|
|
* low-level library.
|
|
|
|
*/
|
|
|
|
constructor(block: BlockParams, provider: Provider);
|
|
|
|
/**
|
2023-10-10 03:27:56 +03:00
|
|
|
* Returns the list of transaction hashes, in the order
|
|
|
|
* they were executed within the block.
|
2022-11-30 23:44:23 +03:00
|
|
|
*/
|
|
|
|
get transactions(): ReadonlyArray<string>;
|
2023-01-27 07:36:26 +03:00
|
|
|
/**
|
2023-10-10 03:27:56 +03:00
|
|
|
* Returns the complete transactions, in the order they
|
|
|
|
* were executed within the block.
|
|
|
|
*
|
|
|
|
* This is only available for blocks which prefetched
|
|
|
|
* transactions, by passing ``true`` to %%prefetchTxs%%
|
2023-06-02 00:52:58 +03:00
|
|
|
* into [[Provider-getBlock]].
|
2023-01-27 07:36:26 +03:00
|
|
|
*/
|
2023-02-03 06:21:31 +03:00
|
|
|
get prefetchedTransactions(): Array<TransactionResponse>;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Returns a JSON-friendly value.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
toJSON(): any;
|
2022-11-30 23:44:23 +03:00
|
|
|
[Symbol.iterator](): Iterator<string>;
|
|
|
|
/**
|
|
|
|
* The number of transactions in this block.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
get length(): number;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
2022-12-03 05:27:06 +03:00
|
|
|
* The [[link-js-date]] this block was included at.
|
2022-11-30 23:44:23 +03:00
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
get date(): null | Date;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Get the transaction at %%indexe%% within this block.
|
|
|
|
*/
|
|
|
|
getTransaction(indexOrHash: number | string): Promise<TransactionResponse>;
|
|
|
|
/**
|
2023-06-02 00:52:58 +03:00
|
|
|
* If a **Block** was fetched with a request to include the transactions
|
|
|
|
* this will allow synchronous access to those transactions.
|
2022-11-30 23:44:23 +03:00
|
|
|
*
|
2023-06-02 00:52:58 +03:00
|
|
|
* If the transactions were not prefetched, this will throw.
|
|
|
|
*/
|
|
|
|
getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse;
|
|
|
|
/**
|
|
|
|
* Returns true if this block been mined. This provides a type guard
|
|
|
|
* for all properties on a [[MinedBlock]].
|
2022-11-30 23:44:23 +03:00
|
|
|
*/
|
|
|
|
isMined(): this is MinedBlock;
|
|
|
|
/**
|
2023-06-02 00:52:58 +03:00
|
|
|
* Returns true if this block is an [[link-eip-2930]] block.
|
2022-11-30 23:44:23 +03:00
|
|
|
*/
|
|
|
|
isLondon(): this is (Block & {
|
2022-09-16 05:58:45 +03:00
|
|
|
baseFeePerGas: bigint;
|
|
|
|
});
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
orphanedEvent(): OrphanFilter;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **Log** in Ethereum represents an event that has been included in a
|
|
|
|
* transaction using the ``LOG*`` opcodes, which are most commonly used by
|
|
|
|
* Solidity's emit for announcing events.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export declare class Log implements LogParams {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The provider connected to the log used to fetch additional details
|
|
|
|
* if necessary.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly provider: Provider;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The transaction hash of the transaction this log occurred in. Use the
|
|
|
|
* [[Log-getTransaction]] to get the [[TransactionResponse]].
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly transactionHash: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block hash of the block this log occurred in. Use the
|
|
|
|
* [[Log-getBlock]] to get the [[Block]].
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly blockHash: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block number of the block this log occurred in. It is preferred
|
|
|
|
* to use the [[Block-hash]] when fetching the related [[Block]],
|
|
|
|
* since in the case of an orphaned block, the block at that height may
|
|
|
|
* have changed.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly blockNumber: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* If the **Log** represents a block that was removed due to an orphaned
|
|
|
|
* block, this will be true.
|
|
|
|
*
|
|
|
|
* This can only happen within an orphan event listener.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly removed: boolean;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The address of the contract that emitted this log.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly address: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The data included in this log when it was emitted.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly data: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The indexed topics included in this log when it was emitted.
|
|
|
|
*
|
|
|
|
* All topics are included in the bloom filters, so they can be
|
|
|
|
* efficiently filtered using the [[Provider-getLogs]] method.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly topics: ReadonlyArray<string>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The index within the block this log occurred at. This is generally
|
|
|
|
* not useful to developers, but can be used with the various roots
|
|
|
|
* to proof inclusion within a block.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly index: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The index within the transaction of this log.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly transactionIndex: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2022-09-27 10:45:27 +03:00
|
|
|
constructor(log: LogParams, provider: Provider);
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Returns a JSON-compatible object.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
toJSON(): any;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Returns the block that this log occurred in.
|
|
|
|
*/
|
2022-11-30 23:44:23 +03:00
|
|
|
getBlock(): Promise<Block>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Returns the transaction that this log occurred in.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
getTransaction(): Promise<TransactionResponse>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Returns the transaction receipt fot the transaction that this
|
|
|
|
* log occurred in.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
getTransactionReceipt(): Promise<TransactionReceipt>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
removedEvent(): OrphanFilter;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **TransactionReceipt** includes additional information about a
|
|
|
|
* transaction that is only available after it has been mined.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export declare class TransactionReceipt implements TransactionReceiptParams, Iterable<Log> {
|
|
|
|
#private;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The provider connected to the log used to fetch additional details
|
|
|
|
* if necessary.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly provider: Provider;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
2023-11-01 23:17:49 +03:00
|
|
|
* The address the transaction was sent to.
|
2023-06-02 00:52:58 +03:00
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly to: null | string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The sender of the transaction.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly from: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The address of the contract if the transaction was directly
|
|
|
|
* responsible for deploying one.
|
|
|
|
*
|
|
|
|
* This is non-null **only** if the ``to`` is empty and the ``data``
|
|
|
|
* was successfully executed as initcode.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly contractAddress: null | string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The transaction hash.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly hash: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The index of this transaction within the block transactions.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly index: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block hash of the [[Block]] this transaction was included in.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly blockHash: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block number of the [[Block]] this transaction was included in.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly blockNumber: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The bloom filter bytes that represent all logs that occurred within
|
|
|
|
* this transaction. This is generally not useful for most developers,
|
|
|
|
* but can be used to validate the included logs.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly logsBloom: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The actual amount of gas used by this transaction.
|
|
|
|
*
|
|
|
|
* When creating a transaction, the amount of gas that will be used can
|
|
|
|
* only be approximated, but the sender must pay the gas fee for the
|
|
|
|
* entire gas limit. After the transaction, the difference is refunded.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly gasUsed: bigint;
|
2024-02-03 08:19:51 +03:00
|
|
|
/**
|
|
|
|
* The gas used for BLObs. See [[link-eip-4844]].
|
|
|
|
*/
|
|
|
|
readonly blobGasUsed: null | bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The amount of gas used by all transactions within the block for this
|
|
|
|
* and all transactions with a lower ``index``.
|
|
|
|
*
|
|
|
|
* This is generally not useful for developers but can be used to
|
|
|
|
* validate certain aspects of execution.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly cumulativeGasUsed: bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The actual gas price used during execution.
|
|
|
|
*
|
|
|
|
* Due to the complexity of [[link-eip-1559]] this value can only
|
|
|
|
* be caluclated after the transaction has been mined, snce the base
|
|
|
|
* fee is protocol-enforced.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly gasPrice: bigint;
|
2024-02-03 08:19:51 +03:00
|
|
|
/**
|
|
|
|
* The price paid per BLOB in gas. See [[link-eip-4844]].
|
|
|
|
*/
|
|
|
|
readonly blobGasPrice: null | bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-2718]] transaction type.
|
|
|
|
*/
|
2022-09-30 05:57:27 +03:00
|
|
|
readonly type: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The status of this transaction, indicating success (i.e. ``1``) or
|
|
|
|
* a revert (i.e. ``0``).
|
|
|
|
*
|
|
|
|
* This is available in post-byzantium blocks, but some backends may
|
|
|
|
* backfill this value.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly status: null | number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The root hash of this transaction.
|
|
|
|
*
|
|
|
|
* This is no present and was only included in pre-byzantium blocks, but
|
|
|
|
* could be used to validate certain parts of the receipt.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly root: null | string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2022-09-27 10:45:27 +03:00
|
|
|
constructor(tx: TransactionReceiptParams, provider: Provider);
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The logs for this transaction.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
get logs(): ReadonlyArray<Log>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Returns a JSON-compatible representation.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
toJSON(): any;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
get length(): number;
|
|
|
|
[Symbol.iterator](): Iterator<Log>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The total fee for this transaction, in wei.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
get fee(): bigint;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the block this transaction occurred in.
|
|
|
|
*/
|
2022-11-30 23:44:23 +03:00
|
|
|
getBlock(): Promise<Block>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the transaction this transaction occurred in.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
getTransaction(): Promise<TransactionResponse>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the return value of the execution of this transaction.
|
|
|
|
*
|
|
|
|
* Support for this feature is limited, as it requires an archive node
|
|
|
|
* with the ``debug_`` or ``trace_`` API enabled.
|
|
|
|
*/
|
2022-09-16 05:58:45 +03:00
|
|
|
getResult(): Promise<string>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the number of confirmations this transaction has.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
confirmations(): Promise<number>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
removedEvent(): OrphanFilter;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
reorderedEvent(other?: TransactionResponse): OrphanFilter;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **MinedTransactionResponse** is an interface representing a
|
|
|
|
* transaction which has been mined and allows for a type guard for its
|
|
|
|
* property values being defined.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export interface MinedTransactionResponse extends TransactionResponse {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block number this transaction occurred in.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
blockNumber: number;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The block hash this transaction occurred in.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
blockHash: string;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The date this transaction occurred on.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
date: Date;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **TransactionResponse** includes all properties about a transaction
|
|
|
|
* that was sent to the network, which may or may not be included in a
|
|
|
|
* block.
|
|
|
|
*
|
|
|
|
* The [[TransactionResponse-isMined]] can be used to check if the
|
|
|
|
* transaction has been mined as well as type guard that the otherwise
|
|
|
|
* possibly ``null`` properties are defined.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export declare class TransactionResponse implements TransactionLike<string>, TransactionResponseParams {
|
2022-09-27 10:45:27 +03:00
|
|
|
#private;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The provider this is connected to, which will influence how its
|
|
|
|
* methods will resolve its async inspection methods.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly provider: Provider;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The block number of the block that this transaction was included in.
|
|
|
|
*
|
|
|
|
* This is ``null`` for pending transactions.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly blockNumber: null | number;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The blockHash of the block that this transaction was included in.
|
|
|
|
*
|
|
|
|
* This is ``null`` for pending transactions.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly blockHash: null | string;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The index within the block that this transaction resides at.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly index: number;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The transaction hash.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly hash: string;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-2718]] transaction envelope type. This is
|
|
|
|
* ``0`` for legacy transactions types.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly type: number;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The receiver of this transaction.
|
|
|
|
*
|
|
|
|
* If ``null``, then the transaction is an initcode transaction.
|
|
|
|
* This means the result of executing the [[data]] will be deployed
|
|
|
|
* as a new contract on chain (assuming it does not revert) and the
|
|
|
|
* address may be computed using [[getCreateAddress]].
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly to: null | string;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The sender of this transaction. It is implicitly computed
|
|
|
|
* from the transaction pre-image hash (as the digest) and the
|
|
|
|
* [[signature]] using ecrecover.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly from: string;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The nonce, which is used to prevent replay attacks and offer
|
|
|
|
* a method to ensure transactions from a given sender are explicitly
|
|
|
|
* ordered.
|
|
|
|
*
|
|
|
|
* When sending a transaction, this must be equal to the number of
|
|
|
|
* transactions ever sent by [[from]].
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly nonce: number;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The maximum units of gas this transaction can consume. If execution
|
|
|
|
* exceeds this, the entries transaction is reverted and the sender
|
|
|
|
* is charged for the full amount, despite not state changes being made.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly gasLimit: bigint;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The gas price can have various values, depending on the network.
|
|
|
|
*
|
|
|
|
* In modern networks, for transactions that are included this is
|
|
|
|
* the //effective gas price// (the fee per gas that was actually
|
|
|
|
* charged), while for transactions that have not been included yet
|
|
|
|
* is the [[maxFeePerGas]].
|
|
|
|
*
|
|
|
|
* For legacy transactions, or transactions on legacy networks, this
|
|
|
|
* is the fee that will be charged per unit of gas the transaction
|
|
|
|
* consumes.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly gasPrice: bigint;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The maximum priority fee (per unit of gas) to allow a
|
|
|
|
* validator to charge the sender. This is inclusive of the
|
|
|
|
* [[maxFeeFeePerGas]].
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly maxPriorityFeePerGas: null | bigint;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The maximum fee (per unit of gas) to allow this transaction
|
|
|
|
* to charge the sender.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly maxFeePerGas: null | bigint;
|
2024-02-03 08:19:51 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-4844]] max fee per BLOb gas.
|
|
|
|
*/
|
|
|
|
readonly maxFeePerBlobGas: null | bigint;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The data.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly data: string;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The value, in wei. Use [[formatEther]] to format this value
|
|
|
|
* as ether.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly value: bigint;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The chain ID.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly chainId: bigint;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The signature.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly signature: Signature;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-2930]] access list for transaction types that
|
|
|
|
* support it, otherwise ``null``.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
readonly accessList: null | AccessList;
|
2024-02-03 08:19:51 +03:00
|
|
|
/**
|
|
|
|
* The [[link-eip-4844]] BLOb versioned hashes.
|
|
|
|
*/
|
|
|
|
readonly blobVersionedHashes: null | Array<string>;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
2023-06-02 00:52:58 +03:00
|
|
|
* @_ignore:
|
2023-03-20 19:53:37 +03:00
|
|
|
*/
|
2022-09-27 10:45:27 +03:00
|
|
|
constructor(tx: TransactionResponseParams, provider: Provider);
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
2023-06-02 00:52:58 +03:00
|
|
|
* Returns a JSON-compatible representation of this transaction.
|
2023-03-20 19:53:37 +03:00
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
toJSON(): any;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the Block that this transaction was included in.
|
|
|
|
*
|
|
|
|
* This will return null if the transaction has not been included yet.
|
|
|
|
*/
|
2022-11-30 23:44:23 +03:00
|
|
|
getBlock(): Promise<null | Block>;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Resolves to this transaction being re-requested from the
|
|
|
|
* provider. This can be used if you have an unmined transaction
|
|
|
|
* and wish to get an up-to-date populated instance.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
getTransaction(): Promise<null | TransactionResponse>;
|
2023-06-07 05:42:28 +03:00
|
|
|
/**
|
|
|
|
* Resolve to the number of confirmations this transaction has.
|
|
|
|
*/
|
|
|
|
confirmations(): Promise<number>;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Resolves once this transaction has been mined and has
|
|
|
|
* %%confirms%% blocks including it (default: ``1``) with an
|
|
|
|
* optional %%timeout%%.
|
|
|
|
*
|
|
|
|
* This can resolve to ``null`` only if %%confirms%% is ``0``
|
|
|
|
* and the transaction has not been mined, otherwise this will
|
|
|
|
* wait until enough confirmations have completed.
|
|
|
|
*/
|
2022-09-27 10:45:27 +03:00
|
|
|
wait(_confirms?: number, _timeout?: number): Promise<null | TransactionReceipt>;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Returns ``true`` if this transaction has been included.
|
|
|
|
*
|
|
|
|
* This is effective only as of the time the TransactionResponse
|
|
|
|
* was instantiated. To get up-to-date information, use
|
|
|
|
* [[getTransaction]].
|
|
|
|
*
|
|
|
|
* This provides a Type Guard that this transaction will have
|
|
|
|
* non-null property values for properties that are null for
|
|
|
|
* unmined transactions.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
isMined(): this is MinedTransactionResponse;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Returns true if the transaction is a legacy (i.e. ``type == 0``)
|
|
|
|
* transaction.
|
|
|
|
*
|
|
|
|
* This provides a Type Guard that this transaction will have
|
|
|
|
* the ``null``-ness for hardfork-specific properties set correctly.
|
|
|
|
*/
|
2022-09-16 05:58:45 +03:00
|
|
|
isLegacy(): this is (TransactionResponse & {
|
|
|
|
accessList: null;
|
|
|
|
maxFeePerGas: null;
|
|
|
|
maxPriorityFeePerGas: null;
|
|
|
|
});
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Returns true if the transaction is a Berlin (i.e. ``type == 1``)
|
|
|
|
* transaction. See [[link-eip-2070]].
|
|
|
|
*
|
|
|
|
* This provides a Type Guard that this transaction will have
|
|
|
|
* the ``null``-ness for hardfork-specific properties set correctly.
|
|
|
|
*/
|
2022-09-16 05:58:45 +03:00
|
|
|
isBerlin(): this is (TransactionResponse & {
|
|
|
|
accessList: AccessList;
|
|
|
|
maxFeePerGas: null;
|
|
|
|
maxPriorityFeePerGas: null;
|
|
|
|
});
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Returns true if the transaction is a London (i.e. ``type == 2``)
|
|
|
|
* transaction. See [[link-eip-1559]].
|
|
|
|
*
|
|
|
|
* This provides a Type Guard that this transaction will have
|
|
|
|
* the ``null``-ness for hardfork-specific properties set correctly.
|
|
|
|
*/
|
2022-09-16 05:58:45 +03:00
|
|
|
isLondon(): this is (TransactionResponse & {
|
|
|
|
accessList: AccessList;
|
|
|
|
maxFeePerGas: bigint;
|
|
|
|
maxPriorityFeePerGas: bigint;
|
|
|
|
});
|
2024-02-03 08:19:51 +03:00
|
|
|
/**
|
|
|
|
* Returns true if hte transaction is a Cancun (i.e. ``type == 3``)
|
|
|
|
* transaction. See [[link-eip-4844]].
|
|
|
|
*/
|
|
|
|
isCancun(): this is (TransactionResponse & {
|
|
|
|
accessList: AccessList;
|
|
|
|
maxFeePerGas: bigint;
|
|
|
|
maxPriorityFeePerGas: bigint;
|
|
|
|
maxFeePerBlobGas: bigint;
|
|
|
|
blobVersionedHashes: Array<string>;
|
|
|
|
});
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Returns a filter which can be used to listen for orphan events
|
|
|
|
* that evict this transaction.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
removedEvent(): OrphanFilter;
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* Returns a filter which can be used to listen for orphan events
|
|
|
|
* that re-order this event against %%other%%.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
reorderedEvent(other?: TransactionResponse): OrphanFilter;
|
2022-09-27 10:45:27 +03:00
|
|
|
/**
|
|
|
|
* Returns a new TransactionResponse instance which has the ability to
|
|
|
|
* detect (and throw an error) if the transaction is replaced, which
|
|
|
|
* will begin scanning at %%startBlock%%.
|
|
|
|
*
|
|
|
|
* This should generally not be used by developers and is intended
|
|
|
|
* primarily for internal use. Setting an incorrect %%startBlock%% can
|
|
|
|
* have devastating performance consequences if used incorrectly.
|
|
|
|
*/
|
|
|
|
replaceableTransaction(startBlock: number): TransactionResponse;
|
2022-09-05 23:57:11 +03:00
|
|
|
}
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* An Orphan Filter allows detecting when an orphan block has
|
|
|
|
* resulted in dropping a block or transaction or has resulted
|
|
|
|
* in transactions changing order.
|
|
|
|
*
|
|
|
|
* Not currently fully supported.
|
|
|
|
*/
|
2023-02-02 12:05:47 +03:00
|
|
|
export type OrphanFilter = {
|
2022-09-05 23:57:11 +03:00
|
|
|
orphan: "drop-block";
|
|
|
|
hash: string;
|
|
|
|
number: number;
|
|
|
|
} | {
|
|
|
|
orphan: "drop-transaction";
|
|
|
|
tx: {
|
|
|
|
hash: string;
|
|
|
|
blockHash: string;
|
|
|
|
blockNumber: number;
|
|
|
|
};
|
|
|
|
other?: {
|
|
|
|
hash: string;
|
|
|
|
blockHash: string;
|
|
|
|
blockNumber: number;
|
|
|
|
};
|
|
|
|
} | {
|
|
|
|
orphan: "reorder-transaction";
|
|
|
|
tx: {
|
|
|
|
hash: string;
|
|
|
|
blockHash: string;
|
|
|
|
blockNumber: number;
|
|
|
|
};
|
|
|
|
other?: {
|
|
|
|
hash: string;
|
|
|
|
blockHash: string;
|
|
|
|
blockNumber: number;
|
|
|
|
};
|
|
|
|
} | {
|
|
|
|
orphan: "drop-log";
|
|
|
|
log: {
|
|
|
|
transactionHash: string;
|
|
|
|
blockHash: string;
|
|
|
|
blockNumber: number;
|
|
|
|
address: string;
|
|
|
|
data: string;
|
|
|
|
topics: ReadonlyArray<string>;
|
|
|
|
index: number;
|
|
|
|
};
|
|
|
|
};
|
2023-03-20 19:53:37 +03:00
|
|
|
/**
|
|
|
|
* A **TopicFilter** provides a struture to define bloom-filter
|
|
|
|
* queries.
|
|
|
|
*
|
|
|
|
* Each field that is ``null`` matches **any** value, a field that is
|
|
|
|
* a ``string`` must match exactly that value and and ``array`` is
|
|
|
|
* effectively an ``OR``-ed set, where any one of those values must
|
|
|
|
* match.
|
|
|
|
*/
|
2023-02-02 12:05:47 +03:00
|
|
|
export type TopicFilter = Array<null | string | Array<string>>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* An **EventFilter** allows efficiently filtering logs (also known as
|
|
|
|
* events) using bloom filters included within blocks.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export interface EventFilter {
|
|
|
|
address?: AddressLike | Array<AddressLike>;
|
|
|
|
topics?: TopicFilter;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **Filter** allows searching a specific range of blocks for mathcing
|
|
|
|
* logs.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export interface Filter extends EventFilter {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The start block for the filter (inclusive).
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
fromBlock?: BlockTag;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The end block for the filter (inclusive).
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
toBlock?: BlockTag;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **FilterByBlockHash** allows searching a specific block for mathcing
|
|
|
|
* logs.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export interface FilterByBlockHash extends EventFilter {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The blockhash of the specific block for the filter.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
blockHash?: string;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **ProviderEvent** provides the types of events that can be subscribed
|
|
|
|
* to on a [[Provider]].
|
|
|
|
*
|
|
|
|
* Each provider may include additional possible events it supports, but
|
|
|
|
* the most commonly supported are:
|
|
|
|
*
|
|
|
|
* **``"block"``** - calls the listener with the current block number on each
|
|
|
|
* new block.
|
|
|
|
*
|
|
|
|
* **``"error"``** - calls the listener on each async error that occurs during
|
|
|
|
* the event loop, with the error.
|
|
|
|
*
|
|
|
|
* **``"debug"``** - calls the listener on debug events, which can be used to
|
|
|
|
* troubleshoot network errors, provider problems, etc.
|
|
|
|
*
|
|
|
|
* **``transaction hash``** - calls the listener on each block after the
|
|
|
|
* transaction has been mined; generally ``.once`` is more appropriate for
|
|
|
|
* this event.
|
|
|
|
*
|
|
|
|
* **``Array``** - calls the listener on each log that matches the filter.
|
|
|
|
*
|
|
|
|
* [[EventFilter]] - calls the listener with each matching log
|
|
|
|
*/
|
2023-02-02 12:05:47 +03:00
|
|
|
export type ProviderEvent = string | Array<string | Array<string>> | EventFilter | OrphanFilter;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* A **Provider** is the primary method to interact with the read-only
|
|
|
|
* content on Ethereum.
|
|
|
|
*
|
|
|
|
* It allows access to details about accounts, blocks and transactions
|
|
|
|
* and the ability to query event logs and simulate contract execution.
|
|
|
|
*
|
|
|
|
* Account data includes the [balance](getBalance),
|
|
|
|
* [transaction count](getTransactionCount), [code](getCode) and
|
|
|
|
* [state trie storage](getStorage).
|
|
|
|
*
|
|
|
|
* Simulating execution can be used to [call](call),
|
|
|
|
* [estimate gas](estimateGas) and
|
|
|
|
* [get transaction results](getTransactionResult).
|
|
|
|
*
|
|
|
|
* The [[broadcastTransaction]] is the only method which allows updating
|
|
|
|
* the blockchain, but it is usually accessed by a [[Signer]], since a
|
|
|
|
* private key must be used to sign the transaction before it can be
|
|
|
|
* broadcast.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
export interface Provider extends ContractRunner, EventEmitterable<ProviderEvent>, NameResolver {
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* The provider iteself.
|
|
|
|
*
|
|
|
|
* This is part of the necessary API for executing a contract, as
|
|
|
|
* it provides a common property on any [[ContractRunner]] that
|
|
|
|
* can be used to access the read-only portion of the runner.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
provider: this;
|
2022-12-31 00:35:04 +03:00
|
|
|
/**
|
|
|
|
* Shutdown any resources this provider is using. No additional
|
|
|
|
* calls should be made to this provider after calling this.
|
|
|
|
*/
|
|
|
|
destroy(): void;
|
2022-09-05 23:57:11 +03:00
|
|
|
/**
|
|
|
|
* Get the current block number.
|
|
|
|
*/
|
|
|
|
getBlockNumber(): Promise<number>;
|
|
|
|
/**
|
|
|
|
* Get the connected [[Network]].
|
|
|
|
*/
|
2022-09-27 10:45:27 +03:00
|
|
|
getNetwork(): Promise<Network>;
|
2022-09-05 23:57:11 +03:00
|
|
|
/**
|
|
|
|
* Get the best guess at the recommended [[FeeData]].
|
|
|
|
*/
|
|
|
|
getFeeData(): Promise<FeeData>;
|
|
|
|
/**
|
2022-11-30 23:44:23 +03:00
|
|
|
* Get the account balance (in wei) of %%address%%. If %%blockTag%%
|
|
|
|
* is specified and the node supports archive access for that
|
|
|
|
* %%blockTag%%, the balance is as of that [[BlockTag]].
|
2022-09-05 23:57:11 +03:00
|
|
|
*
|
|
|
|
* @note On nodes without archive access enabled, the %%blockTag%% may be
|
|
|
|
* **silently ignored** by the node, which may cause issues if relied on.
|
|
|
|
*/
|
|
|
|
getBalance(address: AddressLike, blockTag?: BlockTag): Promise<bigint>;
|
|
|
|
/**
|
2022-11-30 23:44:23 +03:00
|
|
|
* Get the number of transactions ever sent for %%address%%, which
|
|
|
|
* is used as the ``nonce`` when sending a transaction. If
|
|
|
|
* %%blockTag%% is specified and the node supports archive access
|
|
|
|
* for that %%blockTag%%, the transaction count is as of that
|
|
|
|
* [[BlockTag]].
|
2022-09-05 23:57:11 +03:00
|
|
|
*
|
|
|
|
* @note On nodes without archive access enabled, the %%blockTag%% may be
|
|
|
|
* **silently ignored** by the node, which may cause issues if relied on.
|
|
|
|
*/
|
|
|
|
getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise<number>;
|
|
|
|
/**
|
2022-11-30 23:44:23 +03:00
|
|
|
* Get the bytecode for %%address%%.
|
2022-09-05 23:57:11 +03:00
|
|
|
*
|
|
|
|
* @note On nodes without archive access enabled, the %%blockTag%% may be
|
|
|
|
* **silently ignored** by the node, which may cause issues if relied on.
|
|
|
|
*/
|
|
|
|
getCode(address: AddressLike, blockTag?: BlockTag): Promise<string>;
|
|
|
|
/**
|
2022-11-30 23:44:23 +03:00
|
|
|
* Get the storage slot value for %%address%% at slot %%position%%.
|
2022-09-05 23:57:11 +03:00
|
|
|
*
|
|
|
|
* @note On nodes without archive access enabled, the %%blockTag%% may be
|
|
|
|
* **silently ignored** by the node, which may cause issues if relied on.
|
|
|
|
*/
|
2022-09-30 05:57:27 +03:00
|
|
|
getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise<string>;
|
2022-09-05 23:57:11 +03:00
|
|
|
/**
|
|
|
|
* Estimates the amount of gas required to executre %%tx%%.
|
|
|
|
*/
|
|
|
|
estimateGas(tx: TransactionRequest): Promise<bigint>;
|
|
|
|
/**
|
2022-11-30 23:44:23 +03:00
|
|
|
* Simulate the execution of %%tx%%. If the call reverts, it will
|
|
|
|
* throw a [[CallExceptionError]] which includes the revert data.
|
2022-09-05 23:57:11 +03:00
|
|
|
*/
|
2022-09-27 10:45:27 +03:00
|
|
|
call(tx: TransactionRequest): Promise<string>;
|
2022-09-05 23:57:11 +03:00
|
|
|
/**
|
2022-11-30 23:44:23 +03:00
|
|
|
* Broadcasts the %%signedTx%% to the network, adding it to the
|
|
|
|
* memory pool of any node for which the transaction meets the
|
|
|
|
* rebroadcast requirements.
|
2022-09-05 23:57:11 +03:00
|
|
|
*/
|
|
|
|
broadcastTransaction(signedTx: string): Promise<TransactionResponse>;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the block for %%blockHashOrBlockTag%%.
|
|
|
|
*
|
|
|
|
* If %%prefetchTxs%%, and the backend supports including transactions
|
|
|
|
* with block requests, all transactions will be included and the
|
|
|
|
* [[Block]] object will not need to make remote calls for getting
|
|
|
|
* transactions.
|
|
|
|
*/
|
|
|
|
getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise<null | Block>;
|
|
|
|
/**
|
|
|
|
* Resolves to the transaction for %%hash%%.
|
|
|
|
*
|
|
|
|
* If the transaction is unknown or on pruning nodes which
|
|
|
|
* discard old transactions this resolves to ``null``.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
getTransaction(hash: string): Promise<null | TransactionResponse>;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the transaction receipt for %%hash%%, if mined.
|
|
|
|
*
|
|
|
|
* If the transaction has not been mined, is unknown or on
|
|
|
|
* pruning nodes which discard old transactions this resolves to
|
|
|
|
* ``null``.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
getTransactionReceipt(hash: string): Promise<null | TransactionReceipt>;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the result returned by the executions of %%hash%%.
|
|
|
|
*
|
|
|
|
* This is only supported on nodes with archive access and with
|
|
|
|
* the necessary debug APIs enabled.
|
|
|
|
*/
|
2022-09-16 05:58:45 +03:00
|
|
|
getTransactionResult(hash: string): Promise<null | string>;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the list of Logs that match %%filter%%
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the address configured for the %%ensName%% or
|
|
|
|
* ``null`` if unconfigured.
|
|
|
|
*/
|
|
|
|
resolveName(ensName: string): Promise<null | string>;
|
|
|
|
/**
|
|
|
|
* Resolves to the ENS name associated for the %%address%% or
|
|
|
|
* ``null`` if the //primary name// is not configured.
|
|
|
|
*
|
|
|
|
* Users must perform additional steps to configure a //primary name//,
|
|
|
|
* which is not currently common.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
lookupAddress(address: string): Promise<null | string>;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Waits until the transaction %%hash%% is mined and has %%confirms%%
|
|
|
|
* confirmations.
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise<null | TransactionReceipt>;
|
2022-11-30 23:44:23 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the block at %%blockTag%% once it has been mined.
|
|
|
|
*
|
|
|
|
* This can be useful for waiting some number of blocks by using
|
|
|
|
* the ``currentBlockNumber + N``.
|
|
|
|
*/
|
|
|
|
waitForBlock(blockTag?: BlockTag): Promise<Block>;
|
2022-09-05 23:57:11 +03:00
|
|
|
}
|
|
|
|
//# sourceMappingURL=provider.d.ts.map
|