App to index transfers to postgres and serve them to a json api endpoint.
Front-end: https://github.com/vknowable/transfer-map
- Start the postgres container:
cd docker-compose
docker compose -f postgres-docker-compose.yml up -d
- Run db migrations (from project root dir)
cargo install sqlx-cli
sqlx migrate run
- In the .env file, set
RPC
to the url of your node/rpc,LISTEN_PORT
to the port for the server to listen on, andALLOW_FROM
to the url of your front-end app. Then, start the indexer/server:
cargo run
- Get recent tx's
curl localhost:8000/api/txdata
- doesn't check if tx was successful before indexing... need to check
block_results
endpoint at corresponding height and check by tx hash to see if successful - api only serves 100 txs ordered by txhash; needs to be ordered by timestamp and support for pagination added
- support could be added for parameters (eg: all transfers where source='tnam...')
- only transfers (transparent) are indexed; all other transaction types are ignored