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.