Page MenuHomePhabricator

[Cashtab] New validation function for user input NFT list price
ClosedPublic

Authored by bytesofman on Jul 17 2024, 22:15.

Details

Summary

Splitting this out from D16328 to simplify review

Add new (and, here, unimplemented) function to validate user input NFT list price. This function is designed to work with Cashtab input field, i.e. if there is an error, we want to return the error so the user can know what is wrong.

See D16328 for implementation context.

Test Plan

npm test

Diff Detail

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

Event Timeline

emack requested changes to this revision.Jul 18 2024, 09:19
emack added a subscriber: emack.
emack added inline comments.
cashtab/src/validation/fixtures/vectors.js
2139 ↗(On Diff #48711)

assuming 1 CAD does not crash below XEC dust IRL :)

2177 ↗(On Diff #48711)

also test for '111.'

2198–2209 ↗(On Diff #48711)

ListPriceInput in D16328 is of type number so these two are redundant

cashtab/src/validation/index.js
975 ↗(On Diff #48711)

&& if last char of xecListPrice is decimal point

This revision now requires changes to proceed.Jul 18 2024, 09:19
cashtab/src/validation/index.js
975 ↗(On Diff #48711)

actually there should be some pre-made regex you can use to do the above in one go

bytesofman marked 5 inline comments as done.

add test cases for input ending in '.'

This revision is now accepted and ready to land.Jul 18 2024, 17:13