HomePhabricator

[Cashtab] parse sats from scanned qr code amount param

Description

[Cashtab] parse sats from scanned qr code amount param

Summary:
Cashtab does not parse parameters from an address nor does it remove them if they are present. However, it does validate for cashAddr format.

In its current state, Cashtab will throw a validation error after scanning a QR code with parameters.

This diff (1) Removes any scanned parameters from the address when entered into the 'to' field and
(2) parses for an amount param, and passes it to the amount field (Send BCHA screen only).

Its designed to work with mercurymessenger.io, which uses the prefix ecash: and satoshis after the amount param.

Test Plan:

  1. Generate a QR code at mercurymessenger.io
  2. npm start to run Cashtab locally
  3. Attempt to scan your mercurymessenger.io QR code from the Send screen
  4. Observe address is populated with bitcoincash: prefix and amount is populated with satoshis converted to BCHA
  5. Scan normal QR codes with no params and observe no amount is input into the amount field
  6. Scan the mercurymessenger.io QR code with param from the SendToken.js screen and observe no amount is input into the amount field

Reviewers: alcipir, majcosta, Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

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

Details

Provenance
Joey King <joseph.roy.king@gmail.com>Authored on Jan 15 2021, 13:55
bytesofmanPushed on Jan 15 2021, 13:55
Reviewer
Restricted Project
Differential Revision
D8907: [Cashtab] parse sats from scanned qr code amount param
Parents
rABCf472f3394cb4: gui: use PACKAGE_NAME in exception message
Branches
Unknown
Tags
Unknown