Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(indexer): support cell data filter #4303

Merged

Conversation

EthanYuan
Copy link
Collaborator

What problem does this PR solve?

Problem Summary:

We might want to filter cells based on output data, and the CKB Indexer can handle that easily.

What is changed and how it works?

What's Changed:

This pull request extends IndexerSearchMode by adding Partial, which, when combined with the existing Prefix and Exact modes, can be used for flexible filtering of cell data.

Check List

Tests

  • Unit test
  • Manual test
curl -X POST -H "Content-Type: application/json" -d '{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "get_cells",
    "params": [
        {
            "script": {
                "code_hash": "0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494",
                "hash_type": "data1",
                "args": "0x"
            },
            "script_type": "type",
            "script_search_mode": "prefix",
            "filter": {
                "output_data": "0xa58618a553",
                "output_data_filter_mode": "partial"
            },
            "with_data": false
        },
        "asc",
        "0x64"
    ]
}' 'http://127.0.0.1:8114'
curl -X POST -H "Content-Type: application/json" -d '{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "get_cells_capacity",
    "params": [
        {
            "script": {
                "code_hash": "0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494",
                "hash_type": "data1",
                "args": "0x"
            },
            "script_type": "type",
            "script_search_mode": "prefix",
            "filter": {
                "output_data": "0xa58618a553",
                "output_data_filter_mode": "partial"
            }
        }
    ]
}' 'http://127.0.0.1:8114'

Release note

Title Only: Include only the PR title in the release note.

@EthanYuan EthanYuan requested a review from a team as a code owner January 16, 2024 12:11
@EthanYuan EthanYuan requested review from quake and removed request for a team January 16, 2024 12:11
eval-exec
eval-exec previously approved these changes Jan 16, 2024
@eval-exec eval-exec added t:enhancement Type: Feature, refactoring. m:indexer module: ckb-indexer labels Jan 16, 2024
@EthanYuan EthanYuan self-assigned this Jan 17, 2024
util/indexer/src/service.rs Outdated Show resolved Hide resolved
@EthanYuan EthanYuan requested a review from quake January 17, 2024 09:48
@zhangsoledad zhangsoledad added this pull request to the merge queue Jan 25, 2024
Merged via the queue into nervosnetwork:develop with commit 48785ed Jan 25, 2024
32 checks passed
@doitian doitian mentioned this pull request Jan 29, 2024
@EthanYuan EthanYuan deleted the indexer-support-data-search branch February 1, 2024 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
m:indexer module: ckb-indexer t:enhancement Type: Feature, refactoring.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants