Skip to main content

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

ParameterTypeDescription
rpc_client&RpcClientNon-blocking Solana RPC client.
domain&strFull 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::UnsupportedTld when domain is bare or has an unsupported suffix.
  • SnsError::InvalidNameAccountData when a present record account is invalid.
  • SnsError::SolanaClient when 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());