Skip to content

Add CashConnect HD Wallet support#177

Merged
mr-zwets merged 3 commits intocashonize:cashconnect_hd_supportfrom
jimtendo:cashconnect_hd_support
Feb 15, 2026
Merged

Add CashConnect HD Wallet support#177
mr-zwets merged 3 commits intocashonize:cashconnect_hd_supportfrom
jimtendo:cashconnect_hd_support

Conversation

@jimtendo
Copy link
Contributor

@jimtendo jimtendo commented Feb 14, 2026

This MR adds HD Wallet support to CashConnect.

How it works (high-level)

  1. For HD Wallets, the "purpose" in the derivation path is set to 5001 (CashConnect) and a "Master" CashConnect Private Key is derived from it (which is then used to derive other Private Keys per Dapp by hashing it + the domain). We do this to keep CashConnect as naive about the Mnemonic and other secrets as possible - enhances security. For Single/WIF Wallets, we just use their Private Key as the CC Master Private Key (same as before).
  2. For Transaction Building, CashConnect just expects a list of UTXOs. This list was already being provided, but wasn't being married up with the corresponding Private Keys. So, we use the same approach that Mainnet uses internally (wallet.walletCache) to lookup the Private Keys per each address (UTXO).

Other Changes

  • Mostly just UI and Translation cleanups.
  • (Inadvertantly) Fixes bug where CashConnect was still accessible and could still authenticate, despite using HD Wallet (couldn't find the root cause of this, but this behaviour is no longer needed in any case).
  • Better handling of "Change Wallet" for CashConnect: Previously this would be "stuck" on the first Wallet when page was loaded (whereas it now changes correctly).
  • Some typing updates that allows some @ts-ignore statements to be removed (Promise -> Promisable).
  • There are some whitespace corrections (done automatically by my IDE).

Other Notes

  • I do get some Electrum Connection error notifications displaying occasionally when switching wallets - but I don't think this is related to any of these changes or CashConnect. I'm also not sure if it's actually causing an error state in practice (it might just be the notification handling that is buggy).
  • PLEASE FEEL FREE TO MODIFY/REMOVE ANY CODE COMMENTS YOURSELF. I put these here just to help clarify the flow and the "why", but some codebases might consider them overly verbose.

Signed-off-by: James Zuccon <zuccon@gmail.com>
Signed-off-by: James Zuccon <zuccon@gmail.com>
@jimtendo jimtendo marked this pull request as ready for review February 14, 2026 04:04
Signed-off-by: James Zuccon <zuccon@gmail.com>
Copy link
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

Adds CashConnect HD wallet support by deriving a CashConnect-specific master key from HD wallets and ensuring transaction-building can sign UTXOs using the correct per-address private keys.

Changes:

  • Bump cashconnect dependency to 0.0.25.
  • Update CashConnect store initialization to support HD wallets (CashConnect purpose 5001) and to sign UTXOs using per-address keys from walletCache.
  • UI/i18n cleanup: remove “HD not supported” messaging and add new CashConnect notification strings.

Reviewed changes

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

Show a summary per file
File Description
yarn.lock Updates lockfile for cashconnect@0.0.25.
package.json Pins cashconnect dependency to 0.0.25.
src/stores/store.ts Removes HD gating and refactors CashConnect lifecycle management (start/stop, wallet-change handling).
src/stores/cashconnectStore.ts Implements HD master-key derivation and UTXO→privateKey mapping for signing; adds start/stop/disconnect helpers.
src/components/connectDapp.vue Makes CashConnect store always available and always renders CC sessions.
src/components/cashconnect/CCSessions.vue Updates session disconnect action to use store helper.
src/components/walletOnboarding.vue Removes “CashConnect not supported on HD” note in one onboarding flow.
src/components/settings/addWallet.vue Removes “CashConnect not supported on HD” note.
src/i18n/locales/en.json Removes HD-not-supported text and adds new CashConnect notification strings.
src/i18n/locales/es.json Same as en.json for Spanish.
src/i18n/locales/fr.json Same as en.json for French.
Comments suppressed due to low confidence (2)

src/stores/store.ts:609

  • initializeCashConnect() only sets isCcInitialized on success. If cashconnectWallet.start() throws (more likely now that HD derivation/key lookup can fail), isCcInitialized stays false and waitForInitialized(isWcAndCcInitialized) will wait forever (no timeout). Set isCcInitialized in a finally block or introduce a separate “failed” state that unblocks the UI with an error.
    } catch (error) {
      console.error("Error initializing CashConnect:", error);
      Notify.create({
        message: t('store.errors.errorInitializingCashConnect'),
        icon: 'warning',

src/stores/store.ts:583

  • useCashconnectStore expects a Ref<WalletType> (supports HD wallets), but this call site casts _wallet to Ref<Wallet> (single-address). Now that CashConnect is intended to work with HD wallets, this cast undermines type-safety and can hide incorrect assumptions. Consider passing _wallet as Ref<WalletType> (from src/interfaces/interfaces) or updating the imported type accordingly.
      // Initialize CashConnect.
      const cashconnectWallet = useCashconnectStore(_wallet as Ref<Wallet>);


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mr-zwets mr-zwets changed the base branch from main to cashconnect_hd_support February 15, 2026 11:03
@mr-zwets mr-zwets merged commit dfb63bb into cashonize:cashconnect_hd_support Feb 15, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants