mina-indexer
mina-indexer copied to clipboard
GraphQL API does not support the concept of "direction" and "counterparty" for account-level transactions
This is different from being able to query for either outgoing or incoming:
query accountTxnQuery {
transactions(query: {to: "B62qrRvo5wngd5WA1dgXkQpCdQMRDndusmjfWXWT1LgsSFFdBS9RCsV", from:"B62qrRvo5wngd5WA1dgXkQpCdQMRDndusmjfWXWT1LgsSFFdBS9RCsV"}) {
to
from
}
}
We need to support the concept of "direction" and "counterparty". Here is a suggestion on how it might be structured:
query accountTxnQuery {
acccounts(query: {pk: "B62qrRvo5wngd5WA1dgXkQpCdQMRDndusmjfWXWT1LgsSFFdBS9RCsV"}) {
transactions {
direction
counterparty
}
}
}
Currently, the UI augments the data by iterating over all the data and checking if the recipient or sender contains the account's public key, to determine direction and counterparty. This requires making additional structs (containing the concept of counterparty and direction) and mapping to them before rending, which does not seem ideal.
This seems like it should be a first-class concept in our indexer as it provides and account-centric perspective on transactions either incoming or outgoing.