Skip to content

fix(zcoin): ARRR not reappearing in coins list after deactivation and reactivation#3184

Merged
CharlVS merged 9 commits intodevfrom
bugfix/zcash-reactivation
Oct 16, 2025
Merged

fix(zcoin): ARRR not reappearing in coins list after deactivation and reactivation#3184
CharlVS merged 9 commits intodevfrom
bugfix/zcash-reactivation

Conversation

@takenagain
Copy link
Copy Markdown
Contributor

@takenagain takenagain commented Oct 14, 2025

Fixes the issue reported of ARRR not reappearing in the coins list if deactivated and reactivated using the "Add assets" toggle.

Minor ZHTLC improvements:

  • The scan interval and blocks per iteration fields are now in a collapsed "Advanced configuration section".
  • A button to modify zcoin sync config is now in the coin details page.

Unfortunately, cancelling an in-progress activation is more involved and would be best left as a follow-up enhancement in the next release. Already tracked in #3178

image image

Steps to reproduce the bug on walletrc.web.app

  1. Create or import a wallet
  2. Navigate to the "Add assets" page
  3. Activate ARRR and wait for activation to finish
  4. Navigate back to the "Add assets" page
  5. Deactivate ARRR, then reactivate it (can be with or without a delay between actions)
  6. Navigate back to the coins list and observe that ARRR is no longer in the list.
  7. Refresh page and log back into wallet
  8. Observe that ARRR activates and appears in the coins list as expected

Summary by CodeRabbit

  • New Features

    • Add ZHTLC configuration button in coin details for supported assets.
    • Introduce advanced configuration section (toggleable) with additional parameters and warnings.
    • Add new localization strings for ZHTLC configuration.
  • Improvements

    • Allow updating ZHTLC settings for already activated coins without full restart.
    • Enhance activation status bar: clearer error display and longer visibility for final errors.
  • Chores

    • Update version-control ignore rules to exclude a new local folder.
    • Bump SDK submodule revision (no functional changes).

Note

Adds a ZHTLC config button with advanced settings, handles already-activated assets, improves activation status/error handling, and updates i18n/initialization.

  • ZHTLC Configuration & Activation:
    • CoinsRepo: Skips activation for already-activated assets, broadcasts active state, subscribes to balances, registers icons, and adds to wallet metadata; avoids suspending on user-cancelled config and no longer throws on such errors (lib/bloc/coins_bloc/coins_repo.dart).
    • Service: ArrrActivationService now constructed with MM2; adds updateZhtlcConfig to disable coin via disable_coin and save new config (lib/services/arrr_activation/arrr_activation_service.dart, lib/main.dart).
  • UI:
    • Coin details: New ZhtlcConfigButton to edit sync config for ZHTLC coins; integrates dialog, updates config, and reactivates coin (lib/views/wallet/coin_details/.../coin_details_common_buttons.dart).
    • Config dialog: Adds collapsible "Advanced configuration" (scan interval, blocks/iter) with warning; layout tweaks (lib/views/wallet/wallet_page/common/zhtlc/zhtlc_configuration_dialog.dart).
    • Status bar: Keeps final errors visible longer and uses structured ErrorDisplay (lib/views/wallet/wallet_page/common/zhtlc/zhtlc_activation_status_bar.dart).
  • i18n:
    • Adds keys for advanced config and button; tweaks titles/labels (assets/translations/en.json, lib/generated/codegen_loader.g.dart).

Written by Cursor Bugbot for commit 6a15cb8. This will update automatically on new commits. Configure here.

zcoin activation function simply discarded coins that were already active without notifying listeners to display the coin in UI
@takenagain takenagain added this to the v0.9.3 Release milestone Oct 14, 2025
@takenagain takenagain self-assigned this Oct 14, 2025
@takenagain takenagain added the bug Something isn't working label Oct 14, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 14, 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.

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.

Walkthrough

Adds ZHTLC configuration support and adjusts activation handling. Introduces an ArrrActivationService MM2 dependency and a method to update ZHTLC config by disabling coins before persisting. Updates UI to show a ZHTLC Config button and advanced options in the configuration dialog. Tweaks activation status bar and translations. Updates sdk submodule and .gitignore.

Changes

Cohort / File(s) Summary
Repo config
/.gitignore
Ignore .kiro/ directory.
Translations
/assets/translations/en.json
Add ZHTLC strings: zhtlcAdvancedConfiguration, zhtlcAdvancedConfigurationHint, zhtlcConfigButton; adjust commas.
Activation flow (repo)
/lib/bloc/coins_bloc/coins_repo.dart
Check if ZHTLC asset is already activated; if yes, broadcast active state, subscribe to balances (including parent), add to metadata, register custom icon; else proceed with standard activation.
Service wiring
/lib/main.dart
Construct ArrrActivationService(komodoDefiSdk, mm2); pass mm2, tradingStatusService, arrrActivationService into CoinsRepo. Register service in providers.
Arrr activation service
/lib/services/arrr_activation/arrr_activation_service.dart
Constructor adds MM2 dep; add updateZhtlcConfig(Asset, ZhtlcUserConfig); add _disableCoin(String coinId) using MM2 disable_coin; import MM2 and DisableCoinReq.
Wallet UI: ZHTLC config button
/lib/views/wallet/coin_details/coin_details_info/coin_details_common_buttons.dart
Add ZhtlcConfigButton. On tap: fetch asset, prompt for config, deactivate/reactivate via CoinsBloc, call ArrrActivationService.updateZhtlcConfig, update routing, show errors via SnackBar. Render button for subClass == zhtlc.
ZHTLC activation status bar
/lib/views/wallet/wallet_page/common/zhtlc/zhtlc_activation_status_bar.dart
Keep completed hidden; extend error retention to 60s; switch to ErrorDisplay widget with localized message; add _ActivationStatusDetails; minor UI padding and import update.
ZHTLC configuration dialog
/lib/views/wallet/wallet_page/common/zhtlc/zhtlc_configuration_dialog.dart
Add toggleable Advanced Configuration section with warning and fields (blocksPerIter, intervalMs); constrain width; retain sync form; minor import changes.
SDK submodule
/sdk
Update commit to 448eecc... from 679fd92...; no detected API/behavior changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as CoinDetails (ZhtlcConfigButton)
  participant Dialog as ZHTLC Config Dialog
  participant AAS as ArrrActivationService
  participant CR as CoinsRepo
  participant MM2 as MM2 RPC

  User->>UI: Tap "ZHTLC Config"
  UI->>Dialog: Open configuration dialog
  Dialog-->>UI: Return ZhtlcUserConfig
  UI->>AAS: updateZhtlcConfig(asset, newConfig)
  activate AAS
  AAS->>MM2: disable_coin(coinId) [if active]
  MM2-->>AAS: ok/error (logged)
  AAS-->>UI: persist config result
  deactivate AAS
  UI->>CR: Deactivate+Activate coin with new config
  CR->>CR: Check activation state
  alt Already active
    CR->>CR: Broadcast active, subscribe balances, parent checks, register icon
  else Not active
    CR->>CR: Standard activation (_activateZhtlcAsset)
  end
  CR-->>UI: Activation flow complete
  UI-->>User: Navigate to Wallet / show status
Loading
sequenceDiagram
  autonumber
  participant App as main.dart
  participant AAS as ArrrActivationService
  participant CR as CoinsRepo
  participant MM2 as MM2

  App->>AAS: Construct(komodoDefiSdk, mm2)
  App->>CR: Construct(kdfSdk, mm2, tradingStatusService, arrrActivationService)
  note over CR,AAS: Services wired with MM2-enabled config/activation paths
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

enhancement, QA

Suggested reviewers

  • CharlVS
  • smk762
  • AndrewDelaney

Poem

A rabbit taps the config key, hop-hop—
ZHTLC tunes unlock with a pop.
Disable, tweak, re-ignite the chain,
Buttons bloom, translations gain.
Burrows wired to MM2’s lane—
Wallet whispers, “All set again.” 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title concisely and accurately summarizes the main change by specifying that the fix addresses ARRR not reappearing in the coins list after deactivation and reactivation, which directly matches the pull request objectives. It follows a clear conventional commit style with a relevant scope, avoiding unnecessary detail while conveying the essential context.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@takenagain takenagain changed the title fix(zcoin): fix(zcoin): ARRR not reappearing in coins list after deactivation and reactivation Oct 14, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 14, 2025

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

https://walletrc--pull-3184-merge-wj9jebhp.web.app

