queryTransactionsByAddress method
Query transactions that affected address — both sent and received.
Uses the affectedAddress filter so an account's activity is complete;
sentAddress would only return transactions the account signed, dropping
every incoming transfer. Each node carries the timestamp, status, and the
per-owner balance deltas, so callers can derive direction / counterparty
from the balance changes without a second lookup.
Implementation
Future<SenderTransactionPage> queryTransactionsByAddress(
String address, {
int first = 20,
String? after,
}) async {
const q = r'''
query ($address: SuiAddress!, $first: Int!, $after: String) {
transactions(
first: $first
after: $after
filter: { affectedAddress: $address }
) {
pageInfo { hasNextPage endCursor }
nodes {
digest
effects {
timestamp
status
balanceChanges {
nodes { amount coinType { repr } owner { address } }
}
}
}
}
}
''';
final data = await transport.query(q, variables: {
'address': address,
'first': first,
if (after != null) 'after': after,
});
return _parseTransactionsPage(data);
}