Bonfida / sns-sdk

Solana Name Service SDKs monorepo
https://sns.id/
MIT License
28 stars 28 forks source link

How to use react useDomainOwner hook #57

Closed alexandr-kazakov closed 6 months ago

alexandr-kazakov commented 6 months ago

Any example please?

akashrdev commented 6 months ago

Hi @alexandr-kazakov - please see our docs: useDomainsForOwner

alexandr-kazakov commented 6 months ago

thanks, for some reason I couldn't find it.

alexandr-kazakov commented 6 months ago

Look, I asked about this lib https://github.com/Bonfida/sns-sdk/blob/main/react/README.md npm install @bonfida/sns-react

It has useDomainOwner hook, your docs doesn't have info about it, can you give me an example how I can use useDomainOwner hook in react please?

akashrdev commented 6 months ago

Oh my apologies, I misread the hook in question. The example below will log "domain owner: HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA" which is the owner address of the "bonfida" domain. The initial return is of type Public Key, but using the .toBase58() method will give us the address as a string.

 const { connection } = useConnection();
 const { data: domainOwner } = useDomainOwner(connection, "bonfida");

  console.log("domain owner:", domainOwner?.toBase58());

If you need further assistance we have a dev-general channel on Discord where our team can assist.

https://discord.gg/EVaEvGqv.

akashrdev commented 6 months ago

@alexandr-kazakov I'm going to close this issue. Please feel free to reach back out on here or on Discord if you need anything further.