Skip to content

Conversation

pranavkonde
Copy link
Contributor

Transaction Monitoring & Alerts Feature

Overview

Implemented a comprehensive transaction and address monitoring system for the rsk-cli tool, allowing users to track transactions and address changes in real-time.

Features Added

Transaction Monitoring

  • Monitor specific transactions by hash with real-time status updates
  • Track transaction confirmations and finality
  • Automatic session termination when required confirmations are reached
  • Support for custom confirmation thresholds (default: 12)

Address Monitoring

  • Monitor address balance changes
  • Real-time balance updates with polling
  • Support for transaction history monitoring (placeholder for future implementation)

Session Management

  • Persistent monitoring sessions with JSON state storage
  • Session listing and management commands
  • Automatic session cleanup on errors
  • Unique session IDs for tracking

Error Handling & Validation

  • Comprehensive input validation for addresses and transaction hashes
  • Network error handling with graceful degradation
  • Rate limiting detection and handling
  • Automatic session termination on critical errors
  • User-friendly error messages with actionable feedback

CLI Commands

Monitor Transaction

rsk-cli monitor --tx <txhash> --confirmations 12

Monitor Address

rsk-cli monitor --address <address> --balance
rsk-cli monitor --address <address> --transactions

Session Management

rsk-cli monitor --list                    # List active sessions
rsk-cli monitor --stop <sessionId>        # Stop specific session

@chrisarevalo11
Copy link
Collaborator

Hi @pranavkonde!

Great to see so many contributions from you!

I haven’t fully reviewed the PR yet, but I’m sharing some feedback so you can start making adjustments in the meantime and we make the most of the time: regarding the monitor command with the --tx parameter, I suggest you instead update the tx command — which returns the status and additional info of a transaction — by adding a --monitor flag that keeps listening and eventually displays the confirmation or failure. That way, we can avoid using the --tx parameter in the monitor command.

Let me know if you need any help!

@pranavkonde
Copy link
Contributor Author

Hi @pranavkonde!

Great to see so many contributions from you!

I haven’t fully reviewed the PR yet, but I’m sharing some feedback so you can start making adjustments in the meantime and we make the most of the time: regarding the monitor command with the --tx parameter, I suggest you instead update the tx command — which returns the status and additional info of a transaction — by adding a --monitor flag that keeps listening and eventually displays the confirmation or failure. That way, we can avoid using the --tx parameter in the monitor command.

Let me know if you need any help!

Thank you for the feedback! I've moved the transaction monitoring functionality command. The changes are now pushed to the feature branch. Let me know if any adjustments are needed after your review.

@chrisarevalo11
Copy link
Collaborator

chrisarevalo11 commented Jul 21, 2025

Hi @pranavkonde

Please update the README.md taking into account this new feature.

And another thing is that when the monitoring is completed, the command does not end (event with ctrl + c)

image

Please give it a look at how can it be finished effectively

@pranavkonde
Copy link
Contributor Author

Hi @pranavkonde

Please update the README.md taking into account this new feature.

And another thing is that when the monitoring is completed, the command does not end (event with ctrl + c)

image Please give it a look at how can it be finished effectively

Hello @chrisarevalo11

Thank you for the feedback! I've moved the transaction monitoring to tx --monitor, updated the README, and fixed the process termination issue. The changes are now pushed to the feature branch. Let me know if any adjustments are needed!

@scguaquetam
Copy link
Collaborator

Hello @pranavkonde , kindly follow the next comments.

  1. We have done a big enhancement on the CLI modules in order to make them available to interact with external sources (MCP server integration) and now your PR presents conflicts with it, please go ahead and align your feature with this new requirement
  2. Your new monitor module needs to be also compatible and following the same structure as the other modules (e.g wallet, transfer, etc).

We'll definitely keep this in mind when it comes time to reward you.

@pranavkonde
Copy link
Contributor Author

Hello @pranavkonde , kindly follow the next comments.

  1. We have done a big enhancement on the CLI modules in order to make them available to interact with external sources (MCP server integration) and now your PR presents conflicts with it, please go ahead and align your feature with this new requirement
  2. Your new monitor module needs to be also compatible and following the same structure as the other modules (e.g wallet, transfer, etc).

We'll definitely keep this in mind when it comes time to reward you.

Hello @scguaquetam

I have made all the suggested changes, Kindly Review it, and let me know, Thanks

@scguaquetam
Copy link
Collaborator

@pranavkonde , I dont see you adjusted your PR to the new structure of our CLI, I can still see the function parameters are not grouped, also , take as reference https://github.com/rsksmart/rsk-cli/blob/main/src/commands/wallet.ts "wallet" module, where we have a logs and spinner specific handling, which I cannot see in your PR, please change it accordingly.

@pranavkonde
Copy link
Contributor Author

@pranavkonde , I dont see you adjusted your PR to the new structure of our CLI, I can still see the function parameters are not grouped, also , take as reference https://github.com/rsksmart/rsk-cli/blob/main/src/commands/wallet.ts "wallet" module, where we have a logs and spinner specific handling, which I cannot see in your PR, please change it accordingly.

I’ve updated the PR as per the suggested changes.

@scguaquetam
Copy link
Collaborator

Hello @pranavkonde I see it much better, thanks, just 2 things.

  1. Please check the problems that Code scanning / CodeQL is reporting in your PR.
  2. Please take a look on the spinner management we also do in our modules, follow for example the Balance module where we handle the spinners by using startSpinner(), stopSpinner(), and succeedSpinner().

Please let us know any question you have.

@pranavkonde
Copy link
Contributor Author

Hello @pranavkonde I see it much better, thanks, just 2 things.

  1. Please check the problems that Code scanning / CodeQL is reporting in your PR.
  2. Please take a look on the spinner management we also do in our modules, follow for example the Balance module where we handle the spinners by using startSpinner(), stopSpinner(), and succeedSpinner().

Please let us know any question you have.

Thank you for the feedback! I've addressed both points.

this.startPolling(sessionId);
await this.saveState();

console.log(chalk.green(`✅ Started monitoring transaction: ${txHash}`));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pranavkonde the use of console.logs on this class could affect external interactions, please configure here also, the same as you implemented log management on the monitor command, for avoiding console.log on external interactions

@scguaquetam
Copy link
Collaborator

I see CodeQL requests haven't been fixed yet , can you take a look? I tagged you on the comments.

  • Please check there is a conflict now on the Package.json (we did an update today).
  • I can still see console.logs on the MonitorManger.ts file, please take a look on the comment I put there, use the log management as you did on the monitor module.

@pranavkonde
Copy link
Contributor Author

I see CodeQL requests haven't been fixed yet , can you take a look? I tagged you on the comments.

  • Please check there is a conflict now on the Package.json (we did an update today).
  • I can still see console.logs on the MonitorManger.ts file, please take a look on the comment I put there, use the log management as you did on the monitor module.

I have addressed the CodeQL requests, updated the logging in MonitorManager.ts to align with the monitor module, and resolved the Package.json conflict. Please review at your convenience.

@scguaquetam
Copy link
Collaborator

@pranavkonde Please review comments I made, you are not correctly implementing the requested settings on spinner and log functions, also it seems like you are not implementing the monitor functionality inside the TX module.

@pranavkonde
Copy link
Contributor Author

@pranavkonde Please review comments I made, you are not correctly implementing the requested settings on spinner and log functions, also it seems like you are not implementing the monitor functionality inside the TX module.

Thank you for the detailed feedback! I've addressed all the issues mentioned, Can you please take a look now?

@scguaquetam
Copy link
Collaborator

Hello @pranavkonde I can see you followed my comments and now it looks good, thank you so much, I will share this review with people in charge, they will come back to you soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants