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.
The receiptInfo Status will now be be an unsigned integer instead of boolean value to comply with the specification.
1.x
myContract.methods
.MyMethod()
.send()
.on('receipt', receipt => {
console.log(receipt.status); // true | false
});4.x
myContract.methods
.MyMethod()
.send()
.on('receipt', receipt => {
console.log(receipt.status); // BigInt(0) | BigInt(1)
});NOTE: The unsigned integer type is dependent on the data format you specified. Default type is bigint.
In 1.x when following was executed deploy().send().on(‘sending’, payload => {}). The payload was the complete the JSON-RPC Payload. In 4.x it will just be the transaction which is about to be transmitted. Earlier it was accessible by from payload.params[0], now will be available directly to event handler.
1.x
myContract
.deploy()
.send()
.on('send', payload => {
console.log(payload);
// {id: <1>, jsonrpc: '2.0', method: 'eth_sendTransaction', params: [txObject] }
});4.x
myContract
.deploy()
.send()
.on('send', txObject => {
console.log(txObject);
// {id: <>, gas: <>,...}
});In 1.x, the confirmations handler was invoked with multiple parameters. But in 4.x there will be one parameter as object but with all the same properties.
1.x
myContract .send().on(‘confirmation’, (confirmations: number, receipt: object, latestBlockHash: string) => {})`4.x
myContract .send().on(‘confirmation’, ({confirmations: bigint, receipt: object, latestBlockHash: string}) => {})`encodeABI now have strict validation for the ABI types. It's not limited to mentioned use cases below , but applied in general. Some use cases are:
- Earlier a
byte32ABI type was successfully encoded even providing less bytes as input. Now it will throw error. - Earlier a
byte32ABI type was successfully encoded even with an empty bytes. Now it will throw error.
The error message will be different if you try to create a contract object without a new keyword.
1.x
Please use the "new" keyword to instantiate a web3.eth.Contract() object!4.x
Class constructor ContractBuilder cannot be invoked without 'new'In 1.x if you pass the toBlock as event options you would get a warning message.
Invalid option: toBlock. Use getPastEvents for specific range.
In 4.x you will not get any warning. But toBlock still have no effect.
In 1.x the contract .send method was always resolved with transactionHash. That enforces user to make an extra call to get any further information. In 4.x the .send function will resolve with receipt object.
1.x
const transactionHash = await myContract.method.MyMethod().send();4.x
const receipt = await myContract.method.MyMethod().send();
const transactionHash = receipt.transactionHash;- Decoding error data, using Error ABI if available, according to EIP-838. (#5434)
- The class
Web3ContractErroris moved from this package toweb3-error. (#5434)
- 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)
- Decoding error data, using Error ABI if available, if error was returned from a smart contract function call (#5662).
SpecialOutputtype was added as a generic type into the call function to support reassigning output types (#5631)- Overloaded functions types (
ContractOverloadedMethodInputs,ContractOverloadedMethodOutputs) was added (#5631)
- Emit past contract events based on
fromBlockwhen passed tocontract.events.someEventName(#5201) - Use different types for
ContractOptions->jsonInterfacesetter and getter (#5474) - An issue within the
Contractconstructor whereproviderwasn't being set when provided within theoptionsOrContextOrReturnFormatargument (#5669)
- Updated dependencies (#5725)
tsccompiled files moved tolib/directory fromdist/(#5739)
- web3.js dependencies (#5757)