Skip to content

Commit

Permalink
fix: requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
frdomovic committed Dec 19, 2024
1 parent 8d37c23 commit 13522fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
5 changes: 1 addition & 4 deletions crates/context/config/src/client/env/config/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ impl<'a, T: Transport> ContextConfigQuery<'a, T> {
context_id: ContextId,
member_id: ContextIdentity,
) -> Result<u64, ClientError<T>> {
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
}
Expand Down
25 changes: 12 additions & 13 deletions crates/context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -218,22 +217,21 @@ 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::<ContextConfigEnv>(
this.client_config.new.protocol.as_str().into(),
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::<ContextConfigEnv>(
Expand Down Expand Up @@ -960,16 +958,17 @@ impl ContextManager {
);
};

let member_id = signer_id.rt().expect("infallible conversion");

let nonce: u64 = self
.config_client
.query::<ContextConfigEnv>(
context_config.protocol.as_ref().into(),
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;

Expand Down

0 comments on commit 13522fc

Please sign in to comment.