Skip to content

Commit c8ec3b2

Browse files
committed
bump: 💫 Bump version to 0.5.0
1 parent 2b56b53 commit c8ec3b2

File tree

14 files changed

+199
-36
lines changed

14 files changed

+199
-36
lines changed

‎Cargo.lock‎

Lines changed: 162 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pragma-common"
3-
version = "0.4.8"
3+
version = "0.5.0"
44
edition = "2021"
55
rust-version = "1.81"
66
categories = ["finance", "api-bindings"]
@@ -30,7 +30,7 @@ telemetry = [
3030
services = ["dep:async-trait", "dep:futures", "dep:tokio", "dep:tokio-util"]
3131
starknet = [
3232
"dep:async-trait",
33-
"dep:starknet",
33+
"dep:starknet-rust",
3434
"dep:serde",
3535
"dep:starknet-crypto",
3636
"dep:cainome",
@@ -69,7 +69,7 @@ indexmap = { version = "2.2", optional = true }
6969
num-bigint = { version = "0.4.6", features = ["serde"], optional = true }
7070
rust_decimal = { version = "1.37.1", features = ["serde"], optional = true }
7171
serde_json = { version = "1.0", optional = true }
72-
starknet = { version = "0.17.0", optional = true }
72+
starknet-rust = { version = "0.18.0", optional = true }
7373
starknet-crypto = { version = "0.8.1", optional = true }
7474

7575
# feature[proto]

‎src/entries/orderbook.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl std::fmt::Display for UpdateType {
5555
impl std::fmt::Display for OrderbookUpdateType {
5656
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5757
match self {
58-
Self::Update(update_type) => write!(f, "update with type {}", update_type),
58+
Self::Update(update_type) => write!(f, "update with type {update_type}"),
5959
Self::Snapshot => write!(f, "snapshot"),
6060
}
6161
}
@@ -157,8 +157,7 @@ impl OrderbookEntry {
157157
x if x == crate::schema::UpdateType::Delta as i32 => UpdateType::Delta,
158158
_ => {
159159
return Err(prost::DecodeError::new(format!(
160-
"Invalid update type value: {}",
161-
update_type_value,
160+
"Invalid update type value: {update_type_value}",
162161
)))
163162
}
164163
};

‎src/entries/price.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ impl PriceEntry {
9595
x if x == crate::schema::Chain::Worldchain as i32 => Chain::Worldchain,
9696
_ => {
9797
return Err(prost::DecodeError::new(format!(
98-
"Unknown chain value: {}",
99-
chain
98+
"Unknown chain value: {chain}",
10099
)))
101100
}
102101
}),

‎src/exchange/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Exchange {
6060
"BTC" => "PF_XBTUSD".to_string(),
6161
other => format!("PF_{other}USD"),
6262
},
63-
Exchange::Lmax | Exchange::Extended => format!("{}-USD", asset_symbol),
63+
Exchange::Lmax | Exchange::Extended => format!("{asset_symbol}-USD"),
6464
}
6565
}
6666

‎src/instrument_type.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl InstrumentType {
5151
}
5252

5353
pub fn to_ascii_uppercase(&self) -> String {
54-
format!("{}", self).to_ascii_uppercase()
54+
format!("{self}").to_ascii_uppercase()
5555
}
5656
}
5757

‎src/pair/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ mod tests {
266266
#[case(Pair { base: "BTC".to_string(), quote: "USD".to_string() }, "BTC/USD")]
267267
#[case(Pair { base: "ETH".to_string(), quote: "USDT".to_string() }, "ETH/USDT")]
268268
fn test_display(#[case] pair: Pair, #[case] expected: &str) {
269-
assert_eq!(format!("{}", pair), expected);
269+
assert_eq!(format!("{pair}"), expected);
270270
}
271271

272272
/// Test `From<Pair> for String`

‎src/starknet/conversion.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use starknet::core::types::Felt;
1+
use starknet_rust::core::types::Felt;
22

33
pub mod starknet_felt_conversion {
44
use super::Felt; // Import Felt from the parent module (or crate)
@@ -34,7 +34,7 @@ pub mod starknet_felt_conversion {
3434
#[cfg(test)]
3535
mod tests {
3636
use super::starknet_felt_conversion::*; // Use the new module
37-
use starknet::core::types::Felt;
37+
use starknet_rust::core::types::Felt;
3838

3939
// Helper function to create Felt from a byte slice, padding/truncating to 32 bytes BE
4040
fn felt_from_custom_bytes(slice: &[u8]) -> Felt {

‎src/starknet/errors.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use starknet::core::crypto::EcdsaSignError;
2-
use starknet::core::types::Felt;
1+
use starknet_rust::core::crypto::EcdsaSignError;
2+
use starknet_rust::core::types::Felt;
33

44
#[derive(Debug, thiserror::Error)]
55
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]

‎src/starknet/fallback_provider.rs‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::sync::Arc;
22
use std::time::Duration;
33

44
use async_trait::async_trait;
5-
use starknet::{
5+
use starknet_rust::{
66
core::types::{
77
BlockHashAndNumber, BlockId, BroadcastedDeclareTransaction,
88
BroadcastedDeployAccountTransaction, BroadcastedInvokeTransaction, BroadcastedTransaction,
@@ -182,12 +182,11 @@ impl FallbackProvider {
182182
};
183183

184184
timeout(timeout_duration, wait_future).await.map_err(|_| {
185-
ProviderError::StarknetError(starknet::core::types::StarknetError::UnexpectedError(
186-
format!(
187-
"Timeout waiting for transaction {:#x} to be accepted on {:?} after {:?}",
188-
tx_hash, target, timeout_duration
189-
),
190-
))
185+
ProviderError::StarknetError(
186+
starknet_rust::core::types::StarknetError::UnexpectedError(format!(
187+
"Timeout waiting for transaction {tx_hash:#x} to be accepted on {target:?} after {timeout_duration:?}",
188+
)),
189+
)
191190
})?
192191
}
193192

@@ -259,6 +258,15 @@ impl FallbackProvider {
259258
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
260259
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
261260
impl Provider for FallbackProvider {
261+
async fn starknet_version<B>(&self, block_id: B) -> Result<String, ProviderError>
262+
where
263+
B: AsRef<BlockId> + Send + Sync,
264+
{
265+
let owned_block_id = *block_id.as_ref();
266+
self.execute_with_fallback(|provider| Box::pin(provider.starknet_version(owned_block_id)))
267+
.await
268+
}
269+
262270
async fn spec_version(&self) -> Result<String, ProviderError> {
263271
self.execute_with_fallback(|provider| Box::pin(provider.spec_version()))
264272
.await

0 commit comments

Comments
 (0)