1.1. Entities Diagram

Diagram.png

1.1.1. Space

Space is used for aggregating your campaigns.

1.1.2. Campaign

Campaign is the key object that holds all info for NFT claiming process. Except info of itself, like campaign name, thumbnail, description, it also contains info of NFT contract, NFT template etc.

1.1.3. NFT Core

NFT contract(ERC-721) that used for minting NFTs within the campaign.

1.1.4. NFT Template

NFT template of the campaign contains info that used for generating metadata of a minted NFT. Including NFT name, image, traits etc.

1.1.5. Credential

Credential is elemental object that determine whether an address is eligible to claim the NFT. It takes a single wallet address as input and outputs 0(false)/1(true) to indicate whether the wallet address is eligible for this credentail.

1.1.6. Formula(Deprecated)

Formula is a algebraic expression of credentials and entries, the output of formula decide whether and how many NFTs a user can claim witin the campaign. e.g. (C_2&C_3)_1 means a user eligible for both credential 2 and 3 can claim one NFT, (C_4|C_5)_2 means a user eligible for either credential 4 and 5 can claim two NFTs.

1.1.7. TaskConfig

TaskConfig is the configuration structure of campaign’s task condition and task reward. It replaces the previous structure of Formula and credgroup, but we will fill in the credgroup structure with data for compatibility. It is recommended to use this structure when there is TaskConfig.

detailed structure as follows:

Diagram.png

# Both structures are first-level structures of camp
{
  "TaskConfig": {
    "participateCondition": ParticipateCondition -> A necessary condition for the campaign, which is optional. If this is present, it is a threshold condition for participating in the campaign. It must be completed to verify the following participation tasks.
      -> ParticipateCondition: {
        conditions: [ExprEntity]
          -> as ExprEntity below
        conditionalFormula: string -> as conditionalFormula below
        eligible: bool -> It means whether the entire ParticipateCondition is eligible
      }
    "referralConfig": RewardConfig -> The task and reward configuration of the campaign`s referral, which is optional. The detailed structure is RewardConfig.
      -> as RewardConfig below
    "rewardConfigs": []RewardConfig -> campaign`s task and reward configuration, the detailed structure is [] RewardConfig.
      -> RewardConfig: {
        conditions: [ExprEntity]
          -> ExprEntity: {
              cred: Cred -> cred info
              attrs: [ExprEntityAttr] -> This parameter is only available when encountering multi credential, such as space user, score, etc.
                -> ExprEntityAttr: { -> Ex: score >= 100
                  attrName: String! -> The name of the cred parameter
                  operatorSymbol: String! -> Conditional operator for parameters
                  targetValue: String! -> Conditional target value of parameter
                }
              attrFormula: String -> This is a combined expression that means conditions, usually simple ALL/ANY, but also supports complex expressions such as: (entity_0&&entity_1)||(entity_3&&entity_4)||(entity_5&&entity_6)
              eligible: Boolean -> It means whether the entire ExprEntity is eligible.
              eligibleAddress: [String]  -> This represents which addresses are eligible (usually means when multiple binding addresses are eligible)
            }
        conditionalFormula: string -> This is a combined expression that means conditions, usually simple ALL/ANY, but also supports complex expressions such as: (entity_0&&entity_1)||(entity_3&&entity_4)||(entity_5&&entity_6)
        eligible: bool -> It means rewardConfig is eligible.
        description: string
        rewards: [ExprReward]
          -> ExprReward: {
            arithmetics: [ExprEntity]
              -> as ExprEntity before, but the attrFormula here is a little different from the above. Here is an arithmetic expression. ex: entity_0+entity_1, entity_0/entity_1, entity_0/2
            arithmeticFormula: String -> This is a combined expression that represents the amount of the reward, usually a simple constant, but complex expressions are also supported, such as: (entity_0+entity_1)/2, entity_0/2*5
            rewardType: CredentialGroupRewardEntity -> NFT,TOKEN,DISCORDROLE,LOYALTYPOINTS,OAT,CUSTOM,LOYALTYPOINTSMYSTERYBOX,MINTLIST
            rewardCount: Int64 -> This is the reward quantity value calculated by using the user's actual data into the expression.
          }
        rewardAttrVals: RewardAttrVal -> Parameter replacement value of multi credential
      }
  }
}

# This structure is gradually deprecated. If there is TaskConfig, it is recommended to use the above data structure. If not, compatible data will be filled here.
{
  "CredentialGroup": {
    credentials: [Cred] -> credential detail strcut, There is an eligible field inside that represents the achievement status of each credential.
    conditionRelation: CredentialGroupConditionRelation  -> ALL/ANY
    conditions: [CredentialGroupCondition]
      -> CredentialGroupCondition: {
        eligible: Boolean -> It means whether the entire ExprEntity is eligible.
        eligibleAddress: [String]  -> This represents which addresses are eligible (usually means when multiple binding addresses are eligible)
      }
    rewards: [CredentialGroupReward]
      -> CredentialGroupReward: {
        rewardType: CredentialGroupRewardEntity -> NFT,TOKEN,DISCORDROLE,LOYALTYPOINTS,OAT,CUSTOM,LOYALTYPOINTSMYSTERYBOX,MINTLIST
        rewardCount: Int64 -> This is the reward quantity value calculated by using the user's actual data into the expression.  
      }
  }
}

1.2. Integration workflow

  1. Sign up for Galxe Space Dashboard, please visit Create a Space.
  2. Create credentials through the Dashboard. Upload data for your credentials if their source is CSV file.
  3. Create NFT core(NFT contract) if needed, if you are only need to intergrate OAT campaign, then it`s not needed.
  4. Create space through the Dashboard.
  5. Create campaign with with “Integrate campaign claiming into third-party websites” checked under your space through the Dashboard. (This will turn the campaign into gasless mode, right now we only support any campaign that does not require users to pay gas.)
  6. Go to your campaign page inside Galxe to check if the campaign info is correct and credentials lighted up for eligible users.
  7. Release your campaign through Dashboard.
  8. Integrate query campaign API, get campaign info data for rendering your NFT claim page.
  9. If you need to check whether a user is eligible to claim before hand, integrate query campaign API to get TaskConfig(address: $address), If there is a participateCondition field, it is determined that participateCondition->eligible == true. If not, rewardConfigs->eligible it represents the achievement of each set of tasks, and rewardConfigs->rewards->rewardCount represents the number of rewards that the user can obtain.
  10. Integrate mutation prepareParticipate API, send the claim request once user claim.
  11. If needed, integrate query participations API to check Tx status periodically.
  12. If you want, integrate query campaign API and get holders(first:Int, after:String) field info to setup NFTs showcase page.
  13. If needed, integrate query SpaceLeaderboard API to get Leaderboard info (But if you need data after 1000 positions in the rankings, you need owner auth and add auth-token in query header).

NOTE: Then you will need an access token bound to your galxe account to use this API. Please go to the Galxe user setting page to generate an access token.Then add access-token in the header of the query.

2.1. Overview

For endpoint and other info, please refer to Overview | Galxe Docs.

And for interface of each GraphQL query, please check docs/schema from Playground - https://graphigo.prd.galaxy.eco/query .

2.2. Query campaign

This API is used for get campaign object, a campaign is the key object that holds all info for NFT claiming process, integrate this API to setup your own NFT claim page. An example of how a campaign can be shown on website: New To The Galxe? Start your adventure here! by Galxe Space | Galxe .

2.2.1. Query

query {
  campaign
}

2.2.2. Arguments

ArgumentsDescription
id String!You can get campaign id from Galxe Dashboard page`s url once you created a campaign

2.2.3. Fields

FieldsDescription
idCampaign id is used to identify a certain campaign
nameCampaign name
descriptionCampaign description
thumbnailHow many NFTs have been minted/claimed for this campaign
numNFTMintedHow many NFTs have been minted/claimed for this campaign
startTimeCampaign start time in unix time
endTimeCampaign end time in unix time, if null means no end time
formula(Deprecated)Formula is a algebraic expression of credentials and entries, the output of formula decide whether and how many NFTs a user can claim.
claimedTimes(address: $String!)How many times a certain address has successfully claimed in this campaign
spaceSpace is object for aggregating your campaigns. Check object fields below
nftCoreNFT contract that used for this campaign. Check object fields below
nftTemplateNFT template contains info that used for generating metadata for a minted NFT. Check object fields below
credsCredentials are element object that determine whether an address is eligible to claim the NFT. Check object fields below
holders(first:Int, after: String)It shows user who have NFT minted from this campaign, first is same as limit, after is same as offset but it’s a number string and starts from “-1”.
TaskConfig(address: $String)TaskConfig is the configuration structure of campaign’s task condition and task reward.
CredentialGroup(address: $String)This structure is gradually deprecated. If there is TaskConfig, it is recommended to use the above data structure. If not, compatible data will be filled here.

2.2.3.1. Space fields

FieldsDescription
idSpace id
nameSpace name
aliasSpace alias, used for constructing the space url
thumbnailSpace icon image

2.2.3.2. NFT Core fields

FieldsDescription
nameNFT contract name
contractAddressNFT contract address

2.2.3.3. NFT Template fields

FieldsDescription
nameNFT name metadata
imageNFT image url metadata
ipfsImageNFT decentralized image url metadata
traitsNFT traits(you can refer to opensea NFT traits) metadata

2.2.3.4. Creds fields

FieldsDescription
idCredential ID
nameCredential name
descriptionCredential description
credTypeCredential type
credSourceCredential data source
eligible(address: $String)If a certain address is eligible for this credential
referenceLinkCall-to-Action: For example, Discord, Twitter, Telegram, etc. can use this link to jump to the third-party page for completing the task. If the value is empty, there is no direct jump point, and the task needs to be completed according to the task description.

2.2.3.5. TaskConfig

FieldsDescription
participateConditionA necessary condition for the campaign, which is optional. If this is present, it is a threshold condition for participating in the campaign. It must be completed to verify the following.
referralConfigThe task and reward configuration of the campaign`s referral, which is optional. The detailed structure is RewardConfig.
rewardConfigsCampaign`s task and reward configuration, the detailed structure is []RewardConfig.

2.2.3.5.1. rewardConfigs fields

FieldsDescription
conditions [ExprEntity]Campaign Task condition config
conditionalFormulaThis is a combined expression that means conditions, usually simple ALL/ANY, but also supports complex expressions such as: (entity_0&&entity_1)||(entity_3&&entity_4)||(entity_5&&entity_6)
eligibleIt means rewardConfig is eligible.
descriptionReward config desc
rewards [ExprReward]Campaign`s rewards config
rewardAttrValsParameter replacement value of multi credential

2.2.3.5.1.1. condition ExprEntity fields

FieldsDescription
credCredential Info
attrsThis parameter is only available when encountering multi credential, such as space user, score, etc.
attrFormulaThis is a combined expression that means conditions, usually simple ALL/ANY, but also supports complex expressions such as: (entity_0&&entity_1)||(entity_3&&entity_4)||(entity_5&&entity_6)
eligibleIt means whether the entire ExprEntity is eligible.
eligibleAddressThis represents which addresses are eligible (usually means when multiple binding addresses are eligible)

2.2.3.5.1.2. reward ExprReward fields

FieldsDescription
arithmeticsAs ExprEntity before, but the attrFormula here is a little different from the above. Here is an arithmetic expression. ex: entity_0+entity_1, entity_0/entity_1, entity_0/2
arithmeticFormulaThis is a combined expression that represents the amount of the reward, usually a simple constant, but complex expressions are also supported, such as: (entity_0+entity_1)/2, entity_0/2*5
rewardTypeNFT,TOKEN,DISCORDROLE,LOYALTYPOINTS,OAT,CUSTOM,LOYALTYPOINTSMYSTERYBOX,MINTLIST
rewardCountThis is the reward quantity value calculated by using the user’s actual data into the expression.

2.2.3.6. CredentialGroup fields

FieldsDescription
credentialsCredential detail strcut, There is an eligible field inside that represents the achievement status of each credential.
conditionRelationALL/ANY
conditions [CredentialGroupCondition]Credential gruop condition config
rewards [CredentialGroupReward]Credential group rewards config

2.2.3.6.1. condition CredentialGroupCondition fields

FieldsDescription
eligibleIt means whether the entire ExprEntity is eligible.
eligibleAddressThis represents which addresses are eligible (usually means when multiple binding addresses are eligible)

2.2.3.6.2. reward CredentialGroupReward fields

FieldsDescription
rewardTypeNFT,TOKEN,DISCORDROLE,LOYALTYPOINTS,OAT,CUSTOM,LOYALTYPOINTSMYSTERYBOX,MINTLIST
rewardCountThis is the reward quantity value calculated by using the user’s actual data into the expression.

2.2.4. Query example

query {
  campaign(id: "GCqBzUtW7w") {
    numberID
    name
    description
    thumbnail
    numNFTMinted
    startTime
    endTime
    formula
    claimedTimes(address: "0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b05")

    space {
      name
      alias
      thumbnail
    }

    nftCore {
      name
      contractAddress
    }

    nftTemplates {
      name
      image
      ipfsImage
      traits {
        name
        value
      }
    }

    creds {
      id
      name
      description
      credType
      credSource
      eligible(address: "0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b05")
    }

    nftHolderSnapshot{
      holders(
        block:43009180
        first:100
        after:"-1"
      ){
        list{
          id
          holder
        }
      }
    }

    # It will be deprecated in the future. The old structure is now forward compatible data.
    credentialGroups(address: "0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b05"){
      rewards{
        eligible
        rewardCount
        rewardType
      }
      credentials{
        id
        name
        eligible(address: "0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b05")
      }
    }

    # This is a new structure. It is best to refer to this data. If it does not have data, it should refer to credentialGroups.
    taskConfig(address: "0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b05"){
      participateCondition{
        eligible
      }
      rewardConfigs{
        eligible
        rewards{
          rewardType
          rewardCount
        }
      }
    }
  }
}

2.2.5. Response example

{
  "data": {
    "campaign": {
      "numberID": 4018,
      "name": "New To The Galaxy? Start your adventure here!",
      "description": "Galxe is a collaborative credential infrastructure that empowers brands to build better communities and products in Web3, by leveraging on and off-chain credentials into creative and influential growth campaigns.\n\nCampaigns range from on-chain (ex: depositing on the blockchain) to off-chain (Liking a Tweet, Being a Discord member or attending an AMA, etc)\n\n\nStep 1: Verify your Galaxy ID by setting a username [Here !](https://app.galxe.com/quest/id)\n\nStep 2: Follow us on Twitter \n[Here ! ](https://twitter.com/GalxeHQ?s=20&t=6fgf-DUT7ikDP9Bvuem_vQ)",
      "thumbnail": "https://d257b89266utxb.cloudfront.net/galaxy/images/avatar/0xbb3a7bc36b5bafa7691ccb708ebf299b6d521b05-1655889591.jpg",
      "numNFTMinted": 49618,
      "startTime": 1656450000,
      "endTime": null,
      "formula": "(C_3028&C_3034)*1",
      "claimedTimes": 0,
      "space": {
        "name": "Galaxy Space",
        "alias": "galaxy",
        "thumbnail": "https://d257b89266utxb.cloudfront.net/galaxy/images/galaxyspace/galaxyspace-logo-1640145282.png"
      },
      "nftCore": {
        "name": "[Old version]Galaxy OAT",
        "contractAddress": "0x1871464F087dB27823Cff66Aa88599AA4815aE95"
      },
      "nftTemplates": [
        {
          "name": "New To The Galaxy? Start your adventure here!",
          "image": "https://d257b89266utxb.cloudfront.net/galaxy/images/avatar/0xbb3a7bc36b5bafa7691ccb708ebf299b6d521b05-1655889591.jpg",
          "ipfsImage": "",
          "traits": [
            {
              "name": "Location",
              "value": ""
            }
          ]
        }
      ],
      "creds": [
        {
          "id": "3034",
          "name": "Set Galaxy ID Username",
          "description": "Set your Galaxy ID username in Galxe",
          "credType": "EVM_ADDRESS",
          "credSource": "GRAPHQL",
          "eligible": 1
        },
        {
          "id": "3028",
          "name": "Galxe Twitter Follower",
          "description": "Galxe Twitter Follower",
          "credType": "TWITTER",
          "credSource": "TWITTER_FOLLOW",
          "eligible": 0
        }
      ],
      "nftHolderSnapshot": {
        "holders": {
          "list": [
            {
              "id": "840612",
              "holder": "0xb85b3d61439a3d70d3df7913a3a764f352b32c55"
            },
            {
              "id": "840633",
              "holder": "0x2357f665d833c517238eda7f6ef4a1f323f677f0"
            },
            {
              "id": "840666",
              "holder": "0x8bb60421193a2c2ea2bb442ff162f3e3f3a70f68"
            },
            ...
          ]
        }
      },
      "credentialGroups": [
        {
          "rewards": [
            {
              "eligible": false,
              "rewardCount": 0,
              "rewardType": "OAT"
            }
          ],
          "credentials": [
            {
              "id": "3034",
              "name": "Set Galxe ID Username",
              "eligible": 1
            },
            {
              "id": "3028",
              "name": "Galxe - Twitter Followers",
              "eligible": 0
            }
          ]
        }
      ],
      "taskConfig": {
        "participateCondition": null,
        "rewardConfigs": [
          {
            "conditions": [
              {
                "cred": {
                  "name": "Set Galxe ID Username"
                },
                "eligible": true
              },
              {
                "cred": {
                  "name": "Galxe - Twitter Followers"
                },
                "eligible": false
              }
            ],
            "eligible": false,
            "rewards": [
              {
                "rewardType": "OAT",
                "rewardCount": 0
              }
            ]
          }
        ]
      }
    }
  }
}

// multi config example.
{
  "taskConfig": {
    "participateCondition": null,
    "rewardConfigs": [
      {
        "conditions": [
          {
            "cred": {
              "name": "Galxe Web3 Score - Humanity Score"
            },
            "attrs": [
              {
                "attrName": "humanity",
                "operatorSymbol": ">=",
                "targetValue": "2"
              }
            ],
            "attrFormula": "ALL",
            "eligible": false
          },
          {
            "cred": {
              "name": "Galxe Passport Holder"
            },
            "attrs": [],
            "attrFormula": null,
            "eligible": false
          }
        ],
        "eligible": false,
        "rewards": [
          {
            "rewardType": "LOYALTYPOINTS",
            "rewardCount": 0
          }
        ]
      }
    ]
  }
}
 

2.3. Query and mutate credential

Creds fields

2.3.1. query credential info

query {
  credential(id:220244101447720960){
    name
    description
    referenceLink
    credType
    credSource
  }
}

# response
{
  "data": {
    "credential": {
      "name": "MantaNetwork - Twitter Followers",
      "description": "MantaNetwork‘s Twitter followers",
      "referenceLink": "https://twitter.com/MantaNetwork",
      "credType": "TWITTER",
      "credSource": "TWITTER_FOLLOW"
    }
  }
}

2.3.2. update credential items

Use API to update credential Items | Galxe Docs

2.3.3. check address eligiblilty Single

**NOTE:**This can only check single credential eligible.

**NOTE:**This is just to get the eligible status and will not do verification.

query {
  credential(id:220244101447720960){
    eligible(address:"0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b01")
  }
}

# response
{
  "data": {
    "credential": {
      "eligible": 0
    }
  }
}

2.3.4. check address eligiblilty(verify button) Single

**NOTE:**This can only check single credential eligible.

**NOTE:**This will verify the user’s data. Some cred types will have recaptcha restrictions (if verify gets a recaptcha error). Verification can only be initiated from the galxe page, we will regularly adjust the types that require recaptcha.

mutation {
  verifyCredential(input:{
    credId:220244101447720960
    address:"0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b01"
  })
}

# response
{
  "data": {
    "verifyCredential": false
  }
}

2.3.5. check address eligiblilty(verify button) Universal

**NOTE:**This will verify the user’s data. Some cred types will have recaptcha restrictions (if verify gets a recaptcha error). Verification can only be initiated from the galxe page, we will regularly adjust the types that require recaptcha.

# single cred verify
mutation VerifyConfition{
  verifyConditionEntity(input:{
    address: "0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b01"
    entityExpr: {
      credId: 220244101447720960
    }
  })
}

# response
{
  "data": {
    "verifyConditionEntity": false
  }
}

# multi cred verify 
mutation VerifyConfition{
  verifyConditionEntity(input:{
    address: "0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b01"
    entityExpr: {
      credId: 278833942007291904
      attrs: [{
        attrName: "follow"
        operatorSymbol: "=="
        targetValue: "true"
      }]
      attrFormula:"ALL"
    }
  })
}

# response
{
  "data": {
    "verifyConditionEntity": false
  }
}

**NOTE:**You can use ExprEntityInput like TaskConfig ExprEntity verify complex conditions.

2.4. Mutation prepareParticipate

This API send the request for minting a NFT once user claim, our backend will eventually call the NFT contract to have the NFT minted to user.

2.4.1. Mutation

mutation {
  prepareParticipate
}

2.4.2. Arguments

ArgumentsDescription
signature String!Deprecating, keep it a empty string
campaignID String!Campaign ID
address String!User’ wallet address, you can get it from user’s wallet connection or just a plain test input. In either way, for a successful claim, this address must be eligible through credentials of this campaign.
mintCount IntBatch claim count, if batch claim is needed. Otherwise don’t pass in this argument.

2.4.3. Fields

FieldsDescription
allowIf the user is able to claim the NFT
disallowReasonClaim failed reason
mintFuncInfo-> verifyIDsUnique ids(if it’s a batch claim, there will be multiple ids) for identifying and getting on-chain Tx(s)
mintFuncInfo-> nftCoreAddressNFT contract address

2.4.4. Query example

mutation {
  prepareParticipate(input: {
    signature: ""
    campaignID: "GCqBzUtW7"
    address: "0xBb3A7bc36b5baFa7691Ccb708EbF299B6d521b05"
  }) {
    allow
    disallowReason
    mintFuncInfo {
      verifyIDs
      nftCoreAddress
    }
  }
}

2.4.5. Response example

{
  "data": {
    "prepareParticipate": {
      "allow": true,
      "disallowReason": "",
      "mintFuncInfo": {
        "verifyIDs": [
          52547302
        ],
        "nftCoreAddress": "0x6798f4E7dA4Fc196678d75e289A9d4801C3C849E"
      }
    }
  }
}

2.5. Query participations

Once the claim request is sent, use this API to monitor on-chain Tx status.

2.5.1. Query

query {
  participations
}

2.5.2. Arguments

ArgumentsDescription
id [Int!]!ids are verify ids returned by mutation prepareParticipate API

2.5.3. Fields

FieldsDescription
txTx address
statusTx status. Status enum: Generated, tx is just born; Pending, tx is in pending; Success, tx is succeed; Queueing, tx is still in message queue; Failed, tx is failed

2.5.4. Query example

query {
  participations(id:[53936841]) {
    tx
    status{
  "data": {
    "participations": [
      {
        "tx": "0x95d86011835663ff12e562e3f751817e1b4c2028dc8045bfc38d0b0e2592e2a4",
        "campaign": {
          "id": "GCtf9UUuTn"
        },
        "status": "Success"
      }
    ]
  }
}

2.5.5. Response example

{
  "data": {
    "participations": [
      {
        "tx": "0x95d86011835663ff12e562e3f751817e1b4c2028dc8045bfc38d0b0e2592e2a4",
        "status": "Success"
      }
    ]
  }
}

2.6. Query SpaceLeaderboard

You can use this query to query the info information of the leaderboard of space.

2.6.1. Query

query SpaceLeaderboard($id: Int!, $after: String, $pageSize: Int, $order: LoyaltyPointsRankOrder, $seasonId: Int, $cursorAfter: String, $cursorBefore: String) {
  space(id: $id) {
    id
    name
    loyaltyPointsRanks(first: $pageSize, after: $after, order: $order, sprintId: $seasonId, cursorAfter: $cursorAfter, cursorBefore: $cursorBefore) {
      pageInfo {
        startCursor
        endCursor
        hasNextPage
        hasPreviousPage
      }
      totalCount
      edges {
        node {
          id
          rank
          points
          address {
            username
            id
            avatar
            address
          }
        }
      }
    }
  }
}

# variables
{
  "id": XX,
  "pageSize": 20,
  "order": "Points",
  "cursorAfter": "XXX",
  "sprintId": nil
}

2.6.2. Arguments

ArgumentsDescription
id Int!space id
pageSize Int!page size
orderPoints/GalxeID
cursorAfter StringYou don’t need to pass in this value on the first page. On the second page, you can start passing in the endCursor value returned by the first page.
sprintId IntThe id value of the Session can access the data of the specified Session.

2.6.3. Fields

FieldsDescription
rankuser rank in this leaderboard
pointsuser point at this space/sprint
addressuser info has more field for detail

2.6.4. Query example

query SpaceLeaderboard($id: Int!, $after: String, $pageSize: Int, $order: LoyaltyPointsRankOrder, $seasonId: Int, $cursorAfter: String, $cursorBefore: String) {
  space(id: $id) {
    id
    name
    loyaltyPointsRanks(first: $pageSize, after: $after, order: $order, sprintId: $seasonId, cursorAfter: $cursorAfter, cursorBefore: $cursorBefore) {
      pageInfo {
        startCursor
        endCursor
        hasNextPage
        hasPreviousPage
      }
      totalCount
      edges {
        node {
          id
          rank
          points
          address {
            username
            id
            avatar
            address
          }
        }
      }
    }
  }
}

2.6.5. Response example

{
  "data": {
    "space": {
      "id": "xx",
      "name": "xx",
      "loyaltyPointsRanks": {
        "pageInfo": {
          "startCursor": "xxxx",
          "endCursor": "xxxx",
          "hasNextPage": true,
          "hasPreviousPage": false
        },
        "totalCount": 100,
        "edges": [
          {
            "node": {
              "id": "xxx",
              "rank": 1,
              "points": 65,
              "address": {
                "username": "xx",
                "id": "xxx",
                "avatar": "xxx",
                "address": "xxxx"
              }
            }
          },
          ...
        ]
      }
    }
  }
}