banr1 / how-many-holders

0 stars 0 forks source link

Create the MVP #1

Open banr1 opened 1 month ago

banr1 commented 1 month ago

I'm gonna check that we can use this API for free

https://www.oklink.com/docs/en/#fundamental-blockchain-data-token-data-get-token-holder-list

banr1 commented 1 month ago

I finished the registration of OK Link.

banr1 commented 1 month ago

I confirmed that I'm able to call the API for free.

banr1 commented 1 month ago
image
banr1 commented 1 month ago

I found that the token holder list doesn't support SUI.

Get token holder list Get the list of positions of a token under a chain, return only the address with a balance of top10000. The supported chains are ETH, OKTC, XLAYER, XLAYER_TESTNET, BSC, ETC, POLYGON, AVAXC, ETHW, DIS, FTM, OP, ARBITRUM, KLAYTN, ZKSYNC, GNOSIS, RONIN, LINEA, POLYGON_ZKEVM, TRON, Base, Scroll, OMEGA, OPBNB, MANTA, CANTO, SEPOLIA_TESTNET, GOERLI_TESTNET, AMOY_TESTNET, MUMBAI_TESTNET, POLYGON_ZKEVM_TESTNET.

https://www.oklink.com/docs/en/#fundamental-blockchain-data-token-data-get-token-list

banr1 commented 1 month ago

This looks good. It's Dune-ish project that support SUI.

https://chainbase.com/

banr1 commented 1 month ago

I tried calling the Generated API in Data Cloud Studio and it seems that we can use this for our purpose.

