mempool / electrs

An efficient re-implementation of Electrum Server in Rust
MIT License
60 stars 30 forks source link

Add /address/:addr/txs/summary endpoint #80

Closed mononaut closed 6 months ago

mononaut commented 6 months ago

This PR adds a new /address/:address/txs/summary/(last_seen_txid?) endpoint which returns a condensed list of recent confirmed transactions related to an address combined with the blockheight, time, and net balance change.

The endpoint is paginated using the usual last_seen_txid format, with a maximum number of transactions configurable via --rest-default-max-address-summary-txs (default 5000).

Results are returned in the following format:

[
  {"txid":"7b7c9e70071f29a313caf8647cb9dc1790c5bd7de0e8f5920df478e50b715cc8","height":835193,"value":2549627168,"time":1710748543},
  {"txid":"80422fa3e348d5cc3f635a865be162e38d587366ca2cd859dee8f0b4709d2e55","height":835192,"value":-4340898,"time":1710748355},
  {"txid":"c31190e57a7756c32f9c7d1e6a9f2331f448328d75d9b8857bb611b0d221d13f","height":835192,"value":-9389074995,"time":1710748355},
  {"txid":"e31299b80f1666c9be00b9cc223bee646134f5312ddf40884af3fe8f5d83868b","height":835190,"value":-7016,"time":1710747746},
  {"txid":"23a0f71d70c6b244ccb246b480c3e645a81fb257131deac1a3bd7a98ace9d19b","height":835190,"value":2751,"time":1710747746},
]