A command line tool for Polkadot staking reward lookups.
Configure the url of the rpc node, and the polkadot address in an .env file:
echo "POLKADOT_ADDR=<your_address_here>" >> .env
echo "RPC_ENDPOINT=https://polkadot-rpc.dwellir.com" >> .env
echo "SUBQUERY_ENDPOINT_REWARDS=https://api.subquery.network/sq/nova-wallet/nova-wallet-polkadot" >> .env
echo "SUBQUERY_ENDPOINT_STAKE_CHANGES=https://api.subquery.network/sq/nova-wallet/nova-wallet-polkadot" >> .env
echo "KNOWN_REWARDS_FILE=known_rewards.csv" >> .env
echo "KNOWN_STAKE_CHANGES_FILE=known_stake_changes.csv" >> .env
echo "POLKADOT_PROPERTIES_FILE=polkadot_properties.json" >> .env
Build the main binary and ask what it can do for you:
cargo run --bin stake-checker -- --help
Do an example rpc query for total issuance on polkadot
cargo run --bin stake-checker -- --total_issuance
Make the same query but by providing a storage method and a storage name
cargo run --bin stake-checker -- --get_storage Balances TotalIssuance
Ask the subquery rewards endpoint for a list of your latest staking rewards that were not already listed among your known rewards, and append them onto your file of known rewards
cargo run --bin stake-checker -- --staking_rewards >> known_rewards.csv
Ask the subquery stake changes endpoint for an analogous list
cargo run --bin stake-checker -- --stake_changes >> known_stake_changes.csv
Plot known staking rewards in an svg file.
cargo run --bin plotit > plot.svg
I suggest tailoring usage to your needs with a script.
A basic script called check.sh
is included.
Is uses the program eog to view the generated plot.
I invoke it like this
./check.sh
... and it gives me a plot like this:
cargo dylint --all --workspace
cargo dylint --all --workspace -- --test integration_tests