Skip to main content

Rust SDK API Reference / Tokenized domains / get_nft_records

Function: get_nft_records()

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

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

Finds the owner's SPL Token accounts with amount one, looks up each mint's first active Name Tokenizer record, and deserializes valid records. Token accounts, record lookups, and record deserialization failures are skipped rather than returned as errors.

Availability​

Requires the blocking feature.

Parameters​

ParameterTypeDescription
rpc_client&solana_client::rpc_client::RpcClientBlocking client used for token and Name Tokenizer queries.
owner&PubkeyWallet whose unit-balance SPL Token accounts are inspected.

Returns​

Result<Vec<NftRecord>, SnsError> containing successfully deserialized records in the order of qualifying token accounts returned by RPC.

Errors​

Returns SnsError::SolanaClient only when the initial SPL Token program query fails. Per-mint lookup failures are intentionally ignored.

Example​

use sns_sdk::blocking::nft::get_nft_records;
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()?;
let records = get_nft_records(&client, &owner)?;
println!("{} token records", records.len());