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

Commit b86d8ca

Browse files
authored
Format repo, add new rules (#7226)
* format all files and fix formatter so it runs on commit * update eslint * pre commit will run prettier on commited files * update * remove prepush
1 parent 27155ea commit b86d8ca

File tree

222 files changed

+5731
-5318
lines changed

Some content is hidden

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

222 files changed

+5731
-5318
lines changed

.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,19 @@ module.exports = {
1616
typescript: {}, // this loads tsconfig.json to eslint
1717
},
1818
},
19+
overrides: [
20+
{
21+
files: ['*.test.ts'],
22+
rules: {
23+
'@typescript-eslint/no-unsafe-call': 'off',
24+
'import/no-unresolved': 'off',
25+
},
26+
},
27+
{
28+
files: ['*.ts'],
29+
rules: {
30+
'default-param-last': 'off',
31+
},
32+
},
33+
],
1934
};

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.husky/pre-push

Lines changed: 0 additions & 4 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,7 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
24582458

24592459
#### web3-errors
24602460

2461-
- Added `InvalidIntegerError` error for fromWei and toWei (#7052)
2461+
- Added `InvalidIntegerError` error for fromWei and toWei (#7052)
24622462

24632463
#### web3-eth
24642464

@@ -2484,8 +2484,8 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
24842484

24852485
#### web3-utils
24862486

2487-
- `toWei` add warning when using large numbers or large decimals that may cause precision loss (#6908)
2488-
- `toWei` and `fromWei` now supports integers as a unit. (#7053)
2487+
- `toWei` add warning when using large numbers or large decimals that may cause precision loss (#6908)
2488+
- `toWei` and `fromWei` now supports integers as a unit. (#7053)
24892489

24902490
### Fixed
24912491

@@ -2495,13 +2495,13 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
24952495

24962496
#### web3-utils
24972497

2498-
- `toWei` support numbers in scientific notation (#6908)
2499-
- `toWei` and `fromWei` trims according to ether unit successfuly (#7044)
2498+
- `toWei` support numbers in scientific notation (#6908)
2499+
- `toWei` and `fromWei` trims according to ether unit successfuly (#7044)
25002500

25012501
#### web3-validator
25022502

2503-
- 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)
2504-
- `browser` entry point that was pointing to an non-existing bundle file was removed from `package.json` (#7015)
2503+
- 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)
2504+
- `browser` entry point that was pointing to an non-existing bundle file was removed from `package.json` (#7015)
25052505

25062506
#### web3-core
25072507

@@ -2600,7 +2600,7 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26002600

26012601
#### web3-eth-accounts
26022602

2603-
- baseTransaction method updated (#7095)
2603+
- baseTransaction method updated (#7095)
26042604

26052605
#### web3-providers-ws
26062606

@@ -2612,7 +2612,7 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26122612

26132613
#### web3-rpc-providers
26142614

2615-
- Change request return type `Promise<ResultType>` to `Promise<JsonRpcResponseWithResult<ResultType>>` (#7102)
2615+
- Change request return type `Promise<ResultType>` to `Promise<JsonRpcResponseWithResult<ResultType>>` (#7102)
26162616

26172617
### Added
26182618

@@ -2623,7 +2623,7 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26232623

26242624
#### web3-rpc-providers
26252625

2626-
- When error is returned with code 429, throw rate limit error (#7102)
2626+
- When error is returned with code 429, throw rate limit error (#7102)
26272627

26282628
#### web3
26292629

@@ -2635,7 +2635,7 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26352635

26362636
#### web3-errors
26372637

2638-
- Fixed the undefined data in `Eip838ExecutionError` constructor (#6905)
2638+
- Fixed the undefined data in `Eip838ExecutionError` constructor (#6905)
26392639

26402640
#### web3-eth
26412641

@@ -2646,7 +2646,6 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26462646

26472647
- Remove redundant constructor of contractBuilder (#7150)
26482648

2649-
26502649
## [4.12.0]
26512650

26522651
### Fixed
@@ -2657,7 +2656,7 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26572656

26582657
#### web3-eth-accounts
26592658

2660-
- Fix `TransactionFactory.registerTransactionType` not working, if there is a version mistatch between `web3-eth` and `web3-eth-accounts` by saving `extraTxTypes` at `globals`. (#7197)
2659+
- Fix `TransactionFactory.registerTransactionType` not working, if there is a version mistatch between `web3-eth` and `web3-eth-accounts` by saving `extraTxTypes` at `globals`. (#7197)
26612660

26622661
### Added
26632662

@@ -2667,11 +2666,11 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26672666

26682667
#### web3-eth-contract
26692668

2670-
- Added `populateTransaction` to the `contract.deploy(...)` properties. (#7197)
2669+
- Added `populateTransaction` to the `contract.deploy(...)` properties. (#7197)
26712670

26722671
#### web3-providers-http
26732672

2674-
- Added `statusCode` of response in ResponseError, `statusCode` is optional property in ResponseError.
2673+
- Added `statusCode` of response in ResponseError, `statusCode` is optional property in ResponseError.
26752674

26762675
#### web3-rpc-providers
26772676

@@ -2680,22 +2679,22 @@ If there are any bugs, improvements, optimizations or any new feature proposal f
26802679

26812680
#### web3-errors
26822681

2683-
- Added optional `statusCode` property of response in ResponseError.
2682+
- Added optional `statusCode` property of response in ResponseError.
26842683

26852684
### Changed
26862685

26872686
#### web3-eth-contract
26882687

26892688
- The returnred properties of `contract.deploy(...)` are structured with a newly created class named `DeployerMethodClass`. (#7197)
2690-
- Add a missed accepted type for the `abi` parameter, at `dataInputEncodeMethodHelper` and `getSendTxParams`. (#7197)
2689+
- Add a missed accepted type for the `abi` parameter, at `dataInputEncodeMethodHelper` and `getSendTxParams`. (#7197)
26912690

26922691
## [4.12.1]
26932692

26942693
### Fixed
26952694

26962695
#### web3-eth-accounts
26972696

2698-
- Revert `TransactionFactory.registerTransactionType` if there is a version mistatch between `web3-eth` and `web3-eth-accounts` and fix nextjs problem. (#7216)
2697+
- Revert `TransactionFactory.registerTransactionType` if there is a version mistatch between `web3-eth` and `web3-eth-accounts` and fix nextjs problem. (#7216)
26992698

27002699
#### web3
27012700

docs/docs/guides/advanced/custom_RPC.md

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ This will give your plugin access to [requestManager](/api/web3-core/class/Web3C
3030

3131
<Tabs groupId='prog-lang' queryString>
3232

33-
<TabItem value='javascript' label='JavaScript'
34-
attributes={{className: 'javascript-tab'}}>
33+
<TabItem value='javascript' label='JavaScript'
34+
attributes={{className: 'javascript-tab'}}>
3535

3636
```javascript
3737
const { Web3PluginBase } = require('web3');
3838

3939
//highlight-start
4040
class CustomRpcMethodsPlugin extends Web3PluginBase {
41-
// step 1
42-
// ...
41+
// step 1
42+
// ...
4343
}
4444
//highlight-end
4545

@@ -56,8 +56,8 @@ import { Web3PluginBase } from 'web3';
5656

5757
//highlight-start
5858
export default class CustomRpcMethodsPlugin extends Web3PluginBase {
59-
// step 1
60-
// ...
59+
// step 1
60+
// ...
6161
}
6262
//highlight-end
6363
```
@@ -69,19 +69,18 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase {
6969

7070
2. After that add public `pluginNamespace` property. This will be used to access your plugin, as mentioned in step number 5 code example.
7171

72-
7372
<Tabs groupId='prog-lang' queryString>
7473

75-
<TabItem value='javascript' label='JavaScript'
76-
attributes={{className: 'javascript-tab'}}>
74+
<TabItem value='javascript' label='JavaScript'
75+
attributes={{className: 'javascript-tab'}}>
7776

7877
```javascript
7978
const { Web3PluginBase } = require('web3');
8079

8180
class CustomRpcMethodsPlugin extends Web3PluginBase {
82-
//highlight-start
83-
pluginNamespace = 'customRpcMethods'; // step 2
84-
//highlight-end
81+
//highlight-start
82+
pluginNamespace = 'customRpcMethods'; // step 2
83+
//highlight-end
8584
}
8685

8786
module.exports = CustomRpcMethodsPlugin;
@@ -96,40 +95,39 @@ module.exports = CustomRpcMethodsPlugin;
9695
import { Web3PluginBase } from 'web3';
9796

9897
export default class CustomRpcMethodsPlugin extends Web3PluginBase {
99-
//highlight-start
100-
public pluginNamespace = 'customRpcMethods'; // step 2
101-
//highlight-end
98+
//highlight-start
99+
public pluginNamespace = 'customRpcMethods'; // step 2
100+
//highlight-end
102101
}
103102
```
104103

105104
</TabItem>
106105
</Tabs>
107106

108-
109107
### Step 3: Creating Custom RPC Methods in the Plugin Class
110108

111109
3. Once plugin class is created using above mentioned steps, its very easy to add new RPC methods like:
112110

113111
<Tabs groupId='prog-lang' queryString>
114112

115-
<TabItem value='javascript' label='JavaScript'
116-
attributes={{className: 'javascript-tab'}}>
113+
<TabItem value='javascript' label='JavaScript'
114+
attributes={{className: 'javascript-tab'}}>
117115

118116
```javascript
119117
const { Web3PluginBase } = require('web3');
120118

121119
class CustomRpcMethodsPlugin extends Web3PluginBase {
122-
pluginNamespace = 'customRpcMethods';
120+
pluginNamespace = 'customRpcMethods';
123121

124122
//highlight-start
125-
async customRpcMethod() {
126-
// step 3
127-
return this.requestManager.send({
128-
// plugin has access to web3.js internal features like request manager
129-
method: 'custom_rpc_method',
130-
params: [],
131-
});
132-
}
123+
async customRpcMethod() {
124+
// step 3
125+
return this.requestManager.send({
126+
// plugin has access to web3.js internal features like request manager
127+
method: 'custom_rpc_method',
128+
params: [],
129+
});
130+
}
133131
//highlight-end
134132
}
135133

@@ -145,18 +143,18 @@ module.exports = CustomRpcMethodsPlugin;
145143
import { Web3PluginBase } from 'web3';
146144

147145
export default class CustomRpcMethodsPlugin extends Web3PluginBase {
148-
public pluginNamespace = 'customRpcMethods';
149-
150-
//highlight-start
151-
public async customRpcMethod() {
152-
// step 3
153-
return this.requestManager.send({
154-
// plugin has access to web3.js internal features like request manager
155-
method: 'custom_rpc_method',
156-
params: [],
157-
});
158-
}
159-
//highlight-end
146+
public pluginNamespace = 'customRpcMethods';
147+
148+
//highlight-start
149+
public async customRpcMethod() {
150+
// step 3
151+
return this.requestManager.send({
152+
// plugin has access to web3.js internal features like request manager
153+
method: 'custom_rpc_method',
154+
params: [],
155+
});
156+
}
157+
//highlight-end
160158
}
161159
```
162160

@@ -169,22 +167,22 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase {
169167

170168
<Tabs groupId='prog-lang' queryString>
171169

172-
<TabItem value='javascript' label='JavaScript'
173-
attributes={{className: 'javascript-tab'}}>
170+
<TabItem value='javascript' label='JavaScript'
171+
attributes={{className: 'javascript-tab'}}>
174172

175173
```javascript
176174
const { Web3PluginBase } = require('web3');
177175

178176
class CustomRpcMethodsPlugin extends Web3PluginBase {
179-
pluginNamespace = 'customRpcMethods';
180-
181-
async customRpcMethod() {
182-
return this.requestManager.send({
183-
// plugin has access to web3.js internal features like request manager
184-
method: 'custom_rpc_method',
185-
params: [],
186-
});
187-
}
177+
pluginNamespace = 'customRpcMethods';
178+
179+
async customRpcMethod() {
180+
return this.requestManager.send({
181+
// plugin has access to web3.js internal features like request manager
182+
method: 'custom_rpc_method',
183+
params: [],
184+
});
185+
}
188186
}
189187

190188
module.exports = CustomRpcMethodsPlugin;
@@ -199,25 +197,25 @@ module.exports = CustomRpcMethodsPlugin;
199197
import { Web3PluginBase } from 'web3';
200198

201199
export default class CustomRpcMethodsPlugin extends Web3PluginBase {
202-
public pluginNamespace = 'customRpcMethods';
203-
204-
public async customRpcMethod() {
205-
return this.requestManager.send({
206-
// plugin has access to web3.js internal features like request manager
207-
method: 'custom_rpc_method',
208-
params: [],
209-
});
210-
}
200+
public pluginNamespace = 'customRpcMethods';
201+
202+
public async customRpcMethod() {
203+
return this.requestManager.send({
204+
// plugin has access to web3.js internal features like request manager
205+
method: 'custom_rpc_method',
206+
params: [],
207+
});
208+
}
211209
}
212210

213211
//highlight-start
214212
// Module Augmentation
215213
declare module 'web3' {
216-
// step 4
214+
// step 4
217215

218-
interface Web3Context {
219-
customRpcMethods: CustomRpcMethodsPlugin;
220-
}
216+
interface Web3Context {
217+
customRpcMethods: CustomRpcMethodsPlugin;
218+
}
221219
}
222220
//highlight-end
223221
```
@@ -237,8 +235,8 @@ Once plugin is registered its custom methods will be available to use.
237235

238236
<Tabs groupId='prog-lang' queryString>
239237

240-
<TabItem value='javascript' label='JavaScript'
241-
attributes={{className: 'javascript-tab'}}>
238+
<TabItem value='javascript' label='JavaScript'
239+
attributes={{className: 'javascript-tab'}}>
242240

243241
```javascript
244242
const { Web3 } = require('web3');

0 commit comments

Comments
 (0)