Getting Assets API

Glittr's core came with helper APIs to fetch assets information. To use the API you can first run your Glittr node which came with the API functionality (see Setup ). note: All examples below use the devnet version (connected to custom regtest)

Get Assets in a UTXO

GET /helper/assets/{outpoint}

Shows Glittr assets in an output, the format of the outpoint is txid:vout such as 17084c005ffbbe97b06f17acb1b86291da945cc15e4964bfdbc4e61f6ec46d74:0

sample request: https://devnet-core-api.glittr.fi/helper/assets/612accb284e3e28a6ab9120c70b408ae333d825bee5a6ca24df05ed91445216a:1

Response

{
  "block_height": 161760,
  "result": [
    {
      "balance": "464",
      "contract_id": "158399:1",
      "divisibility": 6,
      "ticker": "TESTX",
      "type": {
        "free_mint": true
      }
    }
  ]
}

Get Wallet Balances

GET /helper/address/<address>/balance-summary

Shows Glittr asset balance for a given bitcoin address. The balance here is the total balance from all the UTXOs the address has. sample request: https://devnet-core-api.glittr.fi/helper/address/mroHGEtVBLxKoo34HSHbHdmKz1ooJdA3ew/balance-summary

Response

{
  "block_height": 161761,
  "data": [
    {
      "balance": "26",
      "contract_id": "158458:1",
      "divisibility": 18,
      "ticker": null,
      "type": {
        "collateralized": {
          "assets": [
            {
              "contract_id": "158399:1",
              "divisibility": 6,
              "ticker": "TESTX"
            },
            {
              "contract_id": "158410:1",
              "divisibility": 6,
              "ticker": "TESTY"
            }
          ]
        }
      }
    },
    {
      "balance": "6000",
      "contract_id": "147385:1",
      "divisibility": 6,
      "ticker": "TESTB",
      "type": {
        "free_mint": true
      }
    }
  ]
}

Get Wallet Valid UTXOs

GET /helper/address/<address>/valid-outputs

Shows valid utxos that have Glittr assets in them for a given bitcoin address. sample request: https://devnet-core-api.glittr.fi/helper/address/mroHGEtVBLxKoo34HSHbHdmKz1ooJdA3ew/valid-outputs

Response

{
  "block_height": 161764,
  "data": [
    {
      "address": "mroHGEtVBLxKoo34HSHbHdmKz1ooJdA3ew",
      "asset_balances": [
        {
          "balance": "1000",
          "contract_id": "147385:1",
          "divisibility": 6,
          "ticker": "TESTB",
          "type": {
            "free_mint": true
          }
        }
      ],
      "output": "49cc703f43259f9229b10fb1a42ffd87df3704cb424264b5a66bc18a1ded6dd4:0"
    },
    {
      "address": "mroHGEtVBLxKoo34HSHbHdmKz1ooJdA3ew",
      "asset_balances": [
        {
          "balance": "1000",
          "contract_id": "147385:1",
          "divisibility": 6,
          "ticker": "TESTB",
          "type": {
            "free_mint": true
          }
        }
      ],
      "output": "4c5532f2687646015be9d3a6f5d09a6691dd96ff89a476009ce372f1357f88b2:0"
    },
  ...
}

Last updated