From 8fd25bc4bf2e2e82c7ef96a8729b8ee520374b08 Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Wed, 15 Apr 2026 16:51:20 -0300 Subject: [PATCH] add identifier to PrivacyPreservingAccount to allow passing different identifiers --- wallet/src/privacy_preserving_tx.rs | 9 +++++---- .../src/program_facades/native_token_transfer/private.rs | 1 + .../program_facades/native_token_transfer/shielded.rs | 1 + wallet/src/program_facades/token.rs | 4 ++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/wallet/src/privacy_preserving_tx.rs b/wallet/src/privacy_preserving_tx.rs index 894b3aa3..4a0d3a03 100644 --- a/wallet/src/privacy_preserving_tx.rs +++ b/wallet/src/privacy_preserving_tx.rs @@ -16,6 +16,7 @@ pub enum PrivacyPreservingAccount { PrivateForeign { npk: NullifierPublicKey, vpk: ViewingPublicKey, + identifier: Identifier, }, } @@ -29,7 +30,7 @@ impl PrivacyPreservingAccount { pub const fn is_private(&self) -> bool { matches!( &self, - Self::PrivateOwned(_) | Self::PrivateForeign { npk: _, vpk: _ } + Self::PrivateOwned(_) | Self::PrivateForeign { npk: _, vpk: _, identifier: _ } ) } } @@ -82,13 +83,13 @@ impl AccountManager { (State::Private(pre), mask) } - PrivacyPreservingAccount::PrivateForeign { npk, vpk } => { + PrivacyPreservingAccount::PrivateForeign { npk, vpk, identifier } => { let acc = nssa_core::account::Account::default(); - let auth_acc = AccountWithMetadata::new(acc, false, (&npk, 0)); + let auth_acc = AccountWithMetadata::new(acc, false, (&npk, identifier)); let pre = AccountPreparedData { nsk: None, npk, - identifier: 0, + identifier, vpk, pre_state: auth_acc, proof: None, diff --git a/wallet/src/program_facades/native_token_transfer/private.rs b/wallet/src/program_facades/native_token_transfer/private.rs index c3a2125b..fdefc791 100644 --- a/wallet/src/program_facades/native_token_transfer/private.rs +++ b/wallet/src/program_facades/native_token_transfer/private.rs @@ -44,6 +44,7 @@ impl NativeTokenTransfer<'_> { PrivacyPreservingAccount::PrivateForeign { npk: to_npk, vpk: to_vpk, + identifier: 0, }, ], instruction_data, diff --git a/wallet/src/program_facades/native_token_transfer/shielded.rs b/wallet/src/program_facades/native_token_transfer/shielded.rs index 625e1a8b..4f98979b 100644 --- a/wallet/src/program_facades/native_token_transfer/shielded.rs +++ b/wallet/src/program_facades/native_token_transfer/shielded.rs @@ -50,6 +50,7 @@ impl NativeTokenTransfer<'_> { PrivacyPreservingAccount::PrivateForeign { npk: to_npk, vpk: to_vpk, + identifier: 0, }, ], instruction_data, diff --git a/wallet/src/program_facades/token.rs b/wallet/src/program_facades/token.rs index 1f941c8c..1ef096ea 100644 --- a/wallet/src/program_facades/token.rs +++ b/wallet/src/program_facades/token.rs @@ -262,6 +262,7 @@ impl Token<'_> { PrivacyPreservingAccount::PrivateForeign { npk: recipient_npk, vpk: recipient_vpk, + identifier: 0, }, ], instruction_data, @@ -358,6 +359,7 @@ impl Token<'_> { PrivacyPreservingAccount::PrivateForeign { npk: recipient_npk, vpk: recipient_vpk, + identifier: 0, }, ], instruction_data, @@ -621,6 +623,7 @@ impl Token<'_> { PrivacyPreservingAccount::PrivateForeign { npk: holder_npk, vpk: holder_vpk, + identifier: 0, }, ], instruction_data, @@ -717,6 +720,7 @@ impl Token<'_> { PrivacyPreservingAccount::PrivateForeign { npk: holder_npk, vpk: holder_vpk, + identifier: 0, }, ], instruction_data,