Rust SDK API Reference / Non-blocking APIs / Sub-registrars / get_sub_registrar_info
Function: get_sub_registrar_info()
pub async fn get_sub_registrar_info(
rpc_client: &RpcClient,
domain: &str,
) -> Result<Registrar, SnsError>
Defined in: rust-crates/sns-sdk/src/non_blocking/subdomain.rs:88
Derives the SNS domain account and then its sub-registrar PDA, reads the account through RPC, and validates the program owner and Registrar discriminator before deserializing it.
Availability
This API requires the subdomain feature, which is enabled by default.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &RpcClient | Non-blocking Solana RPC client. |
domain | &str | Full supported .sns or .sol domain name. |
Returns
Result<Registrar, SnsError> containing the validated deserialized sub-registrar state.
Errors
SnsError::UnsupportedTldwhendomainis bare or has an unsupported suffix.SnsError::InvalidSubRegistrarwhen the registrar account is missing, has the wrong owner or tag, or cannot be deserialized.SnsError::InvalidDomainwhen the trimmed SNS domain cannot be derived.SnsError::SolanaClientwhen a TLD or registrar RPC request fails.
Example
use sns_sdk::non_blocking::subdomain::get_sub_registrar_info;
let registrar = get_sub_registrar_info(&client, "registrar.sns").await?;
println!("authority: {}", registrar.authority);