[Cashtab] Add ability to send an OP return msg in a tx
Summary:
- Added a collapsible 'Advanced' section on the Send UI above the Send button that allows the user to input an optional OP_RETURN message as part of their Send XEC transaction.
- The OP_RETURN logic in useBCH.js only executes if the user has supplied a non-empty string message, otherwise the transaction builder simply builds the standard send/change outputs.
- If a message was supplied, it is added as Output #0 to the transaction prior to the send/change outputs.
- Message validation via the use of maxLength attribute, limiting the input field to 150 characters. Technically the limit is 255 chars but there have been reports of bchjs errors well under that limit, hence the nominal limit of 150 for now.
This diff supersedes D10363 due to commit conflicts.
Test Plan:
- npm start
- send XEC with no message and verify no OP_RETURN output in explorer and no regression to existing send XEC transaction
- send XEC with an empty string message (bunch of spaces) and verify no OP_RETURN output in explorer
- send XEC with a message and verify OP_RETURN output in explorer
- send XEC via the MAX amount button with a message and verify OP_RETURN output in explorer
- fill out the OP_Return message but collapse the Advanced section. Click send and verify OP_RETURN message is still sent in explorer
- attempt to send XEC with a message greater than 150 characters and verify the 151st character and beyond are cut off within the input field
- send XEC with a message containing symbols or spaces, and verify OP_RETURN output in explorer
- attempt to send message with no XEC value input and verify the Send button is disabled
- attempt to send message with less than 5.5 XEC value input and verify the Send button is disabled
- verify cross browser compatibility in firefox
- npm run extension
- retest the above in browser extension mode
Reviewers: bytesofman, #bitcoin_abc
Reviewed By: bytesofman, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D10486