portalpayments / solana-wallet-names

Resolves wallet names to wallet addresses (and PFPs) across all of Solana. Includes .abc .backpack .bonk .glow .ottr .poor .sol and @ twitter.
https://getportal.app
MIT License
28 stars 8 forks source link

Fetch all domains for address #6

Open mcintyre94 opened 1 year ago

mcintyre94 commented 1 year ago

I'd like to use this in Explorer to get support for multiple domain services (we currently only support .sol). See https://github.com/solana-labs/explorer/issues/271

One requirement we have is being able to display all the domains owned by an address, eg. https://explorer.solana.com/address/HcKjeHNnRVHhaaRNmvAf4YKDeWWnDqCzQEAvaFig2Dir/domains

It looks like this SDK currently only has a function to get a single domain (I think ANS only?) for an address using walletAddressToNameAndProfilePicture

It'd be great to be able to get all domains for any provider using this SDK. I think that we'd need to combine a few requests for this, but most services do support fetching all domains for an owner. For example parser.getAllUserDomains for ANS and https://sns-sdk-proxy.bonfida.workers.dev/domains/HcKjeHNnRVHhaaRNmvAf4YKDeWWnDqCzQEAvaFig2Dir for .sol

mikemaccana commented 1 year ago

I'd like to use this in Explorer to get support for multiple domain services

Excellent! 😃

It looks like this SDK currently only has a function to get a single domain (I think ANS only?)

No, it gets a single domain, but not ANS only. If it was ANS only, that would defeat the entire purpose of the project, and make the README a lie. See https://github.com/portalpayments/solana-wallet-names/blob/main/src/index.ts#L380

That's very easy to add - just copy the function above and do something like an await Promise.all() - visit https://github.com/portalpayments/solana-wallet-names#contributing and if you send a PR I'll merge it.