feat: AccountPublicData struct changed

This commit is contained in:
Oleksandr Pravdyvyi 2025-07-09 08:16:12 +03:00
parent 5172a95f53
commit 8e987847ee

View File

@ -1,29 +1,13 @@
use accounts::account_core::{AccountAddress, PublicKey};
use k256::AffinePoint;
use accounts::account_core::AccountAddress;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccountPublicData {
pub nullifier_public_key: PublicKey,
pub viewing_public_key: PublicKey,
pub balance: u64,
pub address: AccountAddress,
}
impl AccountPublicData {
pub fn from_raw(
address: AccountAddress,
nullifier_public_key: Vec<u8>,
viewing_public_key: Vec<u8>,
) -> Self {
Self {
nullifier_public_key: serde_json::from_slice::<AffinePoint>(&nullifier_public_key)
.unwrap(),
viewing_public_key: serde_json::from_slice::<AffinePoint>(&viewing_public_key).unwrap(),
address,
}
}
}
#[derive(Debug, Clone)]
pub struct SequencerAccountsStore {
pub accounts: HashMap<AccountAddress, AccountPublicData>,