From 0dce5c592c164a922e20050672ce8724147a6184 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Tue, 13 Aug 2024 15:36:14 -0400 Subject: [PATCH] fix http client `new` --- bindings_wasm/src/mls_client.rs | 7 +++++-- xmtp_api_http/src/lib.rs | 2 +- xmtp_mls/src/utils/test.rs | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bindings_wasm/src/mls_client.rs b/bindings_wasm/src/mls_client.rs index 7c6a6e95c..2afad6c74 100644 --- a/bindings_wasm/src/mls_client.rs +++ b/bindings_wasm/src/mls_client.rs @@ -33,7 +33,7 @@ pub async fn create_client( encryption_key: Option, history_sync_url: Option, ) -> Result { - let api_client = XmtpHttpApiClient::new(host.clone()); + let api_client = XmtpHttpApiClient::new(host.clone()).unwrap(); let storage_option = StorageOption::Ephemeral; let store = match encryption_key { @@ -86,7 +86,10 @@ pub async fn get_inbox_id_for_address( account_address: String, ) -> Result, JsError> { let account_address = account_address.to_lowercase(); - let api_client = ApiClientWrapper::new(XmtpHttpApiClient::new(host.clone()), Retry::default()); + let api_client = ApiClientWrapper::new( + XmtpHttpApiClient::new(host.clone()).unwrap(), + Retry::default(), + ); let results = api_client .get_inbox_ids(vec![account_address.clone()]) diff --git a/xmtp_api_http/src/lib.rs b/xmtp_api_http/src/lib.rs index eace69832..a375ded72 100644 --- a/xmtp_api_http/src/lib.rs +++ b/xmtp_api_http/src/lib.rs @@ -288,7 +288,7 @@ mod tests { #[tokio::test] async fn test_register_installation() { - let client = XmtpHttpApiClient::new(ApiUrls::LOCAL_ADDRESS.to_string()); + let client = XmtpHttpApiClient::new(ApiUrls::LOCAL_ADDRESS.to_string()).unwrap(); let result = client .register_installation(RegisterInstallationRequest { is_inbox_id_credential: false, diff --git a/xmtp_mls/src/utils/test.rs b/xmtp_mls/src/utils/test.rs index 175bcb689..9c7e8bd18 100644 --- a/xmtp_mls/src/utils/test.rs +++ b/xmtp_mls/src/utils/test.rs @@ -52,11 +52,11 @@ pub fn rand_time() -> i64 { #[cfg(feature = "http-api")] impl XmtpTestClient for XmtpHttpApiClient { async fn create_local() -> Self { - XmtpHttpApiClient::new("http://localhost:5555".into()) + XmtpHttpApiClient::new("http://localhost:5555".into()).unwrap() } async fn create_dev() -> Self { - XmtpHttpApiClient::new("https://grpc.dev.xmtp.network:443".into()) + XmtpHttpApiClient::new("https://grpc.dev.xmtp.network:443".into()).unwrap() } }