From 3a860d7d456120e1f0268d1e8b7b06ce99f4f89c Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Wed, 18 Dec 2024 11:33:42 -0500 Subject: [PATCH] use XmtpApiClient in getInboxIds (#1429) * use XmtpApiClient in getInboxIds * fix test --- Cargo.lock | 1 - bindings_ffi/src/mls.rs | 19 ++++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5627ff5d8..cf5f4a245 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7518,7 +7518,6 @@ dependencies = [ "tracing-oslog", "tracing-subscriber", "uniffi", - "url", "uuid 1.11.0", "xmtp_api_grpc", "xmtp_common", diff --git a/bindings_ffi/src/mls.rs b/bindings_ffi/src/mls.rs index 339c9c23e..4ac46b3c1 100644 --- a/bindings_ffi/src/mls.rs +++ b/bindings_ffi/src/mls.rs @@ -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::{ @@ -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, account_address: String, ) -> Result, 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)?; @@ -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