Skip to main content

Rust SDK API Reference / Sub-registrars / get_sub_registrar_info

Function: get_sub_registrar_info()

pub fn get_sub_registrar_info(rpc_client: &RpcClient, domain: &str) -> Result<Registrar, SnsError>

Defined in: rust-crates/sns-sdk/src/blocking/subdomain.rs:66

Derives the SNS name account and its associated sub-registrar PDA, then reads and deserializes the registrar state.

Availability

Requires both the blocking and subdomain features.

Parameters

ParameterTypeDescription
rpc_client&solana_client::rpc_client::RpcClientBlocking client used to fetch registrar state.
domain&strFull supported .sns or .sol domain.

Returns

Result<Registrar, SnsError> containing the deserialized sub-registrar state.

Errors

  • SnsError::UnsupportedTld for a bare, unsupported, or unavailable .sol domain.
  • SnsError::InvalidSubRegistrar when the registrar account is absent, has the wrong owner or tag, or cannot be deserialized.
  • SnsError::SolanaClient for RPC failures.

Example

use sns_sdk::blocking::subdomain::get_sub_registrar_info;
use solana_client::rpc_client::RpcClient;

let client = RpcClient::new("https://your-rpc-endpoint.example".to_string());
let registrar = get_sub_registrar_info(&client, "example.sns")?;
println!("{}", registrar.authority);