Page MenuHomePhabricator

[Cashtab] Replace toSatoshi method in satoshisToSend calc
ClosedPublic

Authored by bytesofman on Feb 1 2021, 21:40.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCb01c29e8daa7: [Cashtab] Replace toSatoshi method in satoshisToSend calc
Summary

Replace the toSatoshi library method with new function toSmallestDenomination in one instances, the cacluation of the satoshisToSend amount. Add a unit test to confirm this function returns the same result as the previous method.

This is part of an ongoing refactor of the sendBch function to accept arbitrary decimal places for sending BCHA. Two more instances of toSatoshi need to be removed, but they require separate refactoring and should be in a different diff.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

More unit tests, tests pass when currency.cashDecimals is changed, throw validation error if input decimals do not match cashDecimals

This revision is now accepted and ready to land.Feb 3 2021, 10:32