Page MenuHomePhabricator

[Cashtab] support valid addresses if no prefix included
ClosedPublic

Authored by bytesofman on Jan 18 2021, 14:27.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCb17877968ed6: [Cashtab] support valid addresses if no prefix included
Summary

Adding prefix validation on Friday broke case of valid cash address with no prefix. This accepts valid addresses without a prefix, as provided by Coinex.

Test Plan

npm test includes this test case. Can try depositing at your Coinex BCHA address to confirm with real money.

Diff Detail

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

Event Timeline

Failed tests logs:

====== CashTab Unit Tests:  toLegacy throws error if input address has invalid prefix ======
Error: expect(received).toStrictEqual(expected) // deep equality

Expected: [Error: Address prefix is not in Ticker.prefixes array]
Received: [Error: Address prefix is not a valid cash address with a prefix form the Ticker.prefixes array]
    at Object.<anonymous> (/work/web/cashtab/src/components/Common/__tests__/Ticker.test.js:85:20)
    at Object.asyncJestTest (/work/web/cashtab/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /work/web/cashtab/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

Each failure log is accessible here:
CashTab Unit Tests: toLegacy throws error if input address has invalid prefix

Fabien requested changes to this revision.Jan 18 2021, 14:45
Fabien added a subscriber: Fabien.
Fabien added inline comments.
web/cashtab/src/components/Common/Ticker.js
66 ↗(On Diff #27040)

form => from

web/cashtab/src/components/Send/Send.js
186 ↗(On Diff #27040)

This is a bad name because it doesn't check if the address has a prefix. foo:bar has a prefix.

200 ↗(On Diff #27040)

Something like Destination is not a valid BCHA address makes more sense imo.

This revision now requires changes to proceed.Jan 18 2021, 14:45

Fix tests, better variable names

Fabien added inline comments.
web/cashtab/src/components/Send/Send.js
188 ↗(On Diff #27043)

Would be a good idea to make it a constant (another diff)

This revision is now accepted and ready to land.Jan 18 2021, 16:27