Asteroid Protocol Docs
  • Asteroid Protocol Docs
    • Introduction
    • General overview
  • Creators/Artists
    • Getting started for creators/artists
    • Creating your first inscription
    • Creating a collection with the launchpad
    • Creating a token (CFT-20)
    • Join the Asteroid community
  • Collectors
    • Getting started for collectors
  • Developers
    • Getting started for devs
    • The Cosmos Inscriptions Specification
    • Cosmos Fungible Token (CFT-20) Standard
    • Deploy, mint, transfer, trade or bridge CFT-20 tokens
    • Asteroid Protocol API
    • Command line tool
    • Ideas to build on Asteroid Protocol
    • Multisig wallets
    • Enable support for your bridged tokens on Astroport.fi
    • NFT spec
    • Migrating an inscription into a collection
  • References
    • Logo and brand assets
    • Frequently Asked Questions (FAQs)
    • Asteroid timeline
    • Important links
    • Terminology
Powered by GitBook
On this page
  • Take a snapshot of CFT-20 token holders and/or collection holders
  • Find the price for any CFT-20
  • Find the hash or ID for all the inscriptions you've created
  • Pull the Top 10 NFT/inscription sales that have occurred since the protocol's launch
  • View the metadata for an inscription
  • View all historical marketplace transactions
  • Query all transactions executed by a specific address
  1. Developers

Asteroid Protocol API

PreviousDeploy, mint, transfer, trade or bridge CFT-20 tokensNextCommand line tool

Last updated 7 months ago

Test out the API instantly here:

Developers can use GraphQL to query the public Asteroid API via the public endpoint at .

Prefer Python? Any GraphQL client like should work.

You can also use publicly-available GraphQL tool such as . Simply, paste the Asteroid Protocol endpoint () into the sandbox field:

Then, you can submit queries in the operation field and click the "run" button to see the results.

Take a snapshot of CFT-20 token holders and/or collection holders

To find CFT-20 holders, paste the following query in the operation field, then click "run":

{
    token_holder(where: { token: { ticker: {_eq: "STAKE" } }, amount: { _gt: 0 } }, offset: 0, limit: 10) {
        address, amount
    }
}

In this example query, we’re pulling 10 addresses that hold “STAKE” tokens, and we’re showing the total amount of STAKE that they hold. To pull more than 10 addresses at a time, increase or eliminate the "limit" field from your query. To query a different token, replace "STAKE" with your desired ticker (as all tickers are required to be unique).

Note that the API strips the decimal point from the "amount" field, so you’ll need to manually add a decimal point after the first 6 digits from the right. For example, in the image below you can see that the API indicates that the address ending in "…ux3z" holds 22780000000 STAKE. When we manually re-add the decimal point, we see the human-readable value, which is 22,780.000000 STAKE.

To find collection holders, paste the following query in the Playground:

query { 
  inscription(where: { collection: { symbol: { _eq: "MONG" } } }) {
    current_owner
    marketplace_inscription_details(where: { marketplace_listing: { is_cancelled: { _eq: false }, is_filled: {_eq: false} } }) {
      marketplace_listing {
        seller_address
      }
    }
  } 
}

Find the price for any CFT-20

Paste the following query into the operation field and click the "run" button. In this case, the token is ROIDS (which has an id or "_eq" of "1"):

{
  token(where: {id: {_eq: 1}}) {
    ticker
    name
    last_price_base
    max_supply
  }
}

Find the hash or ID for all the inscriptions you've created

Paste the following query into the operation field and click the "run" button. Be sure to replace the text that says “paste_your_cosmos_address_here” with your actual Cosmos Hub address. Then, click the “run” button to get a list of all the inscriptions, which your address has created.

{
  inscription(where: { creator: { _eq: "paste_your_cosmos_address_here" }}) {
    transaction {
      hash
    }
    name: metadata(path: "$.metadata.name")
  }
}

Pull the Top 10 NFT/inscription sales that have occurred since the protocol's launch

Paste the following query in the operation field and click "run":

{
  inscription_trade_history(order_by: {amount_quote: desc}, limit: 10) {
    inscription {
      name:metadata(path: "$.metadata.name")
      description:metadata(path: "$.metadata.description")
      content_path
    }
    amount_quote
  }
}

View the metadata for an inscription

Let's look at the metadata for a specific inscription (in this case, Inscription #11087, which was randomly chosen). Paste the following query in the operation field and click "run":

query {
  inscription(
    where: {
      transaction: {
        hash: {
          _eq: "627DF5757FD20D9D2B49352B8ABFF2FDAD9C48A2AE2DA37A607AAF068351EA31"
        }
      }
    }
  ) {
    id
    height
    transaction {
      hash
    }
    creator
    current_owner
    content_path
    content_size_bytes
    is_explicit
    date_created
    name: metadata(path: "$.metadata.name")
    description: metadata(path: "$.metadata.description")
    mime: metadata(path: "$.metadata.mime")
  }
}

View all historical marketplace transactions

Paste the following query in the operation field and click "run":

{
  inscription_trade_history {
    id
    inscription {
      transaction {
        hash
      }
    }
    seller_address
    buyer_address
    amount_quote
    total_usd
    date_created
  }
}

Query all transactions executed by a specific address

Paste the following query in the operation field and click "run":

{
  inscription_trade_history(where: { seller_address: { _eq: "put-wallet-here" }}) {
    id
    inscription {
      transaction {
        hash
      }
    }
    seller_address
    buyer_address
    amount_quote
    total_usd
    date_created
  }
}

This example returns all holders of the Mong collection. You can find the symbol for a collection by visiting its landing page in the marketplace and copying it from the URL. For example, check out the highlighted portion of the link for the Mong collection:

You can find the _eq for any token by visiting the token's landing page. Simply replace ROIDS in this URL, , with your desired ticker. Then, the token's unique ID will appear in the top right of the screen:

The API will return your query results in JSON. You can copy that JSON into a JSON-to-CSV converter here:

https://asteroidprotocol.io/app/collection/MONG
https://asteroidprotocol.io/app/token/ROIDS
https://konklone.io/json/
Apollo Graph
https://new-api.asteroidprotocol.io/v1/graphql
https://github.com/graphql-python/gql
Apollo Graph
https://new-api.asteroidprotocol.io/v1/graphql