diff --git a/Cargo.toml b/Cargo.toml index 9fbdd85..0b96ce5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "init4-bin-base" description = "Internal utilities for binaries produced by the init4 team" keywords = ["init4", "bin", "base"] -version = "0.18.0-rc.9" +version = "0.18.0-rc.10" edition = "2021" rust-version = "1.85" authors = ["init4", "James Prestwich", "evalir"] @@ -15,8 +15,8 @@ repository = "https://github.com/init4tech/bin-base" init4-from-env-derive = { version = "0.2.0", path = "from-env-derive" } # Signet -signet-constants = { version = "0.16.0-rc.7" } -signet-tx-cache = { version = "0.16.0-rc.7", optional = true } +signet-constants = { version = "0.16.0-rc.11" } +signet-tx-cache = { version = "0.16.0-rc.11", optional = true } # alloy alloy = { version = "1.0.35", optional = true, default-features = false, features = ["std", "signer-local", "consensus", "network"] } diff --git a/src/perms/tx_cache.rs b/src/perms/tx_cache.rs index 67cd42a..1cb4902 100644 --- a/src/perms/tx_cache.rs +++ b/src/perms/tx_cache.rs @@ -2,7 +2,7 @@ use crate::perms::oauth::SharedToken; use serde::de::DeserializeOwned; use signet_tx_cache::{ error::TxCacheError, - types::{BundleKey, CacheObject, TxCacheBundle, TxCacheBundleResponse, TxCacheBundlesResponse}, + types::{BundleKey, BundleList, CacheObject, CacheResponse, CachedBundle}, TxCache, }; use thiserror::Error; @@ -139,8 +139,8 @@ impl BuilderTxCache { /// Returns an error if the request fails or the builder is not permissioned /// for the current slot. #[instrument(skip_all)] - pub async fn get_bundles(&self, query: Option) -> Result { - self.get_inner_with_token::(BUNDLES, query) + pub async fn get_bundles(&self, query: Option) -> Result> { + self.get_inner_with_token::>(BUNDLES, query) .await } @@ -151,10 +151,20 @@ impl BuilderTxCache { /// Get a bundle from the cache by its UUID. For convenience, this method /// takes a string reference, which is expected to be a valid UUID. #[instrument(skip_all)] - pub async fn get_bundle(&self, bundle_id: &str) -> Result { - let url = self.get_bundle_url_path(bundle_id); - self.get_inner_with_token::(&url, None) + pub async fn get_bundle(&self, bundle_id: &str) -> Result { + let url_path = self.get_bundle_url_path(bundle_id); + let url = self.tx_cache.url().join(&url_path)?; + let secret = self.token.secret().await?; + + self.tx_cache + .client() + .get(url) + .bearer_auth(secret) + .send() + .await? + .error_for_status()? + .json::() .await - .map(|response| response.bundle) + .map_err(Into::into) } }