* As per T1967, this diff upgrades the OP_RETURN message logic to propose a Cashtab prefix for messages sent from Cashtab, in addition to the existing prefix which differentiates message transactions from eToken transactions.
* The parsing logic is also updated to delineate between a Cashtab generated message vs an externally generated message (e.g. electrum) in transaction history.
When sending OP_RETURN messages from within Cashtab, the following script is proposed (see lines 960-964 in useBCH.js)
> OP_RETURN opcode
> [Transaction Type] - '6d02' hex (621 in text) indicates this is a message, rather than eToken or NFT tx
> [Protocol ID] - '313030' hex (100 in text) indicates this is a message sent via Cashtab.com
> [Message] - the message content
When parsThe following OP_RETURN messages, the parseTxData() logic in useBCH.js is now updated as follows:prefix hex codes are proposed in this diff and will be added to an eCash specific prefix standard separately:
* checks whether an output contains addresses, if not, assume its a message or eToken tx> opReturnPrefixHex: '6a',
* if 'OP_RETURN 5262419' (eToken) is not present in the asm property then assume this is a message> opReturnPushDataHex: '04',
* strip out the 'OP_RETURN' opcode via removeOpReturnPrefixes()> cashtabPrefixHex: '00746162',
* in the remaining string, if the '3158065' cashtab prefix exist then set isCashtabMessage boolean to true and extract the remaining substring as the message content.
* If no cashtab prefix just set the whole string as the message content.> eTokenPrefixHex: '534c5000',
In terms of Styling:When parsing OP_RETURN messages, the parseTxData() logic in useBCH.js is now updated as follows:
* props.theme.primary is used for cashtab generated messages via <CashtabM* checks whether an output contains addresses, if not, assume its either a messageLabel>e or eToken tx
* props.theme.secondary is used for externally generated messages <MessageLabel>* if the output's hex property contains the eToken prefix, then apply eToken logic
{F5146574}* if the output's hex property contains the cashtab message prefix, then apply cashtab message rendering logic
* else, assume it is an external message e.g. from electrum and apply external message rendering logic
Unit tests:{F5146574}
* mockTxDataWithPassthrough.js updated with the additional cashtab prefix and mockParsedTxs.js updated with the new isCashtabMessage property to test OP_RETURN messages with and without the Cashtab prefix in the asm property.