~/workspace/how-many-holders $ ./test-query.sh
RUNNING 5%
RUNNING 6%
RUNNING 23%
FINISHED 100%
{
  "code": 200,
  "data": {
    "columns": [
      {
        "name": "raw_data",
        "type": "VARCHAR"
      }
    ],
    "data": [
      [
        "{\"objectId\":\"0x00004486670f6cad164bd4e2346ed406ffa9254229af5ba0eb4a6b1d207936c4\",\"version\":\"71436857\",\"digest\":\"A6XNsst1Xe9PVWotBTh8nSGm3CtzQ1nXodAymNS5kUTp\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"4288672659\",\"id\":{\"id\":\"0x00004486670f6cad164bd4e2346ed406ffa9254229af5ba0eb4a6b1d207936c4\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AABEhmcPbK0WS9TiNG7UBv+pJUIpr1ug60prHSB5NsST85//AAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":71436857},\"owner\":{\"AddressOwner\":\"0xca27e9f064cac3e5b030296a285f1f9198485b4d946de01c758fee259f38733f\"},\"previousTransaction\":\"BAzxpZvKufAbeBXZ26NkBj6JLvFH9An3VboScCcFSeaC\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x0000499961d1ccb3e60bb57c77d4b80444ca82ccff366518aac0ac9e8a6f57c8\",\"version\":\"26589283\",\"digest\":\"7CZ4kwWytczNRgLxjjPggrNXMq5xykPfjaPh3qkwpm6Q\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"2718711966\",\"id\":{\"id\":\"0x0000499961d1ccb3e60bb57c77d4b80444ca82ccff366518aac0ac9e8a6f57c8\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AABJmWHRzLPmC7V8d9S4BETKgsz/NmUYqsCsnopvV8ieQAyiAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":26589283},\"owner\":{\"AddressOwner\":\"0x7c43bed7a1eafab976faddd38cfe596e544c47e4d61340c5d19db731dff1af8c\"},\"previousTransaction\":\"3T5P77u9WNGEWMRyHZUStKcNqny65LxkcNsE5hytQYGd\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x0000543802100f9e94f3bd206a3b354365ab42e3c46b0a6ff7cf993664bdbab4\",\"version\":\"30465537\",\"digest\":\"b3mMr59jQWHhzrwhvMNxT7kK4VrCijAsoxS3E3r3Bsu\",\"type\":\"0x2::coin::Coin\\u003c0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin\\u003c0x2::sui::SUI\\u003e\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"0\",\"id\":{\"id\":\"0x0000543802100f9e94f3bd206a3b354365ab42e3c46b0a6ff7cf993664bdbab4\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin\\u003c0x2::sui::SUI\\u003e\\u003e\"},\"bcs\":{\"bcsBytes\":\"AABUOAIQD56U870gajs1Q2WrQuPEawpv98+ZNmS9urQAAAAAAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin\\u003c0x2::sui::SUI\\u003e\\u003e\",\"version\":30465537},\"owner\":{\"AddressOwner\":\"0xc15c97c570d29f2b941ed74481141faa9bc9665e54bf6fa9a1e6743196c0eb73\"},\"previousTransaction\":\"CBcYnd3AUshskToNtRp7bc9Pwepv1sCUmC74GZFYaUQc\",\"storageRebate\":\"1710000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x0000753b3f466140d927658476a386eb7c70d7d5d41c969d58652ddaaae6889f\",\"version\":\"18687079\",\"digest\":\"A915TU3wg6XYPixKZrr1i7koLWdTibvMnr47gLeFfpuv\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"76615288\",\"id\":{\"id\":\"0x0000753b3f466140d927658476a386eb7c70d7d5d41c969d58652ddaaae6889f\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AAB1Oz9GYUDZJ2WEdqOG63xw19XUHJadWGUt2qrmiJ94DpEEAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":18687079},\"owner\":{\"AddressOwner\":\"0xebe61d21e75216f1dce4bcadc4f8574dd2dfa0695bdd7734238ea2d2623f861a\"},\"previousTransaction\":\"AjUaGqnczFkHKYqXdfWyBmcB3on69u23dsZCa6y4pAzn\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x00009869afed9e903b68fdf1fb8db9b84378cd91e1f90aae707c14db3d9ea7ed\",\"version\":\"33492924\",\"digest\":\"9RCK2GP9ysaF4hKcE1bVLXFYNXaWRwbt9JjeA4hM1AHd\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"816702123\",\"id\":{\"id\":\"0x00009869afed9e903b68fdf1fb8db9b84378cd91e1f90aae707c14db3d9ea7ed\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AACYaa/tnpA7aP3x+425uEN4zZHh+QqucHwU2z2ep+2r4q0wAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":33492924},\"owner\":{\"AddressOwner\":\"0xb4189c19e42d803fb52f1db9bbf5043fe05b76c76b93d8125fb91ad75cab7f2c\"},\"previousTransaction\":\"841d31a4ExcmmFDXfrbeMJmfjDwy8ukcCeu9AhViijAL\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x0000ceba0e3f1083bc51cb0b7194dd429b4ddcef8738601cf90ecb6c6b2a2609\",\"version\":\"42349128\",\"digest\":\"47PCMiytfGSrEDpENgqnvzuxnWk3KjBRPYfmx7cDCGfj\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"103145062\",\"id\":{\"id\":\"0x0000ceba0e3f1083bc51cb0b7194dd429b4ddcef8738601cf90ecb6c6b2a2609\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AADOug4/EIO8UcsLcZTdQptN3O+HOGAc+Q7LbGsqJglm3iUGAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":42349128},\"owner\":{\"AddressOwner\":\"0xf36e0754162a2b7d52c8d871444d960fd1975c4d5e7e9cd16b0bd96204265267\"},\"previousTransaction\":\"FrB9ix6bc9f4zWwTdu2ZmvHtgQNJCmkgCMXgzhma7wJR\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x0000cfdbc5e6005381c2da678ce77db8d245ade9e35cc86ad57f61eb2a066d03\",\"version\":\"43878753\",\"digest\":\"CdZNf745WdeCx596EN89ZK9pqDG5B3PetJfSrW3fKqsT\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"101186480\",\"id\":{\"id\":\"0x0000cfdbc5e6005381c2da678ce77db8d245ade9e35cc86ad57f61eb2a066d03\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AADP28XmAFOBwtpnjOd9uNJFrenjXMhq1X9h6yoGbQOw+wcGAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":43878753},\"owner\":{\"AddressOwner\":\"0xaea7cbb1d54a4cb11bb85eda956e7b74adc565696ed40b2c32f28f2139f22c8b\"},\"previousTransaction\":\"D9mJdeHmGDsZW8nsRpBh6tpxHSNT2F81SwfwJzHhddjT\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x0000def54cbff5774b3cc3bb9ebd164252a4ace0d50d7486da01636bb9e0bb3a\",\"version\":\"33060556\",\"digest\":\"3ido5LGaLov96Pf6HAUvzH8UnzdJTqttJmZwEabXiNH1\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"102742119\",\"id\":{\"id\":\"0x0000def54cbff5774b3cc3bb9ebd164252a4ace0d50d7486da01636bb9e0bb3a\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AADe9Uy/9XdLPMO7nr0WQlKkrODVDXSG2gFja7nguzpnuB8GAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":33060556},\"owner\":{\"AddressOwner\":\"0xa178c797015da25f322432267bb9265d11c6cd188f6e4a741ea3622b7686c115\"},\"previousTransaction\":\"7y5PWXEkfdYfouGbqS7bLdvHxqV11QYYVEUyHvyqGX3\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x00012662888c059b19fc08dd914ccdd4fb3284934d193069ad1b2af9936ae153\",\"version\":\"16539633\",\"digest\":\"6qqAHUnMnQR2X7hkZDx3JuvwPH4b7b4S2QEKaeY3tpBM\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"8252120\",\"id\":{\"id\":\"0x00012662888c059b19fc08dd914ccdd4fb3284934d193069ad1b2af9936ae153\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AAEmYoiMBZsZ/AjdkUzN1PsyhJNNGTBprRsq+ZNq4VPY6n0AAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":16539633},\"owner\":{\"AddressOwner\":\"0x84fa43b04335ee3bf90cd0492dafdd1d68fef11051f55013f71c20904441be2b\"},\"previousTransaction\":\"GSj6sZt6542o55wWyzkgUrkxh1KFwztw53FpsqTicPiw\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ],
      [
        "{\"objectId\":\"0x00013fcf9c5b070e0bf65064a60951d1ac3e40069f86884f26152493ba880285\",\"version\":\"31144632\",\"digest\":\"FUGA8oAf8M2sLBs6UsCdDkmCYn1ZVb7ULAG7zC5i6wdf\",\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"content\":{\"dataType\":\"moveObject\",\"fields\":{\"balance\":\"25768840\",\"id\":{\"id\":\"0x00013fcf9c5b070e0bf65064a60951d1ac3e40069f86884f26152493ba880285\"}},\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\"},\"bcs\":{\"bcsBytes\":\"AAE/z5xbBw4L9lBkpglR0aw+QAafhohPJhUkk7qIAoWIM4kBAAAAAA==\",\"dataType\":\"moveObject\",\"hasPublicTransfer\":true,\"type\":\"0x2::coin::Coin\\u003c0x2::sui::SUI\\u003e\",\"version\":31144632},\"owner\":{\"AddressOwner\":\"0x5980228a8fee090f4f91e019bb174795654d4c35467c92c518b97cfdd364944a\"},\"previousTransaction\":\"GBuVmZSeNxqkSdf8bTkjc3i1AMeh8juMu3kMoMMauiW8\",\"storageRebate\":\"988000\",\"display\":{\"data\":null,\"error\":null}}"
      ]
    ],
    "execution_ended_at": "2024-08-01 06:22:30.179 +0000 UTC",
    "execution_id": "194bb60aaefc0b12f3613f9b932d26d7",
    "execution_started_at": "2024-08-01 06:22:26.137 +0000 UTC",
    "execution_time_millis": 4040,
    "expires_at": "2024-08-01 06:52:30.179 +0000 UTC",
    "message": "",
    "peak_memory_bytes": 0,
    "pending_time_millis": 17,
    "query_id": 240051,
    "status": "FINISHED",
    "submitted_at": "2024-08-01 06:22:26.12 +0000 UTC",
    "total_row_count": 10
  },
  "message": "success"
}
banr1 commented 1 month ago

And I found that we can use it for free.

image

https://console.chainbase.com/settings/billing

banr1 commented 1 month ago

https://console.chainbase.com/dataCloud/v2

banr1 commented 1 month ago

I'm gonna continue to implement it.

banr1 commented 1 month ago

The ethereum.erc20_balances_historical was not in the expected format...