fix(wallet): suggestion fix 1

This commit is contained in:
Pravdyvy 2026-05-21 13:02:18 +03:00
parent 97d9188c38
commit ef1e0e0fa4
4 changed files with 15 additions and 13 deletions

View File

@ -332,7 +332,7 @@ Unlike the public version, `run_hello_world_private.rs` must:
Luckily all that complexity is hidden behind the `wallet_core.send_privacy_preserving_tx` function:
```rust
let accounts = vec![PrivacyPreservingAccount::PrivateOwned(account_id)];
let accounts = vec![AccountIdentity::PrivateOwned(account_id)];
// Construct and submit the privacy-preserving transaction
wallet_core

View File

@ -54,6 +54,8 @@ pub enum AccountIdentity {
impl AccountIdentity {
#[must_use]
/// Note: `PublicNoSign` still counts as public, the variant just suppresses the signing-key
/// lookup.
pub const fn is_public(&self) -> bool {
matches!(&self, Self::Public(_) | Self::PublicNoSign(_))
}

View File

@ -270,7 +270,7 @@ impl WalletCore {
self.storage.key_chain_mut().set_sealing_secret_key(key);
}
/// Resolve an `AccountId` to the appropriate `PrivacyPreservingAccount` variant.
/// Resolve an `AccountId` to the appropriate `AccountIdentity` variant.
/// Checks the key tree first, then shared private accounts.
#[must_use]
pub fn resolve_private_account(&self, account_id: nssa::AccountId) -> Option<AccountIdentity> {

View File

@ -113,13 +113,13 @@ impl Amm<'_> {
));
}
let user_a_signing_indentity = if token_definition_id_in == definition_token_a_id {
let user_a_signing_identity = if token_definition_id_in == definition_token_a_id {
AccountIdentity::Public(user_holding_a)
} else {
AccountIdentity::PublicNoSign(user_holding_a)
};
let user_b_signing_indentity = if token_definition_id_in == definition_token_b_id {
let user_b_signing_identity = if token_definition_id_in == definition_token_b_id {
AccountIdentity::Public(user_holding_b)
} else {
AccountIdentity::PublicNoSign(user_holding_b)
@ -131,8 +131,8 @@ impl Amm<'_> {
AccountIdentity::PublicNoSign(amm_pool),
AccountIdentity::PublicNoSign(vault_holding_a),
AccountIdentity::PublicNoSign(vault_holding_b),
user_a_signing_indentity,
user_b_signing_indentity,
user_a_signing_identity,
user_b_signing_identity,
],
instruction_data,
&program.into(),
@ -188,13 +188,13 @@ impl Amm<'_> {
));
}
let user_a_signing_indentity = if token_definition_id_in == definition_token_a_id {
let user_a_signing_identity = if token_definition_id_in == definition_token_a_id {
AccountIdentity::Public(user_holding_a)
} else {
AccountIdentity::PublicNoSign(user_holding_a)
};
let user_b_signing_indentity = if token_definition_id_in == definition_token_b_id {
let user_b_signing_identity = if token_definition_id_in == definition_token_b_id {
AccountIdentity::Public(user_holding_b)
} else {
AccountIdentity::PublicNoSign(user_holding_b)
@ -203,11 +203,11 @@ impl Amm<'_> {
self.0
.send_pub_tx(
vec![
AccountIdentity::Public(amm_pool),
AccountIdentity::Public(vault_holding_a),
AccountIdentity::Public(vault_holding_b),
user_a_signing_indentity,
user_b_signing_indentity,
AccountIdentity::PublicNoSign(amm_pool),
AccountIdentity::PublicNoSign(vault_holding_a),
AccountIdentity::PublicNoSign(vault_holding_b),
user_a_signing_identity,
user_b_signing_identity,
],
instruction_data,
&program.into(),