Tron Historical Balances

kafuka
Wed, 02 Apr 2025 10:26:52 +0000
GraphQL API

I can get Tron historical balances by the query below, but it is only between 2 block heights.
Can I specify an unix timestamp or iso time like “2025-01-01T00:00:00Z” ?

query MyQuery {
  tron {
    address(address: {is: "TJ7hhYhVhaxNx6BPyq7yFpqZrQULL3JSdb"}) {
      address
      balances(currency: {is: "TRX"}, height: {between: [70170900, 70170952]}) {
        currency {
          tokenId
          name
        }
        history {
          value
          timestamp
          transferAmount
        }
        value
      }
    }
  }
}

Currently the workaround is to get the block height first:

query MyQuery {
  tron {
    blocks(time: {since: "2025-01-01T00:00:00Z"},
      options: {limit: 1}) {
      height
      timestamp {
        iso8601
      }
    }
  }
}

2 posts - 1 participant