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

Handle new TVL property in /api/v2/stats/charts/market endpoint #1250

Closed
vbaranov opened this issue Oct 4, 2023 · 5 comments · Fixed by #1297
Closed

Handle new TVL property in /api/v2/stats/charts/market endpoint #1250

vbaranov opened this issue Oct 4, 2023 · 5 comments · Fixed by #1297
Assignees
Labels
enhancement New feature or request v1.16.0 Release v1.16.0

Comments

@vbaranov
Copy link
Member

vbaranov commented Oct 4, 2023

Description

Related to backend changes in blockscout/blockscout#8589

A new tvl property is returned in the response of /api/v2/stats/charts/market and returns TVL for the chain in USD. For instance, this is deployed at Shimmer mainnet:
https://explorer.evm.shimmer.network/api/v2/stats/charts/market

Sample response:

{"available_supply":"0.0","chart_data":[{"closing_price":"0.04634324","date":"2023-10-04","market_cap":"0.0","tvl":"214580.2172123008"},{"closing_price":"0.04813","date":"2023-10-03","market_cap":"0.0","tvl":"187285.31938942563"},{"closing_price":"0.0515","date":"2023-10-02","market_cap":"0.0","tvl":"128276.7490563828"},{"closing_price":"0.05174","date":"2023-10-01","market_cap":"0.0","tvl":"81239.16979703683"},{"closing_price":"0.05124","date":"2023-09-30","market_cap":"0.0","tvl":"88130.33137339432"},{"closing_price":"0.05113","date":"2023-09-29","market_cap":"0.0","tvl":"75330.21672293016"},{"closing_price":"0.05357","date":"2023-09-28","market_cap":"0.0","tvl":"82605.7199709903"},{"closing_price":"0.05713","date":"2023-09-27","market_cap":"0.0","tvl":null},{"closing_price":"0.05465","date":"2023-09-26","market_cap":"0.0","tvl":null},{"closing_price":"0.05723","date":"2023-09-25","market_cap":"0.0","tvl":null},{"closing_price":"0.05663","date":"2023-09-24","market_cap":"0.0","tvl":null},{"closing_price":"0.055","date":"2023-09-23","market_cap":"0.0","tvl":null},{"closing_price":"0.05641","date":"2023-09-22","market_cap":"0.0","tvl":null},{"closing_price":"0.0537","date":"2023-09-21","market_cap":"0.0","tvl":null},{"closing_price":"0.05421","date":"2023-09-20","market_cap":"0.0","tvl":null},{"closing_price":"0.04813","date":"2023-09-19","market_cap":"0.0","tvl":null},{"closing_price":"0.04849","date":"2023-09-18","market_cap":"0.0","tvl":null},{"closing_price":"0.04694","date":"2023-09-17","market_cap":"0.0","tvl":null},{"closing_price":"0.04536","date":"2023-09-16","market_cap":"0.0","tvl":null},{"closing_price":"0.04648","date":"2023-09-15","market_cap":"0.0","tvl":null},{"closing_price":"0.0586","date":"2023-09-14","market_cap":"0.0","tvl":null},{"closing_price":"0.06946","date":"2023-09-13","market_cap":"0.0","tvl":null},{"closing_price":"0.06545","date":"2023-09-12","market_cap":"0.0","tvl":null},{"closing_price":"0.06446","date":"2023-09-11","market_cap":"0.0","tvl":null},{"closing_price":"0.07161","date":"2023-09-10","market_cap":"0.0","tvl":null},{"closing_price":"0.0743","date":"2023-09-09","market_cap":"0.0","tvl":null},{"closing_price":"0.07019","date":"2023-09-08","market_cap":"0.0","tvl":null},{"closing_price":"0.07097","date":"2023-09-07","market_cap":"0.0","tvl":null},{"closing_price":"0.0705","date":"2023-09-06","market_cap":"0.0","tvl":null},{"closing_price":"0.05604","date":"2023-09-05","market_cap":"0.0","tvl":null}]}

I suppose we should extend NEXT_PUBLIC_HOMEPAGE_CHARTS env with the value tvl and enable display tvl chart, if it is chosen, based on the value from tvl property in the API endpoint response.

Link to the page

https://explorer.evm.shimmer.network/

Steps to reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error

App version

v1.12.0

Browser

No response

Operating system

None

Additional information

No response

@vbaranov vbaranov added bug Something isn't working triage Issues and PRs that are needed triage labels Oct 4, 2023
@NikitaSavik NikitaSavik added enhancement New feature or request and removed bug Something isn't working triage Issues and PRs that are needed triage labels Oct 10, 2023
@tom2drum tom2drum added need design For issues that wait for design updates and removed need design For issues that wait for design updates labels Oct 12, 2023
@tom2drum tom2drum self-assigned this Oct 12, 2023
@tom2drum
Copy link
Collaborator

@vbaranov can we add the current TVL to /api/v2/stats response? We use data from this endpoint to display values in the graph selector, so we don't have to fetch all possible graphs data at once.

Image

@tom2drum
Copy link
Collaborator

@NikitaSavik what text should we display in the graph hint in this case?

Image

@NikitaSavik
Copy link
Contributor

@tom2drum "Total value of digital assets locked or staked in a chain"

@vbaranov
Copy link
Member Author

@vbaranov can we add the current TVL to /api/v2/stats response? We use data from this endpoint to display values in the graph selector, so we don't have to fetch all possible graphs data at once.

Image

nice catch @tom2drum. I'm adding "tvl" property to /api/v2/stats response.

@tom2drum tom2drum added the need API For issues that wait for API changes label Oct 13, 2023
@vbaranov
Copy link
Member Author

@tom2drum this has been applied

https://explorer.evm.shimmer.network/api/v2/stats

{"average_block_time":2515.0,"coin_price":"0.04442","gas_prices":{"average":975.51,"fast":975.51,"slow":975.51},"gas_used_today":"3324209765","market_cap":"0","network_utilization_percentage":0.017706438,"static_gas_price":null,"total_addresses":"6809","total_blocks":"340956","total_gas_used":"0","total_transactions":"478065","transactions_today":"25337","tvl":"1767425.102766552"}

@tom2drum tom2drum removed the need API For issues that wait for API changes label Oct 18, 2023
@tom2drum tom2drum linked a pull request Oct 18, 2023 that will close this issue
tom2drum added a commit that referenced this issue Oct 18, 2023
* Handle new TVL property in /api/v2/stats/charts/market endpoint

Fixes #1250

* Support stats widget for Rootstock

* fix envs validation

* fix tests
@github-actions github-actions bot added pre-release Tasks in pre-release right now v1.16.0 Release v1.16.0 and removed pre-release Tasks in pre-release right now labels Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v1.16.0 Release v1.16.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants