Skip to content

Commit

Permalink
Replaces #7390, #7391, & #7400 (#7401)
Browse files Browse the repository at this point in the history
  • Loading branch information
danforbes authored Nov 19, 2024
1 parent 6379aa8 commit 56d4aec
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 29 deletions.
17 changes: 9 additions & 8 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Further details about versioning can be found in the [semver 2.0.0 specification
- `bumped-version` of release branch should be of main web3 package.
3. `yarn`: Verify all dependencies have been installed
4. Bump packages version numbers using `lerna version --no-push --no-private --no-git-tag-version` . This will update package versions and also run lifecycle scripts.
- It will prompt for new version , modify package metadata and run life cycle scripts (in our case `version`), for bootstrapping lerna will use underlying yarn.
5. Update each package's and also root `CHANGELOG.md`:
- It will prompt for new version , modify package metadata and run lifecycle scripts (in our case `version`), for bootstrapping lerna will use underlying yarn.
5. Update each package's and also root `CHANGELOG.md`:

5.A. If there are any changes in package during release PR e.g. dependency updated that effects package, add entry in changelog under `## [Unreleased]` of that package's changelog.

Expand All @@ -61,19 +61,20 @@ Further details about versioning can be found in the [semver 2.0.0 specification
- In the release description, copy all entries in `CHANGELOG.md` for the version being released

- Click `Save draft`

12. Open pull request to merge branch created in `Step 2` (`release/bumped-version`) into `4.x`
13. Wait for all tests to pass in github CI/CD , If there are any unusual warnings or errors in logs, discuss with team
14. When sufficient approvals have been met, publish draft release created in `Step 11`
15. Publish on NPM.

- login in NPM and verify you are logged in with right user and in right dir

- If you want to publish `latest` tag release, run `npx lerna publish from-package --ignore-scripts` in the root directory to publish packages to NPM.
- If you want to publish any other tag, run `npx lerna publish from-package --ignore-scripts --dist-tag <<TAG>>` in the root directory e.g. `rc`

- If you want to publish any other tag, run `npx lerna publish from-package --ignore-scripts --dist-tag <<TAG>>` in the root directory e.g. `rc`

IMPORTANT: Replace `<<TAG>>` with required tag in above command, e.g. if publishing `RC`, use following command:
`npx lerna publish from-package --ignore-scripts --dist-tag rc`
`npx lerna publish from-package --ignore-scripts --dist-tag rc`

- lerna will not invoke life cycle scripts before publishing and this will publish all packages to NPM public registry.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/glossary/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The `Contract` class is an important class in the `web3-eth-contract` package, a

The JSON interface is a `JSON` object describing the [Application Binary Interface (ABI)](https://docs.soliditylang.org/en/develop/abi-spec.html) for an Ethereum smart contract.

Using this JSON interface, web3.js is able to create a JavaScript object representing the smart contract , its methods and events using the `web3.eth.Contract` object.
Using this JSON interface, web3.js is able to create a JavaScript object representing the smart contract, its methods and events using the `web3.eth.Contract` object.

### Functions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_label: 'Providers Events Listening'

# Providers Events Listening

Some providers are, by design, always connected. Therefor, they can communicate changes with the user through events. Actually, among the 3 providers, `HttpProvider` is the only one that does not support event. And the other 2:
Some providers are, by design, always connected. Therefore, they can communicate changes with the user through events. Actually, among the 3 providers, `HttpProvider` is the only one that does not support event. And the other 2:
[WebSocketProvider](/api/web3-providers-ws/class/WebSocketProvider) and [IpcProvider](/api/web3-providers-ipc/class/IpcProvider) enable the user to listen to emitted events.

Actually, the events can be categorized as follows ([according to EIP 1193](https://eips.ethereum.org/EIPS/eip-1193#rationale)):
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/guides/05_smart_contracts/tips_and_tricks.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The Solidity code:
pragma solidity >=0.8.20 <0.9.0;
contract TestOverlading {
contract TestOverloading {
function funcWithParamsOverloading(uint256 userId) public pure returns (string memory) {
return "called for the parameter with the type 'uint256'";
}
Expand Down Expand Up @@ -138,6 +138,6 @@ Multiple methods found that are compatible with the given inputs. Found 2 compat
Future releases of web3.js, specifically version 5.x, will replace the warning with an error whenever multiple methods match a call without explicit overloading. This aims to foster greater precision in method invocation.
### Key Takeaway for function overlading: Method Specification
### Key Takeaway for function overloading: Method Specification
When working with overloaded smart contract methods, it's imperative to specify the intended method by appending its parameter types within parentheses, such as `funcWithParamsOverloading(address)` versus `funcWithParamsOverloading(uint256)`. This ensures the accuracy of method invocation, leading to more efficient and clearer contract interactions.
34 changes: 17 additions & 17 deletions docs/docs/guides/06_events_subscriptions/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 1
sidebar_label: 'Mastering Events Subcriptions'
sidebar_label: 'Mastering Events Subscriptions'
---

# Events Subscription
Expand Down Expand Up @@ -46,25 +46,25 @@ If you are the developer who provides custom subscriptions to users. We encourag
- `on("data")` - Fires on each incoming log with the log object as argument.

```ts
subcription.on('data', data => console.log(data));
subscription.on('data', data => console.log(data));
```

- `on("changed")` - Fires on each log which was removed from the blockchain. The log will have the additional property "removed: true".

```ts
subcription.on('changed', changed => console.log(changed));
subscription.on('changed', changed => console.log(changed));
```

- `on("error")` - Fires when an error in the subscription occurs.

```ts
subcription.on('error', error => console.log(error));
subscription.on('error', error => console.log(error));
```

- `on("connected")` - Fires once after the subscription successfully connected. Returns the subscription id.

```ts
subcription.on('connected', connected => console.log(connected));
subscription.on('connected', connected => console.log(connected));
```

### Logs
Expand All @@ -77,11 +77,11 @@ import { Web3 } from 'web3';
const web3 = new Web3('wss://ethereum-rpc.publicnode.com');

async function subscribe() {
//create subcription
const subcription = await web3.eth.subscribe('logs');
//create subscription
const subscription = await web3.eth.subscribe('logs');

//print logs of the latest mined block
subcription.on('data', data => console.log(data));
subscription.on('data', data => console.log(data));
}

// function to unsubscribe from a subscription
Expand All @@ -104,11 +104,11 @@ import { Web3 } from 'web3';
const web3 = new Web3('wss://ethereum-rpc.publicnode.com');

async function subscribe() {
//create subcription
const subcription = await web3.eth.subscribe('pendingTransactions'); //or ("newPendingTransactions")
//create subscription
const subscription = await web3.eth.subscribe('pendingTransactions'); //or ("newPendingTransactions")

//print tx hashs of pending transactions
subcription.on('data', data => console.log(data));
subscription.on('data', data => console.log(data));
}

// function to unsubscribe from a subscription
Expand All @@ -131,11 +131,11 @@ import { Web3 } from 'web3';
const web3 = new Web3('wss://ethereum-rpc.publicnode.com');

async function subscribe() {
//create subcription
const subcription = await web3.eth.subscribe('newBlockHeaders'); //or ("newHeads")
//create subscription
const subscription = await web3.eth.subscribe('newBlockHeaders'); //or ("newHeads")

//print block header everytime a block is mined
subcription.on('data', data => console.log(data));
subscription.on('data', data => console.log(data));
}

// function to unsubscribe from a subscription
Expand All @@ -157,12 +157,12 @@ import { Web3 } from 'web3';
const web3 = new Web3('wss://ethereum-rpc.publicnode.com');

async function subscribe() {
//create subcription
const subcription = await web3.eth.subscribe('syncing');
//create subscription
const subscription = await web3.eth.subscribe('syncing');

//this will return `true` when the node is syncing
//when it’s finished syncing will return `false`, for the `changed` event.
subcription.on('data', data => console.log(data));
subscription.on('data', data => console.log(data));
}

// function to unsubscribe from a subscription
Expand Down

1 comment on commit 56d4aec

@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: 56d4aec Previous: 6379aa8 Ratio
processingTx 21333 ops/sec (±6.28%) 23194 ops/sec (±6.51%) 1.09
processingContractDeploy 37350 ops/sec (±9.12%) 40151 ops/sec (±7.62%) 1.07
processingContractMethodSend 15425 ops/sec (±8.46%) 16041 ops/sec (±7.41%) 1.04
processingContractMethodCall 27828 ops/sec (±7.27%) 27123 ops/sec (±7.21%) 0.97
abiEncode 42616 ops/sec (±7.22%) 43887 ops/sec (±6.78%) 1.03
abiDecode 29566 ops/sec (±9.87%) 30676 ops/sec (±7.58%) 1.04
sign 1505 ops/sec (±3.30%) 1568 ops/sec (±1.16%) 1.04
verify 365 ops/sec (±0.58%) 362 ops/sec (±1.51%) 0.99

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

Please sign in to comment.