Skip to content

Commit

Permalink
added getter methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvja committed Nov 24, 2023
1 parent 0014757 commit a6ec6db
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions solana/solana-ibc/programs/solana-ibc/src/storage/ids.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anchor_lang::prelude::borsh;
use ::ibc::core::ics24_host::identifier::ChannelId;

use super::ibc;

Expand Down Expand Up @@ -125,8 +126,8 @@ impl TryFrom<&ibc::ConnectionId> for ConnectionIdx {
borsh::BorshDeserialize,
)]
pub struct PortChannelPK {
pub port_id: ibc::PortId,
pub channel_idx: u32,
pub(super) port_id: ibc::PortId,
pub(super) channel_idx: u32,
}

impl PortChannelPK {
Expand All @@ -152,6 +153,14 @@ impl PortChannelPK {
}),
}
}

pub fn channel_id(&self) -> ibc::ChannelId {
ChannelId::new(self.channel_idx.into())
}

pub fn port_id(&self) -> ibc::PortId {
self.port_id.clone()
}
}

pub trait MaybeOwned<T> {
Expand Down

0 comments on commit a6ec6db

Please sign in to comment.