Skip to main content

Rust SDK API Reference / Tokenized domains / resolve_nft_owner

Function: resolve_nft_owner()

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

Defined in: rust-crates/sns-sdk/src/blocking/nft.rs:97

Derives the domain's canonical Name Tokenizer mint. It returns an owner only when the mint account exists, has supply one, and a matching amount-one SPL Token account is found.

Availability

Requires the blocking feature.

Parameters

ParameterTypeDescription
rpc_client&solana_client::rpc_client::RpcClientBlocking client used to fetch the mint and matching token account.
domain_key&PubkeySNS name-account key whose canonical domain mint is checked.

Returns

Result<Option<Pubkey>, SnsError>. Some is the owner of the first matching amount-one token account; None means the domain has no mint account, the mint supply is not one, or no matching holder exists.

Errors

  • SnsError::InvalidDomain when the RPC response unexpectedly has no entry for the derived mint query.
  • SnsError::SolanaProgramError when the mint or matching token account cannot be unpacked.
  • SnsError::SolanaClient for RPC failures.

Example

use sns_sdk::{blocking::nft::resolve_nft_owner, derivation::get_sns_domain_key};
use solana_client::rpc_client::RpcClient;

let client = RpcClient::new("https://your-rpc-endpoint.example".to_string());
let domain_key = get_sns_domain_key("example")?.key;
if let Some(owner) = resolve_nft_owner(&client, &domain_key)? {
println!("{owner}");
}