Skip to content

fix: make lookupProfile work with newest stacks API - #1028

Merged
zone117x merged 5 commits into
stx-labs:masterfrom
pradel:feature/fix-lookup-profile
Jun 4, 2021
Merged

fix: make lookupProfile work with newest stacks API#1028
zone117x merged 5 commits into
stx-labs:masterfrom
pradel:feature/fix-lookup-profile

Conversation

@pradel

@pradel pradel commented Jun 4, 2021

Copy link
Copy Markdown
Contributor

Description

In the latest version of the SDK, lookupProfile is throwing an error when you call it to query old or new usernames.

I faced this issue when migrating Sigle to the newest SDK version.

When you call lookupProfile, internally the verifyProfileToken function is called.
If you take a look here https://github.com/blockstack/stacks.js/blob/626c5fccb4dff213f000923ab69c7ed4f5eb48a0/packages/profile/src/profileTokens.ts#L115-L123
publicKeyOrAddress is the STX address returned by the new API and we compare it with the BTC address that we got from the public key so the check is failing.

For details refer to issue #1016

Type of Change

  • New feature
  • Bug fix
  • API reference/documentation update
  • Other

Does this introduce a breaking change?

There is a breaking change in the verifyProfileToken function only if a user uses it directly. By looking at the code it looks like lookupProfile is the only part where it is called.

Testing information

I tested this patch directly into the Sigle codebase and it solved the issue that I am facing.

@vercel

vercel Bot commented Jun 4, 2021

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/blockstack/stacks-js/8kbDFXR4JabneYXPJLUY4ktbSYwF
✅ Preview: https://stacks-js-git-fork-pradel-feature-fix-lookup-profile-blockstack.vercel.app

@codecov

codecov Bot commented Jun 4, 2021

Copy link
Copy Markdown

Codecov Report

Merging #1028 (c0b5e82) into master (da68307) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1028      +/-   ##
==========================================
- Coverage   61.10%   61.07%   -0.04%     
==========================================
  Files         101      101              
  Lines        7675     7668       -7     
  Branches     1429     1428       -1     
==========================================
- Hits         4690     4683       -7     
  Misses       2880     2880              
  Partials      105      105              
Impacted Files Coverage Δ
packages/profile/src/profileTokens.ts 79.66% <100.00%> (-2.16%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da68307...c0b5e82. Read the comment docs.

@reedrosenbluth reedrosenbluth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @pradel!

@zone117x zone117x left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix!!

@zone117x
zone117x merged commit 983f7de into stx-labs:master Jun 4, 2021
@pradel
pradel deleted the feature/fix-lookup-profile branch June 4, 2021 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants