Skip to content

Commit bb7dd2f

Browse files
committed
ledger rpc U64 change
1 parent af85eae commit bb7dd2f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edition = "2021"
55
resolver = "2"
66

77
[dependencies]
8+
alloy-primitives = { version = "0.8.12", default-features = false, features = ["serde"] }
89
anyhow = { version = "1.0.68", default-features = false, features = ["std"] }
910
async-trait = "0.1.71"
1011
bitcoin = { version = "0.32.2", features = ["serde", "rand"] }

src/client.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::time::{Duration, SystemTime};
22

3+
use alloy_primitives::U64;
34
use anyhow::{bail, Result};
45
use jsonrpsee::{
56
core::client::ClientT,
@@ -44,14 +45,16 @@ impl Client {
4445
Ok(self
4546
.client
4647
.request("ledger_getLastScannedL1Height", rpc_params![])
47-
.await?)
48+
.await
49+
.map(|v: U64| v.try_into().expect("U64 to u64 must succeed"))?)
4850
}
4951

5052
pub async fn ledger_get_head_soft_confirmation_height(&self) -> Result<u64> {
5153
Ok(self
5254
.client
5355
.request("ledger_getHeadSoftConfirmationHeight", rpc_params![])
54-
.await?)
56+
.await
57+
.map(|v: U64| v.try_into().expect("U64 to u64 must succeed"))?)
5558
}
5659

5760
pub async fn wait_for_l2_block(&self, num: u64, timeout: Option<Duration>) -> Result<()> {

0 commit comments

Comments
 (0)