Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ankr_getTokenHolders returns unsorted holders #1589

Open
as-iotex opened this issue Mar 23, 2024 · 0 comments
Open

ankr_getTokenHolders returns unsorted holders #1589

as-iotex opened this issue Mar 23, 2024 · 0 comments

Comments

@as-iotex
Copy link

The ankr_getTokenHolders is not returning holders ordered by balance.
Is this by design? What is the reasoning behind it?

I would really like to have an endpoint that returns token holders sorted by balance.

Basically I want to get the top xx holders for a token. But with the current behaviour I would have to query all token holders first (which could be more than one request as the page size is 10k max). Then sort them myself by balance.
Looks like this can be handled more easily server side

Here is a getholders call example:

curl --request POST \
     --url 'https://rpc.ankr.com/multichain/<key>/?ankr_getTokenHolders=' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "jsonrpc": "2.0",
  "method": "ankr_getTokenHolders",
  "params": {
    "blockchain": "eth",
    "contractAddress": "0x9F9c8ec3534c3cE16F928381372BfbFBFb9F4D24",
    "pageSize": 10
  },
  "id": 1
}
'

Returns an array with a seamingly random sorting. Maybe it's listing oldest holders first, not sure.

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockchain": "eth",
    "contractAddress": "0x9f9c8ec3534c3ce16f928381372bfbfbfb9f4d24",
    "tokenDecimals": 18,
    "holders": [
      {
        "holderAddress": "0x000000000000000000000000000000000000dead",
        "balance": "0.000000000000000287",
        "balanceRawInteger": "287"
      },
      {
        "holderAddress": "0x000000000000084e91743124a982076c59f10084",
        "balance": "0.000000000000000001",
        "balanceRawInteger": "1"
      },
      {
        "holderAddress": "0x000000000000294a0d3b43ec78199a84587ae012",
        "balance": "0.000000000000000006",
        "balanceRawInteger": "6"
      },
      {
        "holderAddress": "0x0000000000007f150bd6f54c40a34d7c3d5e9f56",
        "balance": "0.000000004028533483",
        "balanceRawInteger": "4028533483"
      },
      {
        "holderAddress": "0x000000000005af2ddc1a93a03e9b7014064d3b8d",
        "balance": "0.000000000000000001",
        "balanceRawInteger": "1"
      },
      {
        "holderAddress": "0x0000000000208d4805eb97db796e74b48547445d",
        "balance": "0.00000000000015216",
        "balanceRawInteger": "152160"
      },
      {
        "holderAddress": "0x000000000035b5e5ad9019092c665357240f594e",
        "balance": "0.000000000000000065",
        "balanceRawInteger": "65"
      },
      {
        "holderAddress": "0x00000000003b3cc22af3ae1eac0440bcee416b40",
        "balance": "0.033757757619980131",
        "balanceRawInteger": "33757757619980131"
      },
      {
        "holderAddress": "0x00000000007079010d6e70a9b6e6d70a43f58300",
        "balance": "15.238310408853462243",
        "balanceRawInteger": "15238310408853462243"
      },
      {
        "holderAddress": "0x0000000000710a9c1f6db5f504be77ffb3b583ec",
        "balance": "0.000000000000000001",
        "balanceRawInteger": "1"
      }
    ],
    "holdersCount": 7879,
    "nextPageToken": "HUAk46AT4FNtnkuGjueMtqGagGMwaHR5bvyvnCf7u84StLsWcNGNUQ8YSzPBX4Fx9hnPzNvPuSHiZZDjtTZ",
    "syncStatus": {
      "timestamp": 1711217555,
      "lag": "-4m",
      "status": "synced"
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant