Page MenuHomePhabricator

[Cashtab] Store token balances as string and not BigNumber p1/2
AbandonedPublic

Authored by bytesofman on Dec 4 2022, 15:37.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

T2836, T2614

Stop storing token balances as BigNumber. Store as string. Do all calculations as BigNumber.

This prevents type loss when saved in and retrieved from indexedDb

Note: A hard migration is not required here. Cashtab still supports loading the old type. Wallets will eventually migrate to the new type as they are used.

Test Plan

On the master branch, create a few wallets with some tokens
Check out this diff
npm start
Activate one of the wallets
Wait to see Token balances stored as string in the dev console
Check wallet state in local storage to confirm token balances are saved as a string
Send a token tx
Burn a token
Confirm no dev log errors on SendToken page
Confirm no dev log error son CreateToken page
Create a token
Switch to another one of your wallets with token balance
Check dev log for This wallet has token balance stored as a BigNumber
Wait to see Token balances stored as string in the dev console
Switch back to original wallet
Check dev log for This wallet has token balance stored as a string

Diff Detail

Repository
rABC Bitcoin ABC
Branch
store-tokenbalance-as-string
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 21363
Build 42376: Build Diffcashtab-tests
Build 42375: arc lint + arc unit