Rust SDK API Reference / Subdomains / get_subdomains
Function: get_subdomains()
pub fn get_subdomains(rpc_client: &RpcClient, parent: &Pubkey) -> Result<Vec<String>, SnsError>
Defined in: rust-crates/sns-sdk/src/blocking/subdomain.rs:26
Queries reverse-record accounts whose parent is parent, then returns their child labels. Values are TLD-less labels such as team, not full names such as team.example.sns.
Availability
Requires the blocking feature.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &solana_client::rpc_client::RpcClient | Blocking client used for the program-account query. |
parent | &Pubkey | SNS parent name-account key. |
Returns
Result<Vec<String>, SnsError> containing the decoded child labels in RPC response order.
Errors
SnsError::InvalidNameAccountDatawhen a returned account lacks a complete name-record header.SnsError::InvalidReversewhen a reverse payload is malformed, lacks its subdomain marker, or is not UTF-8.SnsError::SolanaClientfor RPC failures.
Example
use sns_sdk::{blocking::subdomain::get_subdomains, derivation::get_sns_domain_key};
use solana_client::rpc_client::RpcClient;
let client = RpcClient::new("https://your-rpc-endpoint.example".to_string());
let parent = get_sns_domain_key("example")?.key;
for label in get_subdomains(&client, &parent)? {
println!("{label}.example.sns");
}