Skip to content

feat: new sending flow with UI#2175

Merged
brianp merged 53 commits intotari-project:mainfrom
mmrrnn:mp_new_sending_flow_with_ui
Jun 4, 2025
Merged

feat: new sending flow with UI#2175
brianp merged 53 commits intotari-project:mainfrom
mmrrnn:mp_new_sending_flow_with_ui

Conversation

@mmrrnn
Copy link
Copy Markdown
Contributor

@mmrrnn mmrrnn commented May 23, 2025

Summary by CodeRabbit

  • New Features

    • Added a new component to display detailed transaction information with hidden fields and copy-to-clipboard functionality.
    • Implemented transaction export and import capabilities in the wallet interface.
    • Enhanced wallet balance retrieval with a new method to fetch current balance via gRPC.
  • Improvements

    • Expanded transaction status types and updated title generation logic for clearer status display.
    • Refined transaction list to show only confirmed transactions, removing pending transaction merging.
    • Localized new status keys across multiple languages and improved formatting of transaction details.
    • Updated transaction type and direction enums for better clarity and categorization.
  • Bug Fixes

    • Added validation to prevent zero-amount transactions in the send form.
  • Refactor

    • Modularized command execution with dedicated helper methods and improved error handling.
    • Simplified wallet balance adjustment logic, removing pending transaction calculations.
    • Corrected variable naming typos and streamlined event handling.
  • Style

    • Increased maximum height for transaction detail modal container for better visibility.
  • Chores

    • Updated localization files with new translation keys and values across multiple languages.
    • Removed unused code and refactored existing components for better maintainability.

@mmrrnn mmrrnn changed the title Mp new sending flow with UI feat: new sending flow with UI May 23, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented May 23, 2025

📝 Walkthrough

Walkthrough

This update refactors transaction display logic, removes pending transaction handling, and introduces modular utilities for transaction details. It updates localization, enhances backend transaction import/export, and modifies process and wallet adapter functions for output control and error handling.

Changes

File(s) Change Summary
public/locales/*/common.json, public/locales/*/wallet.json Added translation keys "complete", "failed", "pending", and "broadcast" (in English); updated "completed-text" to reference broadcasting in English; no removals.
src-tauri/src/commands.rs, src-tauri/src/spend_wallet_manager.rs, src-tauri/src/spend_wallet_adapter.rs, src-tauri/src/wallet_adapter.rs, src-tauri/src/wallet_manager.rs Refactored to support transaction export/import: updated method signatures to accept wallet managers, added transaction import/export logic, improved error handling and cleanup, and modularized command execution.
src-tauri/src/process_utils.rs, src-tauri/src/process_adapter.rs, src-tauri/src/node/remote_node_adapter.rs, src-tauri/src/gpu_miner.rs Added a boolean flag to control child process output capture, implemented new trait method start_and_wait_for_output, and updated process launching logic accordingly.
src-tauri/src/events_manager.rs Fixed a typo in a variable name (in_memoery_configin_memory_config).
src/components/transactions/history/ExpandedItem.tsx Deleted the ItemExpand transaction detail component.
src/components/transactions/history/HistoryList.tsx Removed pending transaction logic; now only confirmed transactions are displayed; switched to new TransactionDetails component for expanded view.
src/components/transactions/history/ListItem.tsx, src/components/transactions/types.ts, src/types/transactions.ts Refactored transaction item rendering to use direction instead of type; expanded and reordered transaction status and direction enums.
src/components/transactions/history/details/TransactionDetails.tsx, src/components/transactions/history/details/getListEntries.ts, src/components/transactions/history/details/styles.ts Introduced new modular components and utilities for transaction detail rendering, including triple-click to show hidden fields, localized labels, and explorer links.
src/components/transactions/history/helpers.ts Removed all transaction type/title helpers except formatTimeStamp.
src/components/transactions/send/SendForm.tsx Added explicit zero-amount validation in the send form.
src/components/transactions/send/SendModal.tsx Replaced adding a pending transaction with a full transaction list refresh after sending.
src/components/transactions/send/SendReview/SendReview.tsx Removed auto-completion logic based on pending/completed transactions; updated status label to "broadcast".
src/components/transactions/wallet/wallet.styles.ts Increased the maximum height of the wallet wrapper for improved UI scalability.
src/store/actions/walletStoreActions.ts Simplified wallet balance update logic by removing pending transaction adjustments.
src/store/useWalletStore.ts Removed all pending transaction state, logic, and related functions from the wallet store.
src/store/useBlockchainVisualisationStore.ts Removed pending transaction refresh logic; added conditional animation based on visual mode.
src/utils/getTxStatus.ts New utility module for transaction type/status determination and localized title generation.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant WalletManager
    participant SpendWalletAdapter
    participant WalletAdapter

    UI->>WalletManager: import_transaction(tx_output_file)
    WalletManager->>WalletAdapter: import_transaction(tx_output_file)
    WalletAdapter->>WalletAdapter: Read JSON file
    WalletAdapter->>WalletAdapter: Connect to gRPC client
    WalletAdapter->>gRPC: ImportTransactionsRequest
    gRPC-->>WalletAdapter: Import result
    WalletAdapter-->>WalletManager: Result
    WalletManager-->>UI: Success/Error
Loading
sequenceDiagram
    participant UI
    participant SpendWalletManager
    participant SpendWalletAdapter
    participant WalletManager

    UI->>SpendWalletManager: send_one_sided_to_stealth_address(amount, destination, payment_id, view_wallet_manager)
    SpendWalletManager->>SpendWalletAdapter: send_one_sided_to_stealth_address(amount, destination, payment_id, view_wallet_manager)
    SpendWalletAdapter->>SpendWalletAdapter: execute_recovery_command()
    SpendWalletAdapter->>SpendWalletAdapter: execute_sync_command()
    SpendWalletAdapter->>SpendWalletAdapter: execute_send_one_sided_command()
    SpendWalletAdapter->>SpendWalletAdapter: export_transaction(tx_id)
    SpendWalletAdapter->>WalletManager: import_transaction(exported_tx_file)
    WalletManager-->>SpendWalletAdapter: Import result
    SpendWalletAdapter-->>SpendWalletManager: Result
    SpendWalletManager-->>UI: Success/Error
Loading

Possibly related PRs

  • universe#1924: Both PRs address transaction status representation and UI display logic, focusing on removing or updating status indicators and related components.
  • universe#2088: Both PRs modify the SendForm component to improve validation logic, specifically handling wallet balance and amount validity.
  • universe#1909: Both PRs update localization files and translation keys for transaction status UI, indicating a direct overlap in translation-related changes.

Suggested reviewers

  • mmrrnn
  • peps
  • brianp

Poem

In the garden where transactions grow,
The pending leaves have ceased to show.
Details bloom with careful care,
New status keys float in the air.
Exports and imports now take root,
With every click, the changes suit.
🐇✨ The ledger’s clear, the UI’s neat—
A rabbit’s work is quite the feat!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-05-26T11_02_03_958Z-debug-0.log

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

Documentation and Community

  • 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

@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: 28

🔭 Outside diff range comments (2)
src/components/transactions/send/SendReview/SendReview.tsx (1)

10-12: ⚠️ Potential issue

Remove unused imports and parameters.

The linter correctly identifies several unused code elements that should be cleaned up:

Apply this diff to remove the unused imports and parameter:

-import { useEffect } from 'react';
 import { SendStatus } from '@app/components/transactions/send/SendModal.tsx';
-import { useWalletStore } from '@app/store';
 import { StatusHero } from '../../components/StatusHero/StatusHero';
 export function SendReview({
     status,
-    setStatus,
+    setStatus: _setStatus,
     amount,
     address,
     message,

Also applies to: 29-29

🧰 Tools
🪛 GitHub Check: Run linters

[warning] 12-12:
'useWalletStore' is defined but never used. Allowed unused vars must match /^_/u


[warning] 10-10:
'useEffect' is defined but never used. Allowed unused vars must match /^_/u

🪛 GitHub Actions: Lint

[warning] 10-10: ESLint: 'useEffect' is defined but never used. Allowed unused vars must match /^_/u (@typescript-eslint/no-unused-vars)


[warning] 12-12: ESLint: 'useWalletStore' is defined but never used. Allowed unused vars must match /^_/u (@typescript-eslint/no-unused-vars)

src/components/transactions/history/helpers.ts (1)

3-13: 🛠️ Refactor suggestion

Consider using a hook for store access to maintain React reactivity.

The formatTimeStamp function directly calls useConfigUIStore.getState() which bypasses React's reactivity system. This means components using this function won't re-render when the language settings change.

Consider refactoring to use the store hook within components instead:

-function formatTimeStamp(timestamp: number): string {
-    const appLanguage = useConfigUIStore.getState().application_language;
-    const systemLang = useConfigUIStore.getState().should_always_use_system_language;
+function formatTimeStamp(timestamp: number, appLanguage?: string, systemLang?: boolean): string {
     return new Date(timestamp * 1000)?.toLocaleString(systemLang ? undefined : appLanguage, {
         month: 'short',
         day: '2-digit',
         hourCycle: 'h23',
         hour: 'numeric',
         minute: 'numeric',
     });
 }

Then in components:

const appLanguage = useConfigUIStore(s => s.application_language);
const systemLang = useConfigUIStore(s => s.should_always_use_system_language);
const formattedTime = formatTimeStamp(item.timestamp, appLanguage, systemLang);
🧹 Nitpick comments (6)
src/components/transactions/send/SendModal.tsx (1)

75-75: Transaction refresh approach ensures data consistency.

Replacing addPendingTransaction(payload) with await refreshTransactions() provides better data consistency by fetching the complete transaction state from the backend instead of optimistically updating the UI state.

However, consider the performance impact of refreshing all transactions after each send operation, especially for users with large transaction histories.

The current implementation from src/store/actions/walletStoreActions.ts (lines 56-59) fetches transactions with a limit based on existing count, which helps mitigate performance concerns by maintaining a reasonable fetch size.

src-tauri/src/process_utils.rs (1)

57-66: Consider extracting the conditional stdio logic for DRY compliance.

The stdout/stderr conditional logic is duplicated between Windows and non-Windows sections.

Consider extracting the stdio configuration to reduce duplication:

+    let stdout = if allow_output {
+        std::process::Stdio::piped()
+    } else {
+        std::process::Stdio::null()
+    };
+    let stderr = if allow_output {
+        std::process::Stdio::piped()
+    } else {
+        std::process::Stdio::null()
+    };
+
     #[cfg(not(target_os = "windows"))]
     {
         Ok(tokio::process::Command::new(file_path)
             .args(args)
             .current_dir(current_dir)
             .envs(envs.cloned().unwrap_or_default())
             .stdout(stdout)
             .stderr(stderr)
             .kill_on_drop(true)
             .spawn()?)
     }

This approach eliminates the duplication while maintaining the same functionality.

src/utils/getTxStatus.ts (1)

47-70: Simplify conditional logic and improve readability.

The nested conditionals and repetitive type checking can be simplified for better maintainability.

Consider this refactor to improve readability:

 export function getTxTitle(transaction: TransactionInfo): string {
     const itemType = getTxTypeByStatus(transaction);
     const txMessage = transaction.payment_id;
     const statusTitleKey = getTxStatusTitleKey(transaction);
-    const statusTitle = i18n.t(`common:${statusTitleKey}`);
+    const statusTitle = statusTitleKey ? i18n.t(`common:${statusTitleKey}`) : '';
     const typeTitle =
         itemType === 'unknown' ? TransactionDirection[transaction.direction] : i18n.t(`common:${itemType}`);

+    // Priority 1: Show block height for mined transactions
     if (itemType === 'mined' && transaction.mined_in_block_height) {
         return `${i18n.t('sidebar:block')} #${transaction.mined_in_block_height}`;
     }

-    if (txMessage && !txMessage.includes('<No message>')) {
-        if (statusTitleKey !== 'complete') {
-            return `${txMessage} | ${statusTitle}`;
-        }
-        return txMessage;
-    }
+    const hasValidMessage = txMessage && !txMessage.includes('<No message>');
+    const isComplete = statusTitleKey === 'complete';

-    if (statusTitleKey !== 'complete') {
-        return `${typeTitle} | ${statusTitle}`;
-    }
-    return i18n.t(`common:${itemType}`);
+    // Priority 2: Show message with status (if not complete)
+    if (hasValidMessage) {
+        return isComplete ? txMessage : `${txMessage} | ${statusTitle}`;
+    }
+
+    // Priority 3: Show type with status or just type
+    return isComplete ? i18n.t(`common:${itemType}`) : `${typeTitle} | ${statusTitle}`;
 }
src/components/transactions/history/details/getListEntries.ts (1)

50-53: Consider omitting the raw status value from the UI.

Displaying the raw numeric status value (e.g., "14", "12") in valueRight may confuse users. The translated status text should be sufficient.

 if (key === 'status') {
     const tKey = getTxStatusTitleKey(transaction);
-    return { value: i18n.t(`common:${tKey}`), valueRight: value };
+    return { value: i18n.t(`common:${tKey}`) };
 }
src-tauri/src/spend_wallet_adapter.rs (2)

184-190: Clever use of fake base node address to prevent broadcasting.

Using an allocated but unused port ensures the wallet cannot establish a connection to broadcast the transaction. This forces the transaction to remain local for export. Consider adding a comment explaining this intentional behavior for future maintainers.

 async fn execute_send_one_sided_command(
     &self,
     amount: &str,
     destination: &str,
     payment_id: Option<String>,
 ) -> Result<Option<String>, Error> {
-    // Allocate an unused port to ensure the transaction is not successfully broadcasted.
-    // This is intentional as we want to export the transaction to the view wallet instead.
+    // IMPORTANT: We intentionally use a fake base node address with an unused port to prevent
+    // the transaction from being broadcasted. This ensures the transaction remains local
+    // so we can export it and import it into the view wallet for proper handling.
     let fake_base_node_public_key = self.get_base_node_public_key_hex();

333-336: Remove unnecessary async from erase_related_data method.

The method only performs synchronous operations and doesn't need to be async.

-pub async fn erase_related_data(&self) -> Result<(), Error> {
+pub fn erase_related_data(&self) -> Result<(), Error> {
     std::fs::remove_dir_all(self.get_working_dir())?;
     Ok(())
 }

Note: You'll also need to update the calls to this method to remove .await:

  • Line 97: let _unused = self.erase_related_data();
  • Line 136: self.erase_related_data()?;
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70b55db and f6defa2.

⛔ Files ignored due to path filters (1)
  • src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (55)
  • public/locales/af/common.json (2 hunks)
  • public/locales/af/wallet.json (1 hunks)
  • public/locales/cn/common.json (2 hunks)
  • public/locales/cn/wallet.json (1 hunks)
  • public/locales/de/common.json (2 hunks)
  • public/locales/de/wallet.json (1 hunks)
  • public/locales/en/common.json (2 hunks)
  • public/locales/en/wallet.json (2 hunks)
  • public/locales/fr/common.json (2 hunks)
  • public/locales/fr/wallet.json (1 hunks)
  • public/locales/hi/common.json (2 hunks)
  • public/locales/hi/wallet.json (1 hunks)
  • public/locales/id/common.json (2 hunks)
  • public/locales/id/wallet.json (1 hunks)
  • public/locales/ja/common.json (2 hunks)
  • public/locales/ja/wallet.json (1 hunks)
  • public/locales/ko/common.json (2 hunks)
  • public/locales/ko/wallet.json (1 hunks)
  • public/locales/pl/common.json (2 hunks)
  • public/locales/pl/wallet.json (1 hunks)
  • public/locales/ru/common.json (2 hunks)
  • public/locales/ru/wallet.json (1 hunks)
  • public/locales/tr/common.json (2 hunks)
  • public/locales/tr/wallet.json (1 hunks)
  • src-tauri/Cargo.toml (3 hunks)
  • src-tauri/src/commands.rs (1 hunks)
  • src-tauri/src/events_manager.rs (1 hunks)
  • src-tauri/src/gpu_miner.rs (1 hunks)
  • src-tauri/src/node/node_adapter.rs (1 hunks)
  • src-tauri/src/node/remote_node_adapter.rs (2 hunks)
  • src-tauri/src/process_adapter.rs (3 hunks)
  • src-tauri/src/process_utils.rs (1 hunks)
  • src-tauri/src/spend_wallet_adapter.rs (4 hunks)
  • src-tauri/src/spend_wallet_manager.rs (2 hunks)
  • src-tauri/src/wallet_adapter.rs (5 hunks)
  • src-tauri/src/wallet_manager.rs (1 hunks)
  • src/components/AdminUI/groups/SwapsGroup.tsx (1 hunks)
  • src/components/transactions/history/ExpandedItem.tsx (0 hunks)
  • src/components/transactions/history/HistoryList.tsx (5 hunks)
  • src/components/transactions/history/ListItem.tsx (3 hunks)
  • src/components/transactions/history/details/TransactionDetails.tsx (1 hunks)
  • src/components/transactions/history/details/getListEntries.ts (1 hunks)
  • src/components/transactions/history/details/styles.ts (1 hunks)
  • src/components/transactions/history/helpers.ts (1 hunks)
  • src/components/transactions/send/SendForm.tsx (1 hunks)
  • src/components/transactions/send/SendModal.tsx (2 hunks)
  • src/components/transactions/send/SendReview/SendReview.tsx (1 hunks)
  • src/components/transactions/types.ts (2 hunks)
  • src/components/transactions/wallet/wallet.styles.ts (1 hunks)
  • src/store/actions/appConfigStoreActions.ts (0 hunks)
  • src/store/actions/walletStoreActions.ts (1 hunks)
  • src/store/useBlockchainVisualisationStore.ts (3 hunks)
  • src/store/useWalletStore.ts (1 hunks)
  • src/types/transactions.ts (1 hunks)
  • src/utils/getTxStatus.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • src/store/actions/appConfigStoreActions.ts
  • src/components/transactions/history/ExpandedItem.tsx
🧰 Additional context used
🧠 Learnings (3)
src/components/transactions/history/HistoryList.tsx (1)
Learnt from: peps
PR: tari-project/universe#2056
File: src/components/transactions/history/HistoryList.tsx:55-63
Timestamp: 2025-05-07T11:46:20.991Z
Learning: The HistoryListItem component in src/components/transactions/history/ListItem.tsx no longer uses a triple-click handler or maintains internal expansion state. Expansion is now handled at a higher level using the setDetailsItem prop to show details in a separate view.
src/components/transactions/history/details/TransactionDetails.tsx (1)
Learnt from: peps
PR: tari-project/universe#2056
File: src/components/transactions/history/HistoryList.tsx:55-63
Timestamp: 2025-05-07T11:46:20.991Z
Learning: The HistoryListItem component in src/components/transactions/history/ListItem.tsx no longer uses a triple-click handler or maintains internal expansion state. Expansion is now handled at a higher level using the setDetailsItem prop to show details in a separate view.
src/components/transactions/history/ListItem.tsx (1)
Learnt from: peps
PR: tari-project/universe#2056
File: src/components/transactions/history/HistoryList.tsx:55-63
Timestamp: 2025-05-07T11:46:20.991Z
Learning: The HistoryListItem component in src/components/transactions/history/ListItem.tsx no longer uses a triple-click handler or maintains internal expansion state. Expansion is now handled at a higher level using the setDetailsItem prop to show details in a separate view.
🧬 Code Graph Analysis (8)
src-tauri/src/wallet_manager.rs (1)
src-tauri/src/wallet_adapter.rs (3)
  • import_transaction (100-140)
  • from (663-678)
  • from (704-711)
src/store/actions/walletStoreActions.ts (1)
src/store/useWalletStore.ts (1)
  • useWalletStore (46-48)
src/store/useBlockchainVisualisationStore.ts (1)
src/store/useAppConfigStore.ts (1)
  • useConfigUIStore (84-86)
src/components/transactions/history/details/TransactionDetails.tsx (6)
src/types/app-status.ts (1)
  • TransactionInfo (73-87)
src/hooks/helpers/useCopyToClipboard.ts (1)
  • useCopyToClipboard (4-30)
src/components/transactions/history/details/getListEntries.ts (1)
  • getListEntries (68-78)
src/components/TransactionModal/TransactionModal.tsx (1)
  • TransactionModal (18-62)
src/components/transactions/history/details/styles.ts (1)
  • Wrapper (3-7)
src/components/transactions/components/StatusList/StatusList.tsx (1)
  • StatusList (19-41)
src/components/transactions/history/details/getListEntries.ts (6)
src/types/app-status.ts (1)
  • TransactionInfo (73-87)
src/store/useMiningStore.ts (1)
  • useMiningStore (33-35)
src/components/transactions/components/StatusList/StatusList.tsx (1)
  • StatusListEntry (6-13)
src/components/transactions/history/helpers.ts (1)
  • formatTimeStamp (14-14)
src/utils/getTxStatus.ts (2)
  • getTxTitle (47-70)
  • getTxStatusTitleKey (40-46)
src/utils/formatters.ts (1)
  • formatNumber (81-103)
src/utils/getTxStatus.ts (2)
src/types/app-status.ts (1)
  • TransactionInfo (73-87)
src/components/transactions/types.ts (1)
  • TransationType (4-4)
src/components/transactions/send/SendModal.tsx (1)
src/store/actions/walletStoreActions.ts (1)
  • refreshTransactions (56-59)
src-tauri/src/spend_wallet_adapter.rs (3)
src-tauri/src/wallet_adapter.rs (3)
  • from (663-678)
  • from (704-711)
  • new (73-90)
src-tauri/src/spend_wallet_manager.rs (1)
  • new (50-57)
src-tauri/src/port_allocator.rs (1)
  • assign_port_with_fallback (73-93)
🪛 GitHub Actions: Lint
src/components/transactions/send/SendReview/SendReview.tsx

[warning] 10-10: ESLint: 'useEffect' is defined but never used. Allowed unused vars must match /^_/u (@typescript-eslint/no-unused-vars)


[warning] 12-12: ESLint: 'useWalletStore' is defined but never used. Allowed unused vars must match /^_/u (@typescript-eslint/no-unused-vars)


[warning] 29-29: ESLint: 'setStatus' is defined but never used. Allowed unused args must match /^_/u (@typescript-eslint/no-unused-vars)

src/store/useBlockchainVisualisationStore.ts

[error] 15-15: Prettier formatting error: Delete newline (prettier/prettier).

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: tauri-build
  • GitHub Check: cargo checks (fmt, clippy, check)
🔇 Additional comments (40)
src/components/transactions/history/details/styles.ts (1)

1-7: Styled-component Wrapper looks good

The new Wrapper component correctly applies a flex layout with a scrollable max-height constraint for transaction details content. This aligns with the intended modal behavior and ensures usability for lengthy content.

public/locales/en/wallet.json (1)

23-27: Localization updates for send flow

The new "broadcast" key and the updated "completed-text" accurately reflect the revised UX copy in English. No issues found.

public/locales/en/common.json (1)

6-6: Added new status keys in English locale

The new "complete", "failed", and "pending" keys have been correctly inserted with English values in the common locale.

Also applies to: 13-13, 23-23

src/components/transactions/wallet/wallet.styles.ts (1)

8-8: Updated max-height clamp is valid

The change to max-height: clamp(10vh, 600px, 55vh); appropriately increases the allowable height for the wallet wrapper. The clamp parameters correctly enforce minimum and maximum viewport proportions with a reasonable ideal fallback.

src/components/transactions/types.ts (1)

2-2: Clean interface refactor for transaction direction handling.

The addition of TransactionDirection import and the property change from type to direction in BaseItemProps aligns well with the broader refactor toward direction-based transaction handling. This semantic improvement should make the code more intuitive.

Also applies to: 15-15

src/components/transactions/send/SendForm.tsx (1)

44-48: Good addition of zero amount validation.

The explicit check for zero amounts with early return is a solid defensive programming practice. It prevents invalid transactions and provides immediate feedback without unnecessary async validation calls.

src-tauri/src/node/node_adapter.rs (1)

103-103:

Details

❓ Verification inconclusive

Verify the new gRPC field name exists.

The field name change from randomx_estimated_hash_rate to monero_randomx_estimated_hash_rate appears to be related to the Tari dependency upgrades. Please ensure this field name exists in the updated gRPC response structure to avoid runtime errors.


🏁 Script executed:

#!/bin/bash
# Search for the new field name in the codebase to verify its usage
rg "monero_randomx_estimated_hash_rate" --type rust

# Also search for any remaining references to the old field name
rg "randomx_estimated_hash_rate" --type rust

Length of output: 322


Confirm updated gRPC field in BaseNodeStatus

I’ve searched the Rust code and confirmed that only res.monero_randomx_estimated_hash_rate is referenced—there are no remaining mentions of randomx_estimated_hash_rate. To avoid runtime mismatches, please verify against your gRPC definitions:

  • Ensure the BaseNodeStatus message in the updated .proto file defines monero_randomx_estimated_hash_rate.
  • Confirm that your generated Rust client stubs (via tonic::include_proto! or equivalent) include this new field.
src-tauri/src/events_manager.rs (1)

57-58: LGTM! Typo fix improves code readability.

The variable name correction from in_memoery_config to in_memory_config fixes a typo and ensures consistency with the actual field name in_memory_config from the state.

src/components/transactions/send/SendReview/SendReview.tsx (1)

65-65: Status label change aligns with new transaction flow.

The change from displaying "completed" to "broadcast" when status is not 'processing' correctly reflects the updated transaction status terminology mentioned in the AI summary.

src-tauri/src/gpu_miner.rs (1)

217-218: LGTM! Function call updated to match new signature.

The addition of the false parameter correctly adapts to the updated launch_child_process function signature that now includes an allow_output parameter. Setting it to false is appropriate for the GPU detection process where output capture is not needed.

src/components/transactions/send/SendModal.tsx (1)

10-10: Import updated to align with new transaction handling architecture.

The change from addPendingTransaction to refreshTransactions correctly reflects the architectural shift away from managing individual pending transactions in the UI state.

src-tauri/src/commands.rs (1)

1881-1881: LGTM! Parameter addition supports transaction import/export flow.

The addition of &state.wallet_manager parameter enables the spend wallet to export transactions and import them into the view wallet manager, as described in the AI summary. This change is well-coordinated with the broader transaction flow enhancements.

src/store/useBlockchainVisualisationStore.ts (3)

12-13: Good refactoring: removing pending transaction dependency.

The removal of refreshPendingTransactions and addition of useConfigUIStore aligns well with the broader changes to simplify transaction state management and add visual mode configuration.


73-77: Excellent implementation of visual mode gating.

The conditional check for visualModeEnabled properly gates animation logic, ensuring animations only trigger when both canAnimate and visual mode are enabled. This provides users with fine-grained control over visual features.


98-99: Consistent visual mode gating in handleFail.

The implementation matches the pattern used in handleWin, ensuring consistent behavior across both success and failure scenarios. This maintains a cohesive user experience.

src/store/actions/walletStoreActions.ts (1)

84-84: Good simplification: removing pending transaction complexity.

The direct assignment of the balance state is cleaner and aligns with the broader effort to remove pending transaction tracking from the wallet store. This simplification improves code maintainability while the calculated_balance computation remains correct.

src-tauri/src/wallet_manager.rs (1)

189-200: Well-implemented transaction import method.

The new import_transaction method follows established patterns in the codebase:

  • Proper async/await usage
  • Consistent error handling with wallet state validation
  • Appropriate delegation to the adapter layer
  • Good error message for wallet not started scenario

The integration with the existing WalletAdapter::import_transaction method (as shown in relevant code snippets) creates a clean separation of concerns.

src-tauri/Cargo.toml (1)

42-43:

Details

❓ Verification inconclusive

Verify compatibility for major version upgrades.

The upgrade from Tari crates v1.18.0-rc.0 to v3.0.0 represents a significant jump that skips major versions. Similarly, tonic upgraded from 0.12.3 to 0.13.1. These changes need verification for breaking API changes and compatibility issues.

Please verify the compatibility and check for breaking changes:

Additionally, please search the web for version compatibility information:

Also applies to: 62-70, 97-97


🏁 Script executed:

#!/bin/bash
# Description: Check for breaking changes and API compatibility in the upgraded dependencies

echo "Checking for potential breaking changes in Tari crates and tonic..."

# Search for usage of potentially affected APIs
echo "=== Searching for minotari_node_grpc_client usage ==="
rg -A 3 "minotari_node_grpc_client::" --type rust

echo "=== Searching for minotari_wallet_grpc_client usage ==="
rg -A 3 "minotari_wallet_grpc_client::" --type rust

echo "=== Searching for tonic usage ==="
rg -A 3 "tonic::" --type rust

echo "=== Searching for tari_common usage ==="
rg -A 3 "tari_common::" --type rust

echo "=== Searching for tari_core usage ==="
rg -A 3 "tari_core::" --type rust

echo "=== Checking for deprecated patterns or imports ==="
rg -A 2 -B 2 "deprecated|DEPRECATED" --type rust

Length of output: 14331


🌐 Web query:

What are the breaking changes between Tari v1.18.0-rc.0 and v3.0.0? Are there any security vulnerabilities in tonic 0.13.1?

💡 Result:

Breaking Changes Between Tari v1.18.0-rc.0 and v3.0.0

The provided search results do not contain a comprehensive changelog directly contrasting Tari v1.18.0-rc.0 with v3.0.0. However, indications from the Tari repository's changelog and related documentation suggest several notable breaking changes in recent major releases:

  • Database Format/Wallet Type: There was a breaking change and subsequent hotfix related to how wallet type information is stored in the database. This change required special handling and could impact users upgrading across releases that made schema or serialization adjustments[1].
  • ByteArray Trait Changes: In Tari utilities, breaking changes were made to the ByteArray trait, including a rename of the from_bytes function to from_canonical_bytes. This affects API consumers and implementers relying on that trait[3].
  • Protocol and Schema Evolution: According to Tari's RFCs, version numbers must increment for any changes to the blockchain schema or validation rules, which is typical in major version changes[2]. This means that v3.0.0 may involve chain-level incompatibilities (e.g., changes to consensus, block structure, or transaction validation).
  • Wallet and Node Configuration: The process for setting up nodes and wallets—including the introduction of additional gRPC methods for monitoring and submission—has evolved, often introducing incompatible configuration shifts[4].
  • Library Upgrades: There is an emphasis on keeping dependencies aligned with upstream changes, which may include breaking API changes or new minimum requirements for Rust versions or related tools.

Because the changelog or documentation explicitly enumerating all breaking changes for the jump from v1.18.0-rc.0 to v3.0.0 is not available in the provided results, users are advised to consult both the main Tari repository and the specific migration/upgrade notes for each service or library to ensure compatibility[1][3][2][4].

Security Vulnerabilities in tonic 0.13.1

No explicit security vulnerabilities have been reported for tonic 0.13.1 in the search results[8][6]. Key points from the references:

  • The tonic 0.13.1 release documentation and changelog do not mention any security advisories or vulnerability patches for this version[8][6].
  • Recent releases and changelogs for tonic have occasionally contained updates related to the hyper and prost ecosystems (e.g., in 0.12.x and 0.13.x), but no vulnerabilities are noted for 0.13.1[6].
  • No advisories or vulnerability warnings are provided on popular open-source vulnerability databases for related tonic libraries[9].

Based on available information, tonic 0.13.1 does not have known published security vulnerabilities as of now[8][6].


Summary Table:

Topic Finding
Tari Major Changes Breaking database format changes, ByteArray trait changes, protocol/schema updates, wallet config.
tonic 0.13.1 Security No known or reported vulnerabilities as of May 2025.

If you require a line-by-line breakdown of Tari's breaking changes, consult the Tari changelog and migration documentation. For tonic, it's prudent to monitor the official changelog and Rust advisories for updates.

Citations:


Double-check breaking changes for Tari v3.0.0 upgrade

We inspected all uses of the upgraded Tari gRPC clients, tonic, tari_common and tari_core. No immediate import errors or new deprecations appeared, but the jump from v1.18.0-rc.0 to v3.0.0 carries several known breaking changes that aren’t auto-detectable:

• Database format / wallet schema migrations (ensure your on-disk wallet/data formats are upgraded or migrated).
ByteArray trait renames (from_bytesfrom_canonical_bytes).
• Protocol/schema evolutions (chain-level changes to block/transaction structures).
• gRPC surface/API changes (added, removed or renamed methods in the node and wallet clients).
• Configuration shifts in node/wallet setup (new required fields or tightened validation).

For tonic 0.13.1, no published security vulnerabilities are known.

Please manually verify:

  • All gRPC client calls in src-tauri/src/wallet_adapter.rs, node_adapter.rs, remote_node_adapter.rs, etc., still compile and match the new method signatures.
  • Any direct uses of ByteArray or related trait functions are updated.
  • Run the full test suite and end-to-end wallet/node integration to catch runtime mismatches.
src-tauri/src/node/remote_node_adapter.rs (1)

230-238: LGTM! Well-implemented null process method.

The start_and_wait_for_output method implementation is correct for a null process instance. It properly:

  • Calls the existing start() method
  • Awaits the wait() method for completion
  • Returns the exit code with empty output vectors (appropriate for a remote node that doesn't generate local output)

This follows the expected pattern for coordinating process management with output capture across the codebase.

src-tauri/src/spend_wallet_manager.rs (1)

76-98:

Details

✅ Verification successful

Good error handling improvement with cleanup on failure.

The changes enhance the method with:

  • Additional view_wallet_manager parameter to enable transaction export/import flow
  • Proper error handling that calls erase_related_data() for cleanup on failure
  • Maintains the same return semantics

Please verify that all callers have been updated for the new method signature:


🏁 Script executed:

#!/bin/bash
# Description: Verify all calls to send_one_sided_to_stealth_address have been updated

echo "=== Searching for calls to send_one_sided_to_stealth_address ==="
rg -A 5 "send_one_sided_to_stealth_address" --type rust

echo "=== Checking for potential compilation issues ==="
ast-grep --pattern 'send_one_sided_to_stealth_address($_, $_, $_)' 

Length of output: 3739


All invocations updated for the new signature – no further action required.

Verification summary:

  • Adapter definition in src-tauri/src/spend_wallet_adapter.rs now accepts view_wallet_manager.
  • Command in src-tauri/src/commands.rs passes &state.wallet_manager as the fourth argument.
  • No remaining calls with only three parameters (confirmed via ast-grep).
src/components/transactions/history/HistoryList.tsx (3)

23-23: Excellent refactoring to remove pending transaction logic.

The changes are well-executed and consistent:

  • Clean removal of pendingTransactions and combinedTransactions logic
  • Consistent use of transactions array throughout the component
  • Proper update of memoization dependencies
  • Maintains all existing functionality (infinite scroll, loading states, new transaction badges)

The refactoring aligns perfectly with the goal of streamlining the transaction history to show only confirmed transactions.

Also applies to: 32-77, 95-95


106-111: Enhanced transaction details with new TransactionDetails component.

The replacement of ItemExpand with TransactionDetails provides improved functionality including triple-click hidden details toggle and copy-to-clipboard features as mentioned in the AI summary.


14-14:

Details

✅ Verification successful

Verify the new TransactionDetails component import.

The component now imports TransactionDetails instead of the previous ItemExpand. Please ensure this component exists and has the expected interface.


🏁 Script executed:

#!/bin/bash
# Description: Verify the TransactionDetails component exists and check its interface

echo "=== Checking if TransactionDetails component exists ==="
fd "TransactionDetails.tsx" src/

echo "=== Checking the component interface ==="
cat src/components/transactions/history/details/TransactionDetails.tsx | head -50

Length of output: 2533


TransactionDetails component verified

The TransactionDetails component is present at src/components/transactions/history/details/TransactionDetails.tsx and exports the expected props interface:

  • item: TransactionInfo
  • expanded: boolean
  • handleClose: () => void

Import and usage in HistoryList.tsx are correct—no further action required.

src-tauri/src/process_utils.rs (1)

25-41: LGTM! Clean implementation of output control.

The addition of the allow_output parameter is well-implemented with clear conditional logic for controlling stdout/stderr piping. The implementation maintains consistency across both Windows and non-Windows platforms.

src/components/transactions/history/details/TransactionDetails.tsx (2)

26-37: LGTM! Well-implemented triple-click handler with proper cleanup.

The triple-click detection logic is correctly implemented with proper timeout cleanup and state management. The 300ms timeout is appropriate for detecting rapid clicks.


48-50:

Details

✅ Verification successful

Verify that TransactionInfo can be safely stringified.

The JSON.stringify(item) call assumes the TransactionInfo object doesn't contain circular references or non-serializable properties.

Let me verify the TransactionInfo structure to ensure safe JSON serialization:


🏁 Script executed:

#!/bin/bash
# Description: Verify TransactionInfo type definition and usage to ensure it's safe for JSON.stringify
# Expected: TransactionInfo should have simple, serializable properties

# Check the TransactionInfo interface definition
rg -A 20 "interface TransactionInfo" --type ts

# Check for any complex nested objects or potential circular references
ast-grep --pattern 'interface TransactionInfo {
  $$$
}'

Length of output: 1879


TransactionInfo is safe to JSON.stringify

I verified the TransactionInfo definition in src/types/app-status.ts—all properties are primitives (number, string, boolean, optional number). There are no methods, nested objects, or circular refs, so JSON.stringify(item) is safe as-is.

src/components/transactions/history/ListItem.tsx (4)

23-24: LGTM! Proper import of new utility functions.

The imports correctly reference the new centralized transaction utilities and the TransactionDirection enum, aligning with the refactoring effort to centralize transaction logic.


71-77: LGTM! Consistent use of new utility functions.

The refactoring correctly replaces the old helper functions with the new centralized utilities getTxTypeByStatus and getTxTitle, maintaining the same functionality while following the new architecture.


88-88: LGTM! Proper use of direction property.

The change from passing a computed type to using the transaction's direction property directly is cleaner and aligns with the new direction-based approach using the TransactionDirection enum.


26-32:

Details

❓ Verification inconclusive

Verify the truncation length change from 30 to 26.

The title truncation length was reduced from 30 to 26 characters. Please confirm this change is intentional and aligns with UI design requirements.

Let me check if this change is documented or if there are related UI layout changes:


🏁 Script executed:

#!/bin/bash
# Description: Check for any UI layout changes or design specifications related to title truncation
# Expected: Find context for the truncation length change

# Look for related truncation changes or comments
rg -i "truncate|26|30" --type tsx --type ts -A 3 -B 3

# Check for any CSS or styling changes that might affect title display
fd "ListItem.styles" --exec cat {}

Length of output: 5150


Verify Title Truncation Change
The threshold was reduced from 30 to 26 characters, but there’s no accompanying update in styles or documentation. Please confirm this aligns with the UI design spec.

• src/components/transactions/history/ListItem.tsx (lines 26–32)
displayTitle = title.length > 26 ? truncateMiddle(title, 8) : title
• No references to “26” or rationale found in ListItem.styles.ts or elsewhere

src-tauri/src/process_adapter.rs (2)

141-144: LGTM: Well-designed trait method signature.

The new async method signature is consistent with the existing trait pattern and provides a clear interface for process execution with output capture.


197-197:

Details

✅ Verification successful

Verify consistency with process_utils.rs signature.

The change to explicitly pass false for output capture aligns with the new parameter mentioned in the AI summary. Ensure this matches the updated launch_child_process function signature.


🏁 Script executed:

#!/bin/bash
# Description: Verify the launch_child_process function signature and its usage
# Expected: Function should accept boolean parameter for output control

ast-grep --pattern 'fn launch_child_process($$$, $ALLOW_OUTPUT: $_) $$$'

Length of output: 74


🏁 Script executed:

#!/bin/bash
# Search for the signature of launch_child_process in the codebase
rg "fn launch_child_process" -n
rg "launch_child_process" -n

Length of output: 567


🏁 Script executed:

#!/bin/bash
# Display the signature of `launch_child_process` in process_utils.rs
rg -n 'pub fn launch_child_process' -A5 src-tauri/src/process_utils.rs

Length of output: 272


Reviewed launch_child_process Signature and Usage
All calls to launch_child_process in process_adapter.rs now correctly pass the new allow_output: bool parameter (false), matching its definition in process_utils.rs (file_path, current_dir, envs, args, allow_output: bool). No further changes required.

src/store/useWalletStore.ts (1)

3-3: LGTM: Clean removal of unused import.

The removal of setWalletBalance import aligns with the broader refactor to eliminate pending transaction handling from the wallet store. The remaining refreshTransactions import is appropriate for the simplified transaction management approach.

src/types/transactions.ts (2)

1-6: LGTM: Good documentation and enum organization.

The comment about syncing with tari.rpc.rs is helpful for maintainability. Moving TransactionDirection to the top and explicitly exporting it improves code organization and discoverability.


8-24:

Details

❓ Verification inconclusive

Verify enum values align with backend definitions.

The expanded TransactionStatus enum includes many new values. Ensure these numeric values exactly match the backend enum definitions to prevent runtime issues.


🏁 Script executed:

#!/bin/bash
# Description: Search for the backend enum definition to verify alignment
# Expected: Find tari.rpc.rs file with matching enum values

fd -e rs -x grep -l "TransactionStatus\|enum.*Status" {} \; | head -5
ast-grep --pattern 'enum $_ {
  $$$
  Completed = $_,
  $$$
}'

Length of output: 1191


Verify TransactionStatus enum values match backend definitions

I was unable to locate a corresponding TransactionStatus enum in the Rust code here, so please confirm that the numeric values in src/types/transactions.ts exactly mirror those defined in your backend (e.g. gRPC/RPC proto or native Rust enum). A mismatch could cause subtle runtime bugs.

• Check the source of truth for TransactionStatus in the backend (e.g. .proto file or Rust crate)
• Ensure each status name and its integer value (0–14) align perfectly
• Update either side if there are any discrepancies

src-tauri/src/wallet_adapter.rs (2)

100-140: Well-structured transaction import implementation.

The method has excellent error handling with detailed logging at each step, making debugging easier. The JSON array wrapping is appropriate if the gRPC API expects multiple transactions.


198-198:

Details

❓ Verification inconclusive

Verify the payment ID field name change is compatible with the gRPC API.

The field name has been changed from tx.payment_id to tx.user_payment_id. Please ensure this change is compatible with the current gRPC API version and that all transactions have this field populated.

Run the following script to check if there are any other references to the old field name that might need updating:

Also applies to: 266-266


🏁 Script executed:

#!/bin/bash
# Description: Search for any remaining references to the old payment_id field in transaction contexts

# Search for payment_id references in Rust files that might be related to transactions
rg -A 3 -B 3 'tx\.payment_id|transaction.*payment_id' --type rust

# Also check for any proto definitions that might define these fields
fd -e proto | xargs rg 'payment_id|user_payment_id' || true

Length of output: 1844


Verify gRPC schema change for payment_iduser_payment_id

Please confirm that the upstream gRPC transaction message has been updated to replace payment_id with user_payment_id and that this field is populated in all responses. The Tauri adapter already maps tx.user_payment_id back to a JSON payment_id for the frontend, so no other code changes should be required—but you’ll need to ensure the gRPC definitions and server implementation align:

  • Check your .proto transaction message to verify it defines user_payment_id (and no longer defines payment_id).
  • Ensure the gRPC server populates user_payment_id on every transaction.
  • Since the adapter maps tx.user_payment_idpayment_id in the JSON API, existing frontend code (e.g. transaction.payment_id) will continue to work.
src-tauri/src/spend_wallet_adapter.rs (3)

108-138: Excellent refactoring for improved modularity and maintainability.

Breaking down the transaction flow into discrete steps (execute_recovery_command, execute_sync_command, execute_send_one_sided_command) makes the code more maintainable and testable. The export/import flow cleverly prevents direct broadcasting while allowing the view wallet to manage the transaction.


281-328: Comprehensive error reporting with Sentry integration.

Excellent implementation of error reporting that captures all relevant context (exit code, stdout, stderr, command details) for debugging production issues. The combination of Sentry events and local logging provides both immediate visibility and long-term monitoring.


378-389: Good application of DRY principle with helper methods.

Extracting base node information retrieval into dedicated methods eliminates code duplication and makes the code more maintainable.

Copy link
Copy Markdown

@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: 2

🔭 Outside diff range comments (2)
src/components/transactions/send/SendModal.tsx (2)

116-117: 🛠️ Refactor suggestion

Consider moving hardcoded fee values to configuration.

The network fee and fee percentage are hardcoded, which could lead to maintenance issues and may not reflect actual network conditions.

Consider implementing a dynamic fee calculation system or at least moving these values to a configuration file or constants that can be easily updated. For example:

// In a constants file or configuration
export const TRANSACTION_FEES = {
    NETWORK_FEE: 0.06,
    FEE_PERCENTAGE: 0.02
};

// Then use in the component
networkFee={TRANSACTION_FEES.NETWORK_FEE}
feePercentage={TRANSACTION_FEES.FEE_PERCENTAGE}

71-82: 🛠️ Refactor suggestion

Consider refreshing transactions after successful send.

After a successful transaction (line 75), the transaction list should be refreshed to show the new pending transaction. Since refreshTransactions was imported but not used, this might have been the intended functionality.

Add transaction refresh after successful send:

 await invoke('send_one_sided_to_stealth_address', {
     ...payload,
     amount: payload.amount.toString(),
 });
 setStatus('completed');
+await refreshTransactions();

Note: If you implement this change, keep the refreshTransactions import instead of removing it as suggested in the previous comment.

♻️ Duplicate comments (2)
src/utils/getTxStatus.ts (2)

17-35: ⚠️ Potential issue

Fix counterintuitive status categorization.

The txStates.pending array includes TransactionStatus.Completed, which is semantically incorrect. A completed transaction should not be categorized as pending.

Apply this diff to fix the categorization:

 const txStates = {
     pending: [
-        TransactionStatus.Completed,
         TransactionStatus.Pending,
         TransactionStatus.Broadcast,
         TransactionStatus.Coinbase,
         TransactionStatus.Queued,
+        TransactionStatus.OneSidedUnconfirmed,
     ],
     failed: [TransactionStatus.Rejected, TransactionStatus.NotFound, TransactionStatus.CoinbaseNotInBlockChain],
     complete: [
+        TransactionStatus.Completed,
         TransactionStatus.Imported,
-        TransactionStatus.OneSidedUnconfirmed,
         TransactionStatus.OneSidedConfirmed,
         TransactionStatus.MinedConfirmed,
         TransactionStatus.MinedUnconfirmed,
         TransactionStatus.CoinbaseConfirmed,
         TransactionStatus.CoinbaseUnconfirmed,
     ],
 };

47-53: 🛠️ Refactor suggestion

Improve type safety and error handling.

The function has potential runtime issues due to dynamic object key access without proper type safety.

Apply this diff to improve type safety:

 export function getTxStatusTitleKey(transaction: TransactionInfo): string | undefined {
-    return Object.keys(txStates).find((key) => {
-        if (txStates[key].includes(transaction.status)) {
-            return key;
-        }
-    });
+    for (const [key, statuses] of Object.entries(txStates)) {
+        if (statuses.includes(transaction.status)) {
+            return key;
+        }
+    }
+    return undefined;
 }
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3923164 and b8681a7.

📒 Files selected for processing (5)
  • src-tauri/src/commands.rs (2 hunks)
  • src-tauri/src/wallet_adapter.rs (7 hunks)
  • src-tauri/src/wallet_manager.rs (3 hunks)
  • src/components/transactions/send/SendModal.tsx (1 hunks)
  • src/utils/getTxStatus.ts (1 hunks)
🧰 Additional context used
🪛 GitHub Check: Run linters
src/components/transactions/send/SendModal.tsx

[warning] 10-10:
'refreshTransactions' is defined but never used. Allowed unused vars must match /^_/u

🪛 GitHub Actions: Lint
src/components/transactions/send/SendModal.tsx

[warning] 10-10: 'refreshTransactions' is defined but never used. Allowed unused vars must match /^_/u

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: tauri-build
  • GitHub Check: cargo checks (fmt, clippy, check)
🔇 Additional comments (12)
src-tauri/src/commands.rs (3)

1891-1892: LGTM: Function signature update is well-motivated.

The addition of the app_handle parameter enables wallet balance update events to be emitted after transaction submission, which improves the user experience by keeping the UI synchronized.


1902-1902: LGTM: Function call updated correctly.

The function call properly passes the new view_wallet_manager parameter as indicated in the AI summary, maintaining consistency with the updated method signature.


1905-1909: LGTM: Balance update logic is well-implemented.

The implementation properly retrieves the wallet balance and emits an update event only on success. The error handling is appropriate - if balance retrieval fails, it doesn't prevent the main transaction from succeeding, which is the correct behavior.

src-tauri/src/wallet_manager.rs (3)

30-30: LGTM: Import addition is necessary.

The WalletBalance import is required for the new get_balance method.


173-176: LGTM: get_balance method follows established patterns.

The method correctly delegates to the adapter's get_balance method while maintaining the same error handling pattern used throughout the codebase.


194-205: LGTM: import_transaction method with proper validation.

The method includes appropriate validation by checking if the wallet is running before attempting the import operation. The error handling and delegation pattern is consistent with other methods in the class.

src/utils/getTxStatus.ts (2)

37-45: LGTM: Transaction type logic is well-structured.

The function correctly categorizes transactions by type based on their status and direction, with appropriate fallback to 'unknown' for unhandled cases.


54-77: LGTM: Title generation logic with good prioritization.

The function implements a clear hierarchy for title generation:

  1. Mined transactions show block height
  2. Transactions with meaningful payment messages show the message
  3. Fallback to type and status combination

The logic appropriately handles edge cases like excluding default messages and differentiating between complete and pending states.

src-tauri/src/wallet_adapter.rs (4)

101-111: LGTM! Clean implementation of balance retrieval.

The get_balance method properly handles connection errors and uses the new from_response helper for type conversion.


211-211: Good simplification of payment ID extraction.

The change from PaymentId::from_bytes(&tx.user_payment_id).user_data_as_string() to PaymentId::stringify_bytes(&tx.user_payment_id) simplifies the API usage while maintaining the same functionality.

Also applies to: 279-279


323-326: Verify the reduced threshold is sufficient for reliable detection.

The threshold for detecting if the wallet was scanned before the gRPC service started has been reduced from 10 to 5. While this improves responsiveness, ensure this is sufficient to avoid false positives on slower systems.

Consider monitoring this in production to ensure the reduced threshold doesn't cause premature returns on slower systems or during high load.


717-728: Well-structured helper methods for WalletBalance conversion.

The addition of from_response and from_option methods provides a clean API for converting gRPC responses into the domain model, with proper handling of optional values.

@brianp brianp merged commit e997c6b into tari-project:main Jun 4, 2025
8 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.

3 participants