get_cells_capacity - Nervos

Returns the live cells capacity by the lock or type script.

Parameters

  • search_key:
    • script - Script.
    • 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
      • 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]
      • block_range: [u64; 2], filter cells by block number range, [inclusive, exclusive]

Returns

  • capacity - total capacity
  • block_hash - indexed tip block hash
  • block_number - indexed tip block number

Example

Request

{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "get_cells_capacity",
    "params": [
        {
            "script": {
                "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
                "hash_type": "type",
                "args": "0x5989ae415bb667931a99896e5fbbfad9ba53a223"
            },
            "script_type": "lock"
        }
    ]
}

Result

{
    "jsonrpc": "2.0",
    "result": {
      "block_hash": "0xbc52444952dc5eb01a7826aaf6bb1b660db01797414e259e7a6e6d636de8fc7c",
      "block_number": "0x5b727a",
      "capacity": "0xf0e8e4b4a0"
    },
    "id": 2
}
Language
Click Try It! to start a request and see the response here!