Page MenuHomePhabricator

[ecash-herald] Label addresses with emoji based on balance
ClosedPublic

Authored by bytesofman on Jun 21 2023, 22:18.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC7ccd5edc3c18: [ecash-herald] Label addresses with emoji based on balance
Summary

T2972

Add logic to the app to get balance information of addresses before msg is generated. This allows tagging addresses with creature emojis depending on their wealth.

Requires a good deal of support and helper functions to get to this feature.

  • mocked chronik had to be upgraded to support chronik.script.utxos()
  • Need to save the responses from chronik.script.utxos() to mocks to be able to do unit tests with these mocks
  • Add emojis and balance thresholds to config
Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
whale-watch
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24189
Build 47988: Build Diffecash-herald-tests
Build 47987: arc lint + arc unit

Event Timeline

Note: blocks.js goes from less than 1MB to over 30MB by including all the utxos

Mocking all of these chronik calls ... is probably overkill.

Or, having so many test blocks is overkill. If we don't mock the utxos, then we are hand waving a lot of app logic.

rebase with smaller mocks file

Removing most of the blocks didn't really reduce the size of the mocks by too much (30+ mb down to 23 mb)

will cut out some more blocks. depends on block having an address with many utxos.

only get output scripts of rendered outputs

Adjust set of test blocks to remove the largest by size

remove incidental formatting changes unrelated to this diff

bytesofman retitled this revision from [ecash-herald] Label addresses with em emoji based on balance to [ecash-herald] Label addresses with emoji based on balance.Jun 26 2023, 19:55

Do not hide generateMocks.js

Fabien requested changes to this revision.Jun 27 2023, 18:12
Fabien added a subscriber: Fabien.
Fabien added inline comments.
apps/ecash-herald/src/chronik.js
55 ↗(On Diff #41009)

Remove or format properly so it doesn't look like it's a debug string.

apps/ecash-herald/src/parse.js
75 ↗(On Diff #41009)

You don't need the else

apps/ecash-herald/src/utils.js
329 ↗(On Diff #41009)

Use a ternary and make balanceSats a const

346 ↗(On Diff #41009)

Might not be worth moving in another file, just put it where it's called

362 ↗(On Diff #41009)

That's unusual to me

This revision now requires changes to proceed.Jun 27 2023, 18:12

lint, add comments explaining generated var change

Fabien requested changes to this revision.Jun 28 2023, 07:12
Fabien added inline comments.
apps/ecash-herald/src/utils.js
315 ↗(On Diff #41049)

You don't need any else

This revision now requires changes to proceed.Jun 28 2023, 07:12

Remove useless elses, add docs to function

This revision is now accepted and ready to land.Jun 28 2023, 17:03