Skip to content

Commit

Permalink
use XmtpApiClient in getInboxIds (#1429)
Browse files Browse the repository at this point in the history
* use XmtpApiClient in getInboxIds

* fix test
  • Loading branch information
insipx authored Dec 18, 2024
1 parent b5f3237 commit 3a860d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 6 additions & 13 deletions bindings_ffi/src/mls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{FfiSubscribeError, GenericError};
use std::{collections::HashMap, convert::TryInto, sync::Arc};
use tokio::sync::Mutex;
use xmtp_api_grpc::grpc_api_helper::Client as TonicApiClient;
use xmtp_common::retry::Retry;
use xmtp_id::associations::verify_signed_with_public_context;
use xmtp_id::scw_verifier::RemoteSignatureVerifier;
use xmtp_id::{
Expand Down Expand Up @@ -155,18 +154,11 @@ pub async fn create_client(
#[allow(unused)]
#[uniffi::export(async_runtime = "tokio")]
pub async fn get_inbox_id_for_address(
host: String,
is_secure: bool,
api: Arc<XmtpApiClient>,
account_address: String,
) -> Result<Option<String>, GenericError> {
let api_client = ApiClientWrapper::new(
TonicApiClient::create(host.clone(), is_secure)
.await?
.into(),
Retry::default(),
);

let results = api_client
let api = ApiClientWrapper::new(Arc::new(api.0.clone()), Default::default());
let results = api
.get_inbox_ids(vec![account_address.clone()])
.await
.map_err(GenericError::from_error)?;
Expand Down Expand Up @@ -2136,8 +2128,9 @@ mod tests {
let real_inbox_id = client.inbox_id();

let from_network = get_inbox_id_for_address(
xmtp_api_grpc::LOCALHOST_ADDRESS.to_string(),
false,
connect_to_backend(xmtp_api_grpc::LOCALHOST_ADDRESS.to_string(), false)
.await
.unwrap(),
client.account_address.clone(),
)
.await
Expand Down

0 comments on commit 3a860d7

Please sign in to comment.