Changeset View
Changeset View
Standalone View
Standalone View
chronik/chronik-indexer/src/indexer.rs
Show First 20 Lines • Show All 524 Lines • ▼ Show 20 Lines | pub fn broadcast<'a>(&'a self, node: &'a Node) -> QueryBroadcast<'a> { | ||||
avalanche: &self.avalanche, | avalanche: &self.avalanche, | ||||
mempool: &self.mempool, | mempool: &self.mempool, | ||||
node, | node, | ||||
is_token_index_enabled: self.is_token_index_enabled, | is_token_index_enabled: self.is_token_index_enabled, | ||||
} | } | ||||
} | } | ||||
/// Return [`QueryBlocks`] to read blocks from the DB. | /// Return [`QueryBlocks`] to read blocks from the DB. | ||||
pub fn blocks(&self) -> QueryBlocks<'_> { | pub fn blocks<'a>(&'a self, node: &'a Node) -> QueryBlocks<'a> { | ||||
QueryBlocks { | QueryBlocks { | ||||
db: &self.db, | db: &self.db, | ||||
avalanche: &self.avalanche, | avalanche: &self.avalanche, | ||||
mempool: &self.mempool, | mempool: &self.mempool, | ||||
node, | |||||
is_token_index_enabled: self.is_token_index_enabled, | is_token_index_enabled: self.is_token_index_enabled, | ||||
} | } | ||||
} | } | ||||
/// Return [`QueryTxs`] to return txs from mempool/DB. | /// Return [`QueryTxs`] to return txs from mempool/DB. | ||||
pub fn txs(&self) -> QueryTxs<'_> { | pub fn txs<'a>(&'a self, node: &'a Node) -> QueryTxs<'a> { | ||||
QueryTxs { | QueryTxs { | ||||
db: &self.db, | db: &self.db, | ||||
avalanche: &self.avalanche, | avalanche: &self.avalanche, | ||||
mempool: &self.mempool, | mempool: &self.mempool, | ||||
node, | |||||
is_token_index_enabled: self.is_token_index_enabled, | is_token_index_enabled: self.is_token_index_enabled, | ||||
} | } | ||||
} | } | ||||
/// Return [`QueryGroupHistory`] for scripts to query the tx history of | /// Return [`QueryGroupHistory`] for scripts to query the tx history of | ||||
/// scripts. | /// scripts. | ||||
pub fn script_history(&self) -> Result<QueryGroupHistory<'_, ScriptGroup>> { | pub fn script_history<'a>( | ||||
&'a self, | |||||
node: &'a Node, | |||||
) -> Result<QueryGroupHistory<'a, ScriptGroup>> { | |||||
Ok(QueryGroupHistory { | Ok(QueryGroupHistory { | ||||
db: &self.db, | db: &self.db, | ||||
avalanche: &self.avalanche, | avalanche: &self.avalanche, | ||||
mempool: &self.mempool, | mempool: &self.mempool, | ||||
mempool_history: self.mempool.script_history(), | mempool_history: self.mempool.script_history(), | ||||
group: self.script_group.clone(), | group: self.script_group.clone(), | ||||
node, | |||||
is_token_index_enabled: self.is_token_index_enabled, | is_token_index_enabled: self.is_token_index_enabled, | ||||
}) | }) | ||||
} | } | ||||
/// Return [`QueryGroupUtxos`] for scripts to query the utxos of scripts. | /// Return [`QueryGroupUtxos`] for scripts to query the utxos of scripts. | ||||
pub fn script_utxos( | pub fn script_utxos( | ||||
&self, | &self, | ||||
) -> Result<QueryGroupUtxos<'_, ScriptGroup, UtxoProtobufValue>> { | ) -> Result<QueryGroupUtxos<'_, ScriptGroup, UtxoProtobufValue>> { | ||||
Ok(QueryGroupUtxos { | Ok(QueryGroupUtxos { | ||||
db: &self.db, | db: &self.db, | ||||
avalanche: &self.avalanche, | avalanche: &self.avalanche, | ||||
mempool: &self.mempool, | mempool: &self.mempool, | ||||
mempool_utxos: self.mempool.script_utxos(), | mempool_utxos: self.mempool.script_utxos(), | ||||
group: self.script_group.clone(), | group: self.script_group.clone(), | ||||
utxo_mapper: UtxoProtobufValue, | utxo_mapper: UtxoProtobufValue, | ||||
is_token_index_enabled: self.is_token_index_enabled, | is_token_index_enabled: self.is_token_index_enabled, | ||||
}) | }) | ||||
} | } | ||||
/// Return [`QueryGroupHistory`] for token IDs to query the tx history of | /// Return [`QueryGroupHistory`] for token IDs to query the tx history of | ||||
/// token IDs. | /// token IDs. | ||||
pub fn token_id_history(&self) -> QueryGroupHistory<'_, TokenIdGroup> { | pub fn token_id_history<'a>( | ||||
&'a self, | |||||
node: &'a Node, | |||||
) -> QueryGroupHistory<'a, TokenIdGroup> { | |||||
QueryGroupHistory { | QueryGroupHistory { | ||||
db: &self.db, | db: &self.db, | ||||
avalanche: &self.avalanche, | avalanche: &self.avalanche, | ||||
mempool: &self.mempool, | mempool: &self.mempool, | ||||
mempool_history: self.mempool.token_id_history(), | mempool_history: self.mempool.token_id_history(), | ||||
group: TokenIdGroup, | group: TokenIdGroup, | ||||
node, | |||||
is_token_index_enabled: self.is_token_index_enabled, | is_token_index_enabled: self.is_token_index_enabled, | ||||
} | } | ||||
} | } | ||||
/// Return [`QueryGroupUtxos`] for token IDs to query the utxos of token IDs | /// Return [`QueryGroupUtxos`] for token IDs to query the utxos of token IDs | ||||
pub fn token_id_utxos( | pub fn token_id_utxos( | ||||
&self, | &self, | ||||
) -> QueryGroupUtxos<'_, TokenIdGroup, UtxoProtobufOutput> { | ) -> QueryGroupUtxos<'_, TokenIdGroup, UtxoProtobufOutput> { | ||||
▲ Show 20 Lines • Show All 331 Lines • Show Last 20 Lines |