Skip to content

Build-Squad/wuphf-moments

Repository files navigation

WUPHF For Moments

Requirements

Make sure that you have installed:

  • Docker
docker --version
  • Docker compose
docker compose version
  • Make
make --version

Dependencies

Install pnpm:

npm add -g pnpm

Install dependencies:

pnpm install

Setup

To setup your local development environment, run:

make setup

This will create the necessary images/containers, as well as the necessary indexes/mappings for Elasticsearch.

To view the sample ES documents, from the two indexes, run:

curl -XGET localhost:9200/listings/_search | jq

curl -XGET localhost:9200/alerts/_search | jq

Index events

To start indexing NFTStorefrontV2 events from the Flow blockchain, we have to run the indexer:

make index-events

You can view how many documents have been indexed to the listings index, by running:

curl -XGET localhost:9200/listings/_count | jq

Run the API

make start-api

There are 3 available endpoints:

  • View alerts for an address,
  • Create a new alert for an address,
  • Remove an alert for an address
curl -XGET 'localhost:3001/alerts/0x9a0766d93b6608b7' -H "Content-Type: application/json" | jq

curl -XPOST localhost:3001/alerts/ -H "Content-Type: application/json" -d @packages/elastic/alerts-document-2.json

curl -XDELETE 'localhost:3001/alerts/132/0xee82856bf20e2c07' -H "Content-Type: application/json"

Run the front-end

make start-client

Will run the React dev server

Miscellaneous

There are more Make recipes, than listed above, to assist with local development:

  • Delete the listings index and its documents
make delete-es-index
  • Setup the listings index and its mapping
setup-es-index
  • Stop the running Elasticsearch and Kibana containers
make stop-containers
  • Start the Elasticsearch and Kibana containers
start-containers

About

NFT price alerts on the Flow blockchain. Made during the Flow Hackathon https://devfolio.co/projects/wuphfmoments-5ee1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •