bsv-sdk 0.2.81

Pure Rust implementation of the BSV Blockchain SDK
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! GetVersion result serialization.

use crate::wallet::error::WalletError;
use crate::wallet::interfaces::GetVersionResult;

pub fn serialize_get_version_result(result: &GetVersionResult) -> Result<Vec<u8>, WalletError> {
    Ok(result.version.as_bytes().to_vec())
}

pub fn deserialize_get_version_result(data: &[u8]) -> Result<GetVersionResult, WalletError> {
    Ok(GetVersionResult {
        version: String::from_utf8(data.to_vec())
            .map_err(|e| WalletError::Internal(e.to_string()))?,
    })
}