Page MenuHomePhabricator

[Cashtab][Pt 2/2] Parse Airdrops in TxHistory - using cashtabCache to get airdrop token name
ClosedPublic

Authored by kieran709 on Oct 10 2022, 20:26.

Details

Summary

Added cashtabCache to context exports in useWallet.js, passed cashtabCache through Home.js to Tx.js. Added logic in Tx.js to look for the index of data.parsed.airdropTokenId in cashtabCache.tokenInfoById, if it is found, the tokenName is added to the Tx.

Depends on D12195

Test Plan

cd web/cashtab && npm start
if there are no sent or received airdrop txs in recent tx history, make them
observe that the token name is now visible under the token icon

Diff Detail

Event Timeline

Add "Depends on D12195" to the Summary field of this diff to allow others to pull it for review.

This revision now requires changes to proceed.Oct 11 2022, 16:35

Get errors when I npm start on this

image.png (628×493 px, 111 KB)

Responding to review feedback

bytesofman added inline comments.
web/cashtab/src/components/Home/Tx.js
694 ↗(On Diff #35948)

Why Object.entries(cashtabCache.tokenInfoById).indexOf(<tokenId>)

and not

Object.keys.includes(<tokenId>)

?

This revision now requires changes to proceed.Oct 24 2022, 17:59

Fixed overly complicated conditional rendering per review feedback.

This revision is now accepted and ready to land.Oct 26 2022, 14:03