This is a stub types definition for web3 (https://github.com/ethereum/web3.js).
web3 provides its own type definitions, so you don't need @types/web3 installed!
This is a stub types definition. web3 provides its own type definitions, so you do not need this installed.
Stub TypeScript definitions entry for web3, which provides its own types definitions
This is a stub types definition for web3 (https://github.com/ethereum/web3.js).
web3 provides its own type definitions, so you don't need @types/web3 installed!
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Released with 1.0.0-beta.37 code base.
websocket
dependency fixed (#2971, #2976)requestOptions
added to WebsocketProvider
(#2979)eth.getChainId
method (#3113)connected
event on subscription creation (#3028)0
as a valid fromBlock
or toBlock
filter param (#1100)null
(#2183)net_version
when signing txs (#2378)tx
object passed to function signTransaction
(#2190)eth_requestAccounts
as requestAccounts
added to web3-eth package (#3219)sha3Raw
and soliditySha3Raw
added to web3-utils package (#3226)eth_getProof
as getProof
added to web3-eth package (#3220)BN
and BigNumber
objects are now supported by the abi.encodeParameter(s)
method (#3238)getPendingTransactions
added to web3-eth package (#3239)handleRevert
module property (#3248)receipt
does now exist as property on the error object for transaction related errors (#3259)internalType
added to AbiInput
TS interface in web3-utils
(#3279)HttpProvider
options (#2980)eth-lib
dependency updated (0.2.7 => ^0.2.8) (#3242)defaultBlock
property handling fixed (#3247)clearSubscriptions
does no longer throw an error if no running subscriptions do exist (#3246)Accounts.signTransaction
fixed (#3280)docs/_build
foldereth_call
that will not default to your first account anymore if from
is not set. If a sender is not explicitly defined, the eth_call
will be executed from address(0)
. (#3467)eth_call
without explicitly setting a sender.view
methods that refer to a msg.sender
without explicitly setting a from
address in your request options, you may see unexpected behavior.web3.js
, the from
address can be specified on a per-call basis or by setting the defaultAccount
property.AbstractProvider
interface. (#3499)methods
and call
. (#3454)web3-eth-abi
ABICoder dependency. (#3490)dtslint
. (#3479)sending
and sent
events for tx submissions (#3438)latestBlockHash
arg to confirmation
event handler payload (#3438)method.encodeABI
(#3549)transactionPollingTimeout
(#3513)@web3-js/scrypt-shim@0.1.0
to scrypt-js@3.0.1
account.hashMessage
with non-ASCII characters (#3523)handleRevert
added (#3452)method.call
description (#3558)request
method (#3625)genesis
block in 1.x documentation (#3594)toBlock
when subscribing to contract events (#3207)_txInputFormatter
with hex prefix check (#3317)fromBlock
value when re-subscribing to events over WS (#3596)Function
type log parameter decoding (#2826)npm run build
now uses TSC to compile (.js allowed) and the build folder is now located under lib
(#3652)web3-providers-ipc
oboe
version to 2.1.5 (#3661)eth_subscription
provider events (#3660)clearSubscriptions
(#3689)web3-eth2-core
package (#3743) (renamed to web3-eth2-base
)web3-eth2-beaconchain
package (#3743) (renamed to web3-eth2-beacon
)stripHexPrefix
method to web3-utils
package (#3776)packages/web3
. Added documentation to root README (#3717)dist
to latest release (1.3.2
) (#3875)fromBlock
option for logs
subscriptions (defaults to latest
) (#3883)web3-eth2-base
to web3-eth2-core
and web3-eth2-beacon
to web3-eth2-beaconchain
(#3833)ts-node
from version ^8.10.2
to ^9.0.0
(#3856)npm audit fix
which fixed 4 vulnerabilities (#3856)web3-eth2-beaconchain
type declarations (#3859) and (#3865)IBaseAPISchema
and IBaseAPIMethodSchema
to index.d.ts
for web3-eth2-core
(#3878)web3-eth2-core
(#3878)notImplemented
flag from ETH2 Beacon Chain package methods schema (#3861)IETH2BeaconChain
interface in favor of exporting a class type: ETH2BeaconChain
(#3878)index.d.ts
files in favor of types.ts
for web3-eth2-core
and web3-eth2-beaconchain
(#3878)schema.ts
from web3-eth2-core
(#3878)dtslint
npm command from web3-eth2-core
and web3-eth2-beaconchain
as index.d.ts
files were removed (#3878)ETH2Core
class export to index.d.ts
for web3-eth2-core
(#3878)web3-eth2-core
and web3-eth2-beaconchain
packages (#3892)web3.utils.soliditySha3
(#3908).nvmrc
file using Node.js version v.14.15.1
(#3817)1.3.0
and onwards (#3961)web3-eth2-core
and web3-eth2-beaconchain
(#3892)tsc
script in all packages to compile
; updates the corresponding lerna run
usage in the main package.json
(#3894)@chainsafe/geth-dev-assistant
from 0.1.5
to 0.1.9
(#3950)elliptic
from 6.5.3
to 6.5.4
for web3-eth-accounts
(#3941)elliptic
from 6.5.3
to 6.5.4
for web3-bzz
(#3940)elliptic
from 6.5.3
to 6.5.4
for web3-core-requestmanager
(#3945)web3-eth-iban
in ES6 (#3955)underscore
package from 1.9.1
to 1.12.1
(#4051)@ensdomains/ens
package from ^0.4.5
to ^0.6.0
(#4059)ethers
package from ^5.0.18
to ^5.1.4
(#4059)stable
to 1.10.3
in e2e.geth.instamine.sh
and scripts/e2e.geth.automine.sh
(#4154)eth_feehistory
call (#4191)toNumber
method to web3.utils
(#4191)maxPriorityFeePerGas
and maxFeePerGas
now included in _txInputFormatter
(#4217)maxPriorityFeePerGas
of maxFeePerGas
present _txInputFormatter
deletes tx.gasPrice
(fixes #4211) (#4217)latest
, pending
, earliest
) to getFeeHistory
(#4224)web3.eth.sendTransaction
(#4220)type
defaulting for eth.sendTransaction
, eth.sendRawTransaction
(#4241)type: 0x0
was being added to legacy transaction when using eth.signTransaction
(#4241)maxPriorityFeePerGas
from 1 Gwei
to 2.5 Gwei
(#4284)eth_createAccessList
as both an rpc call (web3.eth.createAccessList
) and property of contract method wrappers (contractInstance.methods.getValue().createAccessList
) (#4332)tx.chainId
if tx.common.customChain.chainId
is provided for web3.eth.accounts.signTransaction
function (#4293)Web3.utils
, removed context for _
(underscore lib) (#4403)block.baseFeePerGas
to number (#4330)web3-eth-personal.sendTransaction
example in documentation (#4409)web3.rst
example in documentation (#4511)BlockHeader
typing (receiptRoot
-> receiptsRoot
) (#4452)maxPriorityFeePerGas
and maxFeePerGas
added to Transaction
and TransactionConfig
interfaces (#4232) (#4585)number
to hex
according to the spec (#4529)transactionPollingInterval
added to web3, contract and method constructor options. defaults to 1 second. (#4584)methods.myMethod.send
(#4599)web3.eth.accounts.signTransaction
(#4576)methods.myMethod.estimateGas
(#4702)npm audit fix
to address vulnerabilities and update libraries (#4719) (#4728)close
event listener (#4825) (#4839)npm audit fix
to update libraries (#4860)provider.disconnect
function (#4833)f.call = this.call
when intrinsic is frozen (#4918) (#4938)web3.eth.Contract.setProvider()
as per public documentation (#4822) (#5001)npm audit fix
to address vulnerabilities and update libraries (#5014)maxFeePerGas
and maxPriorityFeePerGas
(#5121)createAccessList
types in web3.eth (#5146)AbstractProvider
interface (#5150)got
lib version and fixed other libs using npm audit fix (#5178) (#5254)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.
web3-errors
new package is created, it has Web3 Error codes and classesweb3-types
new package is created, it provides the common data structures and interfaces for web3 modulesweb3-validator
new package is created, it has JSON-Schema compatible validator functionality for Web3errors
are moved to web3-errors
package and formatters are moved in web3-core
packageweb3-core-method
functionality is moved to web3-eth
packageweb3-core
packageweb3-core
packageweb3-core
packageextend
is deprecatedoutputBigNumberFormatter
in web3-core-helper
renamed to outputBigIntFormatter
under web3-core
this.defaultBlock
context from inputDefaultBlockNumberFormatter
in web3-core-helper
and converted to additional parameterthis.defaultBlock
context from inputTransactionFormatter
in web3-core-helper
and converted to additional parametersoliditySha3
soliditySha3Raw
encodePacked
now includes type validation and requires type specification, instead of guessing the value typesoliditySha3
, soliditySha3Raw
and encodePacked
did not support BN; But, now supports BigInt
flattenTypes
and jsonInterfaceMethodToString
moved to the web3-eth-abi
packageisAddress
now includes an optional parameter checkChecksum
type booleanisBoolean
now accept 1
, and 0
as valid values to test. Ref: web3-validator
create
function does not take in the optional parameter entropy
Wallet.create
function doesn't accept entropy
paramisBoolean
now accept 1
, and 0
as valid values to test.signTransaction
will not fill any default values, and it will only sign and return result. For filling default values, use web3-eth
packagerecover
function's last param is boolean hashed
, it is used to indicate if data provided is already hashed or not. By default, this function will assume data is not hashed.Wallet
no longer supports address/number indexing. Have to use wallet.get
instead.Wallet.create
function doesn't accept entropy
paramcontract.method.send()
will resolve to transaction receipt instead of transactionHash
. User can use receipt.transactionHash
instead.isDirect
, isValid
, isIndirect
are now also included as static methods.setMultihash
is not supported in web3-eth-ens 4.x as it's deprecated in ENS public resolver (https://github.com/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://github.com/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.internalType
was renamed to baseType
in all abi typesgivenProvider
default value is undefineddefaultHardfork
default value is 'london'defaultAccount
default value is undefineddefaultNetworkId
default value is undefinedtransactionSendTimeout
, throw an Error.clearSubscriptions
Instead of returning true
, clearSubscriptions
now returns array of subscription's idsgivenProvider
default value is undefinedcurrentProvider
default value is undefinedexecution reverted
, raise ContractExecutionError
and pass the response error to it in order to be set as innerError
(this innerError will be decoded at web3-eth-contract if its ABI was provided according to EIP-838). (#5434)enableExperimentalFeatures
. (#5481)registerPlugin
method to Web3Context
(#5393)Web3PluginBase
exported abstract class (#5393)Web3EthPluginBase
exported abstract class (#5393)innerError
property to the abstract class Web3Error
. This innerError
could be Error
, Error[]
or undefined
. (#5435) (#5434)Web3ContractError
is moved to this package from web3-eth-contract
. (#5434)ERR_TX_SIGNING
and used it inside TransactionSigningError
(#5462)ERR_TX_GAS_MISMATCH
and used it inside TransactionGasMismatchError
(#5462)SignatureError
to web3-errors/src/errors/signature_errors.ts
(moved from web3-eth/src/errors.ts
) (#5462)web3-errors/src/errors/transaction_errors.ts
from web3-eth/src/errors.ts
(#5462)TransactionBlockTimeoutError
class and its error code ERR_TX_BLOCK_TIMEOUT
(#5294)ExistingPluginNamespaceError
class and it's error code ERR_EXISTING_PLUGIN_NAMESPACE
(#5393)web3-rpc-methods
dependency (#5441)validateTransactionForSigning
innerError
inside the error class AbiError
. (#5435)web3-eth-contract
, when decoding error data according to EIP-838. (#5434)Web3ContractError
is moved from this package to web3-error
. (#5434)requestManager
(#5393)pollTillDefined
, rejectIfTimeout
and rejectIfConditionAtInterval
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-rpc-methods
dependency (#5441)web3-rpc-methods
dependency (#5441)Web3EthExecutionAPI
export (#5441)Web3NetAPI
export (#5441)EthPersonalAPI
export (#5441)API
generic for Web3ContextObject
from any
to unknown
(#5393)API
generic for Web3ContextInitOptions
from any
to unknown
(#5393)defaultHardfork
and defaultCommon.hardfork
are different in web3configdefaultChain
and defaultCommon.basechain
are different in web3configenableExperimentalFeatures
. (#5481)SignerError
from web3-errors/src/errors/signature_errors.ts
to web3-errors/src/errors/transaction_errors.ts
, and renamed it to TransactionSigningError
(#5462)JSONRPC_ERR_UNAUTHORIZED
to be 4100
(#5462)Web3EthExecutionAPI
is now imported via web3-types
instead of web3_eth_execution_api.ts
(#5441)rpc_methods.ts
with ethRpcMethods
imports from web3-rpc-methods
(#5441)Web3NetAPI
is now imported from web3-types
instead of web3-net
(#5441)rpc_methods
tests to web3-rpc-methods
(#5441)transactionBlockTimeout
(#5294)rejectIfBlockTimeout
when the provider supports subscription. Implement this as an experimental feature (if useSubscriptionWhenCheckingBlockTimeout
at enableExperimentalFeatures
is true
). (#5481)signTransaction
and privateKeyToAccount
will throw TransactionSigningError
instead of SignerError
now (#5462)Web3NetAPI
is now imported from web3-types
instead of web3-net
(#5441)EthPersonalAPI
from web3-types
instead of local import (#5441)rcp_methods.ts
with personalRpcMethods
imports from web3-rpc-methods
(#5441)EthPersonalAPIManager
with Web3RequestManager<EthPersonalAPI>
(#5441)Web3NetAPI
is now imported from web3-types
instead of web3_net_api.ts
(#5441)rpc_methods.ts
with netRpcMethods
imports from web3-rpc-methods
(#5441)Web3APISpec
, Web3APIMethod
, and Web3APIParams
now supports unknown
APIs (#5393)JSONRPC_ERR_UNAUTHORIZED
to be 4100
(#5462)getBlock
returning empty transactions object on hydrated
true (#5556)web3-eth-abi
, the decoded values of the large numbers, returned from function calls or events, are now available as BigInt
. (#5435)BigInt
instead of string
when decoding function parameters for large numbers, such as uint256
. (#5435)Web3APISpec
, Web3APIMethod
, and Web3APIParams
now supports unknown
APIs (#5393)web3-eth/src/errors.ts
to web3-errors/src/errors/transaction_errors.ts
(#5462)EthPersonalAPIManager
, EthPersonalAPI
is not exported via web3-types
(#5441)rpcMethods
export, these methods are now exported via web3-rpc-methods
as netRpcMethods
(#5441)Web3NetAPI
export, now exported via web3-types
as Web3NetAPI
(#5441)toJSON()
in Web3ValidatorError
class as its available via base class (#5435)web3-eth-accounts
to web3-types
package: Cipher, CipherOptions, ScryptParams, PBKDF2SHA256Params, KeyStore (#5581 )uuidV4
that generates a random v4 Uuid (#5373).id
(#5652).isPromise
that checks if an object is a promise (#5652).SpecialOutput
type was added as a generic type into the call function to support reassigning output types (#5631)ContractOverloadedMethodInputs
, ContractOverloadedMethodOutputs
) was added (#5631)fromBlock
when passed to contract.events.someEventName
(#5201)ContractOptions
-> jsonInterface
setter and getter (#5474)Contract
constructor where provider
wasn't being set when provided within the optionsOrContextOrReturnFormat
argument (#5669)request
method of EIP1193Provider
class, compatible with EIP 1193 (#5591)isHex
returning false
for -123
, fix isHexStrict
returning true
for -0x
, and fix isHex
returning true
for empty strings `` (#5373).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)web3-eth-accounts
to web3-types
package: Cipher, CipherOptions, ScryptParams, PBKDF2SHA256Params, KeyStore (#5581 )web3-validator
package within browser environments (webpack minified filename changed from index.min.js
to web3-validator.min.js
) (#5710)tsc
compiled files moved to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)main
and files
entries in package.json
changed to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)main
and files
entries in package.json
changed to lib/
directory from dist/
(#5739)main
and files
entries in package.json
changed to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)main
and files
entries in package.json
changed to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)main
and files
entries in package.json
changed to lib/
directory from dist/
(#5739)main
and files
entries in package.json
changed to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)tsc
compiled files moved to lib/
directory from dist/
(#5739)build
entry from package.json
(#5755)build
entry from package.json
(#5755)to
field (#5731)TransactionWithFromLocalWalletIndex
, TransactionWithToLocalWalletIndex
and TransactionWithFromAndToLocalWalletIndex
types (#5731)registeredSubscriptions
was added by default in web3 constructor (#5792)web3-types
, web3-errors
and web3
. (#5771)new Web3().eth.contract
(#5824)useRpcCallSpecification
at enableExperimentalFeatures
is true
) (#5525)safe
and finalized
block tags (#5823)InvalidMethodParamsError
and error code ERR_INVALID_METHOD_PARAMS = 207
(#5824)request
property to ResponseError
(#5854)data
property to TransactionRevertInstructionError
(#5854)TransactionRevertWithCustomError
was added to handle custom solidity errors (#5854)createAccessList
functionality ( #5780 )safe
and finalized
block tags (#5823)contractAbi
option to SendTransactionOptions
and SendSignedTransactionOptions
to added the ability to parse custom solidity errors (#5854)decodeErrorData
from web3-eth-contract
is now exported from this package and was renamed to decodeContractErrorData
(#5844)createAccessList
for contracts ( #5780 )Contract
will subscribeToContextEvents
upon instantiation if syncWithContext
is set to true
and the constructor is passed an instance of Web3Context
(#5833)safe
and finalized
block tags (#5823)HttpProvider
(#5771)IpcProvider
(#5771)_socketOptions
from IpcProvider
constructor to the underlying Socket
(#5891)SocketConnection
in IpcProvider
(inherited from SocketProvider
) returns net.Socket
(#5891)WebSocketProvider
(#5771)SocketConnection
in WebSocketProvider
(inherited from SocketProvider
) returns isomorphic WebSocket
(#5891)createAccessList
functionality ( #5780 )safe
and finalized
block tags (#5823)web3-eth-abi
and TypedArray
from (#5771)TypedArray
from web3-utils
and web3-validator
(it was defined twice) (#5771)safe
and finalized
block tags in BlockTags
and BlockTag
types (#5823)safe
and finalized
block tags (#5823)safe
and finalized
block tags in isBlockTag
method (#5823)require('web3')
will now return all web3 exported-objects organized in namespaces . (#5771)Web3Error
is renamed to BaseWeb3Error
(#5771)MaxAttemptsReachedOnReconnectingError
with the same message for 1.x but also adding the maxAttempts
(#5894)sendTransaction
and sendSignedTransaction
now errors with (and error
event emits) the following possible errors: TransactionRevertedWithoutReasonError
, TransactionRevertInstructionError
, TransactionRevertWithCustomError
, InvalidResponseError
, or ContractExecutionError
(#5854)compareBlockNumbers
function now only supports comparison of both blocktags params ( except earliest
vs number) or both block number params (#5842)SocketProvider
abstract class now resolves JSON RPC response errors instead of rejecting them (#5844)SocketConnection
in SocketProvider
(#5891)_contracts:Contract[]
and static setProvider
function was removed (#5792)getRevertReason
is no longer exported (#5844)web3-types
(#5771)decodeErrorData
is no longer exported (method was moved to web3-eth-abi
and renamed decodeContractErrorData
) (#5844)TypedArray
to web3-types
(was also duplicated at web3-validator
) (#5771)genesis
tag in compareBlockNumbers
function (#5823)TypedArray
to web3-types
(was also duplicated at web3-utils
) (#5771)net
and fs
modules (#5978)web3-providers-ipc
and instantiate provider yourself (#5978)data
property is passed to txInputOptionsFormatter
, it will now be replaced with input
(#5915)TransactionTypeParser
and TransactionBuilder
are now utilizing the type Transaction
for the transaction object. (#5993)net
and fs
modules (#5978)web3-providers-ipc
and instantiate provider yourself (#5978)gasLimit
is no longer accepted as a parameter for MissingGasError
and `TransactionGasMismatchError, and is also no longer included in error message (#5915)signTransaction
will now return gas
instead of gasLimit
for returned transaction object regardless of what property name the provider uses (#5915)formatTransaction
will now replace data
transaction property with input
(#5915)isTransactionCall
will now check if value.input
isHexStrict
if provided (#5915)defaultTransactionBuilder
and transactionBuilder
are now utilizing the type Transaction
for the transaction object. (#5993)signTransaction
returned by privateKeyToAccount
is now accepting the type Transaction
for its argument. (#5993)getSendTxParams
will now return input
instead of data
in returned transaction parameters object (#5915)Contract
constructor will now thrown new ContractTransactionDataAndInputError
if both data
and input
are passed in ContractInitOptions
for Contract
constructor (#5915)ContractInitOptions
, NonPayableCallOptions
and PayableCallOptions
are moved to web3-types
. (#5993)data
property in TransactionOutput
was renamed to input
(#5915)signTransaction
inside Web3BaseWalletAccount
is now utilizing the type Transaction
for its argument. (#5993)FMT_NUMBER
, NumberTypes
, FMT_BYTES
, ByteTypes
, DataFormat
, DEFAULT_RETURN_FORMAT
, ETH_DATA_FORMAT
and FormatType
moved from web3-utils
. (#5993)ContractInitOptions
, NonPayableCallOptions
and PayableCallOptions
are moved from web3-eth-contract
. (#5993)FMT_NUMBER
, NumberTypes
, FMT_BYTES
, ByteTypes
, DataFormat
, DEFAULT_RETURN_FORMAT
, ETH_DATA_FORMAT
and FormatType
moved to web3-types
. (#5993)input
is now an acceptable property for ContractInitOptions
in place of data
(either can be used, but input
is used withing the Contract
class) (#5915)isHexString
, isHexPrefixed
, validateNoLeadingZeroes
(#5963)getConfig
method from Web3Config
class, config
is now public and accessible using Web3Config.config
(#5950)formatDecodedObject
function (#5934)data
was removed as a property of ContractOptions
type (#5915)checkNetwork
in ENS (#5988)InvalidPropertiesForTransactionTypeError
with error code 429
(#6102)getPastEvents
method to filter allEvents
and specific event (#6010)maxPriorityFeePerGas
and maxFeePerGas
in ContractOptions
type and updated function using it in utils (#6118)filters
param to the Filter
type (#6010)JsonRpcSubscriptionResultOld
, Web3ProviderMessageEventCallback
. Added .on('data')
type support for old providers (#6082)HardforksOrdered
enum (#6102)Web3ValidationErrorObject
type (#6102)hexstrict
parameter added to numberToHex (#6004)ignoreGasPricing
bug with wallet in context (#6071)Eip838ExecutionError
constructor and the nested error is set at innerError
(#6045)formatTransaction
no longer throws a TransactionDataAndInputError
if it's passed a transaction object with both data
and input
properties set (as long as they are the same value) (#6064)rpc_method_wrappers
to point to the previously duplicated documentation found under the Web3Eth
class documentation (#6054)defaultTransactionTypeParser
to return correct EIP-2718 types, prior implementation was prioritizing transaction.hardfork
and ignoring the use of transaction.gasLimit
. defaultTransactionTypeParser
will now throw InvalidPropertiesForTransactionTypeError
s for properties are used that are incompatible with transaction.type
(#6102)prepareTransactionForSigning
and defaultTransactionBuilder
now accepts optional fillGasPrice
flag and by default will not fill gas(#6071)Buffer
for Uint8Array
(#6004)recover
, encrypt
, privateKeyToAddress
does not support type Buffer
but supports type Uint8Array
(#6004)parseAndValidatePrivateKey
returns a type Uint8Array
instead of type Buffer
(#6004)FMT_BYTES.BUFFER
, Bytes
and FormatType
and encryption option types for salt
and iv
has replaced support for Buffer
for Uint8Array
(#6004)internalType
property to the AbiParameter
type.hexToBytes
, randomBytes
does not return type Buffer
but type Uint8Array
(#6004)sha3
and keccak256Wrapper
does not accept type Buffer
but type Uint8Array
(#6004)bytesToBuffer
has been removed for the usage of bytesToUint8Array
(#6004)Web3ValidationErrorObject
type is now exported from web3-types
package (#6102)Release Notes:
Web3.js 4.0.1 is written in TypeScript and has many exciting features such as: Easy extensibility ( with web3 Plugins feature ) 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 Plugin Developers Plugin Users
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.
r
and s
returned by signTransaction
to does not always consist of 64 characters #6207" (#6216)Web3Context
, Web3PluginBase
, Web3EthPluginBase
from 'web3-core'
, and Web3Validator
from 'web3-validator'
(#6165)SimpleProvider
interface which has only request(args)
method that is compatible with EIP-1193 (#6210)Eip1193EventName
type that contains the possible events names according to EIP-1193 (#6210)EIP1193Provider
class has now all the events (for on
and removeListener
) according to EIP-1193 (#6210)getPastLogs
accept blockHash as a parameter https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs (#6181)Filter
includes blockHash
(#6206)numberToHex
(#6206)RpcErrorMessages
that contains mapping for standard RPC Errors and their messages. (#6230)TransactionGasMismatchInnerError
for clarity on the error in TransactionGasMismatchError
(#6215)MissingGasInnerError
for clarity on the error in MissingGasError
(#6215)rpc_method_wrapper
(signTypedData
) for the rpc calls eth_signTypedData
and eth_signTypedData_v4
(#6286)signTypedData
method to the Web3Eth
class (#6286)getEncodedEip712Data
method that takes an EIP-712 typed data object and returns the encoded data with the option to also keccak256 hash it (#6286)signTypedData
method to eth_rpc_methods
for the rpc calls eth_signTypedData
and eth_signTypedData_v4
(#6286)eth_signTypedData
and eth_signTypedData_v4
to web3_eth_execution_api
(#6286)Eip712TypeDetails
and Eip712TypedData
to eth_types
(#6286)json-schema
as a main json schema type (#6264)estimateGas
unless transaction builder options.fillGas
is false. (#6249)blockHeaderSchema
properties causing some properties to not appear in response of newHeads
subscription (#6243)blockHeaderSchema
properties causing some properties to not appear in response of newHeads
subscription (#6243)CommonSubscriptionEvents &
at every child class of Web3Subscription
(#6262)_processSubscriptionResult
and _processSubscriptionError
has been written in the base class Web3Subscription
and maid public
. (#6262)formatSubscriptionResult
could be used to customize data formatting instead of re-implementing _processSubscriptionResult
. (#6262)CommonSubscriptionEvents &
for the first generic parameter of Web3Subscription
when inheriting from it. (#6262)MissingGasError
error message changed for clarity (#6215)input
and data
are no longer auto populated for transaction objects if they are not present. Instead, whichever property is provided by the user is formatted and sent to the RPC provider. Transaction objects returned from RPC responses are still formatted to contain both input
and data
properties (#6294)input
and data
are now optional properties on PopulatedUnsignedBaseTransaction
(previously input
was a required property, and data
was not available) (#6294)is-my-json-valid
with zod
dependency. Related code was changed (#6264)ValidationError
and JsonSchema
were changed (#6264)blockHeaderSchema
properties causing some properties to not appear in response of newHeads
subscription (#6243)RawValidationError
was removed (#6264)RawValidationError
was removed (#6264)formatSubscriptionResult
in class NewHeadsSubscription
(#6368)send
method on request manager (#6300).contract.events.allEvents
r
and s
returned by sign
to does not always consist of 64 characters" (#6411)soliditySha3()
with BigInt supportWeb3Config
property contractDataInputFill
allowing users to have the choice using property data
, input
or both
for contract methods to be sent to the RPC provider when creating contracts. (#6377) (#6400)Web3Config
property contractDataInputFill
allowing users to have the choice using property data
, input
or both
for contract methods to be sent to the RPC provider when creating contracts. (#6377) (#6400)ALL_EVENTS
and ALL_EVENTS_ABI
constants, SendTransactionEventsBase
type, decodeEventABI
method (#6410)dataInputFill
as a ContractInitOption, allowing users to have the choice using property data
, input
or both
for contract methods to be sent to the RPC provider. (#6355)Web3Config
property contractDataInputFill
allowing users to have the choice using property data
, input
or both
for contract methods to be sent to the RPC provider when creating contracts. (#6377)asEIP1193Provider
to Web3BaseProvider
so every inherited class can have the returned value of request
method, fully compatible with EIP-1193. (#6407)ALL_EVENTS
and ALL_EVENTS_ABI
constants, SendTransactionEventsBase
type, decodeEventABI
method (#6410)privateKeyToPublicKey
BaseTransaction
from the package (#6493)txUtils
from the package (#6493)EventLog
was added. (#6410)EventEmitter
has been implemented and exported. (#6398)checkRevertBeforeSending
in sendSignedTransaction
defaultTransactionBuilder
for value issue (#6509)recover
function, v
will be normalized to value 0,1 (#6344)convertToZod
method (#6434)EventEmitter
from web3-utils
that works in node envrioment as well as in the browser. (#6398)events
property was added to the receipt
object (#6410)ERR_UNSUPPORTED_DIR_IMPORT
in ABI (#6535)isMetaMaskProvider
function to check if provider is metamask (#6534)MetaMaskProvider
added and is part of SupportedProviders
(#6534)gasPrice
was added to Transaction1559UnsignedAPI
type. (#6539)transactionTimeoutHint
(#6559)data
for transactions in contract for metamask provider instead of input
(#6534)contractDataInputFill
has been defaulted to data
, instead of input
. (#6622)data
instead of input
within method calls (#6622)SocketProvider
now contains public function getPendingRequestQueueSize
, getSentRequestsQueueSize
and clearQueues
(#6479)safeDisconnect
as a SocketProvider
method to disconnect only when request queue size and send request queue size is 0 (#6479)isContractInitOptions
method (#6555)TransactionPollingTimeoutError
was added to send transaction events (#6623)AbiError
instead of Error
for errors at web3-eth-abi (#6641).deploy
function to accept parameters, even when no ABI was provided to the Contract
(#6635)common
did not have a copy()
and the chainId
was not provided (#6663)contract.getPastEvents
or contract.events.allEvents()
, if there is no matching events. (#6647)AbiItem
from 1.x to v4 for compatabiltiy (#6678)AbiItem
from 1.x to v4 for compatabiltiy (#6678)requestEIP6963Providers
for multi provider discoveryeth.getMaxPriorityFeePerGas
method (#6748)setAddress
in ENS and Resolver classes (#5956)getMaxPriorityFeePerGas
method (#6748)FeeData
to be filled by await web3.eth.calculateFeeData()
to be used with EIP-1559 transactions (#6795)ContractDeploySend
, ContractMethodSend
, Web3PromiEvent
was exported (#6883)toNumber(...)
function (#6880)getBlock
now includes properties of eip 4844, 4895, 4788 when returning block (#6933)withdrawalsSchema
, blockSchema
and blockHeaderSchema
schemas to include properties of eip 4844, 4895, 4788 (#6933)signature
to type AbiFunctionFragment
(#6922)Withdrawals
, block
and BlockHeaderOutput
to include properties of eip 4844, 4895, 4788 (#6933)Web3EthInterface.accounts
to includes privateKeyToAccount
,privateKeyToAddress
,and privateKeyToPublicKey
(#6762)defaultReturnFormat
was added to the configuration options. (#6947)InvalidIntegerError
error for fromWei and toWei (#7052)defaultReturnFormat
was added to all methods that have ReturnType
param. (#6947)getTransactionFromOrToAttr
, waitForTransactionReceipt
, trySendTransaction
, SendTxHelper
was exported (#7000)defaultReturnFormat
was added to all methods that have ReturnType
param. (#6947)defaultReturnFormat
was added to all methods that have ReturnType
param. (#6947)defaultReturnFormat
was added to all methods that have ReturnType
param. (#6947)signature
to type AbiFunctionFragment
(#6922)Withdrawals
, block
and BlockHeaderOutput
to include properties of eip 4844, 4895, 4788 (#6933)toWei
add warning when using large numbers or large decimals that may cause precision loss (#6908)toWei
and fromWei
now supports integers as a unit. (#7053)checkRevertBeforeSending
if there is no data set in transaction, set gas to be 21000
(#7043)toWei
support numbers in scientific notation (#6908)toWei
and fromWei
trims according to ether unit successfuly (#7044)abi.name
is not available, for example, in the case of public mappings. (#6981)browser
entry point that was pointing to a non-existing bundle file was removed from package.json
(#7015)RequestManagerMiddleware
was changed (#7003)customTransactionReceiptSchema
into methods emitConfirmation
, waitForTransactionReceipt
, watchTransactionByPolling
, watchTransactionBySubscription
, watchTransactionForConfirmations
(#7000)baseFeePerGas===0x0
fill maxPriorityFeePerGas
and maxFeePerGas
by getGasPrice
method (#7050)estimateGas
method to add possibility pass Transaction type (#7000)sendTransaction
in rpc_method_wrappers
accepts optional param of TransactionMiddleware
(#7088)setTransactionMiddleware
and getTransactionMiddleware
for automatically passing to sentTransaction
(#7088)getText
now supports first param AddressgetName
has optional second param checkInterfaceSupportresult
as optional never
and error
as optional never in type
JsonRpcNotification` (#7091)JsonRpcNotfication
as a union type in JsonRpcResponse
(#7091)getName
reverse resolutionweb3.eth.Contract
will get transaction middleware and use it, if web3.eth
has transaction middleware. (#7138)populateTransaction
was added to contract methods (#7124)setTransactionMiddleware
and getTransactionMiddleware
for automatically passing to sentTransaction
for deploy
and send
functions (#7138)_sendPendingRequests
will catch unhandled errors from _sendToSocket
(#6968)Promise<ResultType>
to Promise<JsonRpcResponseWithResult<ResultType>>
(#7102)populateTransaction
was added to contract methods (#7124)setTransactionMiddleware
and getTransactionMiddleware
for automatically passing to sentTransaction
for deploy
and send
functions (#7138)web3.eth.Contract
will get transaction middleware and use it, if web3.eth
has transaction middleware. (#7138)Eip838ExecutionError
constructor (#6905)getTransactionReceipt
to not be casted as TransactionReceipt
to give proper return type (#7159)setConfig()
fix for setMaxListenerWarningThreshold
fix (#5079)TransactionFactory.registerTransactionType
not working, if there is a version mistatch between web3-eth
and web3-eth-accounts
by saving extraTxTypes
at globals
. (#7197)signMessageWithPrivateKey
(#7174)populateTransaction
to the contract.deploy(...)
properties. (#7197)statusCode
of response in ResponseError, statusCode
is optional property in ResponseError.HttpProviderOptions | SocketOptions
in Web3ExternalProvider
and QuickNodeProvider
for provider configsstatusCode
property of response in ResponseError.contract.deploy(...)
are structured with a newly created class named DeployerMethodClass
. (#7197)abi
parameter, at dataInputEncodeMethodHelper
and getSendTxParams
. (#7197)TransactionFactory.registerTransactionType
if there is a version mistatch between web3-eth
and web3-eth-accounts
and fix nextjs problem. (#7216)customTransactionSchema
) to Web3ConfigOptions
(#7227){transactionSchema?: ValidationSchemaInput}
that exists in formatTransaction
to validateTransactionForSigning
web3Context.config.customTransactionSchema
to formatTransaction
web3Context.config.customTransactionSchema
to formatTransaction
Web3.providers
namespace exports type EIP6963ProviderResponse = Map<string, EIP6963ProviderDetail>
. Return type for the static Web3.requestEIP6963Providers
function is now Promise<EIP6963ProviderResponse>
. (#7239)Web3.onNewProviderDiscovered
function expects a parameter of type EIP6963ProvidersMapUpdateEvent
as opposed to EIP6963AnnounceProviderEvent
. (#7242)ignoreGasPricing
to Web3ConfigOptions
. If ignoreGasPricing
is true, gasPrice will not be estimated (#7320)syncing
subscription now supports Besu and Nethermind payload formatpopulateGasPrice
function now checks Web3Context.config.ignoreGasPricing
. If ignoreGasPricing
is true, gasPrice will not be estimated (#7320)providers
namespace. (#7270)getEthereumjsTxDataFrom
to return additional fields that may be passed if using a customTransactionSchema
.baseFeePerGas
at web3.eth.getFeeHistory
to be a number. (#7291)decodeLog
, decodeParametersWith
, decodeParameters
and decodeParameters
now accepts first immutable param as well (#7288)padRight
validation failure on large uint
(#7265)createNewPendingTransactionFilter
, createNewFilter
, createNewBlockFilter
, uninstallFilter
, getFilterChanges
and getFilterLogs
are exported from Web3Eth
and filtering_rpc_method_wrappers
(#7353)decodeFunctionCall
and decodeFunctionReturn
. (#7345)hashMessage
now has a new optional param skipPrefix
with a default value of false
. A new function signRaw
was added to sign a message without prefix. (#7346)FilterParams
type added (#7353)fromWei
return "0" when input is 0
(#7387)