.map(|hash| self.client.get_block(&hash))
.transpose()?,
)
}
pub(crate) fn get_block_by_hash(&self, hash: BlockHash) -> Result<Option<Block>> {
self.client.get_block(&hash).into_option()
}
pub(crate) fn get_collections_paginated(
&self,
page_size: usize,
page_index: usize,
) -> Result<(Vec<InscriptionId>, bool)> {
let rtx = self.database.begin_read()?;
let sequence_number_to_inscription_entry =
rtx.open_table(SEQUENCE_NUMBER_TO_INSCRIPTION_ENTRY)?;
let mut collections = rtx
.open_multimap_table(SEQUENCE_NUMBER_TO_CHILDREN)?
.iter()?
.skip(page_index.saturating_mul(page_size))
.take(page_size.saturating_add(1))
.map(|result| {
result
.and_then(|(parent, _children)| {
sequence_number_to_inscription_entry
.get(parent.value())
.map(|entry| InscriptionEntry::load(entry.unwrap().value()).id)
})
.map_err(|err| err.into())
})
.collect::<Result<Vec<InscriptionId>>>()?;