πŸ–ΌοΈGet Blockchain Data (ownedTokens)

NEAR transaction events get stored by the Mintbase GraphQL Indexer making it easy for you to get the information you need. This page will guide you through getting the tokens that are owned by a specific user as an example.

There are 2 ways to retrieve data.

  1. Calling the corresponding @mintbase-js/data method (alpha)

  2. Making a GraphQL query

Mintbase JS Data

Getting data from this package is easier but is limited to the current methods available.

In this case, all you need to do is import the method and call it.

import { ownedTokens, OwnedTokens } from '@mintbase/data'

const ownedTokens: OwnedTokens[] = ownedTokens('mb_alice.near', { limit: 20 });

The documentation for the currently available methods can be referenced here.

GraphQL Indexer

This endpoint enables you to make GraphQL queries to our API. https://interop-mainnet.hasura.app/v1/graphql

You can try this and other queries on the Hasura Sandbox

More examples and information on how to query all sorts of blockchain information can be found here

query ownedTokens {
  tokens: mb_views_nft_owned_tokens(
    where: {
      owner: { _eq: "INSERT_OWNER" }
    }
  
  ) {
    lastTransferredAt: last_transfer_timestamp
    tokenId: token_id
    contractId: nft_contract_id
    baseUri: base_uri
    metadataId: metadata_id
    title
    minter
    media
    document: reference_blob(path: "$.document")
    animationUrl: reference_blob(path: "$.animation_url")
  }
}

Join Us and Build the Future

Have feedback or perhaps need a hand? Reach out on our Telegram public developer support channel where we are happy to help!

Building something cool? Consider applying for a grant.

Last updated