Skip to main content

Rust SDK API Reference / Reverse lookup / resolve_reverse_with_parent

Function: resolve_reverse_with_parent()

pub async fn resolve_reverse_with_parent(
rpc_client: &RpcClient,
key: &Pubkey,
parent: Option<&Pubkey>,
) -> Result<Option<String>, SnsError>

Defined in: rust-crates/sns-sdk/src/non_blocking/resolve.rs:341

Derives and reads the reverse account for a top-level domain or subdomain. For subdomains, the SDK removes the leading NUL marker stored in the reverse payload. Returned names are TLD-less.

Parameters

ParameterTypeDescription
rpc_client&RpcClientNon-blocking Solana RPC client.
key&PubkeySNS name-account key to reverse-resolve.
parentOption<&Pubkey>None for a top-level name; Some(parent_account) for a subdomain.

Returns

Result<Option<String>, SnsError>. Some contains the TLD-less reverse name or subdomain label; None means no derived reverse account exists.

Errors

  • SnsError::InvalidNameAccountData when the present reverse account is invalid.
  • SnsError::InvalidReverse when the reverse payload is malformed or not UTF-8.
  • SnsError::SolanaClient when the RPC request fails.

Example

use sns_sdk::non_blocking::resolve::resolve_reverse_with_parent;

let label = resolve_reverse_with_parent(&client, &subdomain_account, Some(&parent_account)).await?;
println!("{label:?}");