Skip to content

docs: updated GetAllCompletedTransactionsStream comment#7451

Merged
SWvheerden merged 1 commit intotari-project:developmentfrom
SolfataraEmit:update-GetAllCompletedTransactionsStream-comment
Aug 29, 2025
Merged

docs: updated GetAllCompletedTransactionsStream comment#7451
SWvheerden merged 1 commit intotari-project:developmentfrom
SolfataraEmit:update-GetAllCompletedTransactionsStream-comment

Conversation

@SolfataraEmit
Copy link
Copy Markdown
Contributor

@SolfataraEmit SolfataraEmit commented Aug 29, 2025

Description

Fleshed out the GetAllCompletedTransactionsStream gRPC method since we mention is explicitly in the release notes.

Motivation and Context

Explain the usage.

How Has This Been Tested?

It hasn't

What process can a PR reviewer use to test or verify this change?

Confirm that the instructions match what is required.

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

Summary by CodeRabbit

  • New Features
    • Added a streaming endpoint to retrieve completed wallet transactions, supporting pagination (offset/limit capped at 50) and status filtering. Delivers incremental responses for improved performance on large result sets.
  • Documentation
    • Updated API guidance with streaming usage examples, pagination limits, filtering options, and sample payloads.
  • Chores
    • Deprecated the legacy non-stream method for fetching completed transactions; it remains available temporarily for backward compatibility.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 29, 2025

Walkthrough

Adds a new streaming RPC GetAllCompletedTransactionsStream to wallet.proto and marks the existing GetAllCompletedTransactions RPC as deprecated. Updates accompanying comments to document streaming, pagination (offset, limit≤50), and filtering via status_bitflag.

Changes

Cohort / File(s) Summary of Changes
Wallet gRPC proto updates
applications/minotari_app_grpc/proto/wallet.proto
Added streaming RPC GetAllCompletedTransactionsStream(GetAllCompletedTransactionsRequest) returns (stream GetCompletedTransactionsResponse); marked GetAllCompletedTransactions as deprecated; updated docs to describe streaming semantics, pagination (offset/limit), and status filtering.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant S as Wallet gRPC Server

  Note over C,S: Fetch completed transactions (streaming, paginated, filtered)
  C->>S: GetAllCompletedTransactionsStream(Request{offset, limit≤50, status_bitflag})
  alt Results available
    loop Stream pages until exhausted
      S-->>C: GetCompletedTransactionsResponse{transactions[]}
    end
    S-->>C: Stream completed (OK)
  else Error
    S-->>C: Stream error (status)
  end

  Note over C: Client aggregates or processes streamed TransactionInfo items
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • SWvheerden

Poem

A rabbit taps the proto stream, hop-hop—new lines flow,
Pages of coins in tidy rows, where once a lump would go.
The old path bows, a gentle nod, deprecated in the sun,
Now nibbling bytes, we sip the feed, one carrot—then we’re done. 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
applications/minotari_app_grpc/proto/wallet.proto (1)

1146-1165: Augment example to show constructing status_bitflag properly (BigInt) and reinforce cap behavior

This prevents clients from sending incorrect 32‑bit masks or string values.

Apply this diff:

-// ```javascript
-// const call = client.getAllCompletedTransactionsStream({
-//   offset: 0,
-//   limit: 20,
-//   status_bitflag: 0
-// });
+// ```javascript
+// // Include COMPLETED (0) and MINED_CONFIRMED (6)
+// const statusBitflag = (1n << 0n) | (1n << 6n);
+// const call = client.getAllCompletedTransactionsStream({
+//   offset: 0,        // 0-based
+//   limit: 20,        // server caps to 50
+//   status_bitflag: statusBitflag
+// });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ecf49a3 and c84b0a2.

