How to track transaction status on elrond network

Viewed 288

Can someone help with tracking the transaction status of a value transfer on the elrond network?

   const testTransaction = new Transaction({
      value: Balance.egld(1),
      data: new TransactionPayload('Test Transfer'),
      receiver: new Address(ownerWallet),
      nonce: sender.nonce,
      gasPrice: new GasPrice(10000000000,
      gasLimit: new GasLimit(1000000)
    });

    await refreshAccount();

    const { sessionId  } = await sendTransactions({
      transactions: testTransaction,
      transactionsDisplayInfo: {
        processingMessage: 'Processing transaction',
        errorMessage: 'An error has occured during Transaction',
        successMessage: 'Transaction successful'
      }
    });

I am currently using sendTransactions to send my transaction.

1 Answers

According to the documentation of the erdjs documentation, you can use the TransactionWatcher.

Here's below a reduced example from the documentation:

await tx1.send(provider);

let watcher = new TransactionWatcher(tx1.hash, provider);
await watcher.awaitStatus(status => status.isExecuted());

The erdjs doc: https://elrondnetwork.github.io/elrond-sdk-docs/erdjs/latest/

Related