Skip to main content

Rust SDK API Reference / Tokenized domains / resolve_nft_owner

Function: resolve_nft_owner()

pub async fn resolve_nft_owner(
rpc_client: &RpcClient,
domain_key: &Pubkey,
) -> Result<Option<Pubkey>, SnsError>

Defined in: rust-crates/sns-sdk/src/non_blocking/nft.rs:110

Derives the canonical domain mint, requires that mint to have supply one, then finds the first legacy SPL Token account holding one token. It returns None when the mint is absent, has a supply other than one, or has no matching token account.

Parameters

ParameterTypeDescription
rpc_client&RpcClientNon-blocking Solana RPC client.
domain_key&PubkeySNS name-account key whose canonical domain mint is queried.

Returns

Result<Option<Pubkey>, SnsError>. Some is the owner of the first matching one-token legacy SPL Token account; None means no valid tokenized owner was found.

Errors

  • SnsError::InvalidDomain when the mint account RPC response contains no expected first entry.
  • SnsError::SolanaClient when an RPC request fails.
  • Token-program unpacking errors propagated through SnsError when mint or token-account data is invalid.

Example

use sns_sdk::non_blocking::nft::resolve_nft_owner;

if let Some(owner) = resolve_nft_owner(&client, &domain_account).await? {
println!("tokenized owner: {owner}");
}