0xSplits / splits-sdk

An SDK for building apps on top of 0xSplits
https://docs.splits.org/sdk
MIT License
31 stars 11 forks source link

Access Request to Splits Activity Data #8

Closed grantro closed 3 months ago

grantro commented 1 year ago

Can you please expose access to the splits activity data in the subgraph? This data can be downloaded on a csv file on the app. We're interested in pulling the data into a payment history page on our dapp that shows: Event Type Date & time, Token, Amt, To/from addresses, Splits address. Let me know if any additional context would be helpful. Thanks!

mihoward21 commented 11 months ago

@grantro Hey thanks for writing in. So this data is already available in the subgraph. The queries are a bit ugly unfortunately, but the data is all there.

Unfortunately we have a lot on our roadmap, I don't think we'll be able to add this to the sdk in the near term.

Here's a sample query you can run to see distributions received and withdrawals for an account:

{
  receiveDistributionEvents(first:1000, where:{account:"0xec8bfc8637247cee680444ba1e25fa5e151ba342"}) {
    timestamp
    token {
      id
    }
    amount
    distributionEvent {
      account {
        id
      }
      transaction {
        id
      }
    }
  }
  withdrawalEvents(first:1000, where:{account:"0xec8bfc8637247cee680444ba1e25fa5e151ba342"}){
    timestamp
    transaction {
      id
    }
    tokenWithdrawalEvents(first:1000) {
      token{
        id
      }
      amount
    }
  }
}

You can test that query out here: https://thegraph.com/hosted-service/subgraph/0xsplits/splits-subgraph-ethereum and play around with other events too. In the documentation explorer if you look up the AccountEvent object you can see all the different event types that extend it.