Page MenuHomePhabricator

[Cashtab] [Chronik] getTokenStats refactor
AbandonedPublic

Authored by emack on Jun 17 2022, 04:53.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

Refactors the getTokenStats() function in useBCH.js to retrieve token info via the chronik client and deprecates the use of bch-js' BCH.SLP.Utils.tokenStats() api call.

This diff maps chronik-client's token() response into the existing tokenStats object that Cashtab is familiar with. This ensures no downstream impacts to other parts of Cashtab that calls upon getTokenStats() since the attributes in the tokenStats object remain unchanged.

The existing behaviour to return false if an invalid response is received has remained unchanged.

Test Plan

npm start
navigate to a token
look up the token ID in explorer.be.cash
ensure the token stats match between what is shown in Cashtab vs in the genesis tx shown in explorer
burn some of the token in the wallet's possession
refresh the sendToken component and ensure the circulating supply and total burned stats have been updated

Diff Detail

Repository
rABC Bitcoin ABC
Branch
tokenStatsRefactor
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 19398
Build 38529: Build Diffcashtab-tests
Build 38528: arc lint + arc unit

Event Timeline

emack requested review of this revision.Jun 17 2022, 04:53

Looks good although need to lose the husky changes.

Let's sit on this for now until we have chronik managing the wallet utxos. The working mock-up of using chronik to run the utxo battery (D11385) instead of bch-api also preserves existing Cashtab data handling structures, but when we get to that stacked diff it's possible we will find an opportunity to simplify that structure as part of the chronik migration.

This revision now requires changes to proceed.Jun 17 2022, 17:22

Please rebase and see where we are at with this now that the utxo battery is landed

To be repushed as a fresh diff