Page MenuHomePhabricator

[Cashtab][Alias] Update Send.js to use api endpoint in place of getAddressFromAlias
ClosedPublic

Authored by emack on Jul 5 2023, 08:38.

Details

Summary

T3216

Update the alias lookup in send.js component's address input field to use the alias api endpoint

Test Plan
  • npm test
  • change the alias flag in Ticker.js to true
  • npm start
  • navigate to the Send page
  • input a pre-registered alias in the address input field and ensure it parses to the right address
  • ensure the hyperlink underneath links correctly to the explorer page for this address
  • send an XEC amount to this alias and ensure successful broadcast, and sanity check tx details in explorer
  • input a valid eCash address and ensure it is accepted
  • input a valid prefix-less eCash address and ensure it is accepted
  • input an invalid eCash address and invalid alias and ensure it triggers validation error
  • input an unregistered alias and ensure the eCash Alias does not exist or yet to receive 1 confirmation validation error is displayed

Diff Detail

Repository
rABC Bitcoin ABC
Branch
updateSendEndpoint
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24443
Build 48486: Build Diffcashtab-tests
Build 48485: arc lint + arc unit

Event Timeline

emack requested review of this revision.Jul 5 2023, 08:38
bytesofman requested changes to this revision.Jul 5 2023, 22:17
bytesofman added inline comments.
cashtab/src/components/Common/Ticker.js
13 ↗(On Diff #41261)

remove this param in a separate diff if it's no longer being used by Cashtab

cashtab/src/components/Send/Send.js
498 ↗(On Diff #41261)

getAliasDetails should return the JSON directly

This revision now requires changes to proceed.Jul 5 2023, 22:17
emack marked 2 inline comments as done.Jul 6 2023, 07:33
emack added inline comments.
cashtab/src/components/Common/Ticker.js
13 ↗(On Diff #41261)

this will always be in use by Cashtab as it needs to know where to send the registration transaction to

cashtab/src/components/Send/Send.js
498 ↗(On Diff #41261)

coming up via D14219, will rebase thereafter.

emack marked 2 inline comments as done.
  • rebased to use the new queryAliasServer wrapper
bytesofman added inline comments.
cashtab/src/components/Common/Ticker.js
13 ↗(On Diff #41336)

this change still doesn't seem related to this diff -- in this case, diff is modifying behavior of send transactions that take an alias input.

why are the test vectors for alias registration txs changing?

cashtab/src/utils/__tests__/transactions.test.js
122 ↗(On Diff #41336)

why are these changing?

This revision now requires changes to proceed.Jul 10 2023, 17:40
emack marked 2 inline comments as done.Jul 11 2023, 07:05
emack added inline comments.
cashtab/src/utils/__tests__/transactions.test.js
122 ↗(On Diff #41336)

these were changed due to the alias payment address changing but since that's been backed out, these will too.

emack marked an inline comment as done.

Removed change to aliasPaymentAddress

Fabien added inline comments.
cashtab/src/components/Send/Send.js
500 ↗(On Diff #41370)

You don't need the else.

Unrelated: is the isRegistered flag really useful ? I suppose it was there because of the pending alias feature but this is likely no longer needed.

emack marked an inline comment as done.Jul 11 2023, 08:04
emack added inline comments.
cashtab/src/components/Send/Send.js
500 ↗(On Diff #41370)

yea isRegistered is kind of redundant now, since I can just use the !aliasDetails.address check and if there is no address attached to an alias it's not registered. There is no scenario where a confirmed alias has no address attached.

emack marked an inline comment as done.

Updated if statement and registration status check

bytesofman added inline comments.
cashtab/src/components/Send/Send.js
502

Check for aliasDetails.error -- the alias server validates input, so you can use its returned validation msg

e.g.

https://alias.etokens.cash/alias/invalid_alias

{"error":"Error fetching /alias/invalid_alias: alias param cannot contain non-alphanumeric characters"}
This revision now requires changes to proceed.Jul 11 2023, 17:38
emack marked an inline comment as done.

Added aliasDetails.error check

Fabien requested changes to this revision.Jul 12 2023, 18:24
Fabien added inline comments.
cashtab/src/components/Send/Send.js
506 ↗(On Diff #41401)

The logic is wrong, if aliasDetails.error exists you will override the error

This revision now requires changes to proceed.Jul 12 2023, 18:24
emack marked an inline comment as done.
  • similar to D14247, removed unreachable exception checks
  • corrected error handling flow
This revision is now accepted and ready to land.Jul 14 2023, 09:07