Page MenuHomePhabricator

[Cashtab] Create new getBalanceSats function in wallet dir
ClosedPublic

Authored by bytesofman on Jan 17 2024, 05:22.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCa1edaacb40a2: [Cashtab] Create new getBalanceSats function in wallet dir
Summary

Introduce new function getBalanceSats which gets the total balance in satoshis from an array of chronik utxos

This is part of a broader effort to reduce technical debt in Cashtab. This is step 1 of a series of diffs to combine <BalanceHeader>, <BalanceHeaderFiat>, <ZeroBalanceHeader> components into one standardized component that also shows distinction between spendable balance and total balance.

Looking to replace getWalletBalanceFromUtxos function from cashMethods. However, a number of new functions and refactors need to happen to achieve this goal.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
helpers
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 26419
Build 52408: Build Diffcashtab-tests
Build 52407: arc lint + arc unit

Event Timeline

bytesofman edited the summary of this revision. (Show Details)
Fabien requested changes to this revision.Jan 17 2024, 08:41
Fabien added a subscriber: Fabien.

Let's not replicate the errors from the past. Computing the balance from a utxo set clearly belongs to the wallet, not in some kitchen sink "util" directory.

cashtab/src/utils-v2/index.js
3

Please use a newline

This revision now requires changes to proceed.Jan 17 2024, 08:41

wallet not utils-v2, line breaks in code comments

bytesofman retitled this revision from [Cashtab] Initialize utils-v2 dir to contain refactor functions to [Cashtab] Create new getBalanceSats function in wallet dir.
bytesofman edited the summary of this revision. (Show Details)
bytesofman edited the test plan for this revision. (Show Details)
Fabien added inline comments.
cashtab/src/wallet/index.js
3–6 ↗(On Diff #44279)
This revision is now accepted and ready to land.Jan 17 2024, 13:19