oone-lido-subgraph-reward-history
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

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

output example

rewards history output example

/oone-lido-subgraph-reward-history/

    Package Sidebar

    Install

    npm i oone-lido-subgraph-reward-history

    Weekly Downloads

    0

    Version

    1.0.10

    License

    MIT

    Unpacked Size

    731 kB

    Total Files

    25

    Last publish

    Collaborators

    • pavel.solovyev