fix account id computation in wallet to account for pdas

This commit is contained in:
Sergio Chouhy 2026-05-04 18:11:38 -03:00
parent 95afb2065d
commit 71ad4e0c85

View File

@ -24,7 +24,8 @@ use nssa::{
}, },
}; };
use nssa_core::{ use nssa_core::{
Commitment, MembershipProof, SharedSecretKey, account::Nonce, program::InstructionData, Commitment, MembershipProof, PrivateAccountKind, SharedSecretKey, account::Nonce,
program::InstructionData,
}; };
pub use privacy_preserving_tx::PrivacyPreservingAccount; pub use privacy_preserving_tx::PrivacyPreservingAccount;
use sequencer_service_rpc::{RpcClient as _, SequencerClient, SequencerClientBuilder}; use sequencer_service_rpc::{RpcClient as _, SequencerClient, SequencerClientBuilder};
@ -545,11 +546,15 @@ impl WalletCore {
.expect("Ciphertext ID is expected to fit in u32"), .expect("Ciphertext ID is expected to fit in u32"),
) )
.map(|(kind, res_acc)| { .map(|(kind, res_acc)| {
let identifier = kind.identifier(); let npk = &key_chain.nullifier_public_key;
let account_id = nssa::AccountId::from(( let (account_id, identifier) = match kind {
&key_chain.nullifier_public_key, PrivateAccountKind::Account(identifier) => {
identifier, (nssa::AccountId::from((npk, identifier)), identifier)
)); }
PrivateAccountKind::Pda { program_id, seed, identifier } => {
(nssa::AccountId::for_private_pda(&program_id, &seed, npk, identifier), identifier)
}
};
(account_id, identifier, res_acc) (account_id, identifier, res_acc)
}) })
}) })