Rust SDK API Reference / Non-blocking APIs / Record V1 / get_record
Function: get_record()
pub async fn get_record(
rpc_client: &RpcClient,
domain: &str,
record: Record,
) -> Result<Option<(NameRecordHeader, Vec<u8>)>, SnsError>
Defined in: rust-crates/sns-sdk/src/non_blocking/record_v1.rs:11
Validates the full domain's supported TLD, derives the V1 record address, and reads the account through RPC. The byte vector excludes the NameRecordHeader; deserialize it with the V1 record helper.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &RpcClient | Non-blocking Solana RPC client. |
domain | &str | Full supported .sns or .sol domain name. |
record | Record | Legacy record type to retrieve. |
Returns
Result<Option<(NameRecordHeader, Vec<u8>)>, SnsError>. Some contains the account header and payload; None means the record account does not exist.
Errors
SnsError::UnsupportedTldwhendomainis bare or has an unsupported suffix.SnsError::InvalidNameAccountDatawhen a present record account is invalid.SnsError::SolanaClientwhen a TLD or record RPC request fails.
Example
use sns_sdk::{non_blocking::record_v1::get_record, record::Record};
if let Some((_header, payload)) = get_record(&client, "bonfida.sns", Record::Url).await? {
println!("record bytes: {}", payload.len());
}