Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karmacoma-eth/farcaster-followers-frame
A simple frame that displays a follower graph
https://github.com/karmacoma-eth/farcaster-followers-frame
Last synced: about 1 month ago
JSON representation
A simple frame that displays a follower graph
- Host: GitHub
- URL: https://github.com/karmacoma-eth/farcaster-followers-frame
- Owner: karmacoma-eth
- License: mit
- Created: 2024-02-08T23:33:52.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-10T18:18:23.000Z (10 months ago)
- Last Synced: 2024-04-22T10:12:09.820Z (8 months ago)
- Language: Python
- Size: 584 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-farcaster-dev - `farcaster-followers-frame`
- awesome-farcaster-dev - `farcaster-followers-frame`
README
# farcaster-followers-frame
[Try it in warpcast](https://warpcast.com/karma/0x503694fc)
## How does it work?
* user clicks on the `get my data` button
* the app receives a POST to `/followers` with the `fid` of the user
* we hit the gRPC API of a Farcaster hub and makes a `LinksByTargetRequest` with the user's `fid`
* we receive a list of messages and increment the follower count for every `MESSAGE_TYPE_LINK_ADD` and decrement it for every `MESSAGE_TYPE_LINK_REMOVE`
* we create a `pandas.Series` object using the `timestamp` of the messages and the follower count
* we plot the series using `seaborn`/`matplotlib`
* we render the graph as a png and return it## GRPC API
```sh
# separately check out hub-monorepo
git clone https://github.com/farcasterxyz/hub-monorepo path/to/hub-monorepo# copy the updated protobufs in our repo
cp -R path/to/hub-monorepo/protobufs farcaster-followers-frame/protobufs# generate the client code
python -m grpc_tools.protoc -I./protobufs/schemas/ \
--python_out=./src/fff/grpc --grpc_python_out=./src/fff/grpc protobufs/schemas/*.proto# fix the darn imports generated by protoc
rye run protol --in-place --python-out src/fff/grpc protoc --proto-path=protobufs/schemas protobufs/schemas/*.proto
```To configure the RPC host, create a `.env` file and point it at your hub gRPC host and port:
```
HUB_RPC=hostname:2283
```