Skip to content

refactor: create FundingWidget to top up identity and add funds with QR code on wallet page#416

Closed
lklimek wants to merge 54 commits into
v1.0-devfrom
feat/wallet-address-top-up
Closed

refactor: create FundingWidget to top up identity and add funds with QR code on wallet page#416
lklimek wants to merge 54 commits into
v1.0-devfrom
feat/wallet-address-top-up

Conversation

@lklimek
Copy link
Copy Markdown
Contributor

@lklimek lklimek commented Jul 23, 2025

NOTE: Requires #419 to be merged first.

  • New component introduced, FundingWidget, that is used everywhere where we have funding (top up identity, create identity, wallet addresses list)
  • Added button to generate new address if the user wants more privacy (based on community feedback)
  • On list of addresses, added button to top up selected core address that is showing dialog with QR code
  • Create new identity flow changed - now it waits for funding first

Known bugs

Bugs that are also present on v1.0-dev, to be handled separately:

  1. Funding with existing asset locks doesn't work for me
  2. When topping up with QR code, I enter 0.5 DASH, then I send 1 DASH. As a result, identity is topped up with 1 DASH, expected: 0.5 DASH.

Copilot's summary

This pull request introduces significant changes to the wallet and UI components, primarily focusing on simplifying the codebase by removing unused features and improving modularity. Key changes include the addition of a new method for calculating wallet balances, removal of multiple UI screens related to funding methods, and enhancements to the WalletFundedScreenStep enum.

Wallet Enhancements:

  • Added a max_balance method to the Wallet model to calculate the total balance by summing all UTXOs (src/model/wallet/mod.rs).

UI Simplification:

  • Removed unused UI screens for funding methods, including:
    • by_using_unused_asset_lock.rs
    • by_using_unused_balance.rs
    • by_wallet_qr_code.rs
    • by_using_unused_asset_lock.rs under top_up_identity_screen.
  • Added a new funding_widget module to the UI components (src/ui/components/mod.rs).

Codebase Improvements:

  • Enhanced the WalletFundedScreenStep enum by:
    • Adding an is_processing method to check if the wallet is in a processing state.
    • Implementing the Display trait for better string representation (src/ui/identities/funding_common.rs).
  • Changed funding_common to a public module for broader accessibility (src/ui/identities/mod.rs).

These changes collectively streamline the codebase, reduce redundancy, and improve the maintainability of wallet-related functionalities.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 23, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/wallet-address-top-up

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.
  • 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.

Support

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

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 generate unit tests to generate unit tests for 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.

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

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.

@lklimek lklimek force-pushed the feat/wallet-address-top-up branch from c3ca58a to 2302750 Compare July 23, 2025 15:49
@lklimek lklimek requested review from QuantumExplorer, Copilot and pauldelucia and removed request for QuantumExplorer and pauldelucia July 23, 2025 16:13

This comment was marked as outdated.

@lklimek lklimek moved this to In review / testing in Platform team Jul 28, 2025
@lklimek lklimek changed the base branch from v1.0-dev to refactor/amount-input July 28, 2025 17:13
@lklimek lklimek requested a review from Copilot July 28, 2025 17:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a centralized FundingWidget component to streamline funding operations across the application, replacing multiple scattered funding implementations with a single, reusable component. The refactor consolidates wallet funding, asset lock usage, and QR code generation into one cohesive interface.

Key changes include:

  • Created a new FundingWidget component that handles all funding scenarios (wallet balance, asset locks, QR codes)
  • Replaced separate funding screens with the unified widget in identity creation and top-up flows
  • Added wallet address top-up functionality with QR code support in the wallets screen

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/ui/components/funding_widget.rs New centralized funding component with comprehensive funding method support
src/ui/wallets/wallets_screen/mod.rs Added funding widget integration and top-up modal for wallet addresses
src/ui/identities/top_up_identity_screen/mod.rs Refactored to use the new funding widget instead of custom implementations
src/ui/identities/add_new_identity_screen/mod.rs Simplified identity creation flow using the funding widget
Multiple by_*.rs files Removed redundant funding method implementations

Comment thread src/ui/components/funding_widget.rs Outdated
Comment thread src/ui/components/funding_widget.rs Outdated
.show(ui, |ui| {
ui.vertical(|ui| {
// Render the widget and get response
let funding_widget = self.funding_widget.as_mut().expect("Checked above");
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

[nitpick] Using expect with a custom message is good, but consider using a more descriptive message that explains the actual condition being checked (e.g., "FundingWidget should be Some when funding_widget.is_some() returns true").

Suggested change
let funding_widget = self.funding_widget.as_mut().expect("Checked above");
let funding_widget = self.funding_widget.as_mut().expect("FundingWidget should be Some because self.funding_widget.is_none() was checked above");

Copilot uses AI. Check for mistakes.
Comment thread src/ui/identities/top_up_identity_screen/mod.rs
Comment on lines +158 to +159
/// Track existing UTXOs at the time the address was set up
/// This is used when ignore_existing_utxos is true to filter out pre-existing UTXOs
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

The existing_utxos_snapshot field needs documentation explaining its purpose in filtering pre-existing UTXOs when ignore_existing_utxos is enabled.

Suggested change
/// Track existing UTXOs at the time the address was set up
/// This is used when ignore_existing_utxos is true to filter out pre-existing UTXOs
/// A snapshot of existing UTXOs (Unspent Transaction Outputs) at the time the funding address was set up.
/// This field is used in conjunction with the `ignore_existing_utxos` flag. When `ignore_existing_utxos` is set to true,
/// the `existing_utxos_snapshot` is used to filter out UTXOs that existed prior to the funding process, ensuring that
/// only newly created UTXOs are considered for funding. This helps prevent double-counting or unintended reuse of
/// pre-existing funds.

Copilot uses AI. Check for mistakes.
Comment thread src/ui/identities/add_new_identity_screen/mod.rs Outdated
Base automatically changed from refactor/amount-input to v1.0-dev July 31, 2025 07:07
@lklimek lklimek marked this pull request as draft August 6, 2025 07:07
@lklimek lklimek closed this Jan 20, 2026
@github-project-automation github-project-automation Bot moved this from In review / testing to Done in Platform team Jan 20, 2026
@lklimek lklimek deleted the feat/wallet-address-top-up branch February 26, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants