You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
* Update CHANGELOG version headers
* Contract call with tuple is missing param names (#5613)
* call special output type
* fix
* fix: enable outputs to have param names (#5624)
* hot fix
* add type if only one param
* overloaded inputs types
* fix resolver tests
* add type tests
* simplify types
* revert registry unit test
* test firefox
* revert firefox test
* update changelogs
Co-authored-by: Marin Petrunić <[email protected]>
* Fix `isHex` and `isHexStrict` for some edge cases and enrich their tests (#5655)
* Change `isHex` to return true for negative numbers (for example `-123`)
* Change both `isHex` and `isHexStrict` to return `false` for `-0x`
* Change `isHex` to return `false` for empty strings ''.
* Remove erroneous set provider code for Contract constructor (#5669)
* Remove erroneous set provider code for Contract constructor. Add Contract constructor provider set test
* Update CHANGELOGs
* Debugging failing integration tests
* Apply suggestions from code review
* Use getSystemTestProvider instead of hardcoded string
* Refactor ternaries in Contract constructor to if statements
* Correct CHANGELOG entries
* Remove unneeded checks in if statements
* Test with injected external providers (#5652)
* fix: sending tx with injected provider (#5651)
Co-authored-by: Marin Petrunic <[email protected]>
* adding a test for using `ganache` provider
* enable the jsonrpc `id` to optionally be incremented starting from a number
(Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46)
* test with `in3` as a provider & skip `in3` test if it takes too long
* increase integration test timeout at web3 package
* add a test for using `hardhat` provider
* improve how legacy providers, such as hardhat, is used
* implement `isPromise` that works in the browsers
* refactor external providers tests
* update CHANGELOG.md
* Use Error ABI to parse errors when sending a transaction (#5662)
* use Error ABI when sending a transaction
* update CHANGELOG.md for #5587
* Remove merge conflict marker
Co-authored-by: Oleksii Kosynskyi <[email protected]>
Co-authored-by: Marin Petrunić <[email protected]>
Co-authored-by: Muhammad Altabba <[email protected]>
Co-authored-by: jdevcs <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -895,20 +895,32 @@ should use 4.0.1-alpha.0 for testing.
895
895
896
896
### Added
897
897
898
+
#### web3-eth-contract
899
+
900
+
- Decoding error data, using Error ABI if available, if error was returned from a smart contract function call (#5662).
901
+
898
902
#### web3-types
899
903
900
904
- These types were moved from `web3-eth-accounts` to `web3-types` package: Cipher, CipherOptions, ScryptParams, PBKDF2SHA256Params, KeyStore (#5581 )
901
905
902
906
#### web3-utils
903
907
904
908
- Export a new function `uuidV4` that generates a random v4 Uuid (#5373).
909
+
- Enable passing a starting number, to increment based on it, for the Json Rpc Request `id` (#5652).
910
+
- Export a new function `isPromise` that checks if an object is a promise (#5652).
911
+
912
+
#### web3-eth-contract
913
+
914
+
-`SpecialOutput` type was added as a generic type into the call function to support reassigning output types (#5631)
915
+
- Overloaded functions types (`ContractOverloadedMethodInputs`, `ContractOverloadedMethodOutputs`) was added (#5631)
905
916
906
917
### Fixed
907
918
908
919
#### web3-eth-contract
909
920
910
921
- Emit past contract events based on `fromBlock` when passed to `contract.events.someEventName` (#5201)
911
922
- Use different types for `ContractOptions` -> `jsonInterface` setter and getter (#5474)
923
+
- An issue within the `Contract` constructor where `provider` wasn't being set when provided within the `optionsOrContextOrReturnFormat` argument (#5669)
912
924
913
925
#### web3-types
914
926
@@ -918,6 +930,14 @@ should use 4.0.1-alpha.0 for testing.
918
930
919
931
- Use Uuid for the response id, to fix the issue "Responses get mixed up due to conflicting payload IDs" (#5373).
920
932
933
+
#### web3-validator
934
+
935
+
- Fix `isHex`returning `false` for `-123`, fix `isHexStrict` returning `true` for `-0x`, and fix `isHex` returning `true` for empty strings `` (#5373).
936
+
937
+
#### web3-eth-abi
938
+
939
+
- Fix ContractMethodOutputParameters type to support output object types by index and string key. Also, it returns void if ABI doesn't have outputs and returns exactly one type if the output array has only one element. (#5631)
Copy file name to clipboardExpand all lines: docs/docs/guides/web3_migration_guide/web3_utils_migration_guide.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,3 +28,37 @@ web3.utils.toWei('0.1');
28
28
// 4.x
29
29
web3.utils.toWei('0.1', 'ether');
30
30
```
31
+
32
+
## Validation functions
33
+
34
+
Validation functions has been moved to the new package `web3-validator`. Actually, you can still import them from `web3-util`. But they are marked as "deprecated" and you are encouraged to import them from `web3-validator`.
35
+
36
+
However, there are changes for the following:
37
+
38
+
### `isHex` and `isHexStrict` validation functions
39
+
40
+
There is a fix, and some edge-cases-changes for those 2 functions but the overall functionality stayed the same. And here is exactly whet changed:
41
+
42
+
#### `isHex` now returns `true` for all negative numbers
43
+
44
+
```ts
45
+
isHex('-123'); // in 1.x used to return `false`. But changed in 4.x to return `true`
46
+
// `true`
47
+
```
48
+
49
+
#### `isHex` now returns `false` for an empty string
50
+
51
+
```ts
52
+
isHex(''); // in 1.x used to return `true`. But changed in 4.x to return `false`
53
+
// `false`
54
+
```
55
+
56
+
#### `isHex` and `isHexStrict` now returns `false` for `'-0x'`
57
+
58
+
```ts
59
+
isHex('-0x'); // in 1.x used to return `true`. But changed in 4.x to return `false`
60
+
// `false`
61
+
62
+
isHexStrict('-0x'); // in 1.x used to return `true`. But changed in 4.x to return `false`
// a callback that is expected to be called after getting the response:
228
+
(err,response)=>{
229
+
if(err){
230
+
returnrejectWithError(err);
231
+
}
232
+
233
+
returnresolveWithResponse(response);
234
+
},
235
+
);
236
+
// Some providers, that follow a previous drafted version of EIP1193, has a `request` function
237
+
// that is not defined as `async`, but it returns a promise.
238
+
// Such providers would not be picked with if(isEIP1193Provider(provider)) above
239
+
// because the `request` function was not defined with `async` and so the function definition is not `AsyncFunction`.
240
+
// Like this provider: https://github.dev/NomicFoundation/hardhat/blob/62bea2600785595ba36f2105564076cf5cdf0fd8/packages/hardhat-core/src/internal/core/providers/backwards-compatibility.ts#L19
241
+
// So check if the returned result is a Promise, and resolve with it accordingly.
242
+
// Note: in this case we expect the callback provided above to never be called.
Copy file name to clipboardExpand all lines: packages/web3-eth-abi/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,3 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
53
53
- Updated Web3.js dependencies (#5664)
54
54
55
55
## [Unreleased]
56
+
57
+
### Fixed
58
+
59
+
- Fix ContractMethodOutputParameters type to support output object types by index and string key. Also, it returns void if ABI doesn't have outputs and returns exactly one type if the output array has only one element. (5631)
0 commit comments