From 13522fc1d9af8bd193bda058c07041f0e4aacce9 Mon Sep 17 00:00:00 2001 From: Fran Domovic Date: Thu, 19 Dec 2024 20:11:08 +0100 Subject: [PATCH] fix: requested changes --- .../config/src/client/env/config/query.rs | 5 +--- crates/context/src/lib.rs | 25 +++++++++---------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/crates/context/config/src/client/env/config/query.rs b/crates/context/config/src/client/env/config/query.rs index 4d925cb4d..5bb54a6b1 100644 --- a/crates/context/config/src/client/env/config/query.rs +++ b/crates/context/config/src/client/env/config/query.rs @@ -108,10 +108,7 @@ impl<'a, T: Transport> ContextConfigQuery<'a, T> { context_id: ContextId, member_id: ContextIdentity, ) -> Result> { - let params = fetch_nonce::FetchNonceRequest { - context_id: Repr::new(context_id), - member: Repr::new(member_id), - }; + let params = fetch_nonce::FetchNonceRequest::new(context_id, member_id); utils::send(&self.client, Operation::Read(params)).await } diff --git a/crates/context/src/lib.rs b/crates/context/src/lib.rs index 7798fc561..c0f9bd9b7 100644 --- a/crates/context/src/lib.rs +++ b/crates/context/src/lib.rs @@ -13,8 +13,7 @@ use calimero_context_config::client::{AnyTransport, Client as ExternalClient}; use calimero_context_config::repr::{Repr, ReprBytes, ReprTransmute}; use calimero_context_config::types::{ Application as ApplicationConfig, ApplicationMetadata as ApplicationMetadataConfig, - ApplicationSource as ApplicationSourceConfig, ContextId as IdentityContextId, ContextIdentity, - ProposalId, + ApplicationSource as ApplicationSourceConfig, ContextIdentity, ProposalId, }; use calimero_context_config::{Proposal, ProposalAction, ProposalWithApprovals}; use calimero_network::client::NetworkClient; @@ -218,12 +217,6 @@ impl ContextManager { ) } - let context_id: IdentityContextId = context.id.rt().expect("infallible conversion"); - let member_id = identity_secret - .public_key() - .rt() - .expect("infallible conversion"); - let nonce: u64 = this .config_client .query::( @@ -231,9 +224,14 @@ impl ContextManager { this.client_config.new.network.as_str().into(), this.client_config.new.contract_id.as_str().into(), ) - .fetch_nonce(context_id, member_id) + .fetch_nonce( + context.id.rt().expect("infallible conversion"), + identity_secret + .public_key() + .rt() + .expect("infallible conversion"), + ) .await?; - let nonce = nonce + 1; this.config_client .mutate::( @@ -960,8 +958,6 @@ impl ContextManager { ); }; - let member_id = signer_id.rt().expect("infallible conversion"); - let nonce: u64 = self .config_client .query::( @@ -969,7 +965,10 @@ impl ContextManager { context_config.network.as_ref().into(), context_config.contract.as_ref().into(), ) - .fetch_nonce(context_id.rt().expect("infallible conversion"), member_id) + .fetch_nonce( + context_id.rt().expect("infallible conversion"), + signer_id.rt().expect("infallible conversion"), + ) .await?; let nonce = nonce + 1;