Support bch-wif: protohandler for sweeping CashStamps - #452
Merged
Conversation
Contributor
Author
Contributor
Author
Contributor
Author
|
Follow-up: verified the full funded sweep end-to-end (real on-chain BCH), not just recognition. A genuine CashStamp key was generated (
This exercises the complete CashStamps path: |
peachbits
approved these changes
Jul 13, 2026
j0ntz
enabled auto-merge
July 13, 2026 17:57
CashStamps encode their private key as bch-wif:<WIF>. Strip the <code>-wif: protohandler prefix in parseUri so the existing private-key sweep flow handles it. The prefix is derived from the wallet's own currency code, so it can only ever match this coin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Description
Asana task
Support sweeping CashStamps, which encode their private key as
bch-wif:${WIF}— a normal WIF with abch-wif:protohandler prefix. Edge already supports sweeping a bare WIF, butparseUrirejected anything with an unrecognized URI scheme, sobch-wif:...threwInvalidUriErrorand the sweep never started.parseUrinow strips a leading<currencyCode>-wif:prefix (e.g.bch-wif:for BCH) before parsing, so the remaining bare WIF flows through the existing private-key detection inparsePathnameand the standard sweep path. The prefix is derived from the wallet's own currency code, so it can only ever match its own coin. A bare WIF and all other URIs are unaffected.No GUI change is required: the app's sweep flow already consumes
parsedUri.privateKeys.Token (CashToken) sweeping is intentionally out of scope here — it depends on broader CashToken support that is still incoming — and is left as a follow-up.
Tests: added
parseUrifixtures for the BCH plugin coveringbch-wif:(compressed, non-compressed, and uppercase-prefix) →{ privateKeys: [<bare WIF>] }.Verified end-to-end on iOS sim against the patched plugin (DEBUG_CURRENCY_PLUGINS dev-server): entering
bch-wif:<WIF>in Scan → Enter is recognized as a BCH private key (wallet picker filtered to BCH), advances to the "Sweep Funds From Private Key" modal, and on confirm the sweep executes against the key (returning "Private key has no funds" for the empty test WIF). Screenshots attached.Note
Low Risk
Small, early guard in URI parsing that reuses existing WIF sweep logic; no changes to signing or broadcast.
Overview
parseUriin sharedCurrencyToolsnow removes a leading<currencyCode>-wif:prefix (e.g.bch-wif:) before URI parsing, so CashStamps-style strings no longer hitInvalidUriErrorand the bare WIF is handled by existingparsePathnameprivate-key detection. Matching is scoped to each plugin’s own currency code (case-insensitive on the prefix).BCH
parseUrifixtures were added for compressed, non-compressed, and uppercase-prefixbch-wif:inputs. CHANGELOG documents the feature under Unreleased.Reviewed by Cursor Bugbot for commit 89b8321. Bugbot is set up for automated code reviews on this repo. Configure here.