Asteroid Protocol API

You can use GraphQL to query the public Asteroid API via the public endpoint at https://new-api.asteroidprotocol.io/v1/graphql.

Prefer Python? Any GraphQL client like https://github.com/graphql-python/gql should work.

You can also use publicly-available GraphQL tool such as Apollo Graph. Simply, paste the Asteroid Protocol endpoint (https://new-api.asteroidprotocol.io/v1/graphql) 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
      }
    }
  } 
}

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: https://asteroidprotocol.io/app/collection/MONG

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
  }
}

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

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")
  }
}

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

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
  }
}

Last updated