-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved send_packet impls to its own mod
- Loading branch information
Showing
3 changed files
with
44 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
crates/relayer-all-in-one/src/one_for_all/impls/chain/queries/send_packet.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use async_trait::async_trait; | ||
|
||
use ibc_relayer_components::chain::traits::queries::send_packet::CanQuerySendPacketsFromSequences; | ||
|
||
use crate::one_for_all::traits::chain::{OfaChainTypes, OfaIbcChain}; | ||
use crate::one_for_all::types::chain::OfaChainWrapper; | ||
use crate::std_prelude::*; | ||
|
||
#[async_trait] | ||
impl<Chain, Counterparty> CanQuerySendPacketsFromSequences<OfaChainWrapper<Counterparty>> | ||
for OfaChainWrapper<Chain> | ||
where | ||
Chain: OfaIbcChain<Counterparty> + OfaChainTypes, | ||
Counterparty: OfaIbcChain<Chain>, | ||
{ | ||
/// Given a list of sequences, a channel and port will query a list of outgoing | ||
/// packets which have not been relayed. | ||
async fn query_send_packets_from_sequences( | ||
&self, | ||
channel_id: &Self::ChannelId, | ||
port_id: &Self::PortId, | ||
counterparty_channel_id: &Counterparty::ChannelId, | ||
counterparty_port_id: &Counterparty::PortId, | ||
sequences: &[Self::Sequence], | ||
// The height is given to query the packets from a specific height. | ||
// This height should be the same as the query height from the | ||
// `CanQueryPacketCommitments` made on the same chain. | ||
height: &Self::Height, | ||
) -> Result<Vec<Self::OutgoingPacket>, Self::Error> { | ||
let send_packets = self | ||
.chain | ||
.query_send_packets_from_sequences( | ||
channel_id, | ||
port_id, | ||
counterparty_channel_id, | ||
counterparty_port_id, | ||
sequences, | ||
height, | ||
) | ||
.await?; | ||
Ok(send_packets) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters