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

Commit e4a46bf

Browse files
author
Alex
authored
Merge branch '4.x' into fix/web3-validator-browser-dist-7015
2 parents e847f60 + f216540 commit e4a46bf

File tree

45 files changed

+530
-285
lines changed

Some content is hidden

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

45 files changed

+530
-285
lines changed

.github/workflows/build.yml

Lines changed: 70 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- run: yarn install --ignore-scripts
2727
- run: npx ts-node scripts/init.ts
2828
- run: yarn build:cjs
29-
- uses: actions/cache/save@v3
29+
- uses: actions/cache/save@v4
3030
with:
3131
path: ./
3232
key: web3-${{ matrix.node }}-${{github.sha}}
@@ -39,7 +39,7 @@ jobs:
3939
- uses: actions/setup-node@v4
4040
with:
4141
node-version: 18
42-
- uses: actions/cache/restore@v3
42+
- uses: actions/cache/restore@v4
4343
with:
4444
path: ./
4545
key: web3-18-${{github.sha}}
@@ -52,7 +52,7 @@ jobs:
5252
- uses: actions/setup-node@v4
5353
with:
5454
node-version: 18
55-
- uses: actions/cache/restore@v3
55+
- uses: actions/cache/restore@v4
5656
with:
5757
path: ./
5858
key: web3-18-${{github.sha}}
@@ -65,12 +65,63 @@ jobs:
6565
- uses: actions/setup-node@v4
6666
with:
6767
node-version: 18
68-
- uses: actions/cache/restore@v3
68+
- uses: actions/cache/restore@v4
6969
with:
7070
path: ./
7171
key: web3-18-${{github.sha}}
7272
- run: npx ts-node scripts/init.ts
73+
- name: Restore eslint caches
74+
uses: actions/cache/restore@v4
75+
with:
76+
path: |
77+
packages/web3/.eslintcache
78+
packages/web3-core/.eslintcache
79+
packages/web3-eth/.eslintcache
80+
packages/web3-eth-abi/.eslintcache
81+
packages/web3-eth-accounts/.eslintcache
82+
packages/web3-eth-contract/.eslintcache
83+
packages/web3-eth-ens/.eslintcache
84+
packages/web3-eth-iban/.eslintcache
85+
packages/web3-eth-personal/.eslintcache
86+
packages/web3-net/.eslintcache
87+
packages/web3-providers-http/.eslintcache
88+
packages/web3-providers-ws/.eslintcache
89+
packages/web3-rpc-methods/.eslintcache
90+
packages/web3-types/.eslintcache
91+
packages/web3-utils/.eslintcache
92+
packages/web3-validator/.eslintcache
93+
tools/web3-plugin-example/.eslintcache
94+
key: ${{ runner.os }}-eslintcache
95+
7396
- run: yarn lint
97+
- run: gh cache delete "${{ runner.os }}-eslintcache"
98+
if: github.event_name == 'push' && github.ref == 'refs/heads/4.x'
99+
env:
100+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
102+
- name: Save eslint caches
103+
if: github.event_name == 'push' && github.ref == 'refs/heads/4.x'
104+
uses: actions/cache/save@v4
105+
with:
106+
path: |
107+
packages/web3/.eslintcache
108+
packages/web3-core/.eslintcache
109+
packages/web3-eth/.eslintcache
110+
packages/web3-eth-abi/.eslintcache
111+
packages/web3-eth-accounts/.eslintcache
112+
packages/web3-eth-contract/.eslintcache
113+
packages/web3-eth-ens/.eslintcache
114+
packages/web3-eth-iban/.eslintcache
115+
packages/web3-eth-personal/.eslintcache
116+
packages/web3-net/.eslintcache
117+
packages/web3-providers-http/.eslintcache
118+
packages/web3-providers-ws/.eslintcache
119+
packages/web3-rpc-methods/.eslintcache
120+
packages/web3-types/.eslintcache
121+
packages/web3-utils/.eslintcache
122+
packages/web3-validator/.eslintcache
123+
tools/web3-plugin-example/.eslintcache
124+
key: ${{ runner.os }}-eslintcache
74125

