Permissionless-Software-Foundation / psf-slp-indexer

Indexer for validating SLP transactions. Uses LevelDB.
GNU General Public License v2.0
11 stars 6 forks source link

Address balance should include ticker #28

Open christroutner opened 2 years ago

christroutner commented 2 years ago

Here is an example output of the address/balance endpoint:

{
  "balance": {
    "utxos": [
      {
        "txid": "f28ac3a87c3dc89f6d1c5256ca169de4112ef40aed2139d82384e861d5fe779b",
        "vout": 1,
        "type": "token",
        "qty": "10000000000",
        "tokenId": "f28ac3a87c3dc89f6d1c5256ca169de4112ef40aed2139d82384e861d5fe779b",
        "tokenType": 1,
        "address": "bitcoincash:qqxp444g5e8vs4afdu6zumjc5x9tudr0tgf5p0qxcx",
        "effectiveQty": "100",
        "decimals": 8,
        "value": 0.00000546
      },
      {
        "txid": "f28ac3a87c3dc89f6d1c5256ca169de4112ef40aed2139d82384e861d5fe779b",
        "vout": 2,
        "type": "baton",
        "tokenId": "f28ac3a87c3dc89f6d1c5256ca169de4112ef40aed2139d82384e861d5fe779b",
        "address": "bitcoincash:qqxp444g5e8vs4afdu6zumjc5x9tudr0tgf5p0qxcx"
      }
    ],
    "txs": [
      {
        "txid": "f28ac3a87c3dc89f6d1c5256ca169de4112ef40aed2139d82384e861d5fe779b",
        "height": 733530
      }
    ],
    "balances": [
      {
        "tokenId": "f28ac3a87c3dc89f6d1c5256ca169de4112ef40aed2139d82384e861d5fe779b",
        "qty": "10000000000"
      }
    ]
  }
}

The objects in the balance array should contain a Ticker for each human-readable identification.

christroutner commented 2 years ago

While at it, the ticker should also be added to the UTXO information.

Also, the 'effective' quantity and 'decimals' should be added to the token balance.

christroutner commented 2 years ago

Also, the transaction history should be returned optionally, by passing a flag during the request. It should be handled like the tx history for tokens is.

The documentation for both the address and token need to be updated to reflect that flag for tx history.

salemkode commented 2 years ago

You must also return the transaction type in txs

The types are: Send Received