From 1428dc4a908d307a65c5ed8e5b45bcb5ab7e217f Mon Sep 17 00:00:00 2001 From: Oleksandr Pravdyvyi Date: Wed, 15 Oct 2025 15:25:36 +0300 Subject: [PATCH] fix: suggestion fix 2 --- wallet/src/lib.rs | 26 ++++++++++++++------------ wallet/src/pinata_interactions.rs | 11 +++-------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/wallet/src/lib.rs b/wallet/src/lib.rs index b874ff9..3706b8c 100644 --- a/wallet/src/lib.rs +++ b/wallet/src/lib.rs @@ -14,7 +14,7 @@ use log::info; use nssa::{Account, Address}; use clap::{Parser, Subcommand}; -use nssa_core::Commitment; +use nssa_core::{Commitment, MembershipProof}; use crate::{ helperfunctions::{ @@ -189,16 +189,17 @@ impl WalletCore { Ok(NSSATransaction::try_from(&pub_tx)?) } - pub async fn check_private_account_initialized(&self, addr: &Address) -> bool { + pub async fn check_private_account_initialized( + &self, + addr: &Address, + ) -> Result> { if let Some(acc_comm) = self.get_private_account_commitment(addr) { - matches!( - self.sequencer_client - .get_proof_for_commitment(acc_comm) - .await, - Ok(Some(_)) - ) + self.sequencer_client + .get_proof_for_commitment(acc_comm) + .await + .map_err(anyhow::Error::from) } else { - false + Ok(None) } } @@ -799,16 +800,17 @@ pub async fn execute_subcommand(command: Command) -> Result Result<(SendTxResponse, [SharedSecretKey; 1]), ExecutionFailureKind> { let Some((winner_keys, winner_acc)) = self .storage @@ -46,8 +47,6 @@ impl WalletCore { let program = nssa::program::Program::pinata(); - let winner_commitment = Commitment::new(&winner_npk, &winner_acc); - let pinata_pre = AccountWithMetadata::new(pinata_acc.clone(), false, pinata_addr); let winner_pre = AccountWithMetadata::new(winner_acc.clone(), true, &winner_npk); @@ -62,11 +61,7 @@ impl WalletCore { &[(winner_npk.clone(), shared_secret_winner.clone())], &[( winner_keys.private_key_holder.nullifier_secret_key, - self.sequencer_client - .get_proof_for_commitment(winner_commitment) - .await - .unwrap() - .unwrap(), + winner_proof, )], &program, )