75126
build-web:
76127
name: Build Web
@@ -80,13 +131,13 @@ jobs:
80131
- uses: actions/setup-node@v4
81132
with:
82133
node-version: 18
83-
- uses: actions/cache/restore@v3
134+
- uses: actions/cache/restore@v4
84135
with:
85136
path: ./
86137
key: web3-18-${{github.sha}}
87138
- name: Restore default branch stats
88139
if: github.event_name != 'push'
89-
uses: actions/cache/restore@v3
140+
uses: actions/cache/restore@v4
90141
with:
91142
path: packages/web3/dist/4.x.json
92143
key: web3-bundle-stats-4x-${{github.event.pull_request.base.sha}}
@@ -101,7 +152,7 @@ jobs:
101152
current-stats-json-path: "packages/web3/dist/${{ github.ref_name }}.json"
102153
base-stats-json-path: "packages/web3/dist/4.x.json"
103154
- name: Cache default branch stats
104-
uses: actions/cache/save@v3
155+
uses: actions/cache/save@v4
105156
if: github.event_name == 'push' && github.ref == 'refs/heads/4.x'
106157
with:
107158
path: packages/web3/dist/${{ github.ref_name }}.json
@@ -120,7 +171,7 @@ jobs:
120171
with:
121172
architecture: x64
122173
node-version: ${{ matrix.node }}
123-
- uses: actions/cache/restore@v3
174+
- uses: actions/cache/restore@v4
124175
with:
125176
path: ./
126177
key: web3-${{ matrix.node }}-${{github.sha}}
@@ -142,7 +193,7 @@ jobs:
142193
- uses: actions/setup-node@v3
143194
with:
144195
node-version: 18
145-
- uses: actions/cache/restore@v3
196+
- uses: actions/cache/restore@v4
146197
with:
147198
path: ./
148199
key: web3-18-${{github.sha}}
@@ -165,7 +216,7 @@ jobs:
165216
- uses: actions/setup-node@v4
166217
with:
167218
node-version: 18
168-
- uses: actions/cache/restore@v3
219+
- uses: actions/cache/restore@v4
169220
with:
170221
path: ./
171222
key: web3-18-${{github.sha}}
@@ -186,7 +237,7 @@ jobs:
186237
node-version: 18
187238
- uses: browser-actions/setup-firefox@latest
188239
if: matrix.browser == 'firefox'
189-
- uses: actions/cache/restore@v3
240+
- uses: actions/cache/restore@v4
190241
with:
191242
path: ./
192243
key: web3-18-${{github.sha}}
@@ -212,7 +263,7 @@ jobs:
212263
with:
213264
cache: yarn
214265
node-version: '18'
215-
- uses: actions/cache/restore@v3
266+
- uses: actions/cache/restore@v4
216267
with:
217268
path: ./
218269
key: web3-18-${{github.sha}}
@@ -235,14 +286,14 @@ jobs:
235286
- uses: actions/setup-node@v4
236287
with:
237288
node-version: 18
238-
- uses: actions/cache/restore@v3
289+
- uses: actions/cache/restore@v4
239290
with:
240291
path: ./
241292
key: web3-18-${{github.sha}}
242293
# @octokit/core not supported on node 16, so I can't add it to the package.json
243294
- run: npm install --no-package-lock --no-save --force @octokit/[email protected]
244295
- name: Restore main branch benchmark data
245-
uses: actions/cache/restore@v3
296+
uses: actions/cache/restore@v4
246297
with:
247298
path: web3-benchmark-main.json
248299
key: ${{ runner.os }}-web3-benchmark-main.json
@@ -279,8 +330,12 @@ jobs:
279330
# Enable alert commit comment
280331
alert-threshold: '200%'
281332
comment-always: false
333+
- run: gh cache delete "${{ runner.os }}-web3-benchmark-main.json"
334+
if: github.event_name == 'push' && github.ref == 'refs/heads/4.x'
335+
env:
336+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
282337
- name: Save main branch benchmark data
283-
uses: actions/cache/save@v3
338+
uses: actions/cache/save@v4
284339
if: github.event_name == 'push' && github.ref == 'refs/heads/4.x'
285340
with:
286341
path: web3-benchmark-main.json

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ packages/web3/.in3/
4545

4646
# benchmark results
4747
benchmark-data.txt
48+
49+
.eslintcache

CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2448,13 +2448,18 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
24482448

24492449
### Added
24502450

2451+
#### web3
2452+
2453+
- Updated type `Web3EthInterface.accounts` to includes `privateKeyToAccount`,`privateKeyToAddress`,and `privateKeyToPublicKey` (#6762)
2454+
24512455
#### web3-core
24522456

24532457
- `defaultReturnFormat` was added to the configuration options. (#6947)
24542458

24552459
#### web3-eth
24562460

24572461
- `defaultReturnFormat` was added to all methods that have `ReturnType` param. (#6947)
2462+
- `getTransactionFromOrToAttr`, `waitForTransactionReceipt`, `trySendTransaction`, `SendTxHelper` was exported (#7000)
24582463

24592464
#### web3-eth-contract
24602465

@@ -2473,8 +2478,27 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
24732478
- Added `signature` to type `AbiFunctionFragment` (#6922)
24742479
- update type `Withdrawals`, `block` and `BlockHeaderOutput` to include properties of eip 4844, 4895, 4788 (#6933)
24752480

2481+
#### web3-utils
2482+
2483+
24762484
### Fixed
24772485

2486+
#### web3-utils
2487+
2488+
24782489
#### web3-validator
24792490

2480-
- The JSON schema conversion process now correctly assigns an id when the `abi.name` is not available, for example, in the case of public mappings. (#6981)
2491+
2492+
### Changed
2493+
2494+
#### web3-core
2495+
2496+
- Interface `RequestManagerMiddleware` was changed (#7003)
2497+
2498+
#### web3-eth
2499+
2500+
- Added parameter `customTransactionReceiptSchema` into methods `emitConfirmation`, `waitForTransactionReceipt`, `watchTransactionByPolling`, `watchTransactionBySubscription`, `watchTransactionForConfirmations` (#7000)
2501+
2502+
#### web3-rpc-methods
2503+
2504+
- Change `estimateGas` method to add possibility pass Transaction type (#7000)

FUNDING.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"drips": {
3+
"ethereum": {
4+
"ownedBy": "0x689f1278469c6146d835CB99BbfF818fB62989FE"
5+
}
6+
}
7+
}
Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,54 @@
11
---
22
sidebar_position: 16
3-
sidebar_label: '📚 Resources'
3+
sidebar_label: '📚 Resources & Troubleshooting'
44
---
5-
# Resources
5+
# Resources & Troubleshooting
66

7-
## [Web3.js v4 course](https://www.youtube.com/watch?v=3ZO_t-Kyr1g&list=PLPn3rQCo3XrP4LbQcOyyHQR8McV7w3HZT)
7+
## Troubleshooting
8+
9+
### ReferenceError: Can't find variable: BigInt using React
10+
11+
Occasionally, users encounter errors in web3.js due to external dependencies, which may seem challenging to resolve within the web3.js framework alone.
12+
13+
**Resolution Steps:**
14+
15+
1. Install `rn-nodeify` as a development dependency:
16+
```bash
17+
yarn add --dev rn-nodeify
18+
```
19+
20+
2. Add the `big-integer` package:
21+
```bash
22+
yarn add big-integer
23+
```
24+
25+
3. Create a file named `shim.js` at the root of your project and include the following polyfill:
26+
```ts
27+
if (typeof BigInt === 'undefined') {
28+
global.BigInt = require('big-integer');
29+
}
30+
```
31+
32+
4. Import shim.js at the top of your App.js:
33+
```ts
34+
// Make sure you use `import` and not `require`!
35+
import './shim.js'
36+
```
37+
38+
Additional Info:
39+
40+
[Facebook/React-native Issue #28492](https://github.com/facebook/react-native/issues/28492#issuecomment-824698934)
41+
42+
## Resources
43+
44+
### [Web3.js v4 course](https://www.youtube.com/watch?v=3ZO_t-Kyr1g&list=PLPn3rQCo3XrP4LbQcOyyHQR8McV7w3HZT)
845

946
This comprehensive 14-part video course from ChainSafe equips you with the skills to conquer the blockchain using web3.js v4. Unlock the potential of web3.js v4 and build cutting-edge dApps. This course caters to all skill levels.
1047

1148
[![Web3.js v4 course](https://img.youtube.com/vi/3ZO_t-Kyr1g/0.jpg)](https://www.youtube.com/watch?v=3ZO_t-Kyr1g&list=PLPn3rQCo3XrP4LbQcOyyHQR8McV7w3HZT)
1249

1350

14-
## [Web3.js series](https://www.youtube.com/watch?v=BQ_bDH91S4k&list=PLPn3rQCo3XrNf__8irs4-MjMt4fJqW2I_)
51+
### [Web3.js series](https://www.youtube.com/watch?v=BQ_bDH91S4k&list=PLPn3rQCo3XrNf__8irs4-MjMt4fJqW2I_)
1552

1653
This series of 3 videos takes you on a journey through web3.js. Whether you're a complete beginner or want to refine your skills, these videos have something for you:
1754

@@ -23,6 +60,6 @@ This series of 3 videos takes you on a journey through web3.js. Whether you're a
2360

2461
[![Web3.js series](https://img.youtube.com/vi/BQ_bDH91S4k/0.jpg)](https://www.youtube.com/watch?v=BQ_bDH91S4k&list=PLPn3rQCo3XrNf__8irs4-MjMt4fJqW2I_)
2562

26-
## Hackathons
63+
## Hackathons and Bounties
2764

2865
You'll find the latest hackathons opportunities by following [web3js](https://twitter.com/web3_js) on X.

packages/web3-core/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,10 @@ Documentation:
210210
## [Unreleased]
211211

212212
### Added
213+
213214
- `defaultReturnFormat` was added to the configuration options. (#6947)
215+
216+
### Changed
217+
218+
- Interface `RequestManagerMiddleware` was changed (#7003)
219+

packages/web3-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
3131
"build:types": "tsc --build tsconfig.types.json",
3232
"build:check": "node -e \"require('./lib')\"",
33-
"lint": "eslint --ext .js,.ts .",
33+
"lint": "eslint --cache --cache-strategy content --ext .ts .",
3434
"lint:fix": "eslint --fix --ext .js,.ts .",
3535
"format": "prettier --write '**/*'",
3636
"test": "jest --config=./test/unit/jest.config.js",

packages/web3-core/src/types.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ You should have received a copy of the GNU Lesser General Public License
1515
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
import { HexString, JsonRpcResponse, Transaction, Web3APIMethod, Web3APIRequest, Web3APIReturnType } from 'web3-types';
18+
import {
19+
HexString,
20+
JsonRpcPayload,
21+
JsonRpcResponse,
22+
Transaction,
23+
Web3APIMethod,
24+
Web3APIReturnType,
25+
} from 'web3-types';
1926

20-
export type TransactionTypeParser = (
21-
transaction: Transaction,
22-
) => HexString | undefined;
27+
export type TransactionTypeParser = (transaction: Transaction) => HexString | undefined;
2328

2429
export interface Method {
2530
name: string;
@@ -32,16 +37,16 @@ export interface ExtensionObject {
3237
}
3338

3439
export interface RequestManagerMiddleware<API> {
35-
processRequest<
36-
AnotherMethod extends Web3APIMethod<API>
37-
>(
38-
request: Web3APIRequest<API, AnotherMethod>,
39-
options?: { [key: string]: unknown }): Promise<Web3APIRequest<API, AnotherMethod>>;
40+
processRequest<ParamType = unknown[]>(
41+
request: JsonRpcPayload<ParamType>,
42+
options?: { [key: string]: unknown },
43+
): Promise<JsonRpcPayload<ParamType>>;
4044

4145
processResponse<
4246
AnotherMethod extends Web3APIMethod<API>,
43-
ResponseType = Web3APIReturnType<API, AnotherMethod>>
44-
(
45-
response: JsonRpcResponse<ResponseType>,
46-
options?: { [key: string]: unknown }): Promise<JsonRpcResponse<ResponseType>>;
47-
}
47+
ResponseType = Web3APIReturnType<API, AnotherMethod>,
48+
>(
49+
response: JsonRpcResponse<ResponseType>,
50+
options?: { [key: string]: unknown },
51+
): Promise<JsonRpcResponse<ResponseType>>;
52+
}

0 commit comments

Comments
 (0)