Rust SDK API Reference / Tokenized domains / get_sns_nfts_for_owner
Function: get_sns_nfts_for_owner()
pub fn get_sns_nfts_for_owner(
rpc_client: &RpcClient,
owner: &Pubkey,
) -> Result<Vec<SnsNftDomain>, SnsError>
Defined in: rust-crates/sns-sdk/src/blocking/nft.rs:76
Finds the wallet's token records, reverse-resolves their SNS name accounts, and returns only records with reverse data. Each SnsNftDomain contains a TLD-less reverse, name-account key, and NFT mint; entries without reverse data are omitted.
Availability
Requires the blocking feature.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &solana_client::rpc_client::RpcClient | Blocking client used for token, record, and reverse-record queries. |
owner | &Pubkey | Wallet whose tokenized SNS domains are requested. |
Returns
Result<Vec<SnsNftDomain>, SnsError> containing domains with reverse data, in the order of the token records that produced them.
Errors
SnsError::SolanaClientwhen a required token, record, or reverse-record query fails.SnsError::InvalidNameAccountDatawhen a fetched reverse account is malformed or has the wrong owner.SnsError::InvalidReversewhen a reverse payload is malformed or not UTF-8.
Example
use sns_sdk::blocking::nft::get_sns_nfts_for_owner;
use solana_client::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;
let client = RpcClient::new("https://your-rpc-endpoint.example".to_string());
let owner: Pubkey = std::env::var("OWNER")?.parse()?;
for domain in get_sns_nfts_for_owner(&client, &owner)? {
println!("{}.sns", domain.reverse);
}