Coder Social home page Coder Social logo

emitter's Introduction

emitter

Usage

Build binary from source

cargo build --release

Connect to default ckb rpc service at http://127.0.0.1:8114 and stores the indexer data at /tmp/emitter folder

RUST_LOG=info ./target/release/emitter -s /tmp/emitter

Run emitter --help for more information

RPC

register

Register the cell you want to track

Parameters

search_key:
    script - Script, supports prefix search
    scrip_type - enum, lock | type
    filter - filter cells by following conditions, all conditions are optional
        script: if search script type is lock, filter cells by type script prefix, and vice versa
        script_len_range: [u64; 2], filter cells by script len range, [inclusive, exclusive]
        output_data_len_range: [u64; 2], filter cells by output data len range, [inclusive, exclusive]
        output_capacity_range: [u64; 2], filter cells by output capacity range, [inclusive, exclusive]
start: u64, start block number

Returns

bool, registration success or failure

Examples

echo '{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "register",
    "params": [
        {
            "script": {
                "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                "hash_type": "type",
                "args": "0x5989ae415bb667931a99896e5fbbfad9ba53a223"
            },
            "script_type": "lock"
        },
        "0x0"
    ]
}' \
| curl -H 'content-type: application/json' -d @- \
http://localhost:8120
click to expand result

{
  "jsonrpc": "2.0",
  "result": true,
  "id": 2
}

delete

Delete the registered cell

Parameters

search_key:
    script - Script, supports prefix search
    scrip_type - enum, lock | type
    filter - filter cells by following conditions, all conditions are optional
        script: if search script type is lock, filter cells by type script prefix, and vice versa
        script_len_range: [u64; 2], filter cells by script len range, [inclusive, exclusive]
        output_data_len_range: [u64; 2], filter cells by output data len range, [inclusive, exclusive]
        output_capacity_range: [u64; 2], filter cells by output capacity range, [inclusive, exclusive]

Returns

bool, delete success or failure

Examples

echo '{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "delete",
    "params": [
        {
            "script": {
                "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                "hash_type": "type",
                "args": "0x5989ae415bb667931a99896e5fbbfad9ba53a223"
            },
            "script_type": "lock"
        }
    ]
}' \
| curl -H 'content-type: application/json' -d @- \
http://localhost:8120
click to expand result

{
  "jsonrpc": "2.0",
  "result": true,
  "id": 2
}

info

Returns the state of the cell being tracked

Parameters

null

Returns

objects:
    cells - tracing cells collection
        search_key:
        state
            block_number: scan tip block number
            block_hash: scan tip block hash

Examples

echo '{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "info",
    "params": []
}' \
| curl -H 'content-type: application/json' -d @- \
http://localhost:8120
click to expand result

{
  "jsonrpc": "2.0",
  "result": [
    [
      {
        "script": {
                "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                "hash_type": "type",
                "args": "0x5989ae415bb667931a99896e5fbbfad9ba53a223"
            },
        "script_type": "lock",
        "filter": null
      },
      {
        "block_hash": "0x9bfe99915bd967629d2bccd785ae2a972d2ec82cb8e0d4ebc86baa5c14d89f85",
        "block_number": "0x86f6cd"
      }
    ]
  ],
  "id": 1
}

emitter's People

Contributors

driftluo avatar kaoimin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.