Skip to content

Commit 794feb2

Browse files
committed
refactor(bridge-state): use XOnlyPk for dest_pk
1 parent f021008 commit 794feb2

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

crates/primitives/src/l1.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,9 @@ impl Sum for BitcoinAmount {
365365
}
366366

367367
/// A wrapper around [`Buf32`] for XOnly Schnorr taproot pubkeys.
368-
#[derive(Debug, Clone, Copy, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
368+
#[derive(
369+
Debug, Clone, Copy, PartialEq, Eq, BorshSerialize, BorshDeserialize, Serialize, Deserialize,
370+
)]
369371
pub struct XOnlyPk(Buf32);
370372

371373
impl XOnlyPk {

crates/state/src/bridge_ops.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use borsh::{BorshDeserialize, BorshSerialize};
44
use serde::{Deserialize, Serialize};
55

6-
use alpen_express_primitives::{l1::BitcoinAmount, prelude::BitcoinAddress};
6+
use alpen_express_primitives::l1::{BitcoinAmount, XOnlyPk};
77

88
pub const WITHDRAWAL_DENOMINATION: BitcoinAmount = BitcoinAmount::from_int_btc(10);
99

@@ -14,23 +14,23 @@ pub struct WithdrawalIntent {
1414
amt: BitcoinAmount,
1515

1616
/// Destination address.
17-
dest_pk: BitcoinAddress,
17+
dest_pk: XOnlyPk,
1818
}
1919

2020
impl WithdrawalIntent {
21-
pub fn new(amt: BitcoinAmount, dest_pk: BitcoinAddress) -> Self {
21+
pub fn new(amt: BitcoinAmount, dest_pk: XOnlyPk) -> Self {
2222
Self { amt, dest_pk }
2323
}
2424

25-
pub fn into_parts(&self) -> (BitcoinAmount, BitcoinAddress) {
26-
(self.amt, self.dest_pk.clone())
25+
pub fn into_parts(&self) -> (BitcoinAmount, XOnlyPk) {
26+
(self.amt, self.dest_pk)
2727
}
2828

2929
pub fn amt(&self) -> &BitcoinAmount {
3030
&self.amt
3131
}
3232

33-
pub fn dest_pk(&self) -> &BitcoinAddress {
33+
pub fn dest_pk(&self) -> &XOnlyPk {
3434
&self.dest_pk
3535
}
3636
}

sequencer/src/rpc_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ where
401401
.output()
402402
.withdrawals()
403403
.iter()
404-
.map(|intent| WithdrawalIntent::new(*intent.amt(), intent.dest_pk().clone()))
404+
.map(|intent| WithdrawalIntent::new(*intent.amt(), *intent.dest_pk()))
405405
.collect();
406406

407407
let da_blobs = exec_update

0 commit comments

Comments
 (0)