description |
---|
Query IDA Events |
indexDistributionClaimed
: emits when a subscriber claims a pending distribution. This will increment the super balance of the subscriber
Sample Subgraph Query:
#get events where subscriber "0xdcb" claimed a pending distribution
query MyQuery {
indexDistributionClaimedEvents(
where: {subscriber: "0xDCB45e4f6762C3D7C61a00e96Fb94ADb7Cf27721"}
) {
amount
indexId
timestamp
token
}
}
subscriptionApprovedEvents
: emits when a subscribed approves a subscription. If the subscribed has any unclaimed distributions, this will increment the token balance of the subscriber
Sample Subgraph Query:
#get events where subscriber "0xdcb" approved a subscription
query MyQuery {
subscriptionApprovedEvents(
where: {subscriber: "0xdcb45e4f6762c3d7c61a00e96fb94adb7cf27721"}
) {
timestamp
token
transactionHash
}
}
indexUpdatedEvents
: emits when an index is updated. This will happen when a publisher distributes funds to an index. If a subscriber has approved the subscription by calling approveSubscription()
, then these events will increment the user’s balance. In this case, we’d recommend getting a user’s list of index subscriptions and then simply calling balanceOf()
when an indexUpdatedEvent is emitted for one of those subscriptions.
Sample Subgraph Queries
#get a subscriber's index subscriptions
{
accounts(where: {
#your address below
id: "0x..."
}) {
subscriptions{
index {
token{
symbol
}
}
id
approved
units
totalAmountReceivedUntilUpdatedAt
}
}
}
Then, you can listen for events for the above indexIds^
query MyQuery {
indexUpdatedEvents(where: {indexId: $id}) {
timestamp
}
}