Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions core/apps/dynode/src/jsonrpc_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ pub enum JsonRpcRequest {
}

impl JsonRpcRequest {
pub fn get_methods_list(&self) -> String {
self.get_methods_for_metrics().join(",")
}

pub fn get_methods_for_metrics(&self) -> Vec<String> {
match self {
Self::Single(call) => vec![call.method.clone()],
Expand Down
44 changes: 0 additions & 44 deletions core/crates/api_connector/src/app_store_client/client.rs

This file was deleted.

2 changes: 0 additions & 2 deletions core/crates/api_connector/src/app_store_client/mod.rs

This file was deleted.

75 changes: 0 additions & 75 deletions core/crates/api_connector/src/app_store_client/models.rs

This file was deleted.

2 changes: 0 additions & 2 deletions core/crates/api_connector/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
pub mod app_store_client;
pub mod pusher;
pub mod static_assets_client;
pub use self::app_store_client::client::AppStoreClient;
pub use self::pusher::client::PusherClient;
pub use self::pusher::model::PushResult;
pub use self::static_assets_client::client::StaticAssetsClient;
29 changes: 0 additions & 29 deletions core/crates/cacher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ impl CacherClient {
Ok(Self { connection })
}

pub async fn set_values(&self, values: Vec<(String, String)>) -> Result<usize, Box<dyn Error + Send + Sync>> {
if values.is_empty() {
return Ok(0);
}
self.connection.clone().mset::<String, String, ()>(values.as_slice()).await?;
Ok(values.len())
}

pub async fn set_values_with_publish(&self, values: Vec<(String, String)>, ttl_seconds: i64) -> Result<usize, Box<dyn Error + Send + Sync>> {
let values = values.into_iter().map(|(key, value)| (key, value, ttl_seconds)).collect();
self.set_serialized_values_with_ttl_and_publish(values, true).await
Expand Down Expand Up @@ -121,10 +113,6 @@ impl CacherClient {
Ok(self.connection.clone().del(keys).await?)
}

pub async fn increment(&self, key: &str) -> Result<i64, Box<dyn Error + Send + Sync>> {
Ok(self.connection.clone().incr(key, 1).await?)
}

pub async fn increment_with_ttl(&self, key: &str, ttl: i64) -> Result<i64, Box<dyn Error + Send + Sync>> {
let mut pipe = redis::pipe();
pipe.atomic();
Expand All @@ -144,10 +132,6 @@ impl CacherClient {
Ok(())
}

pub async fn get_cached<T: serde::de::DeserializeOwned>(&self, key: CacheKey<'_>) -> Result<T, Box<dyn Error + Send + Sync>> {
self.get_value(&key.key()).await
}

pub async fn get_cached_optional<T: serde::de::DeserializeOwned>(&self, key: CacheKey<'_>) -> Result<Option<T>, Box<dyn Error + Send + Sync>> {
self.get_value_optional(&key.key()).await
}
Expand Down Expand Up @@ -245,15 +229,6 @@ impl CacherClient {
self.can_process_now(&key.key(), key.ttl()).await
}

pub async fn set_i64(&self, key: &str, value: i64, ttl_seconds: u64) -> Result<(), Box<dyn Error + Send + Sync>> {
self.connection.clone().set_ex::<&str, i64, ()>(key, value, ttl_seconds).await?;
Ok(())
}

pub async fn get_i64(&self, key: &str) -> Result<Option<i64>, Box<dyn Error + Send + Sync>> {
Ok(self.connection.clone().get::<&str, Option<i64>>(key).await?)
}

pub async fn sorted_set_incr_with_expire(&self, key: &str, members: &[String], ttl: i64) -> Result<(), Box<dyn Error + Send + Sync>> {
if members.is_empty() {
return Ok(());
Expand All @@ -272,10 +247,6 @@ impl CacherClient {
Ok(self.connection.clone().publish(channel, &message).await?)
}

pub async fn keys(&self, pattern: &str) -> Result<Vec<String>, Box<dyn Error + Send + Sync>> {
Ok(redis::cmd("KEYS").arg(pattern).query_async(&mut self.connection.clone()).await?)
}

pub async fn sorted_set_range_by_score(&self, key: &str, min: f64, max: f64, limit: usize) -> Result<Vec<String>, Box<dyn Error + Send + Sync>> {
Ok(redis::cmd("ZRANGEBYSCORE")
.arg(key)
Expand Down
4 changes: 0 additions & 4 deletions core/crates/chain_traits/src/node_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ impl NodeCheckRecorder {
self.record_result(method, result.map(|value| (value, "available".to_string())), started.elapsed()).0
}

pub fn record_available<T, E: Display>(self, method: &str, result: Result<T, E>) -> Self {
self.record_result(method, result.map(|value| (value, "available".to_string())), Duration::ZERO).0
}

pub async fn record_optional_available_timed<T, E: Display, F: Future<Output = Result<T, E>>>(self, method: &str, future: F) -> Self {
let started = Instant::now();
let result = future.await;
Expand Down
4 changes: 0 additions & 4 deletions core/crates/coingecko/src/testkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ use chrono::{DateTime, Utc};
use crate::CoinMarket;

impl CoinMarket {
pub fn mock() -> Self {
Self::mock_with_id("bitcoin")
}

pub fn mock_with_id(id: &str) -> Self {
Self {
id: id.to_string(),
Expand Down
4 changes: 0 additions & 4 deletions core/crates/coinmarketcap/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ pub struct CoinMarketCapClient<C: Client> {
}

impl CoinMarketCapClient<ReqwestClient> {
pub fn new(api_key: &str) -> Self {
Self::new_with_reqwest_client(gem_client::reqwest_client(), api_key)
}

pub fn new_with_reqwest_client(client: reqwest::Client, api_key: &str) -> Self {
Self::new_with_client_and_api_key(ReqwestClient::new(COINMARKETCAP_API_URL.to_string(), client), api_key)
}
Expand Down
11 changes: 0 additions & 11 deletions core/crates/fiat/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,6 @@ impl FiatClient {
Ok(FiatRepository::get_fiat_providers_countries(&mut self.database.fiat()?)?)
}

pub async fn get_order_status(&self, provider_name: &str, order_id: &str) -> Result<FiatTransaction, Box<dyn std::error::Error + Send + Sync>> {
let provider = self.provider(provider_name)?;
let update = provider.get_order_status(order_id).await?;
let transaction = self.database.fiat()?.update_fiat_transaction(provider.name(), update)?;
Ok(transaction.as_primitive()?)
}

pub async fn process_and_publish_webhook(&self, request: FiatWebhookRequest, provider_name: &str) -> Result<FiatWebhookPayload, Box<dyn std::error::Error + Send + Sync>> {
let provider = self.provider(provider_name)?;
let provider_id = provider.name().id().to_string();
Expand Down Expand Up @@ -231,10 +224,6 @@ impl FiatClient {
Ok(FiatQuotes { quotes, errors })
}

pub async fn get_quote(&self, quote_id: &str) -> Result<FiatQuote, Box<dyn Error + Send + Sync>> {
Ok(self.fiat_cacher.get_quote(quote_id).await?.quote)
}

pub async fn get_quote_url(&self, quote_id: &str, wallet_id: i32, device_id: i32, ip_address: &str, locale: &str) -> Result<FiatQuoteUrl, Box<dyn Error + Send + Sync>> {
let crate::CachedFiatQuoteData {
quote,
Expand Down
4 changes: 0 additions & 4 deletions core/crates/fiat/src/providers/mercuryo/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ impl MercuryoWidget {
format!("v2:{}", hash)
}

pub fn merchant_transaction_id(&self) -> &str {
&self.merchant_transaction_id
}

pub fn to_url(&self) -> String {
let mut url = Url::parse(MERCURYO_REDIRECT_URL).unwrap();

Expand Down
6 changes: 1 addition & 5 deletions core/crates/gem_algorand/src/rpc/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::error::Error;

use crate::models::{Account, AssetDetails, Block, TransactionBroadcast, TransactionStatus, TransactionsParams};
use crate::models::{Account, AssetDetails, TransactionBroadcast, TransactionStatus, TransactionsParams};
use gem_client::{CONTENT_TYPE, ContentType};

#[cfg(feature = "rpc")]
Expand Down Expand Up @@ -36,10 +36,6 @@ impl<C: Client> AlgorandClient<C> {
Ok(self.client.get("/v2/transactions/params").await?)
}

pub async fn get_block(&self, block_number: u64) -> Result<Block, Box<dyn Error + Send + Sync>> {
Ok(self.client.get(&format!("/v2/blocks/{}", block_number)).await?)
}

pub async fn broadcast_transaction(&self, data: &str) -> Result<TransactionBroadcast, Box<dyn Error + Send + Sync>> {
let headers = HashMap::from([(CONTENT_TYPE.to_string(), ContentType::ApplicationXBinary.as_str().to_string())]);

Expand Down
19 changes: 7 additions & 12 deletions core/crates/gem_encoding/src/protobuf/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ impl<'a> Field<'a> {
}
}

pub fn fixed32(self) -> MessageResult<u32> {
match self.value {
FieldValue::Fixed32(value) => Ok(value),
_ => Err(format!("protobuf field {} is not fixed32", self.number).into()),
}
}

pub fn bytes(self) -> MessageResult<&'a [u8]> {
match self.value {
FieldValue::Bytes(value) => Ok(value),
Expand All @@ -50,7 +43,7 @@ enum FieldValue<'a> {
Varint(u64),
Fixed64(u64),
Bytes(&'a [u8]),
Fixed32(u32),
Fixed32,
}

pub fn visit_fields(data: &[u8], mut visitor: impl FnMut(Field<'_>) -> MessageResult<()>) -> MessageResult<()> {
Expand All @@ -72,7 +65,10 @@ pub fn visit_fields(data: &[u8], mut visitor: impl FnMut(Field<'_>) -> MessageRe
position = end;
FieldValue::Bytes(value)
}
WIRE_FIXED32 => FieldValue::Fixed32(read_fixed32(data, &mut position)?),
WIRE_FIXED32 => {
skip_fixed32(data, &mut position)?;
FieldValue::Fixed32
}
_ => return Err(format!("unsupported protobuf wire type {wire_type}").into()),
};
visitor(Field { number, value })?;
Expand Down Expand Up @@ -112,14 +108,13 @@ fn read_fixed64(data: &[u8], position: &mut usize) -> MessageResult<u64> {
Ok(value)
}

fn read_fixed32(data: &[u8], position: &mut usize) -> MessageResult<u32> {
fn skip_fixed32(data: &[u8], position: &mut usize) -> MessageResult<()> {
let end = position.checked_add(4).ok_or("invalid protobuf fixed32 length")?;
if end > data.len() {
return Err("truncated protobuf fixed32".into());
}
let value = u32::from_le_bytes(data[*position..end].try_into()?);
*position = end;
Ok(value)
Ok(())
}

#[macro_export]
Expand Down
Loading
Loading