Skip to content

fix(wallet): open Send for silent payment addresses scanned on home - #199

Merged
theanmolsharma merged 7 commits into
CypherCommons:masterfrom
chaitika:fix/home-sp-scan
Oct 14, 2026
Merged

theanmolsharma merged 7 commits into
CypherCommons:masterfrom
chaitika:fix/home-sp-scan

Conversation

@chaitika

@chaitika chaitika commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #197.

Changes

  • Silent payment addresses: scanning or pasting one on home now opens Send prefilled, either on its own or inside a bitcoin: link.
  • Errors on home: scans that home can't open now show an error. An address valid on another network gets its own message naming the active network; anything else gets "Shroud doesn't recognize this code or text."
  • New routing result: navigationRouteFor is replaced by destinationFor, which returns { send } | { electrumServer } | { error }. Home does the navigation itself and passes the walletID SendDetails needs, so the @ts-ignore is gone.
  • Scheme cleanup: the bitcoin: scheme is cleaned up in one place, used by both routing and bip21decode. Labels containing :// and mixed-case Bitcoin:// now parse correctly. isBitcoinAddress is replaced by private helpers.
  • bitcoin= prefix: no longer accepted. It isn't BIP21, and it used to open Send with the whole string as the address.
  • setelectrumserver links: a link with no usable server or a malformed % escape returns unrecognized instead of throwing or opening empty settings. url.parse is replaced by a prefix check.
  • Dead code: the widget routes and the unused context parameter are removed.
  • Paste on home: hidden when the clipboard has no text. Before, it showed and did nothing.
  • Test fixtures: e2e specs share silent payment addresses from tests/fixtures/addresses.js, and 07-contacts reads its strings from loc/en.json.
  • Not covered: bitcoin:?sp= links are still unrecognized; see Support BIP-321 sp= payment links #202.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 14:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Address normalization drops the previously accepted bitcoin=<address> format.

1 open finding
What changed in this PR

Adds silent-payment address routing and clearer scan errors on the wallet home screen.

Changes:

  • Recognizes silent-payment addresses on the active network.
  • Distinguishes wrong-network and unrecognized inputs.
  • Adds unit and end-to-end coverage.
File Description
class/​deeplink-schema-match.ts Adds network-aware routing results.
screen/​wallets/​WalletsList.tsx Routes scans or displays errors.
loc/​en.json Adds scan error messages.
tests/​unit/​deeplink-schema-match.test.js Tests routing and network handling.
tests/​e2e/​05-send.spec.js Tests home-screen scanning flows.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread class/deeplink-schema-match.ts Outdated
Comment thread class/deeplink-schema-match.ts Outdated
Comment thread class/deeplink-schema-match.ts Outdated
Comment thread class/deeplink-schema-match.ts Outdated
Comment thread class/deeplink-schema-match.ts Outdated
Comment thread class/deeplink-schema-match.ts Outdated
Comment thread tests/unit/deeplink-schema-match.test.js Outdated
Comment thread tests/unit/deeplink-schema-match.test.js
Comment thread tests/unit/deeplink-schema-match.test.js Outdated
Comment thread tests/e2e/05-send.spec.js Outdated
Comment thread tests/e2e/05-send.spec.js
The contacts spec copied its strings out of loc/en.json, so a copy edit
there only showed up as a waitFor timeout. en.json is plain data, so the
spec now imports it directly.

The silent payment addresses move into tests/fixtures so other specs and
unit tests can use the same ones.
The app has no widget, and nothing passes navigationRouteFor a context,
so the shroud://widget?action= branch could never route anywhere. The
branch, isWidgetAction and the unused context parameter are removed.
A setelectrumserver link with a malformed % escape threw from
decodeURIComponent, and url.parse can throw on its own for some inputs.
A link with no server, or one that didn't parse, still opened Electrum
settings, which then did nothing with it.

The decode is guarded inside getServerFromSetElectrumServerAction, the
url.parse check becomes a prefix check, and the link only routes when
it carries a server.
Scanning or pasting something home couldn't route did nothing, with no
feedback. navigationRouteFor called back only on success.

destinationFor replaces it and returns where the input should open, or
that it's unrecognized. Home shows an error alert for unrecognized input
and does the navigation itself, passing the wallet ID SendDetails
requires, so the @ts-ignore on the spread route goes away.
Scanned input had its scheme cleaned up in three places, three different
ways. The route rewrote the first :// anywhere in the string, so a label
such as http://example.com lost its slashes. bip21decode only rewrote
three exact spellings, so Bitcoin://addr decoded to the address //addr.

A single helper now trims the input, unwraps shroud:bitcoin: and rewrites
a leading bitcoin: or bitcoin:// in any case to bitcoin:. Routing and
bip21decode both use it, so Send always receives a lowercase bitcoin:
URI. The address is extracted once and checked against a given network,
replacing isBitcoinAddress.

The old bitcoin= prefix is no longer stripped. It isn't BIP21, and an
input such as bitcoin=<address> opened Send with that whole string as the
address, so it is now reported as unrecognized.
Scanning or pasting a silent payment address on home reported it as
unrecognized, because only addresses bitcoinjs can parse counted as
payable. They now open Send prefilled, bare or inside a bitcoin: URI.

An address that is valid on another network, such as a signet address
while the wallet is on mainnet, gets its own error naming the active
network instead of the generic one.

A bitcoin: URI with only an sp= parameter (BIP-321) is still
unrecognized and left as a TODO.
getClipboardContent returns undefined when the clipboard holds no text
or reading it is turned off. undefined?.trim().length === 0 is false, so
Paste was offered anyway and tapping it did nothing.
Copilot AI balanced review requested due to automatic review settings October 14, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@theanmolsharma
theanmolsharma merged commit cb69b67 into CypherCommons:master Oct 14, 2026
4 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.

Scanning a silent payment address on the home screen does nothing

3 participants