Skip to main content

Rust SDK API Reference / Non-blocking APIs / Wallet domains / get_sns_domains_for_owner

Function: get_sns_domains_for_owner()

pub async fn get_sns_domains_for_owner(
rpc_client: &RpcClient,
owner: Pubkey,
) -> Result<Vec<Pubkey>, SnsError>

Defined in: rust-crates/sns-sdk/src/non_blocking/domain.rs:11

Queries SPL Name Service accounts whose parent is the SNS root account and whose header owner equals the supplied wallet. It does not include tokenized domains or subdomains, and it does not impose an ordering on returned keys.

Parameters

ParameterTypeDescription
rpc_client&RpcClientNon-blocking Solana RPC client.
ownerPubkeyWallet public key to match as direct registry owner.

Returns

Result<Vec<Pubkey>, SnsError> containing directly owned top-level SNS name-account keys. Reverse-resolve keys to obtain display names.

Errors

  • SnsError::SolanaClient when the program-account query fails.

Example

use sns_sdk::non_blocking::domain::get_sns_domains_for_owner;

let domains = get_sns_domains_for_owner(&client, owner).await?;
for domain in domains {
println!("{domain}");
}