use alloc::string::String;
use alloc::vec::Vec;
use miden_tx::utils::serde::{Deserializable, Serializable};
use super::Client;
use crate::errors::ClientError;
impl<AUTH> Client<AUTH> {
pub async fn set_setting<T: Serializable>(
&mut self,
key: String,
value: T,
) -> Result<(), ClientError> {
self.store.set_setting(key, value.to_bytes()).await.map_err(Into::into)
}
pub async fn get_setting<T: Deserializable>(
&self,
key: String,
) -> Result<Option<T>, ClientError> {
self.store
.get_setting(key)
.await
.map(|value| value.map(|value| Deserializable::read_from_bytes(&value)))?
.transpose()
.map_err(Into::into)
}
pub async fn remove_setting(&mut self, key: String) -> Result<(), ClientError> {
self.store.remove_setting(key).await.map_err(Into::into)
}
pub async fn list_setting_keys(&self) -> Result<Vec<String>, ClientError> {
self.store.list_setting_keys().await.map_err(Into::into)
}
}