Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss: Provide endpoint to fetch unlock schedule for a set of addresses #442

Open
nop33 opened this issue Mar 23, 2023 · 5 comments
Open

Comments

@nop33
Copy link
Member

nop33 commented Mar 23, 2023

This is highly related to alephium/alephium-frontend#60 and alephium/alephium-frontend#44.

In the desktop wallet, we would like to provide the user with a chart of the unlock schedule of their assets. Since the wallet does not (at least currently) know all the transaction history of every address, it does not have a way of knowing the lockTime of each UTXO. It would be useful to have an endpoint that, given a list of addresses, it returns a mapping between lockTime and assets.

image

@tdroxler
Copy link
Member

tdroxler commented Mar 23, 2023

Something like that?

mainnet=# SELECT address, amount, lock_time
FROM outputs
WHERE lock_time > 1679583920368
AND (address='1CBer2FQeRx5KCRYC1H69L1Py6Vp9neJgb7W3D751R3QH'
  OR address='19TUu8oE8dfDzH3RuJhACdBFh3Wndez7xZ8Fqjb13GiKd'
  OR address='1CBer2FQeRx5KCRYC1H69L1Py6Vp9neJgb7W3D751R3QH'
  OR address='1fVWdLaVgFDKkW6Q4qjsNQsLSXsaRuZPTyZmjBKE1iPq'
  OR address='1CBer2FQeRx5KCRYC1H69L1Py6Vp9neJgb7W3D751R3QH')
ORDER BY address;
                    address                    |          amount          |   lock_time
-----------------------------------------------+--------------------------+---------------
 19TUu8oE8dfDzH3RuJhACdBFh3Wndez7xZ8Fqjb13GiKd |     10000000000000000000 | 1704137700000
 19TUu8oE8dfDzH3RuJhACdBFh3Wndez7xZ8Fqjb13GiKd |   2828280000000000000000 | 1850408880000
 19TUu8oE8dfDzH3RuJhACdBFh3Wndez7xZ8Fqjb13GiKd |      5000000000000000000 | 1993754880000
 1CBer2FQeRx5KCRYC1H69L1Py6Vp9neJgb7W3D751R3QH |     39000000000000000000 | 1709995740000
 1CBer2FQeRx5KCRYC1H69L1Py6Vp9neJgb7W3D751R3QH |   4747000000000000000000 | 1695572040000
 1CBer2FQeRx5KCRYC1H69L1Py6Vp9neJgb7W3D751R3QH |      1000000000000000000 | 1761588240000
 1CBer2FQeRx5KCRYC1H69L1Py6Vp9neJgb7W3D751R3QH |   1470000000000000000000 | 1704967260000
 1fVWdLaVgFDKkW6Q4qjsNQsLSXsaRuZPTyZmjBKE1iPq  |      1000000000000000000 | 1709994900000
 1fVWdLaVgFDKkW6Q4qjsNQsLSXsaRuZPTyZmjBKE1iPq  | 335000000000000000000000 | 1706079600000
(9 rows)

1679583920368 being now

@nop33
Copy link
Member Author

nop33 commented Mar 23, 2023

Yeah, I think that'd be great! Tokens can be locked as well, however, right? This only shows the "attoALPH" amount?

@nop33
Copy link
Member Author

nop33 commented Mar 23, 2023

and it can be grouped by lock_time and the amounts can be sumed.

@tdroxler
Copy link
Member

but Tokens will have a different price than ALPH, shouldn't you have one graph per token?

@nop33
Copy link
Member Author

nop33 commented Mar 24, 2023

We are not talking about prices here, this is about letting the user know when their assets will get unlocked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants