Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5811 merge block tags #5823

Merged
merged 22 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/web3-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added rpc exception codes following eip-1474 as an experimental feature (if `useRpcCallSpecification` at `enableExperimentalFeatures` is `true`) (#5525)
- Added support of `safe` and `finalized` block tags (#5823)
2 changes: 2 additions & 0 deletions packages/web3-core/src/web3_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ export abstract class Web3Config
* - `"earliest"` - String: The genesis block
* - `"latest"` - String: The latest block (current head of the blockchain)
* - `"pending"` - String: The currently mined block (including pending transactions)
* - `"finalized"` - String: (For POS networks) The finalized block is one which has been accepted as canonical by greater than 2/3 of validators
* - `"safe"` - String: (For POS networks) The safe head block is one which under normal network conditions, is expected to be included in the canonical chain. Under normal network conditions the safe head and the actual tip of the chain will be equivalent (with safe head trailing only by a few seconds). Safe heads will be less likely to be reorged than the proof of work network`s latest blocks.
*/
public set defaultBlock(val) {
this.emit(Web3ConfigEvent.CONFIG_CHANGE, {
Expand Down
1 change: 1 addition & 0 deletions packages/web3-eth-contract/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,4 @@ const transactionHash = receipt.transactionHash;
### Added

- Added functionality of `createAccessList` for contracts ( #5780 )
- Added support of `safe` and `finalized` block tags (#5823)
10 changes: 5 additions & 5 deletions packages/web3-eth-contract/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface ContractEventOptions {
*/
filter?: Record<string, unknown>;
/**
* The block number (greater than or equal to) from which to get events on. Pre-defined block numbers as `earliest`, `latest` and `pending` can also be used. For specific range use {@link Contract.getPastEvents}.
* The block number (greater than or equal to) from which to get events on. Pre-defined block numbers as `earliest`, `latest`, `pending`, `safe` or `finalized` can also be used. For specific range use {@link Contract.getPastEvents}.
*/
fromBlock?: BlockNumberOrTag;
/**
Expand Down Expand Up @@ -236,7 +236,7 @@ export interface NonPayableMethodObject<Inputs = unknown[], Outputs = unknown[]>
* ```
*
* @param tx - The options used for calling.
* @param block - If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as `earliest`, `latest`, and `pending` can also be used. Useful for requesting data from or replaying transactions in past blocks.
* @param block - If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as `earliest`, `latest`, `pending`, `safe` or `finalized can also be used. Useful for requesting data from or replaying transactions in past blocks.
* @returns - The return value(s) of the smart contract method. If it returns a single value, it’s returned as is. If it has multiple return values they are returned as an object with properties and indices.
*/

Expand Down Expand Up @@ -355,7 +355,7 @@ export interface NonPayableMethodObject<Inputs = unknown[], Outputs = unknown[]>
* This method generates an access list for a transaction. You must specify a `from` address and `gas` if it’s not specified in options.
*
* @param options - The options used for createAccessList.
* @param block - If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as `earliest`, `latest`, and `pending` can also be used. Useful for requesting data from or replaying transactions in past blocks.
* @param block - If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as `earliest`, `latest`, `pending`, `safe` or `finalized can also be used. Useful for requesting data from or replaying transactions in past blocks.
* @returns The returned data of the createAccessList, e.g. The generated access list for transaction.
*
* ```ts
Expand Down Expand Up @@ -426,7 +426,7 @@ export interface PayableMethodObject<Inputs = unknown[], Outputs = unknown[]> {
* ```
*
* @param tx - The options used for calling.
* @param block - If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as `earliest`, `latest`, and `pending` can also be used. Useful for requesting data from or replaying transactions in past blocks.
* @param block - If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as `earliest`, `latest`, `pending`, `safe` or `finalized can also be used. Useful for requesting data from or replaying transactions in past blocks.
* @returns - The return value(s) of the smart contract method. If it returns a single value, it’s returned as is. If it has multiple return values they are returned as an object with properties and indices.
*/
call<SpecialOutput = Outputs>(
Expand Down Expand Up @@ -544,7 +544,7 @@ export interface PayableMethodObject<Inputs = unknown[], Outputs = unknown[]> {
* This method generates an access list for a transaction. You must specify a `from` address and `gas` if it’s not specified in options.
*
* @param options - The options used for createAccessList.
* @param block - If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as `earliest`, `latest`, and `pending` can also be used. Useful for requesting data from or replaying transactions in past blocks.
* @param block - If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as `earliest`, `latest`, `pending`, `safe` or `finalized can also be used. Useful for requesting data from or replaying transactions in past blocks.
* @returns The returned data of the createAccessList, e.g. The generated access list for transaction.
*
* ```ts
Expand Down
1 change: 1 addition & 0 deletions packages/web3-eth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added `createAccessList` functionality ( #5780 )
- Added support of `safe` and `finalized` block tags (#5823)
jdevcs marked this conversation as resolved.
Show resolved Hide resolved
Loading