Rust SDK API Reference / Name registries / resolve_name_registry
Function: resolve_name_registry()
pub async fn resolve_name_registry(
rpc_client: &RpcClient,
key: &Pubkey,
) -> Result<Option<(NameRecordHeader, Vec<u8>)>, SnsError>
Defined in: rust-crates/sns-sdk/src/non_blocking/resolve.rs:297
Reads one account through RPC. Present accounts must be owned by the SPL Name Service program and contain a complete NameRecordHeader; the returned byte vector excludes that header.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &RpcClient | Non-blocking Solana RPC client. |
key | &Pubkey | Name-registry account public key. |
Returns
Result<Option<(NameRecordHeader, Vec<u8>)>, SnsError>. Some((header, payload)) contains the unpacked header and payload; None means the account does not exist.
Errors
SnsError::InvalidNameAccountDatawhen a present account has the wrong owner, a truncated header, or no payload region.SnsError::SolanaClientwhen the RPC request fails.
Example
use sns_sdk::non_blocking::resolve::resolve_name_registry;
if let Some((header, payload)) = resolve_name_registry(&client, &account_key).await? {
println!("owner: {}, payload bytes: {}", header.owner, payload.len());
}