diff --git a/contracts/icp/context-config/context_contract.did b/contracts/icp/context-config/context_contract.did index af9edb43c..68eeb6d14 100644 --- a/contracts/icp/context-config/context_contract.did +++ b/contracts/icp/context-config/context_contract.did @@ -18,6 +18,6 @@ service : () -> { privileges : (blob, vec blob) -> ( vec record { blob; vec ICCapability }, ) query; - proxy_contract : (blob) -> (principal) query; + proxy_contract : (blob) -> (text) query; set_proxy_code : (blob) -> (Result); } diff --git a/contracts/icp/context-config/src/query.rs b/contracts/icp/context-config/src/query.rs index 47205de9f..15642c542 100644 --- a/contracts/icp/context-config/src/query.rs +++ b/contracts/icp/context-config/src/query.rs @@ -34,16 +34,18 @@ fn application_revision(context_id: ICContextId) -> u64 { } #[query] -fn proxy_contract(context_id: ICContextId) -> Principal { - CONTEXT_CONFIGS.with(|configs| { - let configs = configs.borrow(); - let context = configs - .contexts - .get(&context_id) - .expect("context does not exist"); - - (*context.proxy).clone() - }) +fn proxy_contract(context_id: ICContextId) -> String { + CONTEXT_CONFIGS + .with(|configs: &std::cell::RefCell| { + let configs = configs.borrow(); + let context = configs + .contexts + .get(&context_id) + .expect("context does not exist"); + + (*context.proxy).clone() + }) + .to_string() } #[query] diff --git a/crates/context/config/src/client/env/config/query/members.rs b/crates/context/config/src/client/env/config/query/members.rs index 1b8a9e462..f0f503c8e 100644 --- a/crates/context/config/src/client/env/config/query/members.rs +++ b/crates/context/config/src/client/env/config/query/members.rs @@ -5,7 +5,7 @@ use serde::Serialize; use starknet::core::codec::{Decode as StarknetDecode, Encode as StarknetEncode}; use starknet_crypto::Felt; -use crate::client::env::config::types::icp::{ICContextId, ICContextIdentity, ICMembersRequest}; +use crate::client::env::config::types::icp::{ICContextId, ICContextIdentity}; use crate::client::env::config::types::starknet::{ CallData, StarknetMembers, StarknetMembersRequest, }; @@ -108,12 +108,7 @@ impl Method for MembersRequest { fn encode(self) -> eyre::Result> { let context_id: ICContextId = (*self.context_id).rt()?; - let payload: ICMembersRequest = ICMembersRequest { - context_id, - offset: self.offset, - length: self.length, - }; - Encode!(&payload).map_err(|e| eyre::eyre!(e)) + Encode!(&context_id, &self.offset, &self.length).map_err(|e| eyre::eyre!(e)) } fn decode(response: Vec) -> eyre::Result { diff --git a/crates/context/config/src/client/env/config/query/proxy_contract.rs b/crates/context/config/src/client/env/config/query/proxy_contract.rs index 00a68b3aa..fd9bcb9dd 100644 --- a/crates/context/config/src/client/env/config/query/proxy_contract.rs +++ b/crates/context/config/src/client/env/config/query/proxy_contract.rs @@ -1,14 +1,15 @@ -use candid::Decode; +use candid::{Decode, Encode}; use serde::Serialize; use starknet::core::codec::Encode as StarknetEncode; use starknet_crypto::Felt; +use crate::client::env::config::types::icp::ICContextId; use crate::client::env::config::types::starknet::{CallData, FeltPair}; use crate::client::env::Method; use crate::client::protocol::icp::Icp; use crate::client::protocol::near::Near; use crate::client::protocol::starknet::Starknet; -use crate::repr::Repr; +use crate::repr::{Repr, ReprTransmute}; use crate::types::ContextId; #[derive(Copy, Clone, Debug, Serialize)] @@ -66,7 +67,8 @@ impl Method for ProxyContractRequest { type Returns = String; fn encode(self) -> eyre::Result> { - todo!(); + let context_id: ICContextId = (*self.context_id).rt()?; + Encode!(&context_id).map_err(|e| eyre::eyre!(e)) } fn decode(response: Vec) -> eyre::Result {