Ethers/6/Transactions

/icons/calendar.svg

Last update

Aug 28, 2024

The transaction helpers present in v5 were all wrapped into a Transaction class, which can handle any supported transaction format to be further processed.

Example

Before

tx = parseTransaction(txBytes);

After

tx = Transaction.from(txBytes);

There is new way to serialize the transaction object('tx') back into raw transaction bytes. The advantage here is that Transaction object itself manages whether the transaction is signed or not, and the serialized property will automatically include the signature if it is present in the Transaction object.

Whereas in v5 we have to we have to explicitly mentioned whether the transaction is signed or not.

This is for both the transformation below.

Before

txBytes = serializeTransaction(tx);

After

txBytes = Transaction.from(tx).serialized;

Before

txBytes = serializeTransaction(tx, sig);

After

txBytes = Transaction.from(tx).serialized;

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now