Page MenuHomePhabricator

[Cashtab] Upgrade SLPv1 genesis txs
ClosedPublic

Authored by bytesofman on Feb 21 2024, 19:48.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABCd8bddc7c3fcf: [Cashtab] Upgrade SLPv1 genesis txs
Summary

Have had helper functions in here for awhile but was working on the best way to implement.

For a Genesis tx, I think it's best to preserve the existing SendXec function and simply load it with targetOutputs that match SLP spec. We do not need to select any token utxo inputs for a genesis tx.

Modify getSlpGenesisTargetOutput function to return to-spec target outputs for a fixed supply genesis tx. Implement in CreateTokenForm.js.

The resulting tx differs from the legacy tested tx only in having a better calculated fee.

Test Plan

npm test

npm start and create an etoken with an icon to make sure this works (or trust me on this one, I did it and it does work)

image.png (74×491 px, 8 KB)

Diff Detail

Repository
rABC Bitcoin ABC
Branch
coinselect-slp
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27305
Build 54173: Build Diffcashtab-tests
Build 54172: arc lint + arc unit

Event Timeline

version bump, improve comments

bytesofman added inline comments.
cashtab/src/components/Etokens/__tests__/CreateTokenForm.test.js
74 ↗(On Diff #45461)

old one loaded in electrum, change is 9501.52

image.png (706×795 px, 74 KB)

74 ↗(On Diff #45461)

updated tx, change is 9503.11 (better fee calc) -- otherwise the same

image.png (545×795 px, 62 KB)

cashtab/src/slpv1/__tests__/index.test.js
29 ↗(On Diff #45461)

txBuilder takes a buffer for script, which is complicated to store in JSON mocks. So, we test the function result against script.toString('hex'), same as before.

document new param, change param order

This revision is now accepted and ready to land.Feb 22 2024, 11:58
This revision was automatically updated to reflect the committed changes.