oone-lido-subgraph-reward-history
v1.0.10
Published
Start point example of using Lido Subgraph to fetch user's daily rewards history report.
Downloads
15
Readme
Using Lido Subgraph to fetch Daily Rewards History
The repository contains sample code for using Lido Subgraph to retrieve the daily rewards history for a specific address of a stETH-holding user.
In fact, the current code is a minimized and refactored version of the same logic used in the API of the Lido Reward History Backend service
setup
install packages
npm install
configure
Copy the .env.example
file to .env
and if needed modify SUBGRAPH_URL
var to point to mainnet Lido Subgraph query endpoint.
By default, the URL is The Graph-hosted Lido Subgraph mainnet endpoint:
SUBGRAPH_URL=https://api.thegraph.com/subgraphs/name/lidofinance/lido
Feel free to change it to a more stable service, e.g. use the decentralized version of Lido Subgraph.
usage
Command to run the script via ts-node
:
npm run rewards-dev <address>
or using mode.js
(build & run):
npm run build
npm run rewards <address>
where <address>
is any stETH
holder address. E.g. for Lido Agent
:
npm run rewards-dev 0x3e40D73EB977Dc6a537aF587D48316feE66E9C8c