Rust SDK API Reference / Record V2 reads / get_multiple_records_v2
Function: get_multiple_records_v2()
pub async fn get_multiple_records_v2(
rpc_client: &RpcClient,
domain: &str,
records: &[Record],
) -> Result<Vec<Option<(NameRecordHeader, Vec<u8>)>>, SnsError>
Defined in: rust-crates/sns-sdk/src/non_blocking/record_v2.rs:22
Validates a full supported domain, derives one V2 record address per requested Record, then reads them with the name-registry batch helper. The output preserves the order and duplicates of records.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc_client | &RpcClient | Non-blocking Solana RPC client. |
domain | &str | Full supported .sns or .sol domain name. |
records | &[Record] | V2 record types to retrieve. |
Returns
Result<Vec<Option<(NameRecordHeader, Vec<u8>)>>, SnsError>. Each result corresponds to the requested record at the same index; missing record accounts are None.
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_v2::get_multiple_records_v2, record::Record};
let records = [Record::Url, Record::Email];
let values = get_multiple_records_v2(&client, "bonfida.sns", &records).await?;
assert_eq!(values.len(), records.len());