Rust SDK API Reference / Reverse lookup / resolve_reverse_with_parent
Function: resolve_reverse_with_parent()
pub fn resolve_reverse_with_parent(
rpc_client: &RpcClient,
key: &Pubkey,
parent: Option<&Pubkey>,
) -> Result<Option<String>, SnsError>
Defined in: rust-crates/sns-sdk/src/blocking/resolve.rs:324
Derives and reads a reverse record for either a top-level name or a subdomain. For subdomains, the implementation removes the SNS reverse-record marker before returning the TLD-less label.
Availability
Requires the blocking feature.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &solana_client::rpc_client::RpcClient | Blocking client used to read the reverse record. |
key | &Pubkey | SNS name-account key to reverse-resolve. |
parent | Option<&Pubkey> | None for a top-level domain; Some(parent) for a subdomain. |
Returns
Result<Option<String>, SnsError>. Some contains a TLD-less name or subdomain label; None means the derived reverse account does not exist.
Errors
SnsError::InvalidNameAccountDatawhen the reverse account is malformed or has the wrong owner.SnsError::InvalidReversewhen the reverse payload is malformed or not UTF-8.SnsError::SolanaClientfor RPC failures.
Example
use sns_sdk::{blocking::resolve::resolve_reverse_with_parent, derivation::get_sns_domain_key};
use solana_client::rpc_client::RpcClient;
let client = RpcClient::new("https://your-rpc-endpoint.example".to_string());
let child = get_sns_domain_key("team.example")?;
let label = resolve_reverse_with_parent(&client, &child.key, Some(&child.parent))?;
println!("{label:?}");