Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating Arweave Name Service (ANS) #4

Open
charmful0x opened this issue Nov 22, 2022 · 0 comments
Open

Integrating Arweave Name Service (ANS) #4

charmful0x opened this issue Nov 22, 2022 · 0 comments

Comments

@charmful0x
Copy link

About

Latest ArProfile is a great app that packs a user's profile metadata from several sources, this issue is about integrating ANS protocol to reverse resolve the profile's Arweave address.

The How

laa-widget already fetches the profile's Arweave address, and that will make integrating ANS as simple as a single HTTP GET request.

Only the profile's currentLabel can be bound as the main profile's ANS domain.

Code snippet

import axios from "axios";

async function getAnsLabel(addr) {
  try {
    const label = (
      await axios.get(`https://ans-stats.decent.land/profile/${addr}`)
    )?.data?.currentLabel;
    return label ? `${label}.ar` : void 0;
  } catch (error) {
    return undefined;
  }
}

// call it
getAnsLabel("AeK_9yb3f3HEK1Gzwky6tIx8ujW9Pxr_FkhCkWftFtw");

ANS has a decent number of users in the closed beta testing phase (572 at the time of writing this GH issue) and it would be great to see it integrated into laa-widget and your other social tech stack!

If you don't have an ANS label yet, please LMK so I can mint one for you to test it out, and we would be happy to open a PR to integrate ANS incase you don't have enough dev time for it, thanks and looking forward to it!

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

No branches or pull requests

1 participant