(expires Thu, 23 Oct 2025 15:36:31 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

@takenagain takenagain requested a review from Copilot October 14, 2025 23:22
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 a bug where ARRR (and other ZHTLC coins) would not reappear in the coins list after being deactivated and reactivated. Additionally, it improves the ZHTLC configuration dialog by organizing advanced settings into a collapsible section and adds a configuration button to the coin details page.

  • Fixed ZHTLC coin reappearing issue by checking for already-activated assets during activation
  • Improved ZHTLC configuration dialog with collapsible advanced settings section
  • Added ZHTLC configuration button to coin details page for easier access to sync settings

Reviewed Changes

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

Show a summary per file
File Description
sdk Updated subproject commit
lib/views/wallet/wallet_page/common/zhtlc/zhtlc_configuration_dialog.dart Reorganized UI to move advanced settings into collapsible section
lib/views/wallet/wallet_page/common/zhtlc/zhtlc_activation_status_bar.dart Enhanced error display and increased error status duration
lib/views/wallet/coin_details/coin_details_info/coin_details_common_buttons.dart Added ZHTLC configuration button to coin details page
lib/services/arrr_activation/arrr_activation_service.dart Added updateZhtlcConfig method for modifying configurations
lib/main.dart Updated ArrrActivationService constructor to include MM2 dependency
lib/bloc/coins_bloc/coins_repo.dart Fixed core bug by checking for already-activated assets during activation
assets/translations/en.json Added new translation keys for advanced configuration UI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@takenagain
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 14, 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.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f042412 and 04e4e0f.

⛔ Files ignored due to path filters (1)
  • lib/generated/codegen_loader.g.dart is excluded by !**/generated/**
📒 Files selected for processing (9)
  • .gitignore (1 hunks)
  • assets/translations/en.json (1 hunks)
  • lib/bloc/coins_bloc/coins_repo.dart (1 hunks)
  • lib/main.dart (1 hunks)
  • lib/services/arrr_activation/arrr_activation_service.dart (2 hunks)
  • lib/views/wallet/coin_details/coin_details_info/coin_details_common_buttons.dart (4 hunks)
  • lib/views/wallet/wallet_page/common/zhtlc/zhtlc_activation_status_bar.dart (4 hunks)
  • lib/views/wallet/wallet_page/common/zhtlc/zhtlc_configuration_dialog.dart (4 hunks)
  • sdk (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-04-01T15:51:37.060Z
Learnt from: takenagain
PR: KomodoPlatform/komodo-wallet#2566
File: lib/bloc/coins_bloc/coins_bloc.dart:10-10
Timestamp: 2025-04-01T15:51:37.060Z
Learning: In the Komodo Wallet project, part files share imports with their parent files. The import for `app_config.dart` in `coins_bloc.dart` is necessary because the part file `coins_state.dart` uses `excludedAssetList` from that package.

Applied to files:

  • lib/views/wallet/coin_details/coin_details_info/coin_details_common_buttons.dart
  • lib/views/wallet/wallet_page/common/zhtlc/zhtlc_activation_status_bar.dart
🪛 GitHub Actions: takenagain is validating code guidelines 🚀
lib/main.dart

[error] 1-1: Target of URI doesn't exist: 'package:komodo_defi_framework_example/services/secure_storage_service.dart'.

sdk

[error] 9-9: Missing concrete implementations of 'abstract class IBinanceProvider.fetch24hrTicker', 'abstract class IBinanceProvider.fetchExchangeInfo', 'abstract class IBinanceProvider.fetchExchangeInfoReduced', and 'abstract class IBinanceProvider.fetchKlines'.


[error] 6-6: Target of URI doesn't exist: 'package:kdf_sdk_example/main.dart'.


[error] 4-4: Target of URI doesn't exist: 'package:mocktail/mocktail.dart'.


[error] 12-12: Missing concrete implementations of 'abstract class ApiClient.executeRpc'.


[warning] 1-1: include_file_not_found: The include file 'package:very_good_analysis/analysis_options.yaml' can't be found.


[error] 1-1: Target of URI doesn't exist: 'package:kdf_sdk_example/widgets/assets/asset_item.dart'.


[error] 1-1: Target of URI doesn't exist: 'package:komodo_defi_framework_example/services/secure_storage_service.dart'.


[error] 2-2: Target of URI doesn't exist: 'package:komodo_symbol_converter/komodo_symbol_converter.dart'.


[error] 14-14: The function 'registerFallbackValue' isn't defined.

⏰ 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). (2)
  • GitHub Check: Build Desktop (windows)
  • GitHub Check: Build Mobile (Android)

@takenagain takenagain marked this pull request as ready for review October 15, 2025 00:25
@takenagain takenagain added the QA Ready for QA Testing label Oct 15, 2025
@takenagain takenagain requested review from CharlVS and smk762 October 15, 2025 00:30
Copy link
Copy Markdown
Collaborator

@smk762 smk762 left a comment

Choose a reason for hiding this comment

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

Confirmed ARRR appears in the portfolio list after activation cycling (via both the disable button in coin page, and toggle in activation list).

LGTM, thanks!

Copy link
Copy Markdown
Collaborator

@CharlVS CharlVS left a comment

Choose a reason for hiding this comment

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

Great work! Thank you for fixing it swiftly, @takenagain.

In the future, let's revisit what changes/shortfalls need addressing in KW/SDK so that KW doesn't need to manually call activation/deactivation RPCs.

mismatch of assumptions: activateArrr returns an activation error result rather than throwing an exception, so it has to be rethrown in the error handler for it to bubble up.

there is also a mismatch between single and multiple activations, but that is fine for now since single activations are all that are present
@CharlVS CharlVS merged commit 8ee26a4 into dev Oct 16, 2025
7 of 13 checks passed
@CharlVS CharlVS deleted the bugfix/zcash-reactivation branch October 16, 2025 16:02
@coderabbitai coderabbitai bot mentioned this pull request Oct 26, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 29, 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 QA Ready for QA Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants