Page MenuHomePhabricator

[Cashtab] Enable special features if wallet has specific eToken
ClosedPublic

Authored by josephroyking on Sat, Feb 20, 22:07.

Details

Summary

Add a method to check the wallet for an arbitrary token. Conditionally render react component if token balance found. This diff includes one feature inspired by https://dogechain.info/

This can be extended for other token-enabled features e.g. dark mode, token minting, token icons.

Test Plan

npm test to verify new method

Ping me in slack with your eToken address and I'll send you some tabcash to enable testing this specific feature.

Verify feature is enabled for wallet with a balance of the tabcash eToken. Verify feature is disabled for wallets without a balance in tabcash.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

majcosta requested changes to this revision.Mon, Feb 22, 19:50
majcosta added a subscriber: majcosta.
majcosta added inline comments.
web/cashtab/src/utils/tokenMethods.js
2–9 ↗(On Diff #27752)

the code is self-explanatory enough that these comments are just noise. I suggest using for..of instead of regular for to make it even simpler

This revision now requires changes to proceed.Mon, Feb 22, 19:50

Implementing suggested changes

This revision is now accepted and ready to land.Mon, Feb 22, 20:22