HomePhabricator

[Cashtab] Upgrade transaction history to parse and display OP_RETURN messages

Description

[Cashtab] Upgrade transaction history to parse and display OP_RETURN messages

Summary:
End to end updates to tx history logic to enable the parsing of OP_RETURN outputs and render them as part of the Transaction History tab.

  • Updated useBCH.js's parseTxData function to extract the asm value from the getTxData JSON response, which is then parsed to determine whether it is an eToken tx with OP_RETURN outputs or a genuine OP_RETURN message encoded output
  • The message content is then decoded into text and returned as part of parseTxData() back all the way up to Tx.js, which conditionally renders the message if it exists
  • Updated mockParsedTxs.js and mockTxDataWithPassthrough.js to incorporate the new opReturnMessage parameter that is now being returned from parseTxData() in useBCH.js, as well as new message-centric mocks

This diff supersedes D10408 due to commit conflicts.

Test Plan:

  • Have a simple node js script ready to send OP_RETURN messages
  • npm start
  • Send a normal tx from address A to address B with no message to ensure no regression on XEC sending function
  • Send outbound OP_RETURN tx from address A to address B with normal message string
  • Send outbound OP_RETURN tx from address B to address A with normal message string
  • verify both inbound and outbound OP_RETURN messages are displayed in the Transaction History tab for both wallets and not for other non-message txs
  • Send outbound OP_RETURN tx from address A to address B with empty string (bunch of spaces) message. Once D10486 lands, this message will not displayed in Cashtab as empty string messages are ignored in D10486's useBCH.js sendBCH() function. It will be displayed if you're reviewing this diff independently.
  • Send outbound OP_RETURN tx from address A to address B with a message containing over 150 characters (D10486 limits to 150 chars and below) and verify this is displayed appropriately by being cut off at appropriate height and width limits. This is to guard against mischievious users purposely spamming insanely long messages via nodejs to distort other users' tx history screen
  • Send outbound OP_RETURN tx from address A to address B with a message containing an extra long word and verify the long word is broken into multiple lines and height clipping CSS applied if necessary
  • Send outbound token tx and ensure the new OP_RETURN parsing logic in useBCH.js does not break existing eToken parsing logic
  • verify cross-browser compatibility in Firefox
  • npm run extension
  • verify OP_RETURN messages are displayed in extension mode

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

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

Details

Provenance
emackAuthored on Nov 18 2021, 04:40
emackPushed on Nov 18 2021, 21:45
Reviewer
Restricted Project
Differential Revision
D10485: [Cashtab] Upgrade transaction history to parse and display OP_RETURN messages
Parents
rABCb898d04c1e49: -[Docs] copyedit docs title
Branches
Unknown
Tags
Unknown