From 7a57b4f51ca27bb85ce08ad6abc711fa30a23b38 Mon Sep 17 00:00:00 2001 From: Rostyslav Tyshko Date: Wed, 9 Apr 2025 01:34:21 -0400 Subject: [PATCH] vec_u8_to_vec_u64 helper --- node_core/src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/node_core/src/lib.rs b/node_core/src/lib.rs index fef36a3..009949c 100644 --- a/node_core/src/lib.rs +++ b/node_core/src/lib.rs @@ -240,6 +240,24 @@ impl NodeCore { )) } + fn vec_u8_to_vec_u64(bytes: Vec) -> Vec { + // Pad with zeros to make sure it's a multiple of 8 + let mut padded = bytes.clone(); + while padded.len() % 8 != 0 { + padded.push(0); + } + + padded + .chunks(8) + .map(|chunk| { + let mut array = [0u8; 8]; + array.copy_from_slice(chunk); + u64::from_le_bytes(array) + }) + .collect() + } + + pub async fn mint_utxo_multiple_assets_private( &self, acc: AccountAddress,