Granola-Team / mina-indexer

The Mina Indexer is a re-imagined version of the software collectively called the "Mina archive node."
Apache License 2.0
18 stars 10 forks source link

Filtering GQL txns by hash doesn't sort correctly #1107

Closed trevorbernard closed 3 months ago

trevorbernard commented 3 months ago
query TransactionsQuery(
  $limit: Int = 10
  $sort_by: TransactionSortByInput!
  $query: TransactionQueryInput!
) {
  transactions(limit: $limit, sortBy: $sort_by, query: $query) {
    blockHeight
    failureReason
    canonical
    amount
    fee
    kind
    to
    from
    nonce
    memo
    hash
    block {
      dateTime
      stateHash
    }
    receiver {
      publicKey
    }
  }
}
// variables
{
  "limit": 10,
  "sort_by": "BLOCKHEIGHT_ASC",
  "query": {
    "hash": "CkpZhvEYxb9YFZULWEw61khrHAqGZhTktZSiGQ1CKfe6n2TcnxdgD"
  }
}

The results are in reverse order

{
  "data": {
    "transactions": [
      {
        "blockHeight": 9999,
        "failureReason": "",
        "canonical": true,
        "amount": 215456725760,
        "fee": 1000000,
        "kind": "PAYMENT",
        "to": "B62qnd8XmGgeSWZ35bdbpKeoadr5vz3JV4rgZ9dZqu81o3K1npGUHuu",
        "from": "B62qoaMj7u1JzuqXaBByQBL5jzqLguK8e7LHVPdY9LcvvLXK7HPsusD",
        "nonce": 9,
        "memo": "whisperit#8145",
        "hash": "CkpZhvEYxb9YFZULWEw61khrHAqGZhTktZSiGQ1CKfe6n2TcnxdgD",
        "block": {
          "dateTime": "2021-04-15T09:15:00.000Z",
          "stateHash": "3NLjanAoyqjqmPsQHafJcvQiGW2xbvyXANHxEyNwPwan2eUoZBV9"
        },
        "receiver": {
          "publicKey": "B62qnd8XmGgeSWZ35bdbpKeoadr5vz3JV4rgZ9dZqu81o3K1npGUHuu"
        }
      },
      {
        "blockHeight": 9992,
        "failureReason": "",
        "canonical": false,
        "amount": 215456725760,
        "fee": 1000000,
        "kind": "PAYMENT",
        "to": "B62qnd8XmGgeSWZ35bdbpKeoadr5vz3JV4rgZ9dZqu81o3K1npGUHuu",
        "from": "B62qoaMj7u1JzuqXaBByQBL5jzqLguK8e7LHVPdY9LcvvLXK7HPsusD",
        "nonce": 9,
        "memo": "whisperit#8145",
        "hash": "CkpZhvEYxb9YFZULWEw61khrHAqGZhTktZSiGQ1CKfe6n2TcnxdgD",
        "block": {
          "dateTime": "2021-04-15T10:03:00.000Z",
          "stateHash": "3NLWbWj5US2atTS38JkecFofgRN3BUGhwsWGtMMvD2qbAeKJtb6m"
        },
        "receiver": {
          "publicKey": "B62qnd8XmGgeSWZ35bdbpKeoadr5vz3JV4rgZ9dZqu81o3K1npGUHuu"
        }
      },
      {
        "blockHeight": 9935,
        "failureReason": "",
        "canonical": false,
        "amount": 215456725760,
        "fee": 1000000,
        "kind": "PAYMENT",
        "to": "B62qnd8XmGgeSWZ35bdbpKeoadr5vz3JV4rgZ9dZqu81o3K1npGUHuu",
        "from": "B62qoaMj7u1JzuqXaBByQBL5jzqLguK8e7LHVPdY9LcvvLXK7HPsusD",
        "nonce": 9,
        "memo": "whisperit#8145",
        "hash": "CkpZhvEYxb9YFZULWEw61khrHAqGZhTktZSiGQ1CKfe6n2TcnxdgD",
        "block": {
          "dateTime": "2021-04-15T10:18:00.000Z",
          "stateHash": "3NLAWUiBBPbJJpHCnrYxoW6rthtbAxYhoJZYL5TP6BTw7fBk31Lg"
        },
        "receiver": {
          "publicKey": "B62qnd8XmGgeSWZ35bdbpKeoadr5vz3JV4rgZ9dZqu81o3K1npGUHuu"
        }
      },
      {
        "blockHeight": 9899,
        "failureReason": "",
        "canonical": false,
        "amount": 215456725760,
        "fee": 1000000,
        "kind": "PAYMENT",
        "to": "B62qnd8XmGgeSWZ35bdbpKeoadr5vz3JV4rgZ9dZqu81o3K1npGUHuu",
        "from": "B62qoaMj7u1JzuqXaBByQBL5jzqLguK8e7LHVPdY9LcvvLXK7HPsusD",
        "nonce": 9,
        "memo": "whisperit#8145",
        "hash": "CkpZhvEYxb9YFZULWEw61khrHAqGZhTktZSiGQ1CKfe6n2TcnxdgD",
        "block": {
          "dateTime": "2021-04-15T20:30:00.000Z",
          "stateHash": "3NLfedSiPtaaeUG6Aamj5HRsqbVQRsy4xxqmdLDVEBt6dE2oKLus"
        },
        "receiver": {
          "publicKey": "B62qnd8XmGgeSWZ35bdbpKeoadr5vz3JV4rgZ9dZqu81o3K1npGUHuu"
        }
      }
    ]
  }
}
trevorbernard commented 3 months ago

This issue was resolved: https://github.com/Granola-Team/mina-indexer/pull/1112