Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

A toy project to produce a cool looking CLI dashboard for the NEAR platform.

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE
Notifications You must be signed in to change notification settings

deprecated-near-examples/near-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️⛔ DEPRECATED

This project is not being actively supported, the code is not expected to work nor reflects the latests improvements in our tooling stack

A toy project to produce a cool looking CLI dashboard for the NEAR platform.

Quickstart

  1. clone this repo
  2. install Sampler with brew install sampler
  3. start the dashboard with npm start

Wat?

Sampler is a "A tool for shell commands execution, visualization and alerting. Configured with a simple YAML file."

This project provides a near.yml configuration file for Sampler that renders a dashboard against the NEAR platform by polling data from various NEAR endpoints over HTTP.

It depends on Sampler being installed along with the availability of curl, awk and printf at the terminal.

Caveat: this project was only tested on a 2015 Macbook Pro.

What does the dashboard look like?

demo

Where is the data coming from?

The NEAR platform exposes multiple status endpoints for polling over HTTP for TestNet:

At the terminal you can use this command (wherever curl is available) to fetch network status

curl -s https://rpc.nearprotocol.com/status

see explainshell for details on the line above

Another utility, jq, is used to process the results that arrive as JSON

curl -s https://rpc.nearprotocol.com/status | jq '.chain_id'

see explainshell for details on the line above

And awk is used to extract data when multiple values are retrieved together and printf us used to format the results for presentation.

curl -s https://rpc.nearprotocol.com/metrics | grep '^block_produced_total' | awk -F ' ' '{ printf(" %d", $2) }'

see explainshell for details on the line above

Note

Another endpoint is available but not currently used by this dashboard

Local Development

The dashboard is configured using near.yml. See Sampler documentation for details on the format.

All requests used by the dashboard are also available in the file dev/requests.sh. This file is executable and running it will generate all the data being used to drive the dashboard, although without the pretty formatting.

A fake /status endpoint is included for sizing the dashboard to variable size data like number of validators. To use this utility use npm run dev to start a local server and edit the near.yml file anywhere you see the /status endpoint being used. Since the data is polled, any edits to dev/db.json will appear in the dashboard with the next request.

Related Resources

There are lots of dashboard builders like this:

About

A toy project to produce a cool looking CLI dashboard for the NEAR platform.

Resources

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages