HomePhabricator

[Cashtab] [no BigNumber in indexedDb p1/2] Store etoken balances as strings

Description

[Cashtab] [no BigNumber in indexedDb p1/2] Store etoken balances as strings

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

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Subscribers: emack

Differential Revision: https://reviews.bitcoinabc.org/D12759

Details

Provenance
bytesofmanAuthored on Dec 4 2022, 23:56
bytesofmanPushed on Dec 5 2022, 12:37
Reviewer
Restricted Project
Differential Revision
D12759: [Cashtab] [no BigNumber in indexedDb p1/2] Store etoken balances as strings
Parents
rABC96e618e6ab3c: [Chronik] Add `-chronik` and `-chronikbind` command line options
Branches
Unknown
Tags
Unknown