Page MenuHomePhabricator

[Cashtab] Add function to generate an OP_RETURN output for an airdrop tx
ClosedPublic

Authored by bytesofman on Nov 3 2023, 20:20.

Details

Summary

Per title.

Note: this function is not currently implemented in the app.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
airdrop-msgs-helpers
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25540
Build 50661: Build Diffcashtab-tests
Build 50660: arc lint + arc unit

Event Timeline

cashtab/src/opreturn/index.js
15 ↗(On Diff #42947)

this could be done in a separate diff....done here as this is the first diff where adding this function means we don't have to repeat this comment describing specific library behavior of utxolib's op_return parsing, trivial change, and covered by existing unit tests

emack requested changes to this revision.Nov 4 2023, 02:56
emack added a subscriber: emack.
emack added inline comments.
cashtab/src/opreturn/fixtures/vectors.js
62 ↗(On Diff #42947)

Airdrop messages can include emojis and non-english characters as per current OP_RETURN messaging designs, so will need to include these in test vectors.

image.png (657×550 px, 64 KB)

cashtab/src/opreturn/index.js
68 ↗(On Diff #42947)

isValidTokenId() already checks for tokenId being a non-string so no need to revalidate it again here

82 ↗(On Diff #42947)

Should check for bunch of spaces which we don't want to take up script space. Current sendXec() logic ignores them for OP_RETURN generation.

This revision now requires changes to proceed.Nov 4 2023, 02:56
bytesofman marked 3 inline comments as done.

Add unit test for non-standard utf8 characters, remove double validation check for tokenId as string, check for multiple blank spaces and add unit test for this case

This revision is now accepted and ready to land.Nov 8 2023, 23:01