📥Using TheGraph

TheGraph indexes data from the smart contracts to facilitate easier access. You can use it to understand what happens live during this guide.

To gain access to TheGraph, contact Kiln and you will receive credentials to Kiln's TheGraph instance. Feel free to also host the subgraph on your end, allowing you to run the queries locally. During this guide, we will often use TheGraph queries to verify that specific actions had the expected outcome.

The easiest way to interact with TheGraph is by visiting the web query builder.

To test it, you can try a simple query to retrieve all the deposits made by an address on an integration contract (Native20,Liquid20A or Liquid20C):

{
  erc20(id:"INTEGRATION_CONTRACT_ADDRESS") {
    deposits(where:{staker:"USER_ADDRESS"},orderBy:createdAt,orderDirection:desc) {
      hash
      depositAmount
      mintedShares
    }
  }
}

And if everything goes well, you should have a response looking like this if the wallet made some deposits.

{
  "data": {
    "erc20": {
      {
        "deposits": [
          {
            "hash": "0xb644b754d59c3693fa12a8be796bbc31db2f922964b581603c5e020b5aebd591",
            "depositAmount": "10000000000",
            "mintedShares": "9981371152"
          },
          {
            "hash": "0xd2aa2b95f27f38e57a1cf4064110f1c5771252249b16fcf55c4d6aa74bc7340e",
            "depositAmount": "10000000000",
            "mintedShares": "9982062545"
          },
          {
            "hash": "0xf640ef3b91de25f76792debb41f2f26f0886a79f3fccb4fffff372487dac22fa",
            "depositAmount": "100000000000",
            "mintedShares": "99821696059"
          },
          {
            "hash": "0xaa212b98a0c44f57ebedc50337c24853739f07164a7681a1eb6b2fc1753e8f91",
            "depositAmount": "100000000000",
            "mintedShares": "99822049624"
          },
          {
            "hash": "0xad2ad5026fda650861ea6ab0e278e39150812fa74a623879cbb3263dd157b07c",
            "depositAmount": "100000000000",
            "mintedShares": "99822049624"
          },
          {
            "hash": "0x8a5f98769d52b05bd37ef66db8976981d67e50f7401269cf2ffd2801d583ddc1",
            "depositAmount": "100000000000",
            "mintedShares": "99822049623"
          }
        ]
      }
    }
  }
}

You're now ready to follow the guide and run the queries when needed !

Last updated