HomePhabricator

[Cashtab] Support bip21 param from URL

Description

[Cashtab] Support bip21 param from URL

Summary:
Support new bip21 param in url at Cashtab's send screen. Parse it as a bip21 query string.

Background
Cashtab supports tx requests from webapps by parsing tx information from URL params.

Before this diff, only address and value are supported. PayButton and cashtab-components use this approach.

After this diff, we continue to support address and value params in a backwards compatible way.

Future
We should migrate to only supporting bip21 param. All new webapp features should be added through this param, which is flexible and has a well-defined spec. There is no spec for the legacy Cashtab approach. We should maintain support for the legacy approach until it is not required by PayButton or cashtab-components.

Reviewer notes
The various cases to handle in this diff are unfortunately somewhat complex (bip21 or legacy? if legacy, do you have only value and not address? is legacy valid? are legacy params duplicated?). However, automated integration tests for how specific inputs are rendered are straightforward to add for this feature. Simplification should be achieved by deprecating support for legacy params when feasible.

Test Plan: npm test

Reviewers: #bitcoin_abc, PiRK, Fabien

Reviewed By: #bitcoin_abc, PiRK, Fabien

Subscribers: Fabien, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D15262

Details

Provenance
bytesofmanAuthored on Jan 24 2024, 01:00
bytesofmanPushed on Jan 25 2024, 14:33
Reviewer
Restricted Project
Differential Revision
D15262: [Cashtab] Support bip21 param from URL
Parents
rABC8001490901d4: [Cashtab] Delete function that is handled better by lib
Branches
Unknown
Tags
Unknown