mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-08-25 03:11:21 +00:00
refactor wallet config to use identifiers instead of the redundant account_id field
This commit is contained in:
@@ -95,12 +95,18 @@ pub struct PublicAccountPrivateInitialData {
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PrivateAccountPrivateInitialData {
|
||||
pub account_id: nssa::AccountId,
|
||||
pub account: nssa_core::account::Account,
|
||||
pub key_chain: KeyChain,
|
||||
pub identifier: nssa_core::Identifier,
|
||||
}
|
||||
|
||||
impl PrivateAccountPrivateInitialData {
|
||||
#[must_use]
|
||||
pub fn account_id(&self) -> nssa::AccountId {
|
||||
nssa::AccountId::from((&self.key_chain.nullifier_public_key, self.identifier))
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn initial_pub_accounts_private_keys() -> Vec<PublicAccountPrivateInitialData> {
|
||||
let acc1_pub_sign_key = PrivateKey::try_new(PRIVATE_KEY_PUB_ACC_A).unwrap();
|
||||
@@ -143,7 +149,6 @@ pub fn initial_priv_accounts_private_keys() -> Vec<PrivateAccountPrivateInitialD
|
||||
|
||||
vec![
|
||||
PrivateAccountPrivateInitialData {
|
||||
account_id: AccountId::from((&key_chain_1.nullifier_public_key, 0)),
|
||||
account: Account {
|
||||
program_owner: DEFAULT_PROGRAM_OWNER,
|
||||
balance: PRIV_ACC_A_INITIAL_BALANCE,
|
||||
@@ -154,7 +159,6 @@ pub fn initial_priv_accounts_private_keys() -> Vec<PrivateAccountPrivateInitialD
|
||||
identifier: 0,
|
||||
},
|
||||
PrivateAccountPrivateInitialData {
|
||||
account_id: AccountId::from((&key_chain_2.nullifier_public_key, 0)),
|
||||
account: Account {
|
||||
program_owner: DEFAULT_PROGRAM_OWNER,
|
||||
balance: PRIV_ACC_B_INITIAL_BALANCE,
|
||||
@@ -358,11 +362,11 @@ mod tests {
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
init_private_accs_keys[0].account_id.to_string(),
|
||||
init_private_accs_keys[0].account_id().to_string(),
|
||||
PRIV_ACC_A_TEXT_ADDR
|
||||
);
|
||||
assert_eq!(
|
||||
init_private_accs_keys[1].account_id.to_string(),
|
||||
init_private_accs_keys[1].account_id().to_string(),
|
||||
PRIV_ACC_B_TEXT_ADDR
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user