This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Releases: web3/web3.js
Releases · web3/web3.js
v4.0.3
Fixed
web3
web3-rpc-methods
- Rpc method
getPastLogsaccept blockHash as a parameter https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs (#6181)
web3-types
- type
FilterincludesblockHash(#6206)
web3-utils
- BigInts pass validation within the method
numberToHex(#6206)
Changed
web3-core
- Dependencies updated
web3-errors
- Dependencies updated
web3-eth
- Dependencies updated
web3-eth-abi
- Dependencies updated
web3-eth-accounts
- Dependencies updated
web3-eth-contract
- Dependencies updated
web3-eth-ens
- Dependencies updated
web3-eth-iban
- Dependencies updated
web3-eth-personal
- Dependencies updated
web3-net
- Dependencies updated
web3-providers-http
- Dependencies updated
web3-providers-ipc
- Dependencies updated
web3-providers-ws
- Dependencies updated
web3-validator
- Dependencies updated
v4.0.2
Fixed
web3
web3-core
- Fixed Batch requests erroring out on one request (#6164)
- Fixed the issue: Subscribing to multiple blockchain events causes every listener to be fired for every registered event (#6210)
- Fixed the issue: Unsubscribe at a Web3Subscription class will still have the id of the subscription at the Web3SubscriptionManager (#6210)
- Fixed the issue: A call to the provider is made for every subscription object (#6210)
web3-eth-abi
- Support for "decoding" indexed string event arguments (returns the keccak256 hash of the string value instead of the actual string value) (#6167)
web3-eth-accounts
- Fixed "The
randsreturned bysignTransactionto does not always consist of 64 characters #6207" (#6216)
web3-eth-contract
- Event filtering using non-indexed and indexed string event arguments (#6167)
web3-eth-ens
web3-providers-ws
web3-types
Added
web3
- Exported
Web3Context,Web3PluginBase,Web3EthPluginBasefrom'web3-core', andWeb3Validatorfrom'web3-validator'(#6165)
web3-core
- Web3Subscription constructor accept a Subscription Manager (as an alternative to accepting Request Manager that is now marked marked as deprecated) (#6210)
web3-types
- Added the
SimpleProviderinterface which has onlyrequest(args)method that is compatible with EIP-1193 (#6210) - Added the
Eip1193EventNametype that contains the possible events names according to EIP-1193 (#6210)
Changed
web3-core
- Web3Subscription constructor overloading that accept a Request Manager is marked as deprecated (#6210)
web3-errors
- Dependencies updated
web3-eth
- Dependencies updated
web3-eth-iban
- Dependencies updated
web3-eth-personal
- Dependencies updated
web3-net
- Dependencies updated
web3-providers-http
- Dependencies updated
web3-providers-ipc
- Dependencies updated
web3-rpc-methods
- Dependencies updated
web3-types
- The
EIP1193Providerclass has now all the events (foronandremoveListener) according to EIP-1193 (#6210)
web3-utils
- Dependencies updated
web3-validator
- Dependencies updated
v4.0.1
Web3.js 4.0.1 is written in TypeScript and has many exciting features such as:
- Easy extensibility ( with web3 Plugins feature. example: Chainlink Plugin )
- In compliance with ETH EL Specification
- Dynamic Contract Typing
- Native typescript
- ESM CJS native builds
- 85%+ test coverage
- Custom data formatting feature
- Reduced package size
- New packages ( web3-types, web3-errors, web3-validator, web3-rpc-methods )
- Validation functionality using schema
Documentation:
- Web3.js documentation
- Web3 API
- Migration Guide from 1.x
- Web3 Plugin Developers Guide
- Web3 Plugin Users Guide
Detailed List of changes are mentioned under:
- 4.0.0-alpha.0
- 4.0.1-alpha.1
- 4.0.1-alpha.2
- 4.0.1-alpha.3
- 4.0.1-alpha.4
- 4.0.1-alpha.5
- 4.0.1-rc.0
- 4.0.1-rc.1
- 4.0.1-rc.2
If there are any bugs, improvements, optimizations or any new feature proposal feel free to create github issue, or post a pull request for contributions.
v4.0.1-rc.2
Added
web3-errors
InvalidPropertiesForTransactionTypeErrorwith error code429(#6102)
web3-eth-contract
- Added support for
getPastEventsmethod to filterallEventsand specific event (#6010) - Added
maxPriorityFeePerGasandmaxFeePerGasinContractOptionstype and updated function using it in utils (#6118) - Added method's type autodetection by ABI param (#6137)
web3-types
- Added
filtersparam to theFiltertype (#6010) - Added types
JsonRpcSubscriptionResultOld,Web3ProviderMessageEventCallback. Added.on('data')type support for old providers (#6082) - Export for
HardforksOrderedenum (#6102) - Export for
Web3ValidationErrorObjecttype (#6102)
web3-utils
- Optional
hexstrictparameter added to numberToHex (#6004)
Fixed
web3-eth
- Fixed
ignoreGasPricingbug with wallet in context (#6071)
web3-eth-accounts
- Fixed ESM import bugs reported in (#6032) and (#6034)
- ESM projects will not need to run --experimental-specifier-resolution=node (#6127)
Changed
web3-core
- Replaced Buffer for Uint8Array (#6004)
web3-errors
- Nested Smart Contract error data is extracted at
Eip838ExecutionErrorconstructor and the nested error is set atinnerError(#6045)
web3-eth
formatTransactionno longer throws aTransactionDataAndInputErrorif it's passed a transaction object with bothdataandinputproperties set (as long as they are the same value) (#6064)- Refactored documentation for
rpc_method_wrappersto point to the previously duplicated documentation found under theWeb3Ethclass documentation (#6054) - Replaced Buffer for Uint8Array (#6004)
- Refactored
defaultTransactionTypeParserto return correct EIP-2718 types, prior implementation was prioritizingtransaction.hardforkand ignoring the use oftransaction.gasLimit.defaultTransactionTypeParserwill now throwInvalidPropertiesForTransactionTypeErrors for properties are used that are incompatible withtransaction.type(#6102) prepareTransactionForSigninganddefaultTransactionBuildernow accepts optionalfillGasPriceflag and by default will not fill gas(#6071)
web3-eth-abi
- Nested Smart Contract error data hex string is decoded when the error contains the data as object (when the data hex string is inside data.originalError.data or data.data) (#6045)
web3-eth-accounts
- Replaced
BufferforUint8Array(#6004) - The methods
recover,encrypt,privateKeyToAddressdoes not support typeBufferbut supports typeUint8Array(#6004) - The method
parseAndValidatePrivateKeyreturns a typeUint8Arrayinstead of typeBuffer(#6004)
web3-providers-ipc
- Replaced Buffer for Uint8Array (#6004)
web3-types
- Removed chainId, to, data & input properties from NonPayableCallOptions
- Replaced Buffer for Uint8Array (#6004)
- types
FMT_BYTES.BUFFER,BytesandFormatTypeand encryption option types forsaltandivhas replaced support forBufferforUint8Array(#6004) - Added
internalTypeproperty to theAbiParametertype.
web3-utils
- Replaced Buffer for Uint8Array (#6004)
- The methods
hexToBytes,randomBytesdoes not return typeBufferbut typeUint8Array(#6004) - The methods
sha3andkeccak256Wrapperdoes not accept typeBufferbut typeUint8Array(#6004) - The method
bytesToBufferhas been removed for the usage ofbytesToUint8Array(#6004)
web3-validator
- Replaced Buffer for Uint8Array (#6004)
Removed
web3-eth-ens
- Removed non read-only methods (#6084)
web3-validator
Web3ValidationErrorObjecttype is now exported fromweb3-typespackage (#6102)
v1.10.0
Fixed
- Improved the error propagation in
web3-providers-httppackage to effectively propagate useful error infomation about failed HTTP connections (#5955) - Fixed "Uncaught TypeError" calling a contract function that revert using MetaMask (#4454) and related "n.data.substring is not a function", that is raised when there is a revert and
web.eth.handleRevert = true(#6000)
Changed
transaction.typeis now formatted to a hex string before being send to provider (#5979)- When sending a transaction, if
transaction.type === '0x1' && transaction.accessList === undefined, thentransaction.accessListis set to[](#5979) - Removed an unnecessary
chainIdparameter fromtoChecksumAddress()function types (#5888)
Added
- Added support for
getPastEventsmethod to filterallEventsand specific event (#6015)
Security
- Updated dependencies (#6044)
v1.10.0-rc.0
Fixed
- Improved the error propagation in
web3-providers-httppackage to effectively propagate useful error infomation about failed HTTP connections (#5955) - Fixed "Uncaught TypeError" calling a contract function that revert using MetaMask (#4454) and related "n.data.substring is not a function", that is raised when there is a revert and
web.eth.handleRevert = true(#6000)
Changed
transaction.typeis now formatted to a hex string before being send to provider (#5979)- When sending a transaction, if
transaction.type === '0x1' && transaction.accessList === undefined, thentransaction.accessListis set to[](#5979) - Removed an unnecessary
chainIdparameter fromtoChecksumAddress()function types (#5888)
Added
- Added support for
getPastEventsmethod to filterallEventsand specific event (#6015)
Security
- Updated dependencies (#6044)
v4.0.1-rc.1
Changed
web3
- No need for polyfilling nodejs
netandfsmodules (#5978) - Removed IPC provider dependency, IPC path is no longer viable provider. If you wanna use IPC, please install
web3-providers-ipcand instantiate provider yourself (#5978)
web3-core
- If a transaction object with a
dataproperty is passed totxInputOptionsFormatter, it will now be replaced withinput(#5915) - The types
TransactionTypeParserandTransactionBuilderare now utilizing the typeTransactionfor the transaction object. (#5993) - No need for polyfilling nodejs
netandfsmodules (#5978) - Removed IPC provider dependency, IPC path is no longer viable provider. If you wanna use IPC, please install
web3-providers-ipcand instantiate provider yourself (#5978)
web3-errors
gasLimitis no longer accepted as a parameter forMissingGasErrorand `TransactionGasMismatchError, and is also no longer included in error message (#5915)
web3-eth
signTransactionwill now returngasinstead ofgasLimitfor returned transaction object regardless of what property name the provider uses (#5915)formatTransactionwill now replacedatatransaction property withinput(#5915)isTransactionCallwill now check ifvalue.inputisHexStrictif provided (#5915)- The functions
defaultTransactionBuilderandtransactionBuilderare now utilizing the typeTransactionfor the transaction object. (#5993)
web3-eth-accounts
- Moved @ethereumjs/tx, @ethereumjs/common code to our source code (#5963)
- The method
signTransactionreturned byprivateKeyToAccountis now accepting the typeTransactionfor its argument. (#5993)
web3-eth-contract
getSendTxParamswill now returninputinstead ofdatain returned transaction parameters object (#5915)Contractconstructor will now thrown newContractTransactionDataAndInputErrorif bothdataandinputare passed inContractInitOptionsforContractconstructor (#5915)- The types
ContractInitOptions,NonPayableCallOptionsandPayableCallOptionsare moved toweb3-types. (#5993)
web3-types
dataproperty inTransactionOutputwas renamed toinput(#5915)- The method
signTransactioninsideWeb3BaseWalletAccountis now utilizing the typeTransactionfor its argument. (#5993) - The types
FMT_NUMBER,NumberTypes,FMT_BYTES,ByteTypes,DataFormat,DEFAULT_RETURN_FORMAT,ETH_DATA_FORMATandFormatTypemoved fromweb3-utils. (#5993) - The types
ContractInitOptions,NonPayableCallOptionsandPayableCallOptionsare moved fromweb3-eth-contract. (#5993)
web3-utils
- The types
FMT_NUMBER,NumberTypes,FMT_BYTES,ByteTypes,DataFormat,DEFAULT_RETURN_FORMAT,ETH_DATA_FORMATandFormatTypemoved toweb3-types. (#5993)
Added
web3
web3-core
web3-errors
web3-eth
- Added source files (#5956)
web3-eth-abi
web3-eth-accounts
web3-eth-contract
inputis now an acceptable property forContractInitOptionsin place ofdata(either can be used, butinputis used withing theContractclass) (#5915)- Added source files (#5956)
- Added hybrid build (ESM and CJS) of library (#5904)
web3-eth-ens
web3-eth-iban
web3-eth-personal
web3-net
web3-providers-http
web3-providers-ipc
web3-providers-ws
web3-rpc-methods
web3-types
web3-utils
web3-validator
- Added source files (#5956)
- Added hybrid build (ESM and CJS) of library (#5904)
- Added functions
isHexString,isHexPrefixed,validateNoLeadingZeroes(#5963)
Removed
web3-core
getConfigmethod fromWeb3Configclass,configis now public and accessible usingWeb3Config.config(#5950)
web3-eth
- Removed dependencies @ethereumjs/tx, @ethereumjs/common (#5963)
web3-eth-abi
- Removed
formatDecodedObjectfunction (#5934)
web3-eth-contract
datawas removed as a property ofContractOptionstype (#5915)
web3-utils
- Removed dependencies @ethereumjs/tx, @ethereumjs/common (#5963)
Fixed
web3-eth-ens
- Bug fix of
checkNetworkin ENS (#5988)
v1.9.0
Fixed
- Fixed skipped ws-ganache tests (#5759)
- Fixed "provider started to reconnect error" in web3-provider-ws (#5820)
- Fixed Error: Number can only safely store up to 53 bits (#5845)
- Fixed types for packages which have default exports but not declared default export in .d.ts (#5866)
- Fixed Transaction type by adding missing properties (#5856)
Changed
- Add optional
hexFormatparam togetTransactionandgetBlockthat accepts the value'hex'(#5845) utils.toNumberandutils.hexToNumbercan now return the large unsafe numbers asBigInt, iftruewas passed to a new optional parameter calledbigIntOnOverflow(#5845)- Updated @types/bn.js dependency to 5.1.1 in web3, web3-core and web3-eth-contract as reason mentioned in #5640 (#5885)
- Add description to error for failed connection on websocket (#5884)
Security
- Updated dependencies (#5885)
v4.0.1-rc.0
Added
web3
registeredSubscriptionswas added by default in web3 constructor (#5792)- Add named exports for all objects which are the default-exported-object in their packages (#5771)
- Export all packages' objects organized by namespaces (#5771)
- Add Additional flat exports for all types and constants from
web3-types,web3-errorsandweb3. (#5771) - Fix few issues with
new Web3().eth.contract(#5824)
web3-core
- Added rpc exception codes following eip-1474 as an experimental feature (if
useRpcCallSpecificationatenableExperimentalFeaturesistrue) (#5525) - Added support of
safeandfinalizedblock tags (#5823)
web3-errors
- Added error class
InvalidMethodParamsErrorand error codeERR_INVALID_METHOD_PARAMS = 207(#5824) requestproperty toResponseError(#5854)dataproperty toTransactionRevertInstructionError(#5854)TransactionRevertWithCustomErrorwas added to handle custom solidity errors (#5854)
web3-eth
- Added
createAccessListfunctionality ( #5780 ) - Added support of
safeandfinalizedblock tags (#5823) contractAbioption toSendTransactionOptionsandSendSignedTransactionOptionsto added the ability to parse custom solidity errors (#5854)
web3-eth-abi
decodeErrorDatafromweb3-eth-contractis now exported from this package and was renamed todecodeContractErrorData(#5844)
web3-eth-contract
- Added functionality of
createAccessListfor contracts ( #5780 ) - An instance of
ContractwillsubscribeToContextEventsupon instantiation ifsyncWithContextis set totrueand the constructor is passed an instance ofWeb3Context(#5833) - Added support of
safeandfinalizedblock tags (#5823)
web3-providers-http
- Added named export for
HttpProvider(#5771)
web3-providers-ipc
- Added named export for
IpcProvider(#5771) - Pass
_socketOptionsfromIpcProviderconstructor to the underlyingSocket(#5891) - The getter of
SocketConnectioninIpcProvider(inherited fromSocketProvider) returnsnet.Socket(#5891)
web3-providers-ws
- Added named export for
WebSocketProvider(#5771) - The getter of
SocketConnectioninWebSocketProvider(inherited fromSocketProvider) returns isomorphicWebSocket(#5891)
web3-rpc-methods
- Added
createAccessListfunctionality ( #5780 ) - Added support of
safeandfinalizedblock tags (#5823)
web3-types
- Added types from
web3-eth-abiandTypedArrayfrom (#5771) - Added
TypedArrayfromweb3-utilsandweb3-validator(it was defined twice) (#5771) - Added
safeandfinalizedblock tags inBlockTagsandBlockTagtypes (#5823)
web3-utils
- Added support of
safeandfinalizedblock tags (#5823)
web3-validator
- Added support of
safeandfinalizedblock tags inisBlockTagmethod (#5823)
Changed
web3
require('web3')will now return all web3 exported-objects organized in namespaces . (#5771)
web3-errors
- The abstract class
Web3Erroris renamed toBaseWeb3Error(#5771) - Renamed TransactionRevertError to TransactionRevertInstructionError to remain consistent with 1.x
- Using
MaxAttemptsReachedOnReconnectingErrorwith the same message for 1.x but also adding themaxAttempts(#5894)
web3-eth
- Update imports statements for objects that was moved between web3 packages (#5771)
sendTransactionandsendSignedTransactionnow errors with (anderrorevent emits) the following possible errors:TransactionRevertedWithoutReasonError,TransactionRevertInstructionError,TransactionRevertWithCustomError,InvalidResponseError, orContractExecutionError(#5854)
web3-eth-accounts
- Updated dependencies (#5912)
web3-eth-contract
- Update imports statements for objects that was moved between web3 packages (#5771)
web3-eth-ens
- Updated dependencies (#5912)
web3-eth-iban
- Updated dependencies (#5912)
web3-eth-personal
- Updated dependencies (#5912)
web3-net
- Updated dependencies (#5912)
web3-utils
compareBlockNumbersfunction now only supports comparison of both blocktags params ( exceptearliestvs number) or both block number params (#5842)SocketProviderabstract class now resolves JSON RPC response errors instead of rejecting them (#5844)- Exposes the getter of
SocketConnectioninSocketProvider(#5891)
Removed
web3
- Private static
_contracts:Contract[]and staticsetProviderfunction was removed (#5792)
web3-eth
getRevertReasonis no longer exported (#5844)
web3-eth-abi
- Moved all types and interfaces to
web3-types(#5771)
web3-eth-contract
decodeErrorDatais no longer exported (method was moved toweb3-eth-abiand renameddecodeContractErrorData) (#5844)
web3-utils
- Moved
TypedArraytoweb3-types(was also duplicated atweb3-validator) (#5771) - Removed support of
genesistag incompareBlockNumbersfunction (#5823)
web3-validator
- Moved
TypedArraytoweb3-types(was also duplicated atweb3-utils) (#5771)
Fixed
web3-eth-contract
v1.9.0-rc.0
Fixed
- Fixed skipped ws-ganache tests (#5759)
- Fixed "provider started to reconnect error" in web3-provider-ws (#5820)
- Fixed Error: Number can only safely store up to 53 bits (#5845)
- Fixed types for packages which have default exports but not declared default export in .d.ts (#5866)
- Fixed Transaction type by adding missing properties (#5856)
Changed
- Add optional
hexFormatparam togetTransactionandgetBlockthat accepts the value'hex'(#5845) utils.toNumberandutils.hexToNumbercan now return the large unsafe numbers asBigInt, iftruewas passed to a new optional parameter calledbigIntOnOverflow(#5845)- Updated @types/bn.js dependency to 5.1.1 in web3, web3-core and web3-eth-contract as reason mentioned in #5640 (#5885)
- Add description to error for failed connection on websocket (#5884)
Security
- Updated dependencies (#5885)