Page MenuHomePhabricator

[Cashtab] [Chronik] [Tx Gen] Token transaction refactor - part 3 burnToken
ClosedPublic

Authored by emack on Oct 19 2022, 13:53.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

Depends on D12306

As per T2503

Refactor the burnToken function to utilize the newly landed generateTxInput & generateTxOutput utility functions, as well as the new approach of signing input UTXOs, building tx and broadcasting via the chronik client.

Test Plan

npm start
burn an existing token and verify tx on explorer (fee, token change, xec change...etc)
burn a newly created token and verify tx on explorer (fee, token change, xec change...etc)
burn max balance of token and verify tx on explorer there are no token change outputs

Diff Detail

Repository
rABC Bitcoin ABC
Branch
createTokenRefactor
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 20629
Build 40922: Build Diffcashtab-tests
Build 40921: arc lint + arc unit

Event Timeline

emack requested review of this revision.Oct 19 2022, 13:53
emack planned changes to this revision.EditedOct 19 2022, 13:55

Need to figure out why chronik is getting confused

image.png (173×657 px, 47 KB)

e.g. attempting to broadcast a burn 1 x HIP token tx to chronik but it seems to be adding 2 decimal places to it.

image.png (108×725 px, 20 KB)

Setting skipSlpCheck to true in order to bypass the chronik safety mechanism in place to avoid accidental token burns.

Failed tests logs:

====== CashTab Unit Tests: useBCH hook Throws error attempting to burn an eToken ID that is not within the wallet's utxo ======
Error: expect(received).toStrictEqual(expected) // deep equality

Expected: [Error: No token UTXOs for the specified token could be found.]
Received: [Error: Invalid token tx input parameter]
    at Object.<anonymous> (/work/web/cashtab/src/hooks/__tests__/useBCH.test.js:262:29)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

Each failure log is accessible here:
CashTab Unit Tests: useBCH hook Throws error attempting to burn an eToken ID that is not within the wallet's utxo

updated token burn unit test

This revision is now accepted and ready to land.Oct 24 2022, 17:15