Rust SDK API Reference / Record V1 / get_record
Function: get_record()
pub fn get_record(
rpc_client: &RpcClient,
domain: &str,
record: Record,
) -> Result<Option<(NameRecordHeader, Vec<u8>)>, SnsError>
Defined in: rust-crates/sns-sdk/src/blocking/record_v1.rs:11
Derives the legacy record address for a supported full domain and fetches its name-registry account through the blocking client.
Availability
Requires the blocking feature.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &solana_client::rpc_client::RpcClient | Blocking client used to fetch the record account. |
domain | &str | Full supported .sns or .sol domain. |
record | Record | Legacy SNS record kind to fetch. |
Returns
Result<Option<(NameRecordHeader, Vec<u8>)>, SnsError>. Some contains the account header and payload without header bytes; None means the record account is absent.
Errors
SnsError::UnsupportedTldfor a bare, unsupported, or unavailable.soldomain.SnsError::InvalidNameAccountDatawhen an existing record account is malformed or has the wrong owner.SnsError::SolanaClientfor RPC failures.
Example
use sns_sdk::{blocking::record_v1::get_record, record::Record};
use solana_client::rpc_client::RpcClient;
let client = RpcClient::new("https://your-rpc-endpoint.example".to_string());
if let Some((header, payload)) = get_record(&client, "example.sns", Record::Url)? {
println!("{} bytes owned by {}", payload.len(), header.owner);
}