Page MenuHomePhabricator

[Cashtab][Alias] Implement getAliasDetails
ClosedPublic

Authored by emack on Jul 2 2023, 03:11.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC17c003c4d228: [Cashtab][Alias] Implement getAliasDetails
Summary

T3216

Add the new getAliasDetails function in aliasUtils.js to wrap around the fetch call to alias-server's alias endpoint.

This will be used for retrieving alias info (associated address, txid, blockheight) and also to check whether the alias is registered or not.

Test Plan

npm test
npm start and sanity check Cashtab doesn't blow up with alias flag remaining as false

Diff Detail

Repository
rABC Bitcoin ABC
Branch
getAliasDetails
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24304
Build 48218: Build Diffcashtab-tests
Build 48217: arc lint + arc unit

Event Timeline

emack requested review of this revision.Jul 2 2023, 03:11
bytesofman requested changes to this revision.Jul 2 2023, 03:28
bytesofman added inline comments.
cashtab/src/utils/aliasUtils.js
36

is @response a standard thing? I get that it's useful. But if it's just something you are adding and not some standard, better to use descriptive language, e.g. "example successful response"

45

From the unit tests, it looks like this function is still returning responses when the API is showing an error.

In this case, should throw new Error(response.error) -- since when this function is called in the app, it will be wrapped by try...catch

This revision now requires changes to proceed.Jul 2 2023, 03:28
cashtab/src/utils/aliasUtils.js
45

looks like the alias-server isn't actually returning the error responses when catch in the try block, hence cashtab's fetch functions getting undefined on error but all ok on successful calls. I'll push up a separate diff on alias-server for this.

image.png (659×652 px, 70 KB)

emack marked an inline comment as done.

updated comments

emack planned changes to this revision.Jul 2 2023, 09:09

Will update response handling once D14193 is propagated to alias.etokens.cash.

  • updated getAliasDetails to throw error if alias endpoint returns an error response
  • updated error handling unit tests accordingly
This revision is now accepted and ready to land.Jul 3 2023, 03:50
This revision was automatically updated to reflect the committed changes.