fix: make lookupProfile work with newest stacks API - #1028
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/blockstack/stacks-js/8kbDFXR4JabneYXPJLUY4ktbSYwF |
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
reedrosenbluth
left a comment
There was a problem hiding this comment.
LGTM. Thanks @pradel!
zone117x
left a comment
There was a problem hiding this comment.
LGTM, thanks for the fix!!
Description
In the latest version of the SDK,
lookupProfileis 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.
addressfield as a BTC addressaddressfield as a STX addressWhen you call
lookupProfile, internally theverifyProfileTokenfunction is called.If you take a look here https://github.com/blockstack/stacks.js/blob/626c5fccb4dff213f000923ab69c7ed4f5eb48a0/packages/profile/src/profileTokens.ts#L115-L123
publicKeyOrAddressis 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
Does this introduce a breaking change?
There is a breaking change in the
verifyProfileTokenfunction only if a user uses it directly. By looking at the code it looks likelookupProfileis 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.