📒 Files selected for processing (1)
  • applications/minotari_app_grpc/proto/wallet.proto (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: test (nextnet, nextnet)
  • GitHub Check: test (mainnet, stagenet)
  • GitHub Check: test (testnet, esmeralda)
  • GitHub Check: cargo check with stable
  • GitHub Check: wasm build tests
  • GitHub Check: ledger build tests
  • GitHub Check: ci
  • GitHub Check: Cucumber tests / Base Layer
  • GitHub Check: Cucumber tests / FFI
🔇 Additional comments (1)
applications/minotari_app_grpc/proto/wallet.proto (1)

1117-1121: Document pagination and status_bitflag semantics accurately

  • offset: 0-based index into a descending-timestamp list of completed transactions; offsets beyond the end immediately return an empty stream (wallet_grpc_server.rs:1436–1440).
  • limit: total number of transactions to fetch; the server does not cap the overall result to 50, but for streaming performance it issues database calls in chunks of up to 50 (chunk_size = min(limit, 50)) and continues until the total requested count is reached. A limit of 0 yields no results.
  • status_bitflag: a bitmask over the TransactionStatus enum. The server treats 0 as “no filter” (include all statuses) and, for each bit i set in status_bitflag, includes TransactionStatus::from_i32(i) in the query (sqlite_db.rs:1264–1269).

Provide an example for clients:

// Include COMPLETED (0) and MINED_CONFIRMED (6):
const statusBitflag = (1n << 0n) | (1n << 6n);

[m​andatory_refactors_required]

Comment on lines +1109 to +1116
// Streams previously completed wallet transactions to the client.
//
// The `GetAllCompletedTransactionsStream` RPC provides a paginated, filtered stream of previously completed transactions
// from the wallet database. Unlike real-time event streaming, this RPC allows clients to retrieve historical transaction
// data using offset, limit, and optional status-based filtering.
//
// This is ideal for applications that need to display a transaction history, perform analytics, or resume from a known offset.
//
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Specify sort order and cancelled-tx inclusion to match deprecated RPC semantics

The deprecated RPC explicitly says “sorted by timestamp and paginated” and “including cancelled ones.” Please state the same here to avoid ambiguity and ensure clients implement stable pagination.

Apply this diff:

-// The `GetAllCompletedTransactionsStream` RPC provides a paginated, filtered stream of previously completed transactions
-// from the wallet database. Unlike real-time event streaming, this RPC allows clients to retrieve historical transaction
-// data using offset, limit, and optional status-based filtering.
+// The `GetAllCompletedTransactionsStream` RPC provides a paginated, filtered stream of previously completed transactions
+// from the wallet database, sorted by timestamp (descending) for stable pagination. It includes cancelled transactions
+// unless filtered out via `status_bitflag`. Unlike real-time event streaming, this RPC allows clients to retrieve
+// historical transaction data using offset, limit, and optional status-based filtering.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Streams previously completed wallet transactions to the client.
//
// The `GetAllCompletedTransactionsStream` RPC provides a paginated, filtered stream of previously completed transactions
// from the wallet database. Unlike real-time event streaming, this RPC allows clients to retrieve historical transaction
// data using offset, limit, and optional status-based filtering.
//
// This is ideal for applications that need to display a transaction history, perform analytics, or resume from a known offset.
//
// Streams previously completed wallet transactions to the client.
//
// The `GetAllCompletedTransactionsStream` RPC provides a paginated, filtered stream of previously completed transactions
// from the wallet database, sorted by timestamp (descending) for stable pagination. It includes cancelled transactions
// unless filtered out via `status_bitflag`. Unlike real-time event streaming, this RPC allows clients to retrieve
// historical transaction data using offset, limit, and optional status-based filtering.
//
// This is ideal for applications that need to display a transaction history, perform analytics, or resume from a known offset.
//
🤖 Prompt for AI Agents
In applications/minotari_app_grpc/proto/wallet.proto around lines 1109 to 1116,
the RPC docblock omits that results must be sorted and that cancelled
transactions are included; update the comment to state the stream is sorted by
timestamp (ascending or descending—choose and document consistently) and that it
includes cancelled transactions so pagination is stable and matches the
deprecated RPC semantics; ensure the wording explicitly mentions "sorted by
timestamp and paginated" and "including cancelled ones" to remove ambiguity.

Comment on lines +1123 to +1145
// - Each message in the response stream is a `GetCompletedTransactionsResponse` containing:
// - **transaction**: A `TransactionInfo` object representing a completed wallet transaction.
//
// ### `TransactionInfo` Fields:
// - **tx_id** (uint64): Unique transaction identifier.
// - **source_address** (bytes): Sender address.
// - **dest_address** (bytes): Recipient address.
// - **status** (enum): Status of the transaction (`Completed`, `Mined`, `Cancelled`, etc.).
// - **direction** (enum): `"Inbound"` or `"Outbound"`.
// - **amount** (uint64): Transaction amount in microTari.
// - **fee** (uint64): Transaction fee in microTari.
// - **is_cancelled** (bool): Whether the transaction was cancelled.
// - **excess_sig** (bytes): Signature of the transaction kernel excess.
// - **timestamp** (uint64): UNIX timestamp of the transaction creation time.
// - **raw_payment_id** (bytes): Raw payment ID used in the transaction.
// - **user_payment_id** (bytes): User-visible payment ID, if applicable.
// - **mined_in_block_height** (uint64): Block height where the transaction was mined. Zero if not mined.
// - **input_commitments** (repeated bytes): Commitments for transaction inputs.
// - **output_commitments** (repeated bytes): Commitments for transaction outputs.
// - **payment_references_sent** (repeated bytes): Metadata references associated with sent outputs.
// - **payment_references_received** (repeated bytes): Metadata references associated with received outputs.
// - **payment_references_change** (repeated bytes): Metadata references associated with change outputs.
//
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use exact enum types/names in field docs for consistency

Elsewhere in this proto the examples use fully-qualified enum constants (e.g., TRANSACTION_STATUS_MINED_CONFIRMED). Align this section to reduce ambiguity across languages that serialize enums as integers.

Apply this diff:

-// - **status** (enum): Status of the transaction (`Completed`, `Mined`, `Cancelled`, etc.).
-// - **direction** (enum): `"Inbound"` or `"Outbound"`.
+// - **status** (`TransactionStatus`): e.g., `TRANSACTION_STATUS_COMPLETED`, `TRANSACTION_STATUS_MINED_CONFIRMED`.
+// - **direction** (`TransactionDirection`): `TRANSACTION_DIRECTION_INBOUND` or `TRANSACTION_DIRECTION_OUTBOUND`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// - Each message in the response stream is a `GetCompletedTransactionsResponse` containing:
// - **transaction**: A `TransactionInfo` object representing a completed wallet transaction.
//
// ### `TransactionInfo` Fields:
// - **tx_id** (uint64): Unique transaction identifier.
// - **source_address** (bytes): Sender address.
// - **dest_address** (bytes): Recipient address.
// - **status** (enum): Status of the transaction (`Completed`, `Mined`, `Cancelled`, etc.).
// - **direction** (enum): `"Inbound"` or `"Outbound"`.
// - **amount** (uint64): Transaction amount in microTari.
// - **fee** (uint64): Transaction fee in microTari.
// - **is_cancelled** (bool): Whether the transaction was cancelled.
// - **excess_sig** (bytes): Signature of the transaction kernel excess.
// - **timestamp** (uint64): UNIX timestamp of the transaction creation time.
// - **raw_payment_id** (bytes): Raw payment ID used in the transaction.
// - **user_payment_id** (bytes): User-visible payment ID, if applicable.
// - **mined_in_block_height** (uint64): Block height where the transaction was mined. Zero if not mined.
// - **input_commitments** (repeated bytes): Commitments for transaction inputs.
// - **output_commitments** (repeated bytes): Commitments for transaction outputs.
// - **payment_references_sent** (repeated bytes): Metadata references associated with sent outputs.
// - **payment_references_received** (repeated bytes): Metadata references associated with received outputs.
// - **payment_references_change** (repeated bytes): Metadata references associated with change outputs.
//
// ### `TransactionInfo` Fields:
// - **tx_id** (uint64): Unique transaction identifier.
// - **source_address** (bytes): Sender address.
// - **dest_address** (bytes): Recipient address.
// - **status** (`TransactionStatus`): e.g., `TRANSACTION_STATUS_COMPLETED`, `TRANSACTION_STATUS_MINED_CONFIRMED`.
// - **direction** (`TransactionDirection`): `TRANSACTION_DIRECTION_INBOUND` or `TRANSACTION_DIRECTION_OUTBOUND`.
// - **amount** (uint64): Transaction amount in microTari.
// - **fee** (uint64): Transaction fee in microTari.
// - **is_cancelled** (bool): Whether the transaction was cancelled.
// - **excess_sig** (bytes): Signature of the transaction kernel excess.
// - **timestamp** (uint64): UNIX timestamp of the transaction creation time.
// - **raw_payment_id** (bytes): Raw payment ID used in the transaction.
// - **user_payment_id** (bytes): User-visible payment ID, if applicable.
// - **mined_in_block_height** (uint64): Block height where the transaction was mined. Zero if not mined.
// - **input_commitments** (repeated bytes): Commitments for transaction inputs.
// - **output_commitments** (repeated bytes): Commitments for transaction outputs.
// - **payment_references_sent** (repeated bytes): Metadata references associated with sent outputs.
// - **payment_references_received** (repeated bytes): Metadata references associated with received outputs.
// - **payment_references_change** (repeated bytes): Metadata references associated with change outputs.
🤖 Prompt for AI Agents
In applications/minotari_app_grpc/proto/wallet.proto around lines 1123–1145, the
field docs use generic enum labels like `Completed`, `Mined`,
`"Inbound"`/`"Outbound"`; update these comments to use the exact fully-qualified
enum identifiers used elsewhere (for example use
TRANSACTION_STATUS_MINED_CONFIRMED or TRANSACTION_STATUS_COMPLETED and
TRANSACTION_DIRECTION_INBOUND / TRANSACTION_DIRECTION_OUTBOUND or whatever exact
names are defined in this proto), replacing the generic names so the docs are
unambiguous across languages and match the enum definitions in this file.

Comment on lines +1167 to +1191
// ### Sample JSON Streamed Response:
// ```json
// {
// "transaction": {
// "tx_id": 103248,
// "source_address": "0xabc123...",
// "dest_address": "0xdef456...",
// "status": "Completed",
// "direction": "Outbound",
// "amount": 100000000,
// "fee": 200000,
// "is_cancelled": false,
// "excess_sig": "0x...",
// "timestamp": 1670000000,
// "raw_payment_id": "0xdeadbeef...",
// "user_payment_id": "0xdeadbeef...",
// "mined_in_block_height": 202000,
// "input_commitments": ["0x...", "0x..."],
// "output_commitments": ["0x...", "0x..."],
// "payment_references_sent": ["0x...", "0x..."],
// "payment_references_received": [],
// "payment_references_change": []
// }
// }
// ```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Standardize enum values in sample JSON to match defined enums

Earlier examples use TRANSACTION_STATUS_* and TRANSACTION_DIRECTION_*. Keep this consistent.

Apply this diff:

-//     "status": "Completed",
-//     "direction": "Outbound",
+//     "status": "TRANSACTION_STATUS_COMPLETED",
+//     "direction": "TRANSACTION_DIRECTION_OUTBOUND",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// ### Sample JSON Streamed Response:
// ```json
// {
// "transaction": {
// "tx_id": 103248,
// "source_address": "0xabc123...",
// "dest_address": "0xdef456...",
// "status": "Completed",
// "direction": "Outbound",
// "amount": 100000000,
// "fee": 200000,
// "is_cancelled": false,
// "excess_sig": "0x...",
// "timestamp": 1670000000,
// "raw_payment_id": "0xdeadbeef...",
// "user_payment_id": "0xdeadbeef...",
// "mined_in_block_height": 202000,
// "input_commitments": ["0x...", "0x..."],
// "output_commitments": ["0x...", "0x..."],
// "payment_references_sent": ["0x...", "0x..."],
// "payment_references_received": [],
// "payment_references_change": []
// }
// }
// ```
// {
// "transaction": {
// "tx_id": 103248,
// "source_address": "0xabc123...",
// "dest_address": "0xdef456...",
- // "status": "Completed",
// "status": "TRANSACTION_STATUS_COMPLETED",
// "direction": "TRANSACTION_DIRECTION_OUTBOUND",
// "amount": 100000000,
// "fee": 200000,
// "is_cancelled": false,
// "excess_sig": "0x...",
// "timestamp": 1670000000,
// "raw_payment_id": "0xdeadbeef...",
// "user_payment_id": "0xdeadbeef...",
// "mined_in_block_height": 202000,
// "input_commitments": ["0x...", "0x..."],
// "output_commitments": ["0x...", "0x..."],
// "payment_references_sent": ["0x...", "0x..."],
// "payment_references_received": [],
// "payment_references_change": []
// }
// }
🤖 Prompt for AI Agents
In applications/minotari_app_grpc/proto/wallet.proto around lines 1167 to 1191,
the sample JSON uses literal enum labels ("Completed", "Outbound") that don’t
match the proto enum constants used elsewhere; update the sample JSON to use the
standardized enum identifiers (e.g., TRANSACTION_STATUS_COMPLETED and
TRANSACTION_DIRECTION_OUTBOUND or the exact enum names defined in the proto) so
all examples consistently reference the proto enum values.

@SWvheerden SWvheerden merged commit 88ebf01 into tari-project:development Aug 29, 2025
14 of 16 checks passed
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.

2 participants