Skip to content

Commit

Permalink
Merge branch '4.x' into dependabot/npm_and_yarn/undici-5.28.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevcs committed Mar 20, 2024
2 parents 69cb59d + 1f81ff0 commit 004fb4d
Show file tree
Hide file tree
Showing 112 changed files with 1,860 additions and 849 deletions.
30 changes: 15 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Contributing

Thank you for contributing to web3.js! We appreciate your interest and welcome any contributions that can help improve our documentation, functionality, addressing bugs, or any other aspects that can contribute to the overall improvement of our project. Before you start contributing, please take a moment to review the guidelines below.
Thank you for contributing to Web3.js! We appreciate your interest and welcome any contributions that can help improve our documentation, functionality, address bugs, or any other aspects that can contribute to the overall improvement of our project. Before you start contributing, please take a moment to review the guidelines below.

## Help and Support

If you face any issues while contributing, or you want any type of support, we encourage you to join our [Discord Community](https://discord.com/invite/3shNX8cqGR) and ask any question in the `#web3js-general` channel, and/or submit a [New Issue](https://github.com/web3/web3.js/issues/new).
If you face any issues while contributing or want any type of support, we encourage you to join our [Discord Community](https://discord.com/invite/3shNX8cqGR), ask any question in the `#web3js-general` channel, and/or submit a [new issue](https://github.com/web3/web3.js/issues/new).

## Prerequisites

Expand All @@ -15,12 +15,12 @@ If you face any issues while contributing, or you want any type of support, we e

1. **Fork the docs:** Start by forking our repository to your GitHub account.

2. **Clone the repo:** Clone the forked repository to your local machine using the following command
2. **Clone the repo:** Clone the forked repository to your local machine using the following command:
```bash
git clone https://github.com/your-username/web3.js.git
```
3. **Create a Branch:** Create a new branch for your changes with a descriptive name.
**NOTE: The branch name must include the issue number (if there is no issue created for your contribution, please create one)**
**NOTE: The branch name must include the issue number (if there is no issue created for your contribution, please create one).**
```bash
git checkout -b issue-name-1234
```
Expand All @@ -32,7 +32,7 @@ yarn
```
6. **Make your changes:**...

7. Check changes in local environment: Run the command `yarn start` and you'll see a local environment in `localhost:3000` with the docs
7. Check changes in the local environment: Run the command `yarn start` and you'll see a local environment in `localhost:3000` with the documents.

8. **Commit your changes:** `git add .` and `git commit -m 'descriptive msg'`

Expand All @@ -41,9 +41,9 @@ yarn
git push origin branch-name
```

10. **Open a Pull request(PR):** Provide a detailed description of your changes, the problem you are solving, and any additional context(you can use the PR template).
10. **Open a Pull Request (PR):** Provide a detailed description of your changes, the problem you are solving, and any additional context (you can use the PR template).

11. **Wait for review**: Before merging any branch into the main branch, it must be approved by 2 devs, after succesfully approved, you can `Squash and merge` your branch, Please be responsive to any feedback on your pull request and make necessary changes based on the review.
11. **Wait for review**: Before merging any branch into the main branch, it must be approved by two devs, after it is successfully approved, you can `Squash and merge` your branch, Please be responsive to any feedback on your pull request and make necessary changes based on the review.

## Guidelines for Pull Requests and Releases (Web3 4.x)

Expand All @@ -54,25 +54,25 @@ that **Web3 not break**.
### Pull Requests for substantive changes (e.g. everything except comments and docs)

1. Any PR that introduces a logic change should include tests. (In many cases, the tests will take more time to write than the actual code).
1. All PRs should sit for 72 hours with the `pleasereview` tag in order to garner feedback.
1. All PRs should sit for 72 hours with the `please review` tag to garner feedback.
1. No PR should be merged until it has been reviewed, passes CI, and all reviews' comments are
addressed.
1. PRs should:
1. have a narrow, well-defined focus.
1. make the smallest set of changes possible to achieve their goal.
1. include a clear description in the opening comment.
1. preserve the conventions and stylistic consistency of any files they modify.
1. Given the choice between a conservative change that mostly works and an adventurous change which seems better but introduces uncertainty - prefer the conservative change.
1. Given the choice between a conservative change that mostly works and an adventurous change that seems better but introduces uncertainty - prefer the conservative change.

### Reviews

The end goal of review is to suggest useful improvements to the author. Reviews should finish with approval unless there are issues that would result in:
The end goal of the review is to suggest useful improvements to the author. Reviews should finish with approval unless there are issues that would result in:

1. Buggy behaviour.
1. Buggy behavior.
1. Undue maintenance burden.
1. Pessimisation (i.e. speed reduction / meaningful build-size increases).
1. Pessimisation (i.e. speed reduction or meaningful build-size increases).
1. Feature reduction (i.e. it removes some aspect of functionality that users rely on).
1. Avoidable risk (i.e it's difficult to test or hard to anticipate the implications of, without
1. Avoidable risk (i.e. it's difficult to test or hard to anticipate the implications of, without
being strictly necessary to fix something broken).

Read more in [Review Guidelines](./REVIEW.md).
Expand All @@ -85,9 +85,9 @@ Read more in [Review Guidelines](./REVIEW.md).
1. Changes should trigger a new `rc` release and set the release clock back enough that reviewers have the time they need to test new changes.
1. Regular maintainers should manually test the `rc` against a Node project and the published
minified bundle in a browser context. An external reviewer should verify they've done the same.
1. A release PR must be approved at least by two known contributors of the web3.js project.
1. A release PR must be approved at least by two known contributors to the web3.js project.

Read more in [Release Guidelines](./RELEASE.md).
Read more in the [Release Guidelines](./RELEASE.md).

### Emergencies

Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ jobs:
uses: actions/cache/restore@v3
with:
path: packages/web3/dist/4.x.json
key: web3-bundle-stats-4x-${{github.sha}}
key: web3-bundle-stats-4x-${{github.event.pull_request.base.sha}}
- run: yarn build:web:analyze
env:
STATS_FILE: ${{ github.ref_name }}.json
- name: Compare bundle stats
uses: github/webpack-bundlesize-compare-action@v1
if: github.event_name != 'push'
uses: github/webpack-bundlesize-compare-action@v1.8.2
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -105,9 +104,10 @@ jobs:
uses: actions/cache/save@v3
if: github.event_name == 'push' && github.ref == 'refs/heads/4.x'
with:
path: packages/web3/dist/4.x.json
path: packages/web3/dist/${{ github.ref_name }}.json
key: web3-bundle-stats-4x-${{github.sha}}


unit:
name: Unit Tests
needs: build
Expand All @@ -118,6 +118,7 @@ jobs:
steps:
- uses: actions/setup-node@v4
with:
architecture: x64
node-version: ${{ matrix.node }}
- uses: actions/cache/restore@v3
with:
Expand Down Expand Up @@ -239,7 +240,7 @@ jobs:
path: ./
key: web3-18-${{github.sha}}
# @octokit/core not supported on node 16, so I can't add it to the package.json
- run: npm install --no-package-lock --no-save --force @octokit/core
- run: npm install --no-package-lock --no-save --force @octokit/core@5.1.0
- name: Restore main branch benchmark data
uses: actions/cache/restore@v3
with:
Expand Down
62 changes: 51 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ Released with 1.0.0-beta.37 code base.

- Introduce review and release guidelines. (#3460)
- Add EIP-1193 compatible provider to `AbstractProvider` interface. (#3499)
- Add Typescript definitions for contract `methods` and `call`. (#3454)
- Add TypeScript definitions for contract `methods` and `call`. (#3454)
- Update AbstractProvider and contract.methods TS definitions (#3521)
- Add support for ENS contenthash methods. (#3392, #2782)

### Changed

- Change CI provider from Travis to Github Actions. (#3468)
- Change CI provider from Travis to GitHub Actions. (#3468)
- Update `web3-eth-abi` ABICoder dependency. (#3490)
- Update AbiCoder param formatting (#3522)
- Improve code clarity of HttpProvider keepAlive option setting. (#3463)
Expand Down Expand Up @@ -354,7 +354,7 @@ Released with 1.0.0-beta.37 code base.

### Added

- Github action for running tests for `web3-eth2-core` and `web3-eth2-beaconchain` packages (#3892)
- GitHub action for running tests for `web3-eth2-core` and `web3-eth2-beaconchain` packages (#3892)
- Added description to documentation on how to connect using a remote node provider (#3884)
- Added Security risk warning to docs for `web3.utils.soliditySha3` (#3908)
- `.nvmrc` file using Node.js version `v.14.15.1` (#3817)
Expand All @@ -366,7 +366,7 @@ Released with 1.0.0-beta.37 code base.
- Renamed the `tsc` script in all packages to `compile`; updates the corresponding `lerna run` usage in the main `package.json` (#3894)
- moved deprecation warnings to postinstall scripts (#3917)
- Upgrade `@chainsafe/geth-dev-assistant` from `0.1.5` to `0.1.9` (#3950)
- Replaced hardcoded infura link with Github Secret for some tests (#3943)
- Replaced hardcoded infura link with GitHub Secret for some tests (#3943)
- Bump `elliptic` from `6.5.3` to `6.5.4` for `web3-eth-accounts` (#3941)
- Bump `elliptic` from `6.5.3` to `6.5.4` for `web3-bzz` (#3940)
- Bump `elliptic` from `6.5.3` to `6.5.4` for `web3-core-requestmanager` (#3945)
Expand Down Expand Up @@ -466,13 +466,13 @@ Released with 1.0.0-beta.37 code base.

- Not considering `tx.chainId` if `tx.common.customChain.chainId` is provided for `web3.eth.accounts.signTransaction` function (#4293)
- Added missing PromiEvent handler types (#4194)
- Updated README to include Webpack 5 angular support instructions (#4174)
- Updated README to include webpack 5 angular support instructions (#4174)
- Updated the documentation for the `Web3.utils`, removed context for `_` (underscore lib) (#4403)
- Emit subscription id with connect event when creating a subscription (#4300)
- Introduced new configuration "blockHeaderTimeout" for waiting of block headers for transaction receipt (#3891)
- Format `block.baseFeePerGas` to number (#4330)
- Correct `web3-eth-personal.sendTransaction` example in documentation (#4409)
- Updated README to include Webpack 5 angular support instructions (#4174)
- Updated README to include webpack 5 angular support instructions (#4174)

### Fixed

Expand Down Expand Up @@ -509,7 +509,7 @@ Released with 1.0.0-beta.37 code base.
- Fix typos in web3-utils.rst (#4662)
- Added effectiveGasPrice to TransactionReceipt (#4692)
- Correction in documentation for `web3.eth.accounts.signTransaction` (#4576)
- Updated README to include Webpack 5 create-react-app support instructions (#4173)
- Updated README to include webpack 5 create-react-app support instructions (#4173)
- Update the documentation for `methods.myMethod.estimateGas` (#4702)
- Fix typos in REVIEW.md and TESTING.md (#4691)
- Fix encoding for "0x" string values (#4512)
Expand Down Expand Up @@ -562,7 +562,7 @@ Released with 1.0.0-beta.37 code base.

- Replace deprecated String.prototype.substr() (#4855)
- Exporting AbiCoder as coder (#4937)
- Github build workflow updated min build for node.js 12 and tests for 12, 14 and 16 (#5014)
- GitHub build workflow updated min build for node.js 12 and tests for 12, 14 and 16 (#5014)
- Updated libraries using BN and the BN library (#5072)

### Added
Expand Down Expand Up @@ -950,7 +950,7 @@ should use 4.0.1-alpha.0 for testing.

#### web3-validator

- Fix issue when importing `web3-validator` package within browser environments (Webpack minified filename changed from `index.min.js` to `web3-validator.min.js`) (#5710)
- Fix issue when importing `web3-validator` package within browser environments (webpack minified filename changed from `index.min.js` to `web3-validator.min.js`) (#5710)
- Fix build error '"type"' does not satisfy the constraint (#5712)

#### web3-eth-abi
Expand Down Expand Up @@ -2260,7 +2260,7 @@ If there are any bugs, improvements, optimizations or any new feature proposal f

#### web3-core

- Web3config `contractDataInputFill` has been defaulted to `data`, istead of `input`. (#6622)
- Web3config `contractDataInputFill` has been defaulted to `data`, instead of `input`. (#6622)

#### web3-eth-contracts

Expand Down Expand Up @@ -2353,4 +2353,44 @@ If there are any bugs, improvements, optimizations or any new feature proposal f

- Dependencies updated

## [Unreleased]
## [4.6.0]

### Added

#### web3

- Added EIP-6963 utility function `requestEIP6963Providers` for multi provider discovery

#### web3-eth

- Added `eth.getMaxPriorityFeePerGas` method (#6748)

#### web3-eth-ens

- Added function `setAddress` in ENS and Resolver classes (#5956)

#### web3-rpc-methods

- Added `getMaxPriorityFeePerGas` method (#6748)

#### web3-types

- Type `FeeData` to be filled by `await web3.eth.calculateFeeData()` to be used with EIP-1559 transactions (#6795)

### Fixed

#### web3-utils

- replaced our eventEmitter to EventEmitter3 to support react native builds (#6253)

## [Unreleased]
### Changed

#### web3

- Types `ContractDeploySend`, `ContractMethodSend`, `Web3PromiEvent` was exported (#6883)

### Added

#### web3-eth-contract

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ yarn add web3

## Useful links

- [Web3 tree shaking support guide](https://docs.web3js.org/guides/advanced/web3_tree_shaking_support_guide/)
- [Web3 tree shaking support guide](https://docs.web3js.org/guides/advanced/tree_shaking/)
- [React App Example](https://github.com/ChainSafe/web3js-example-react-app)

## Architecture Overview
Expand Down
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Further details about versioning can be found in the [semver 2.0.0 specification

### Running E2E Tests

`E2E Network Tests` will be triggered to run via a Github workflow when a PR is open for a branch prefixed with `release/` and is being merged into `4.x` branch. These tests depend on a couple of ENVs to be set that are configurable in Github's Action Secrets when running these tests in CI. The following required secrets are:
`E2E Network Tests` will be triggered to run via a GitHub workflow when a PR is open for a branch prefixed with `release/` and is being merged into `4.x` branch. These tests depend on a couple of ENVs to be set that are configurable in GitHub's Action Secrets when running these tests in CI. The following required secrets are:

- `E2E_TESTS_ALLOWED_SEND_TRANSACTION`: If set to `false` this will keep the Sepolia tests that spend ETH from running, setting to anything else will cause them to run
- `TEST_ACCOUNT_PRIVATE_KEY`: The private key of the Sepolia account to use when submitting transactions
Expand Down Expand Up @@ -50,7 +50,7 @@ Further details about versioning can be found in the [semver 2.0.0 specification
8. `git tag bumped-version`: Tag the commit with bumped version having prefix `v` , e.g. `git tag v4.0.1-alpha.0`
9. `git push origin release/bumped-version`: Push release branch to `origin`
10. `git push origin --tags`: Push release tag created in `Step 8` to `origin`
11. Create a draft release on Github similar to [this](https://github.com/web3/web3.js/releases/tag/v4.2.0)
11. Create a draft release on GitHub similar to [this](https://github.com/web3/web3.js/releases/tag/v4.2.0)

- Select recently pushed tag in `choose a tag` drop down

Expand Down
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
### Requirement

Before getting started, ensure that you have ``Yarn`` installed on your machine.

[How to install Yarn](https://www.hostinger.com/tutorials/how-to-install-yarn)
### Installation

```
Expand Down
28 changes: 28 additions & 0 deletions docs/docs/guides/feedback/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
sidebar_position: 15
sidebar_label: '🗣️ Feedback'
---

# Web3.js Developer Feedback

We highly value your feedback to continually improve our documentation and the web3.js library. Whether you have suggestions for improvement, requests for additional features, or simply want to let us know if the documentation has been helpful, please use the form linked below to provide your feedback.

## How to provide feedback

Please take a moment to fill out our [Web3.js User Feedback Form](https://forms.gle/7cWt1hPU43ayS53V9) to share your thoughts.

## What we will do with your feedback

We review all submissions regularly and use them to improve our documentation, address any gaps or issues, and ensure that our documentation and resources meets your needs effectively.

Thank you for taking the time to help us improve!

## Urgent questions or concerns

Please reach out to us:

[💬 Discord: `#web3js-general` channel](https://discord.gg/f5QhHUswtr)

[🐦 Twitter: `@web3_js`](https://twitter.com/web3_js)


9 changes: 5 additions & 4 deletions docs/docs/guides/getting_started/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ sidebar_label: Quickstart

# Quickstart


## Live code editor

<iframe width="100%" height="700px" src="https://stackblitz.com/edit/vitejs-vite-aksddx?embed=1&file=main.js&showSidebar=1"></iframe>

## Installation

If NPM is being used as package manager, use the following for installing the web3.js library.
Expand Down Expand Up @@ -247,7 +252,3 @@ const subscription = uniswapToken.events.Transfer();
subscription.on('data',console.log);
// ↳ [{...},{...}, ...] live events will be printed in the console
```

## Live code editor

<iframe width="100%" height="700px" src="https://stackblitz.com/edit/vitejs-vite-aksddx?embed=1&file=main.js&showSidebar=1"></iframe>
8 changes: 4 additions & 4 deletions docs/docs/guides/glossary/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,24 @@ contract Test {
```json title='Resulting JSON ABI'
[
{
"type": "constructor"
"type": "constructor",
"stateMutability": "nonpayable",
"inputs": [{"internalType":"uint256","name":"testInt","type":"uint256"}],
},
{
"type": "event"
"type": "event",
"name": "Event",
"inputs": [{"indexed":true,"internalType":"uint256","name":"b","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"c","type":"bytes32"}],
"anonymous": false,
},
{
"type": "event"
"type": "event",
"name": "Event2",
"inputs": [{"indexed":true,"internalType":"uint256","name":"b","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"c","type":"bytes32"}],
"anonymous": false,
},
{
"type": "function"
"type": "function",
"name": "foo",
"stateMutability": "nonpayable",
"inputs": [{"internalType":"uint256","name":"b","type":"uint256"},{"internalType":"bytes32","name":"c","type":"bytes32"}],
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/guides/hardhat_tutorial/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
label: '⛑️ Hardhat Tutorial'
collapsible: true
collapsed: true
link: null
position: 2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 004fb4d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 004fb4d Previous: 6c075db Ratio
processingTx 9394 ops/sec (±3.96%) 9301 ops/sec (±4.81%) 0.99
processingContractDeploy 36661 ops/sec (±5.60%) 39129 ops/sec (±7.62%) 1.07
processingContractMethodSend 17587 ops/sec (±8.51%) 19443 ops/sec (±5.19%) 1.11
processingContractMethodCall 36623 ops/sec (±6.52%) 38971 ops/sec (±6.34%) 1.06
abiEncode 42405 ops/sec (±7.62%) 44252 ops/sec (±6.92%) 1.04
abiDecode 29682 ops/sec (±7.49%) 30419 ops/sec (±8.89%) 1.02
sign 1590 ops/sec (±0.80%) 1656 ops/sec (±4.08%) 1.04
verify 366 ops/sec (±0.56%) 373 ops/sec (±0.78%) 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.