Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 43efc92

Browse files
Merge branch '4.x' into 7143-an-issue-when-calling-a-method-on-diamonds-proxy-contract
2 parents b5babdb + 0db2b18 commit 43efc92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+5012
-2504
lines changed

.github/workflows/black_box_tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ jobs:
2929
needs: build
3030
runs-on: ubuntu-latest
3131
env:
32-
INFURA_HTTP: ${{ secrets.INFURA_HTTP }}
33-
INFURA_WSS: ${{ secrets.INFURA_WSS }}
34-
INFURA_GOERLI_WS: ${{ secrets.INFURA_GOERLI_WS }}
32+
INFURA_MAINNET_HTTP: ${{ secrets.INFURA_MAINNET_HTTP }}
33+
INFURA_MAINNET_WS: ${{ secrets.INFURA_MAINNET_WS }}
34+
INFURA_SEPOLIA_WS: ${{ secrets.INFURA_SEPOLIA_WS }}
3535
MODE: ${{ matrix.mode }}
3636
strategy:
3737
fail-fast: false

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ jobs:
206206
needs: build
207207
runs-on: ubuntu-latest
208208
env:
209-
INFURA_GOERLI_HTTP: ${{ secrets.INFURA_GOERLI_HTTP }}
210-
INFURA_GOERLI_WS: ${{ secrets.INFURA_GOERLI_WS }}
209+
INFURA_SEPOLIA_HTTP: ${{ secrets.INFURA_SEPOLIA_HTTP }}
210+
INFURA_SEPOLIA_WS: ${{ secrets.INFURA_SEPOLIA_WS }}
211211
strategy:
212212
fail-fast: false
213213
matrix:

.github/workflows/e2e_network_tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
- release/**
66
tags:
77
- v4.*
8-
98
jobs:
109
build:
1110
name: Build Packages

CHANGELOG.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2631,4 +2631,33 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26312631

26322632
- `web3.eth.Contract` will get transaction middleware and use it, if `web3.eth` has transaction middleware. (#7138)
26332633

2634-
## [Unreleased]
2634+
## [4.11.1]
2635+
2636+
### Fixed
2637+
2638+
#### web3-errors
2639+
2640+
- Fixed the undefined data in `Eip838ExecutionError` constructor (#6905)
2641+
2642+
#### web3-eth
2643+
2644+
- Adds transaction property to be an empty list rather than undefined when no transactions are included in the block (#7151)
2645+
- Change method `getTransactionReceipt` to not be casted as `TransactionReceipt` to give proper return type (#7159)
2646+
2647+
#### web3
2648+
2649+
- Remove redundant constructor of contractBuilder (#7150)
2650+
2651+
## [Unreleased]
2652+
2653+
### Fixed
2654+
2655+
#### web3-utils
2656+
2657+
- Fixed format schema with `oneOf` doesn't work correctly (#7055)
2658+
2659+
### Added
2660+
2661+
#### web3-eth-accounts
2662+
2663+
- Added public function `signMessageWithPrivateKey` (#7174)

docs/docs/glossary/index.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,86 @@ contract Test {
108108
}
109109
]
110110
```
111+
112+
## Proxy
113+
114+
A `proxy` in Web3.js serves as an intermediary between your application and an Ethereum node, **facilitating communication** by **forwarding requests and responses**. Configuring a proxy can help overcome network restrictions, enhance security, and improve load balancing. You can set up a proxy using either HttpProvider or WebSocketProvider in Web3.js.
115+
116+
## HttpProvider
117+
118+
[HttpProvider](https://docs.web3js.org/guides/web3_providers_guide/#http-provider) in Web3.js connects an application to an Ethereum node over HTTP. It allows for sending transactions, reading blockchain data, and interacting with smart contracts. You create a Web3 instance with the node’s URL to establish the connection. It’s essential for DApps needing blockchain interaction but can block the event loop, so alternatives like `WebSocketProvider` might be used for better performance when real-time communication is needed.
119+
120+
```typescript
121+
import { Web3 } from 'web3';
122+
const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
123+
```
124+
125+
## WebSocketProvider
126+
[WebSocketProvider](https://docs.web3js.org/guides/web3_providers_guide/#websocket-provider) in Web3.js connects your application to an Ethereum node via WebSocket, enabling real-time and asynchronous communication. This provider is ideal for applications needing real-time updates, such as new blocks or smart contract events. It offers better performance for high-throughput applications compared to `HttpProvider`. Ensure secure connections with `wss://` for exposed endpoints. Handle reconnections gracefully for reliable operation.
127+
128+
```javascript title='WebSocketProvider example'
129+
import { Web3 } from 'web3';
130+
const web3 = new Web3(new Web3.providers.WebsocketProvider('ws://localhost:8546'));
131+
```
132+
133+
## Events
134+
135+
The `Events` class in Web3.js is a crucial part of the library that enables developers to interact with and listen for events emitted by smart contracts on the Ethereum network. Events in **smart contracts** are similar to `logs` or `messages` that the **contract emits to notify** external applications about specific actions or state changes. Web3.js provides a comprehensive set of tools to handle these events, making it possible to build responsive and interactive decentralized applications (dApps).
136+
137+
#### Example
138+
139+
```solidity title='Event in solidity'
140+
contract MyContract {
141+
event Transfer(address indexed from, address indexed to, uint value);
142+
143+
function transfer(address recipient, uint amount) public {
144+
// ... transfer logic ...
145+
emit Transfer(msg.sender, recipient, amount);
146+
}
147+
}
148+
```
149+
150+
```javascript title='Event in web3.js'
151+
import { Web3 } from 'web3';
152+
const MyContract = require('./MyContract.json'); // Assuming ABI is loaded
153+
154+
const web3 = new Web3('wss://mainnet.infura.io/v3/YOUR_INFURA_ID'); // Replace with your provider URL
155+
const contractAddress = '0x...'; // Replace with your contract address
156+
157+
const myContract = new web3.eth.Contract(MyContract.abi, contractAddress);
158+
159+
const transferEvent = myContract.events.Transfer(); // Access the Transfer event
160+
161+
transferEvent.on('data', (event) => {
162+
console.log('Transfer Event:', event);
163+
// Process the event data (from, to, value)
164+
});
165+
```
166+
167+
## Event logs
168+
169+
`Logs` in Web3.js are a part of **Ethereum transactions** that contain **information about events triggered** within smart contracts. They provide a way to record and retrieve significant occurrences within the blockchain. `Event logs` are particularly useful for tracking changes, and debugging.
170+
171+
#### Example
172+
173+
```typescript
174+
import { Web3 } from 'web3';
175+
const web3 = new Web3('https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID');
176+
177+
const options = {
178+
fromBlock: 0,
179+
toBlock: 'latest',
180+
address: '0xYourContractAddress',
181+
topics: [
182+
web3.utils.sha3('Transfer(address,address,uint256)')
183+
]
184+
};
185+
186+
web3.eth.getPastLogs(options)
187+
.then((logs) => {
188+
console.log(logs);
189+
})
190+
.catch((error) => {
191+
console.error('Error retrieving logs:', error);
192+
});
193+
`

0 commit comments

Comments
 (0)