Example Queries
Below are some sample queries you can use to gather information from the Juicebox contracts.
You can experiment on the subgraph playground or on a GraphiQL Explorer – open one of the endpoints listed in Subgraph in your browser.
Get Project Metrics By Owner
Get your Project ID.
query ProjectByOwner(
  $Owner: String! = "0xaf28bcb48c40dbc86f52d459a6562f658fc94b1e"
) {
  projects(where: { owner: $Owner }, first: 10) {
    createdAt
    id
    owner
    projectId
    totalPaid
    totalRedeemed
    metadataUri
    handle
    terminal
    currentBalance
    cv
  }
}
Project Metrics
Get the latest metrics for your project.
query ProjectMetrics($Project: String! = "1-1") {
  projects(where: { id: $Project }) {
    createdAt
    id
    owner
    projectId
    totalPaid
    totalRedeemed
    metadataUri
    handle
    terminal
    currentBalance
    cv
  }
}
Project Payments
Get the 20 latest payments into your project.
query ProjectPayments($ProjectId: String! = "2-1") {
  projects(where: { id: $ProjectId }, first: 10) {
    handle
    payEvents(first: 20, orderBy: timestamp, orderDirection: desc) {
      amount
      caller
      note
      timestamp
      txHash
    }
  }
}