Skip to content

Nintondo/bel-20-indexer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to

  1. Rename .env.example to .env
  2. Replace the values in .env with your own values
  3. Make sure you have installed rust and cargo
  4. Run the following command to start the server
cargo r -r

API Documentation

Overview

This API provides endpoints to interact with addresses, tokens, and events. Below are the available routes, their parameters, and descriptions.

Routes

GET /address/:address

  • Description: Retrieves token balances and transfers for a specific address.
  • Parameters:
    • address (path): The address to retrieve token balances and transfers for.
Response example:
[
    {
        "tick": "<tick>",
        "balance": "1000",
        "transferable_balance": "1000",
        "transfers": [
            {
                "outpoint": "<txid:vout>",
                "value": "1000"
            }
        ],
        "transfers_count": 1
    },
    ...
]

GET /address/:address/history

  • Description: Retrieves the history of token actions for a specific address.
  • Parameters:
    • address (path): The address to retrieve token history for.
    • tick (query): The token tick to filter by.
    • offset (query, optional): The offset for pagination. (key: id)
    • limit (query, optional): The maximum number of records to return.
Response example:
[
    {
        "id": 1,
        "tick": "<tick>",
        "height": 100,
        "type": "Send",
        "amt": "1",
        "recipient": "<address>",
        "adddress": "<address>",
        "txid": "<txid>",
        "vout": 0
    },
    ...
]

GET /events/:height

  • Description: Retrieves the history of token actions for a specific height.
  • Parameters:
    • height (path): The block number to retrieve events history for.
Response example:
[
    {
        "id": 1,
        "tick": "<tick>",
        "height": 100,
        "type": "Send",
        "amt": "1",
        "recipient": "<address>",
        "adddress": "<address>",
        "txid": "<txid>",
        "vout": 0
    },
    ...
]

GET /txid/:txid

  • Description: Retrieves events by TXID
  • Parameters:
    • txid (path): Transaction Hash (ID)
Response example:
[
    {
        "id": 1,
        "tick": "<tick>",
        "height": 100,
        "type": "Send",
        "amt": "1",
        "recipient": "<address>",
        "adddress": "<address>",
        "txid": "<txid>",
        "vout": 0
    },
    ...
]

GET /tokens

  • Description: Retrieves metadata for all tokens.
Response example:
[
    {
        "genesis": "<inscription_id>",
        "tick": "<tick>",
        "max": "1000000000",
        "lim": "1000",
        "dec": 18,
        "supply": "6000",
        "mint_count": 5,
        "transfer_count": 10,
        "holders": 10
    },
    ...
]

POST /events

  • Description: Subscribes to events related to specific addresses and tokens.
  • Parameters:
    • addresses (body, optional): A set of addresses to subscribe to.
    • tokens (body, optional): A set of tokens to subscribe to.
Response examples:
New block
{
  "event_type": "new_block",
  "height": 1,
  "proof": "<hash>",
  "blockhash": "<hash>"
}
Reorg
{
  "event_type": "reorg",
  "blocks_count": 5,
  "new_height": 67890
}
Deploy
{
  "id": 1,
  "type": "Deploy",
  "max": "1000000",
  "lim": "500000",
  "dec": 18,
  "address": "<address>",
  "txid": "<txid>",
  "vout": 0
}
Mint
{
  "id": 1,
  "type": "Mint",
  "amt": "1000.0",
  "address": "<address>",
  "txid": "<txid>",
  "vout": 0
}
DeployTransfer
{
  "id": 1,
  "type": "DeployTransfer",
  "amt": "500.0",
  "address": "<address>",
  "txid": "<txid>",
  "vout": 0
}
Send
{
  "id": 1,
  "type": "Send",
  "amt": "250.0",
  "recipient": "<address>",
  "address": "<address>",
  "txid": "<txid>",
  "vout": 0
}
Receive
{
  "id": 1,
  "type": "Receive",
  "amt": "250.0",
  "sender": "<address>",
  "address": "<address>",
  "txid": "<txid>",
  "vout": 0
}
SendReceive
{
  "id": 1,
  "type": "SendReceive",
  "amt": "500.0",
  "address": "<address>",
  "txid": "<txid>",
  "vout": 0
}

GET /status

  • Description: Retrieves current status of the server
Response example:
{
    "height": 0,
    "proof": "<hash>",
    "blockhash": "<hash>"
}

GET /proof-of-history

  • Description:
  • Parameters:
    • offset (query, optional): The offset for pagination. (key: height)
    • limit (query, optional): The maximum number of records to return. (up to 100)
Response example:
[
    {
        "height": 0,
        "hash": "<hash>"
    },
    ...
]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages