Skip to main content

Rust SDK API Reference / Record V2 codecs and verification / decode_record_v2_fields

Function: decode_record_v2_fields()

pub fn decode_record_v2_fields(record_data: &[u8]) -> Result<RecordV2Fields<'_>, SnsError>

Defined in: record_v2.rs:121

Decodes the header, validation kinds, staleness ID, RoA ID, and content slice from on-chain V2 bytes.

Parameters

record_data: raw V2 account data.

Returns

Borrowed RecordV2Fields. Invalid header, validation, or lengths return SnsError::InvalidRecordData or propagated validation errors.

Example

use sns_sdk::record::record_v2::decode_record_v2_fields;

let fields = decode_record_v2_fields(&account.data)?;