w3f / staking-rewards-collector

Apache License 2.0
78 stars 32 forks source link

Rewards not found (Subscan API unreliable) #50

Closed jonasW3F closed 2 years ago

jonasW3F commented 2 years ago

There seems to be an issue where the collector would not found rewards for an address. Currently, I have account A and account B, and running the script several times gives me different outcomes. Sometimes it finds all rewards for account A and B, sometimes only for A and sometimes only for B.

From my tests, running the script with a Subscan API key yields always correct results.

jonasW3F commented 2 years ago

I am experiencing the same issues with other addresses. This is an example userInput with 1kv addresses.

{
    "start": "2022-06-01",
    "end": "2022-06-11",
    "currency": "CHF",
    "priceData": "true",
    "exportOutput": "true",
    "subscan_apikey": "",
    "exportPrefix": "out/",
    "addresses": [
        {
            "name": "1kv1",
            "address":"GZPJSqoN3u49yyAZfcxtfHxBDrvxJ79BfZe2Q9aQvv2HrAN",
            "startBalance": 883.1958,
            "network": "Kusama"
        },
        {
            "name":"1kv2",
            "address": "14Ns6kKbCoka3MS4Hn6b7oRw9fFejG8RH5rq5j63cWUfpPDJ",
            "startBalance": 14852.0034,
            "network": "Polkadot"
        }
    ]}

Running it multiple times provides different outputs. I will reach out to subscan and see what is going on.

jonasW3F commented 2 years ago

This issue might be related to the subscan_apikey. When I run it with my key, I always get the same output (which I hope is correct).

When running it without a API key the pattern seems to be that either it returns the correct value or 0. This seems to happen on an account individual level (i.e., each account independently returns sometimes 0 or the correct value)

jonasW3F commented 2 years ago

It seems to be an issue on subscan's side and they fixed it. I cannot reproduce the error above anymore.