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

Create script to analyze our userbase #460

Open
dcts opened this issue Jun 19, 2024 · 0 comments
Open

Create script to analyze our userbase #460

dcts opened this issue Jun 19, 2024 · 0 comments

Comments

@dcts
Copy link
Contributor

dcts commented Jun 19, 2024

We should create a script that gives us deeper insights on our userbase. On a weekly basis we need to fetch all receipt NFTs of all pairs and calculate the following:

  • new addresses onboarded (= new users)
  • nbr of active addresses in a given period

For that we will need the following API calls:

  1. get all alphadex trade pairs
  2. for each trade pair:
    (a) get the order receipt address
    (b) fetch all receipt NFTs
    (3) for each receipt -> find out who's the owner of that NFT receipt

Useful API calls

Thanks @Radstakes for providing those!

Get all AlphaDEX Trade Pairs:

curl --location --request POST 'https://api.alphadex.net/v0/alphadex/pairs' \
--header 'Accept: application/json'

With each component address returned, you can use this end point to find out the receipt NFT resource address:

curl --location 'https://api.alphadex.net/v0/pair/info' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "pairAddress": "<string>"
}'

Once you have the order receipt address, the easiest way to then find the holders of those receipts, I suggest using RadixAPI:

curl -X 'GET' \
  'https://api.radixapi.net/v1/nft/accounts/resource_rdx1ntjfxdj66erumwrnph234vdjdr77ka4uwjwf50amzeskvfqqhev99n' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <BEARER TOKEN NEEDED HERE>'

In the example above, I've used the floop/xrd receipt. This will return the following:

{
  "data": [
    {
      "address": "account_rdx12804z27zmqnegk7xew03qh8g5kxp8tvcpnvj5gc44nhct9kfj5npzj",
      "non_fungible_ids": [
        "#71#",
        "#74#",
        "#73#",
        "#72#"
      ]
    },
    {
      "address": "account_rdx128496dyfrmvql3yjjjgc2vjcrx58xcmx0ffzqd0rgaplru076pltt9",
      "non_fungible_ids": [
        "#23#"
      ]
    },
    {
      "address": "account_rdx129qa4eh2ny3e4fgzpzj8f55uk6hcq2dx204p8jyk0k5xw6zdhwwjh9",
      "non_fungible_ids": [
        "#32#",
        "#34#",
        "#33#"
      ]
    },
    {
      "address": "account_rdx12y9rw7kkgs6t56fthrv70s58fszt7atjnsdvaygwu75t7q27lngp9v",
      "non_fungible_ids": [
        "#4#",
        "#5#"
      ]
    },
    {
      "address": "account_rdx12yr634z7xtpjvkk3jzrw94k9zhgq5glwz55wd6nn7lhgkzffwnum0r",
      "non_fungible_ids": [
        "#30#"
      ]
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant