API - Read Queries

API Endpoint

The API can be explored using the following endpoint, which operates on the LAOS Sigma testnet:

  • Testnet API endpoint: https://testnet.playground.laosnetwork.io/

LAOS testnet tokens can be obtained, e.g., using the LAOS Foundation faucet.

Useful Queries

All Assets in a Collection

This query retrieves all assets within a specific collection, providing details such as description, image, name, token ID, and owner.

query AllCollectionAssets {
  polygon {
    tokens(
      where: { contractAddress: "0xc7471bab04d2f53f6e79c754e19fdbd1e5a4a3c3" }
    ) {
      totalCount
      edges {
        node {
          description
          image
          name
          tokenId
          owner
        }
      }
    }
  }
}

User's Inventory

This query fetches all assets owned by a specific user within a particular collection, allowing for easy inventory management.

query AllUserAssetsInCollection {
  polygon {
    tokens(
      where: {
        owner: "0x4E6Da57f62b9954fBb6bAb531F556BE08E128e75"
        contractAddress: "0xc7471bab04d2f53f6e79c754e19fdbd1e5a4a3c3"
      }
    ) {
      totalCount
      edges {
        node {
          description
          image
          name
          tokenId
          owner
        }
      }
    }
  }
}

Asset History

This query retrieves the complete history of an asset, including all its past states, evolutions, and transfers.

query AssetHistory {
  polygon {
    tokenHistory(contractAddress: "0xc7471bab04d2f53f6e79c754e19fdbd1e5a4a3c3", tokenId: "46231769497101023895754357762572931969783788518045090509665456129453327552117") {
      contractAddress
      tokenUri
      tokenUriFetchState
      name
      description
      image
      attributes
    }
  }
}

LAOS Sibling Collection Pair

This query helps identify the LAOS sibling collection associated with a specific collection address, useful for developers who want to interact directly with LAOS contracts.

query ContractPair {
  polygon {
    contracts(where: {address_eq: "0xc7471bab04d2f53f6e79c754e19fdbd1e5a4a3c3"}) {
      address
      laosContract
    }
  }
}

Supported Chains

Currently, the API supports the chains listed below. Reach out via the LAOS channels to help prioritize support for other chains.

  • LAOS Testnet (Sigma)

    • Ethereum Mainnet - Id: 1

    • Polygon Mainnet - Id: 137

Support for the corresponding versions using LAOS Mainnet is coming soon.

Last updated