Rust SDK API Reference / Non-blocking APIs / Subdomains / get_subdomains
Function: get_subdomains()
pub async fn get_subdomains(
rpc_client: &RpcClient,
parent: &Pubkey,
) -> Result<Vec<String>, SnsError>
Defined in: rust-crates/sns-sdk/src/non_blocking/subdomain.rs:26
Queries reverse lookup accounts whose parent is parent, then decodes their NUL-prefixed reverse payloads into child labels. Results are labels such as team, not complete domain names; the RPC program-account response determines their order.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &RpcClient | Non-blocking Solana RPC client. |
parent | &Pubkey | Parent SNS name-account key. |
Returns
Result<Vec<String>, SnsError> containing TLD-less child labels for valid matching reverse accounts.
Errors
SnsError::InvalidNameAccountDatawhen a matching account has no complete name-record header.SnsError::InvalidReversewhen a reverse payload is malformed, missing its subdomain marker, or not UTF-8.SnsError::SolanaClientwhen the program-account query fails.
Example
use sns_sdk::non_blocking::subdomain::get_subdomains;
for label in get_subdomains(&client, &parent_account).await? {
println!("{label}");
}