> For the complete documentation index, see [llms.txt](https://superfluid.gitbook.io/superfluid/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://superfluid.gitbook.io/superfluid/developers/integration-guides/useful-queries-for-your-integration/instant-distribution-events.md).

# Instant Distribution Events

Query IDA Events

## IDA Events (For Distributions)

`indexDistributionClaimed`: emits when a subscriber claims a pending distribution. This will increment the super balance of the subscriber

[**Solidity Event:**](https://github.com/superfluid-finance/protocol-monorepo/blob/ace5c3186a8880df0e8d9f99db0d02c6fc941ae1/packages/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol#L480)

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2Fk2CMsAFctDlSbbKlvxbh%2FScreen%20Shot%202022-11-29%20at%2010.03.06%20AM.png?alt=media&amp;token=30ded7ff-9fc4-42cf-941f-29f3de7e26af" alt=""><figcaption></figcaption></figure>

**Sample Subgraph Query:**

```graphql
#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

[Solidity Event:](https://github.com/superfluid-finance/protocol-monorepo/blob/ace5c3186a8880df0e8d9f99db0d02c6fc941ae1/packages/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol#L235)

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2FFPJOKXRoM5MKgUkUJyiX%2FScreen%20Shot%202022-11-29%20at%2010.03.30%20AM.png?alt=media&amp;token=2660983e-1ed9-4c33-88d9-8bf0a53db0ff" alt=""><figcaption></figcaption></figure>

Sample Subgraph Query:

```graphql
#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.

[**Solidity Event:**](https://github.com/superfluid-finance/protocol-monorepo/blob/ace5c3186a8880df0e8d9f99db0d02c6fc941ae1/packages/ethereum-contracts/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol#L148)

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2Fc1TRKLbfPGPNqzVLfETq%2FScreen%20Shot%202022-11-29%20at%2010.04.07%20AM.png?alt=media&amp;token=771f73be-d931-49e2-ab4a-4a128c1ab945" alt=""><figcaption></figcaption></figure>

**Sample Subgraph Queries**

```graphql
#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^

```graphql
query MyQuery {
  indexUpdatedEvents(where: {indexId: $id}) {
    timestamp
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://superfluid.gitbook.io/superfluid/developers/integration-guides/useful-queries-for-your-integration/instant-distribution-events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
