Releases: web3/web3.js
v1.8.2-rc.0
Changed
- Updated Webpack 4 to Webpack 5, more details at (#5629)
crypto-browserify
module is now used only in webpack builds for polyfilling browsers (#5629)- Updated
ethereumjs-util
to7.1.5
(#5629) - Updated
lerna
4 to version 6 (#5680) - Bump utils 0.12.0 to 0.12.5 (#5691)
Fixed
- Fixed types for
web3.utils._jsonInterfaceMethodToString
(#5550) - Fixed Next.js builds failing on Node.js v16, Abortcontroller added if it doesn't exist globally (#5601)
- Builds fixed by updating all typescript versions to 4.1 (#5675)
Removed
clean-webpack-plugin
has been removed from dev-dependencies (#5629)
Added
https-browserify
,process
,stream-browserify
,stream-http
,crypto-browserify
added to dev-dependencies for polyfilling (#5629)- Add
readable-stream
to dev-dependancies for webpack (#5629)
Security
npm audit fix
for libraries update (#5726)
v4.0.1-alpha.3
Fixed
web3-validator
- Fix issue when importing
web3-validator
package within browser environments (Webpack minified filename changed fromindex.min.js
toweb3-validator.min.js
) (#5710) - Fix build error '"type"' does not satisfy the constraint (#5712)
web3-eth-abi
- Parameters decoding error for nested components (#5714)
v4.0.1-alpha.2
Added
web3-eth-contract
- Decoding error data, using Error ABI if available, if error was returned from a smart contract function call (#5662).
web3-types
- These types were moved from
web3-eth-accounts
toweb3-types
package: Cipher, CipherOptions, ScryptParams, PBKDF2SHA256Params, KeyStore (#5581 )
web3-utils
- Export a new function
uuidV4
that generates a random v4 Uuid (#5373). - Enable passing a starting number, to increment based on it, for the Json Rpc Request
id
(#5652). - Export a new function
isPromise
that checks if an object is a promise (#5652).
web3-eth-contract
SpecialOutput
type was added as a generic type into the call function to support reassigning output types (#5631)- Overloaded functions types (
ContractOverloadedMethodInputs
,ContractOverloadedMethodOutputs
) was added (#5631)
Fixed
web3-eth-contract
- Emit past contract events based on
fromBlock
when passed tocontract.events.someEventName
(#5201) - Use different types for
ContractOptions
->jsonInterface
setter and getter (#5474) - An issue within the
Contract
constructor whereprovider
wasn't being set when provided within theoptionsOrContextOrReturnFormat
argument (#5669)
web3-types
- Make the
request
method ofEIP1193Provider
class, compatible with EIP 1193 (#5591)
web3-utils
- Use Uuid for the response id, to fix the issue "Responses get mixed up due to conflicting payload IDs" (#5373).
web3-validator
- Fix
isHex
returningfalse
for-123
, fixisHexStrict
returningtrue
for-0x
, and fixisHex
returningtrue
for empty strings `` (#5373).
web3-eth-abi
- 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)
Removed
web3-eth-accounts
- These types were moved from
web3-eth-accounts
toweb3-types
package: Cipher, CipherOptions, ScryptParams, PBKDF2SHA256Params, KeyStore (#5581 )
v1.8.1
v4.0.1-alpha.1
Added
web3-core
- If the response error was
execution reverted
, raiseContractExecutionError
and pass the response error to it in order to be set asinnerError
(this innerError will be decoded at web3-eth-contract if its ABI was provided according to EIP-838). (#5434) - Added a new configuration variable
enableExperimentalFeatures
. (#5481) registerPlugin
method toWeb3Context
(#5393)Web3PluginBase
exported abstract class (#5393)Web3EthPluginBase
exported abstract class (#5393)
web3-error
- Add optional
innerError
property to the abstract classWeb3Error
. ThisinnerError
could beError
,Error[]
orundefined
. (#5435) (#5434) - The class
Web3ContractError
is moved to this package fromweb3-eth-contract
. (#5434) - Added the error code
ERR_TX_SIGNING
and used it insideTransactionSigningError
(#5462) - Added the error code
ERR_TX_GAS_MISMATCH
and used it insideTransactionGasMismatchError
(#5462) - Added
SignatureError
toweb3-errors/src/errors/signature_errors.ts
(moved fromweb3-eth/src/errors.ts
) (#5462) - Added the errors' classes to
web3-errors/src/errors/transaction_errors.ts
fromweb3-eth/src/errors.ts
(#5462) - Added
TransactionBlockTimeoutError
class and its error codeERR_TX_BLOCK_TIMEOUT
(#5294) ExistingPluginNamespaceError
class and it's error codeERR_EXISTING_PLUGIN_NAMESPACE
(#5393)
web3-eth
web3-rpc-methods
dependency (#5441)- Added chain and hardfork validation for transaction and transaction.common object in
validateTransactionForSigning
web3-eth-abi
- If an error happens when decoding a value, preserve that exception at
innerError
inside the error classAbiError
. (#5435) - Add basic functionality that is used, by
web3-eth-contract
, when decoding error data according to EIP-838. (#5434)
web3-eth-contract
- Decoding error data, using Error ABI if available, according to EIP-838. (#5434)
- The class
Web3ContractError
is moved from this package toweb3-error
. (#5434)
web3-plugin-example
- Example plugin for wrapping contract methods to provide custom functionality (#5393)
- Example plugin for custom RPC methods using the
requestManager
(#5393)
web3-utils
- Added and exported three reusable utility functions:
pollTillDefined
,rejectIfTimeout
andrejectIfConditionAtInterval
which are useful when dealing with promises that involves polling, rejecting after timeout or rejecting if a condition was met when calling repeatably at every time intervals.
web3-eth-personal
web3-rpc-methods
dependency (#5441)
web3-eth-net
web3-rpc-methods
dependency (#5441)
web3-providers-ipc
- Show error message and return dummy promise if socket is not writable (#5294)
web3-rpc-methods
- web3-rpc-methods package added
web3-types
Changed
web3-core
- Default value for
API
generic forWeb3ContextObject
fromany
tounknown
(#5393) - Default value for
API
generic forWeb3ContextInitOptions
fromany
tounknown
(#5393) - Added validation when
defaultHardfork
anddefaultCommon.hardfork
are different in web3config - Added validation when
defaultChain
anddefaultCommon.basechain
are different in web3config - Added a new configuration variable
enableExperimentalFeatures
. (#5481)
web3-error
- Moved
SignerError
fromweb3-errors/src/errors/signature_errors.ts
toweb3-errors/src/errors/transaction_errors.ts
, and renamed it toTransactionSigningError
(#5462) - Corrected the error code for
JSONRPC_ERR_UNAUTHORIZED
to be4100
(#5462)
web3-eth
Web3EthExecutionAPI
is now imported viaweb3-types
instead ofweb3_eth_execution_api.ts
(#5441)- Replace the imported methods from
rpc_methods.ts
withethRpcMethods
imports fromweb3-rpc-methods
(#5441) Web3NetAPI
is now imported fromweb3-types
instead ofweb3-net
(#5441)- Moved
rpc_methods
tests toweb3-rpc-methods
(#5441) - Implemented the logic for
transactionBlockTimeout
(#5294) - Use subscription at
rejectIfBlockTimeout
when the provider supports subscription. Implement this as an experimental feature (ifuseSubscriptionWhenCheckingBlockTimeout
atenableExperimentalFeatures
istrue
). (#5481) - At some test cases, optimized some codes. (#5481)
web3-eth-accounts
signTransaction
andprivateKeyToAccount
will throwTransactionSigningError
instead ofSignerError
now (#5462)
web3-eth-ens
Web3NetAPI
is now imported fromweb3-types
instead ofweb3-net
(#5441)
web3-eth-personal
- Import
EthPersonalAPI
fromweb3-types
instead of local import (#5441) - Replace the imported methods from
rcp_methods.ts
withpersonalRpcMethods
imports fromweb3-rpc-methods
(#5441) - Replace use of
EthPersonalAPIManager
withWeb3RequestManager<EthPersonalAPI>
(#5441)
web3-eth-net
Web3NetAPI
is now imported fromweb3-types
instead ofweb3_net_api.ts
(#5441)- Replace the imported methods from
rpc_methods.ts
withnetRpcMethods
imports fromweb3-rpc-methods
(#5441)
web3-types
Web3APISpec
,Web3APIMethod
, andWeb3APIParams
now supportsunknown
APIs (#5393)
Fixed
web3-error
- Corrected the error code for
JSONRPC_ERR_UNAUTHORIZED
to be4100
(#5462)
web3-eth
- Fix
getBlock
returning empty transactions object onhydrated
true (#5556) - setimmediate package to polyfill setImmediate for browsers (#5450)
web3-eth-contract
- According to the latest change in
web3-eth-abi
, the decoded values of the large numbers, returned from function calls or events, are now available asBigInt
. (#5435)
web3-eth-abi
- Return
BigInt
instead ofstring
when decoding function parameters for large numbers, such asuint256
. (#5435)
web3-types
Web3APISpec
,Web3APIMethod
, andWeb3APIParams
now supportsunknown
APIs (#5393)
Removed
web3-eth
- Moved the errors' classes from
web3-eth/src/errors.ts
toweb3-errors/src/errors/transaction_errors.ts
(#5462)
web3-eth-personal
- Exported type
EthPersonalAPIManager
,EthPersonalAPI
is not exported viaweb3-types
(#5441)
web3-eth-net
rpcMethods
export, these methods are now exported viaweb3-rpc-methods
asnetRpcMethods
(#5441)Web3NetAPI
export, now exported viaweb3-types
asWeb3NetAPI
(#5441)
web3-validator
- Removed direct function
toJSON()
inWeb3ValidatorError
class as its available via base class (#5435)
v1.8.1-rc.0
v1.8.0
Changed
- Updated
sha3
andsha3Raw
type definition to acceptBuffer
(#5357) - Removing legacy field in lerna.json (#5403)
- Correct
eth_sendSignedTransaction
code example (#5402)
Fixed
- Browser builds support polyfills (#5031) (#5053) (#4659) (#4767)
- Update node version on actions to fix breaking mosaic test (#5354)
- Start incrementing jsonrpc.id from random number (#5327)
web3-eth-contract
'scall
andsend
methods no longer mutateoptions
argument (#5394)- Improvement using provided gas options in web3-eth-accounts for eip-1559 transactions (#5012)
Added
v1.8.0-rc.0
Changed
- Updated
sha3
andsha3Raw
type definition to acceptBuffer
(#5357) - Removing legacy field in lerna.json (#5403)
- Correct
eth_sendSignedTransaction
code example (#5402)
Fixed
- Browser builds support polyfills (#5031) (#5053) (#4659) (#4767)
- Update node version on actions to fix breaking mosaic test (#5354)
- Start incrementing jsonrpc.id from random number (#5327)
web3-eth-contract
'scall
andsend
methods no longer mutateoptions
argument (#5394)- Improvement using provided gas options in web3-eth-accounts for eip-1559 transactions (#5012)
Added
v4.0.1-alpha.0
Fixed
- Dependency tree cannot be resolved by Yarn due to old deprecated packages picked by yarn - fixed (#5382)
v4.0.0-alpha.0
Note: Yarn is resolving to some old deprecated package versions for 4.0.0-alpha.0
instead of latest alpha versions. A patch bump is posted so yarn users should use 4.0.1-alpha.0
for testing.
Summary
Web3.js 4.0.0-alpha.0 is a complete overhaul. This alpha version is written in TypeScript and has many exciting features. Features such as:
- Full types support ( including Dynamic Contracts Typing )
- ETH functions optional data formatters
- ETH RPC method wrappers for advance users
- Validation functionality using schema
- Configurable behavior of the sendTransaction
- Easy extensibility and high readability
- Clear specs of base wallet, base providers and much more
Check out our 4.x API documentation (https://docs.web3js.org/) for the full details. The release contains mostly 1.x parity functionality with some documented breaking changes. Most of the packages in this release have been unit tested and only selected packages are E2E tested (web3, web3-eth, web3-contracts, web3-eth-personal, web3-providers-http and web3-providers-ws).
Checkout our 1.x to 4.x migration guide (https://docs.web3js.org/docs/guides/web3_migration_guide) for testing the 4.0.0-alpha.0 release and share your feedback with us.
Added
web3-errors
web3-errors
new package is created, it has Web3 Error codes and classes
web3-types
web3-types
new package is created, it provides the common data structures and interfaces for web3 modules
web3-validator
web3-validator
new package is created, it has JSON-Schema compatible validator functionality for Web3
Removed
web3-bzz
- This Package is deprecated
web3-shh
- This Package is deprecated
web3-core-helpers
- This Package is removed,
errors
are moved toweb3-errors
package and formatters are moved inweb3-core
package
web3-core-method
- This Package is removed, and
web3-core-method
functionality is moved toweb3-eth
package
web3-core-promieevent
- This Package is removed, and core promi events functionality is moved to
web3-core
package
web3-core-requestmanager
- This Package is removed, batch requests and request manager functionality is moved to
web3-core
package
web3-core-subscription
- This Package is removed, and core subscription functionality is moved to
web3-core
package
Changed
web3
- Passing callbacks to functions is no longer supported, except for event listeners.
- Method
extend
is deprecated
web3-core
- The function
outputBigNumberFormatter
inweb3-core-helper
renamed tooutputBigIntFormatter
underweb3-core
- Removed
this.defaultBlock
context frominputDefaultBlockNumberFormatter
inweb3-core-helper
and converted to additional parameter - Removed
this.defaultBlock
context frominputTransactionFormatter
inweb3-core-helper
and converted to additional parameter
web3-utils
- The following functions
soliditySha3
soliditySha3Raw
encodePacked
now includes type validation and requires type specification, instead of guessing the value type - The functions
soliditySha3
,soliditySha3Raw
andencodePacked
did not support BN; But, now supportsBigInt
- The functions
flattenTypes
andjsonInterfaceMethodToString
moved to theweb3-eth-abi
package - The function
isAddress
now includes an optional parametercheckChecksum
type boolean isBoolean
now accept1
, and0
as valid values to test. Ref:web3-validator
web3-eth-accounts
create
function does not take in the optional parameterentropy
Wallet.create
function doesn't acceptentropy
param
web3-validator
isBoolean
now accept1
, and0
as valid values to test.
web3-eth-contract
- Event logs do not support types for indexed properties, but named properties are supported.
- Types for overloaded ABI functions are not yet supported.
signTransaction
will not fill any default values, and it will only sign and return result. For filling default values, useweb3-eth
packagerecover
function's last param is booleanhashed
, it is used to indicate if data provided is already hashed or not. By default, this function will assume data is not hashed.- The
Wallet
no longer supports address/number indexing. Have to usewallet.get
instead. Wallet.create
function doesn't acceptentropy
paramcontract.method.send()
will resolve to transaction receipt instead oftransactionHash
. User can usereceipt.transactionHash
instead.
web3-net
- Package will not support web3.bzz.net and web3.shh.net
web3-eth-iban
- IBAN constructor now has validation checks for indirect/direct iban.
isDirect
,isValid
,isIndirect
are now also included as static methods.
web3-eth-ens
setMultihash
is not supported in web3-eth-ens 4.x as it's deprecated in ENS public resolver (https:/ensdomains/resolvers/blob/master/contracts/PublicResolver.sol)setContent
is not supported in web3-eth-ens 4.x as it's deprecated in ENS public resolver (https:/ensdomains/resolvers/blob/master/contracts/PublicResolver.sol)getContent
is not supported in web3-eth-ens 4.x as it's deprecated in ENS public resolver.getMultihash
is not supported in web3-eth-ens 4.x as it's deprecated in ENS public resolver.
web3-eth-abi
internalType
was renamed tobaseType
in all abi types
web3-eth
givenProvider
default value is undefineddefaultHardfork
default value is 'london'defaultAccount
default value is undefineddefaultNetworkId
default value is undefined- When sending a transaction, if Ethereum Node does not respond within
transactionSendTimeout
, throw an Error.
web3-eth-subscribe
clearSubscriptions
Instead of returningtrue
,clearSubscriptions
now returns array of subscription's ids
web3-eth-personal
givenProvider
default value is undefinedcurrentProvider
default value is undefined