aptos-labs / aptos-ts-sdk

An SDK for accessing the Aptos blockchain data, submitting transactions, and more!
https://aptos-labs.github.io/aptos-ts-sdk/
Apache License 2.0
77 stars 46 forks source link

Transaction Worker not async #408

Open 0xmaayan opened 5 months ago

0xmaayan commented 5 months ago

🐛 Bug Description

When running a batch transaction using the Transaction Worker the events are fired only when the worker has finished its execution instead of while it is executing.

How to reproduce

This event only fires when the worker has finished its execution.

Code snippet to reproduce

aptos.transaction.batch.on(TransactionWorkerEventsEnum.TransactionSent, async (data) => {
    console.log("message:", data.message);
    console.log("transaction hash:", data.transactionHash);
  });

Also, see https://github.com/primus/eventemitter3/issues/239

Expected Behavior

Event should fire while the worker is executing async and not wait for the worker to finish

System information

System details: