helium / blockchain-http

An http API for the helium blockchain database
https://helium.com
Apache License 2.0
47 stars 18 forks source link

Return all hotspots which belonged to account at some point #395

Open davetapley opened 2 years ago

davetapley commented 2 years ago

The v1/accounts/:address/hotspots endpoint only returns hotspots which currently belong to an account.

As noted on https://github.com/davetapley/helium-tax/issues/49, this creates a problem for tax reporting.


If I'm correct that there's currently no way to get such a list of hotspots from the API, then could we get a new endpoint (or filter on v1/accounts/:address/hotspots)?

davetapley commented 2 years ago

Relevant links:

https://github.com/helium/blockchain-http/blob/24e501095279648c909dbfc19065a69c3ee78149/src/bh_route_hotspots.erl#L419-L433

And:

https://github.com/helium/blockchain-http/blob/24e501095279648c909dbfc19065a69c3ee78149/priv/hotspots.sql#L55-L56

davetapley commented 2 years ago

Alas looking at gateway_inventory on https://etl.dewi.org/ it only includes current owners 😞

transactions_transfer_hotspot has it, but we first need a transactions_transfer_hotspot.sql in /priv/ with something like:

select buyer, seller, gateway from transactions_transfer_hotspot
where seller = $1

I might have a go at a PR, but I haven't Erlang'd for a long time, so it might not be pretty 😆