Aavegotchi Docs
Official WebsiteDapp
  • Welcome to Aavegotchi
    • Introduction
  • Own. Trade. Earn.
    • What is True Ownership?
    • Tokens
      • GHST Token
      • Gotchus Alchemica
      • GLTR Token
    • Game Items
      • Aavegotchis
      • Portals
      • Wearables
      • The Forge
      • Gotchiverse
    • Trading
      • Aavegotchi Baazaar
      • Auction House
    • Earning in Aavegotchi
      • Rarity Farming
      • Staking
      • Playing Games
  • Gaming
    • Aavegotchi Gaming Console
    • Live Games
    • Assets
      • Badges
      • Experience Points
      • Skins
      • [REDACTED]
  • Geist
    • Overview
    • FAQ
  • Governance
    • About AavegotchiDAO
    • Creating a Proposal
    • Voting on Proposals
  • developers
    • Aavegotchi Contracts
      • Reading from Aavegotchi Contracts
        • Fetching Onchain SVGs
      • Writing to Aavegotchi Contracts
      • Extending Aavegotchi Contracts
        • Upgrading
        • Security
        • Deployment
        • Governance
      • About EIP-2535 Diamonds
        • Facets
      • maTokens
      • Concepts
      • Deployed Contracts
        • Aavegotchi Diamond
        • Forge Diamond
        • Wearable Diamond
        • Gotchiverse Realm Diamond
        • Installation Diamond
        • Tile Diamond
    • Subgraphs
      • General
      • Core Matic Subgraph
      • SVG Subgraphs
      • Gotchiverse Subgraph
      • FAKE Gotchi Subgraph
Powered by GitBook
On this page
  • Examples
  • Get traits and modified traits of specific Aavegotchi
  • Get Bazaar Listings of items which are a potion
  • Get user data
  • Get statistics

Was this helpful?

  1. developers
  2. Subgraphs

Core Matic Subgraph

PreviousGeneralNextSVG Subgraphs

Last updated 3 years ago

Was this helpful?

The probably best way to discover the subgraph is the GraphQL Playground from thegraph itself:

The full documentation can be found in the repository

If you want connect to the endpoint please use the following endpoint: https://api.thegraph.com/subgraphs/name/aavegotchi/aavegotchi-core-matic Below you can find some possible use cases:

Examples

Get traits and modified traits of specific Aavegotchi

You can get information about the traits of the gotchi with the following query

{
  aavegotchi(id: 4430) {
    numericTraits, modifiedNumericTraits
  }
}

It will return an array with integers which represents the values of the six different traits. The order is: Energy, Aggression, Spookiness, Brain Size, Eye Shape, Eye Color

{
  "data": {
    "aavegotchi": {
      "modifiedNumericTraits": [
        18,
        68,
        10,
        48,
        82,
        22
      ],
      "numericTraits": [
        17,
        68,
        10,
        48,
        82,
        22
      ]
    }
  }
}

Get Bazaar Listings of items which are a potion

Its also possible to fetch present and historic listings on the bazaar. If you want to fetch all available potions. You must first fetch the itemTypeID of the items you want to fetch and insert the IDs afterwards in your getListings Query:

{
  itemTypes(where:{name_contains: "Potion"}) {
  name, id
}

will return

 "itemTypes": [
  {
    "id": "126",
    "name": "Kinship Potion"
  },
  {
    "id": "127",
    "name": "Greater Kinship Potion"
  },
  {
    "id": "128",
    "name": "XP Potion"
  },
  {
    "id": "129",
    "name": "Greater XP Potion"
  }
]

Afterwards you can get the Listings with:

erc1155Listings(where: {id_in: ["126", "127","128","129"]}) {
  priceInWei, seller, quantity, erc1155TypeId, erc1155TokenAddress
}

which will return

"erc1155Listings": [
  {
    "erc1155TokenAddress": "0x86935f11c86623dec8a25696e1c19a8659cbf95d",
    "erc1155TypeId": "78",
    "priceInWei": "200000000000000000000",
    "quantity": "1",
    "seller": "0xded1fd193cd8b55c2f9c42b3257d5a9088c7d137"
  },
  {
    "erc1155TokenAddress": "0x86935f11c86623dec8a25696e1c19a8659cbf95d",
    "erc1155TypeId": "106",
    "priceInWei": "1100000000000000000000",
    "quantity": "1",
    "seller": "0x75ddb7ab958135bbe2dab48d6286826f6aa5e3b4"
  },
  {
    "erc1155TokenAddress": "0x86935f11c86623dec8a25696e1c19a8659cbf95d",
    "erc1155TypeId": "105",
    "priceInWei": "3000000000000000000000",
    "quantity": "1",
    "seller": "0xf3152f7f73b3cc394708e6c465c4bc8598cc44f5"
  },
  {
    "erc1155TokenAddress": "0x86935f11c86623dec8a25696e1c19a8659cbf95d",
    "erc1155TypeId": "128",
    "priceInWei": "398000000000000000000",
    "quantity": "5",
    "seller": "0xbeaea5d64b81e48e9f91870cbc8ca5f00d8c396f"
  }
],

Get user data

In case you need all the data from a specifc user you fetch also the user entities. The user contains arrays of from user bought & owned portals, as well as owned gotchis.

user(id: "0x1ad3d72e54fb0eb46e87f82f77b284fc8a66b16c") {
      portalsOwned{id }, portalsBought {id},gotchisOwned { id, name },id
}

returns

{
  "data": {
    "user": {
      "gotchisOwned": [
        {
          "id": "4430",
          "name": "ChillETH"
        }
      ],
      "id": "0x1ad3d72e54fb0eb46e87f82f77b284fc8a66b16c",
      "portalsBought": [],
      "portalsOwned": [
        {
          "id": "4430"
        }
      ]
    }
  }
}

Be sure that the ID is case sensitive and you have to provide the address as lowercase!

Get statistics

We also maintain some statistics on the subgraph. Such as portals bought, portal opened and aavegotchis claimed, but also some market data. You can query for volumes from the market:

{
  statistics {
    portalsBought,
    portalsOpened,
    aavegotchisClaimed,
    erc721TotalVolume,
    erc1155TotalVolume
  }
}

you will get something like

{
  "data": {
    "statistics": [
      {
        "aavegotchisClaimed": "7136",
        "erc1155TotalVolume": "9486555714498572424804980",
        "erc721TotalVolume": "11126949887492653499800000",
        "portalsBought": "10000",
        "portalsOpened": "7761"
      }
    ]
  }
}
Try the Playground
here