Glittr
  • Introduction
  • Protocol Overview
  • Contract Primitives
    • MOAs - Mint Only Assets
    • MBAs - Mint and Burn Assets
      • Vaults
    • Spec Contracts
    • Oracle Commitments
  • Building on Glittr
    • Setup
    • Faucet
    • Glittr SDK
    • Glittr Transactions
    • Glittr Contracts
    • Installing Glittr Wallet
    • Local Development Guide
  • GLIP
  • Node
    • Run a Bitcoin Node
    • Run a Glittr Node
  • Examples & Guide
    • Creating Tokens
    • Contract Custody
    • Complex Tokens
    • Vesting and Freemint Contract
    • Wrapped BTC Contract
    • USD Contract
    • Oracle Implementation Guide
    • Glittr Output Structure
    • AMM Contract
  • API Reference
    • Getting Assets API
  • APP EXAMPLES
    • Freemint App (NextJS)
    • Freemint App (React + Vite)
    • NFT App (React + Vite)
Powered by GitBook
On this page
  • Get Assets in a UTXO
  • Get Wallet Balances
  • Get Wallet Valid UTXOs
  1. API Reference

Getting Assets API

PreviousAMM ContractNextFreemint App (NextJS)

Last updated 4 months ago

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 ). 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:

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

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

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"
    },
  ...
}

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:

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/balance-summary
https://devnet-core-api.glittr.fi/helper/address/mroHGEtVBLxKoo34HSHbHdmKz1ooJdA3ew/valid-outputs
https://devnet-core-api.glittr.fi/helper/assets/612accb284e3e28a6ab9120c70b408ae333d825bee5a6ca24df05ed91445216a:1
#localnet