[Cashtab] [Chronik] [Tx Gen] Generate encoded OP_RETURN script
Summary:
As per T2503, this is part of a series of diffs to refactor the transaction generation process within useBCH.
This diff is a standalone utility function which generates an encoded OP_RETURN script to reflect the various OP_RETURN powered send XEC permutations involving messaging, encryption, eToken IDs and airdrops.
The existing OP_RETURN script generation logic in sendXec() has a bit of repetition based on the permutations, which this diff seeks to optimize by using a building block approach to the script array rather than rebuilding the entire script for each permutation.
This diff does not change any existing functionality within the codebase.
Test Plan:
npm start
npm test
observe the successful execution of new useBCH.test.js unit tests
Reviewers: bytesofman, #bitcoin_abc
Reviewed By: bytesofman, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D11626