sporeprotocol / spore-scrum

0 stars 0 forks source link

Integrate rich-indexer of a new CKB indexer service to simplify the process of searching Spore cells #13

Open ashuralyk opened 8 months ago

ashuralyk commented 8 months ago

Description

the basic service of ckb-indexer provided by CKB node lacks custom parameters to filter cells that have some particular fields in its cell.data field, so spore-sdk uses ugly code to reach on-chain Spore cells

we aim to simplify this which can also benefit to other further projects built on CKB layer1. Currently, rich-indexer is on process, we should keep watching it

the latest status of rich-indexer can be found in DC channel spore indexing https://discord.com/channels/674518700518408213/1162311568038567978

docs here: https://www.notion.so/cryptape/Spore-Indexing-Issue-ae968c4a498e41d6b2e0922a2afea8f3

ashuralyk commented 8 months ago

new pattern of SearchKey of rich-indexer:

/// IndexerSearchKeyFilter represent indexer params `filter`
#[derive(Deserialize, Default)]
pub struct IndexerSearchKeyFilter {
    /// if search script type is lock, filter cells by type script prefix, and vice versa
    pub script: Option<Script>,
    /// filter cells by script len range
    pub script_len_range: Option<IndexerRange>,
    /// filter cells by output data
    pub output_data: Option<JsonBytes>,
    /// output data filter mode, optional default is `prefix`, means search data with prefix
    pub output_data_filter_mode: Option<IndexerSearchMode>,
    /// filter cells by output data len range
    pub output_data_len_range: Option<IndexerRange>,
    /// filter cells by output capacity range
    pub output_capacity_range: Option<IndexerRange>,
    /// filter cells by block number range
    pub block_range: Option<IndexerRange>,
}
ashuralyk commented 8 months ago

Image