Skip to content

fix(activation): add assets deactivation state updates and silently activate coins needed for NFT#3031

Merged
CharlVS merged 7 commits intodevfrom
bugfix/nft-auto-coin-activation
Aug 1, 2025
Merged

fix(activation): add assets deactivation state updates and silently activate coins needed for NFT#3031
CharlVS merged 7 commits intodevfrom
bugfix/nft-auto-coin-activation

Conversation

@takenagain
Copy link
Copy Markdown
Contributor

@takenagain takenagain commented Jul 31, 2025

Fixes the following issues:

  • Deactivating a coin in the "Add Assets" page does not reflect on the main wallet page.
  • Deactivated NFT coins reappearing after deactivation (e.g. AVAX, FTM, BNB, ETH).
  • Possible duplication of coins in the "Add Assets" page when filtering and sorting. This could happen because the legacy usdPrice and address fields were added to the Coin model props for backwards-compatible UI/state updates.
  • Filters out NFT_ coins from the private key export list

Summary by CodeRabbit

  • Refactor

    • Improved code formatting and readability across several areas of the app.
    • Simplified method signatures and removed unused parameters for cleaner code.
    • Adjusted the order of state updates for more responsive UI during coin removal.
    • Updated activation methods to allow optional addition to wallet metadata and notification control.
  • Style

    • Unified and streamlined code style for better maintainability and consistency.

@takenagain takenagain added this to the v0.9.2 Release milestone Jul 31, 2025
@takenagain takenagain self-assigned this Jul 31, 2025
@takenagain takenagain added the bug Something isn't working label Jul 31, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 31, 2025

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.

Walkthrough

This change introduces an optional addToWalletMetadata parameter to the activateAssetsSync and activateCoinsSync methods in CoinsRepo, allowing control over wallet metadata updates during activation. Related refactoring and formatting improvements were made in coins_manager_bloc.dart and nft_main_repo.dart, with minor logic adjustments for coin activation and removal.

Changes

Cohort / File(s) Change Summary
CoinsRepo Activation & Deactivation Logic
lib/bloc/coins_bloc/coins_repo.dart
Added optional addToWalletMetadata parameter (default true) to activateAssetsSync and activateCoinsSync methods; conditional wallet metadata update; deactivation disables coin RPC calls but still broadcasts state changes.
Coins Manager Bloc Refactor & Formatting
lib/bloc/coins_manager/coins_manager_bloc.dart
Refactored for improved readability and formatting; removed unused parameters from _tryActivateCoin and _tryDeactivateCoin; reordered state emission and async deactivation in coin removal; no functional logic changes.
NFTs Repo Activation Call Update
lib/bloc/nfts/nft_main_repo.dart
Reformatted constructor; updated _activateParentCoins to call activateCoinsSync with notify: false and addToWalletMetadata: false, changing activation behavior for parent coins.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant CoinsManagerBloc
    participant CoinsRepo
    participant WalletMetadata

    UI->>CoinsManagerBloc: User requests coin activation
    CoinsManagerBloc->>CoinsRepo: activateCoinsSync(coins, addToWalletMetadata)
    alt addToWalletMetadata = true
        CoinsRepo->>WalletMetadata: Add coins to metadata
    end
    CoinsRepo-->>CoinsManagerBloc: Activation complete
    CoinsManagerBloc-->>UI: Update state/UI
Loading
sequenceDiagram
    participant NftsRepo
    participant CoinsRepo
    participant WalletMetadata

    NftsRepo->>CoinsRepo: activateCoinsSync(parentCoins, notify: false, addToWalletMetadata: false)
    Note right of CoinsRepo: Skips wallet metadata update
    CoinsRepo-->>NftsRepo: Activation complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Suggested labels

QA

Suggested reviewers

  • smk762
  • CharlVS

Poem

A hop, a skip, a wallet tweak—
Coins now know just what to seek.
Metadata’s optional, oh what fun,
Activation’s smarter, the work is done!
With code refactored, neat and bright,
This bunny’s hopping with delight.
🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/nft-auto-coin-activation

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 31, 2025

Visit the preview URL for this PR (updated for commit 5661859):

https://walletrc--pull-3031-merge-6smzf6cw.web.app

(expires Thu, 07 Aug 2025 20:04:36 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

@takenagain
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 31, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

legacy usdPrice and address fields were added to the Coin model props, which could result in duplication when those fields are updated while the user is filtering
@takenagain takenagain force-pushed the bugfix/nft-auto-coin-activation branch from 4698217 to e55f366 Compare July 31, 2025 13:42
@takenagain takenagain marked this pull request as ready for review July 31, 2025 13:52
@takenagain takenagain requested review from CharlVS, Copilot and smk762 July 31, 2025 13:52
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 fixes issues with coin activation and deactivation states in the wallet's "Add Assets" page and prevents deactivated NFT coins from reappearing. The changes focus on improving state synchronization, preventing coin duplication, and ensuring proper silent activation of NFT parent coins.

Key changes:

  • Added silent activation mechanism for NFT parent coins to avoid unwanted notifications
  • Implemented unique filtering to prevent coin duplication in the assets list
  • Improved state management for coin activation/deactivation flows

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
lib/model/coin.dart Adds unique filtering extension to prevent coin duplication
lib/bloc/nfts/nft_main_repo.dart Enables silent activation of NFT parent coins without notifications
lib/bloc/coins_manager/coins_manager_bloc.dart Improves coin list management and state updates for responsive UI
lib/bloc/coins_bloc/coins_repo.dart Adds parameters for controlling wallet metadata updates and notifications during activation
Comments suppressed due to low confidence (1)

lib/model/coin.dart:285

  • The parameter name 'inplace' should be 'inPlace' to follow Dart naming conventions for camelCase.
  List<E> unique(Id Function(E element) id, [bool inplace = true]) {

takenagain and others added 2 commits July 31, 2025 15:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@takenagain takenagain linked an issue Jul 31, 2025 that may be closed by this pull request
@takenagain takenagain closed this Jul 31, 2025
@takenagain takenagain deleted the bugfix/nft-auto-coin-activation branch July 31, 2025 19:34
@takenagain takenagain restored the bugfix/nft-auto-coin-activation branch July 31, 2025 20:01
@takenagain takenagain reopened this Jul 31, 2025
@CharlVS CharlVS merged commit 6773056 into dev Aug 1, 2025
16 of 24 checks passed
smk762 pushed a commit that referenced this pull request Aug 1, 2025
…ctivate coins needed for NFT (#3031)

* fix(nft): do not add auto-activated parents to the wallet coins list

* fix(coins-repo): notify listeners for disabling in add assets page

* fix(add-assets): sync state, remove child coins, and formatting

* fix(add-assets): deduplicate coins list

legacy usdPrice and address fields were added to the Coin model props, which could result in duplication when those fields are updated while the user is filtering

* fix(coins-manager): create copy of selectedCoins

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(private-keys): filter out excluded assets from the private keys

* refactor(private-keys): clone list from SDK before mutating

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
smk762 pushed a commit that referenced this pull request Aug 1, 2025
…ctivate coins needed for NFT (#3031)

* fix(nft): do not add auto-activated parents to the wallet coins list

* fix(coins-repo): notify listeners for disabling in add assets page

* fix(add-assets): sync state, remove child coins, and formatting

* fix(add-assets): deduplicate coins list

legacy usdPrice and address fields were added to the Coin model props, which could result in duplication when those fields are updated while the user is filtering

* fix(coins-manager): create copy of selectedCoins

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(private-keys): filter out excluded assets from the private keys

* refactor(private-keys): clone list from SDK before mutating

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
smk762 pushed a commit that referenced this pull request Aug 1, 2025
…ctivate coins needed for NFT (#3031)

* fix(nft): do not add auto-activated parents to the wallet coins list

* fix(coins-repo): notify listeners for disabling in add assets page

* fix(add-assets): sync state, remove child coins, and formatting

* fix(add-assets): deduplicate coins list

legacy usdPrice and address fields were added to the Coin model props, which could result in duplication when those fields are updated while the user is filtering

* fix(coins-manager): create copy of selectedCoins

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(private-keys): filter out excluded assets from the private keys

* refactor(private-keys): clone list from SDK before mutating

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
smk762 pushed a commit that referenced this pull request Aug 1, 2025
…ctivate coins needed for NFT (#3031)

* fix(nft): do not add auto-activated parents to the wallet coins list

* fix(coins-repo): notify listeners for disabling in add assets page

* fix(add-assets): sync state, remove child coins, and formatting

* fix(add-assets): deduplicate coins list

legacy usdPrice and address fields were added to the Coin model props, which could result in duplication when those fields are updated while the user is filtering

* fix(coins-manager): create copy of selectedCoins

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(private-keys): filter out excluded assets from the private keys

* refactor(private-keys): clone list from SDK before mutating

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
smk762 pushed a commit that referenced this pull request Aug 1, 2025
…ctivate coins needed for NFT (#3031)

* fix(nft): do not add auto-activated parents to the wallet coins list

* fix(coins-repo): notify listeners for disabling in add assets page

* fix(add-assets): sync state, remove child coins, and formatting

* fix(add-assets): deduplicate coins list

legacy usdPrice and address fields were added to the Coin model props, which could result in duplication when those fields are updated while the user is filtering

* fix(coins-manager): create copy of selectedCoins

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(private-keys): filter out excluded assets from the private keys

* refactor(private-keys): clone list from SDK before mutating

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
smk762 pushed a commit that referenced this pull request Aug 1, 2025
…ctivate coins needed for NFT (#3031)

* fix(nft): do not add auto-activated parents to the wallet coins list

* fix(coins-repo): notify listeners for disabling in add assets page

* fix(add-assets): sync state, remove child coins, and formatting

* fix(add-assets): deduplicate coins list

legacy usdPrice and address fields were added to the Coin model props, which could result in duplication when those fields are updated while the user is filtering

* fix(coins-manager): create copy of selectedCoins

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(private-keys): filter out excluded assets from the private keys

* refactor(private-keys): clone list from SDK before mutating

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@takenagain takenagain deleted the bugfix/nft-auto-coin-activation branch August 4, 2025 09:38
smk762 pushed a commit that referenced this pull request Aug 8, 2025
…ctivate coins needed for NFT (#3031)

* fix(nft): do not add auto-activated parents to the wallet coins list

* fix(coins-repo): notify listeners for disabling in add assets page

* fix(add-assets): sync state, remove child coins, and formatting

* fix(add-assets): deduplicate coins list

legacy usdPrice and address fields were added to the Coin model props, which could result in duplication when those fields are updated while the user is filtering

* fix(coins-manager): create copy of selectedCoins

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(private-keys): filter out excluded assets from the private keys

* refactor(private-keys): clone list from SDK before mutating

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(filter): NFT coins displayed in private keys list

3 participants