This repo contains the front and backend code for the Namada Masp Dashboard (which can be seen live at https://masp.knowable.run).
Feel free to use or modify this code in any way you like.
Charts are made using eCharts.
- a frontend React app in
./namada-masp-dashboard - a small helper WASM module in Rust used by the backend server for decoding some Namada-SDK types from the ABCI responses; the source code for this is in
./srcand the prebuilt package is in./pkg - a NodeJs express backend api server which caches and serves Coingecko price data as well as token supply, IBC
and MASP metrics data from the Namada RPC and namada-indexer database; located in
./backend-api
- a Namada RPC -- preferably an archive node -- and namada-indexer endpoint. The RPC should provide enough look-back to query ~30 days worth of blocks in the past
- If you want to use Coingecko price data, you will need an API key
- A local instance of
namada-indexer(https://github.com/anoma/namada-indexer). A local instance is needed because the backend-api requires a direct connection to the indexer's postgres db - Metadata (i.e. chain-registry) is used to get info about the canonical assets (such as their logo, symbol, etc.) and IBC channels. This repo uses the registry at https://github.com/vknowable/mock-registry though it could be subsituted with another
- You can find the prebuilt WASM package in
./pkg; however if you wish to build it yourself, you can do so by first runningrustup target add wasm32-unknown-unknownfollowed bywasm-pack build --target nodejs. (This will recreate the contents of./pkg) - To build the frontend, first install the dependencies:
cd namada-masp-dashboarddirectory, followed bynpm install. Then, create the file(s)./namada-masp-dashboard/.env.developmentand/or./namada-masp-dashboard/.env.productionaccording to the example.env.sample(use the former when runningnpm run devand the later when building withnpm run build). Finally, runnpm run buildwhich will produce thedistdirectory containing your build
- Make sure your RPC node and indexer are synced up and accesible to both the front and backends
- Start the backend server in the
./backend-apidirectory (cd backend-apiandnpm run start). The README inside that directory contains further info specific to running the backend. Make sure the backend api endpoint is accesible to the frontend - Enter the
namada-masp-dashboarddirectory and create a .env file for the frontend (referring to.env.sample) - Start the frontend app, e.g. using
npm run dev(or build it usingnpm run build)