Skip to main content

Entities & Sample Queries

Ticket TWAB - Entities

Ticket

FieldTypeDescription
idID!Ticket address
accountsAccount!Account associated with ticket

Account

FieldTypeDescription
idID!Account address
balanceBigIntTicket balance in user wallet
delegateBalanceBigIntAmount of tickets delegated to this account
ticketTicketTicket associated with the account
twabs[Twab!]!Time weighted average balance
delegates[Account!]!Accounts who delegated to this account
delegateeAccountAccount to whom this account delegates his tickets

Twab

FieldTypeDescription
idID!Delegate address + timestamp
amountBigInt!Token balance for the prize pool after deposit
delegateBalanceBigInt!Amount of tickets delegated
timestampBigInt!Time stamp for twab
accountAccount!User account

Sample Queries

Below are some sample queries you can use to gather information from the Ticket TWAB subgraph.

You can build your own queries using a GraphQL Explorer and enter your endpoint to limit the data to exactly what you need.

TWAB

Description: This query fetches TWAB data.

{
twabs {
id
amount
delegateBalance
timestamp
}
}

Tickets

Description: This query fetches ticket data and the accounts they are associated with. It also sorts through the first 20 users where the balance is not equal to 0.

{
tickets {
id
accounts(
first: 20
orderBy: id
orderDirection: desc
where: { balance_not: "0" }
) {
id
balance
delegateBalance
}
}
}