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
Branch
nft-list-price-validation
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 29618
Build 58771: Build Diffecash-lib-tests · cashtab-tests
Build 58770: arc lint + arc unit

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

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

2177

also test for '111.'

2198–2209

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

cashtab/src/validation/index.js
975

&& 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

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