Space Access:

Campaign

Query campaign participants

Arguments:

NameDescription
idCampaign hash id.
pfirstQuery limit.
pafterQuery offset.

Request:

query campaignParticipants($id: ID!, $pfirst: Int!, $pafter: String!) {
  campaign(id: $id) {
    id
    numberID
    numNFTMinted
    participants {
      participants(first: $pfirst, after: $pafter) {
        list {
          username
          avatar
          address
          email
          solanaAddress
          aptosAddress
          seiAddress
          discordUserID
        }
      }
      participantsCount
    }
  }
}

Variables:

{
  "id": "GCn45UjHXE",
  "pfirst": 1,
  "pafter": "-1"
}

Response:

{
  "data": {
    "campaign": {
      "id": "GCn45UjHXE",
      "numberID": 151178,
      "numNFTMinted": 0,
      "participants": {
        "participants": {
          "list": [
            {
              "username": "oojojoj",
              "avatar": "https://source.boringavatars.com/marble/120/0x00000000ccd193975907ddb660b4692bb4257f9f",
              "address": "0x00000000ccd193975907ddb660b4692bb4257f9f",
              "email": "",
              "solanaAddress": "",
              "aptosAddress": "",
              "seiAddress": "",
              "discordUserID": ""
            }
          ]
        },
        "participantsCount": 310277
      }
    }
  }
}

Query NFT holder by campaign

Arguments:

NameDescription
idCampaign hash id.
blockChain block.
firstQuery limit.
afterQuery offset.

Request:

query NFTHolders($id: ID!, $block: Int!, $first: Int!, $after: String!) {
  campaign(id: $id) {
    nftHolderSnapshot {
      holders(block: $block, first: $first, after: $after) {
        list {
          id
          holder
        }
        totalCount
        edges {
          node {
            id
            holder
          }
          cursor
        }
        pageInfo {
          startCursor
          endCursor
          hasNextPage
          hasPreviousPage
        }
      }
    }
  }
}

Variables:

{
  "id": "GCCw3UD1eD",
  "block": 47291627,
  "first": 1,
  "after": "-1"
}

Response:

{
  "data": {
    "campaign": {
      "nftHolderSnapshot": {
        "holders": {
          "list": [
            {
              "id": "1",
              "holder": "0x102daf0f0b6c5f467dc0dab22c957c412e57b4aa"
            }
          ],
          "totalCount": 1,
          "edges": [
            {
              "node": {
                "id": "1",
                "holder": "0x102daf0f0b6c5f467dc0dab22c957c412e57b4aa"
              },
              "cursor": "1"
            }
          ],
          "pageInfo": {
            "startCursor": "1",
            "endCursor": "1",
            "hasNextPage": true,
            "hasPreviousPage": false
          }
        }
      }
    }
  }
}

Create campaigns

Arguments:

NameDescription
inputCampaign hash id.

Request:

mutation addCampaign($input: MutateCampaignInput!) {
  campaign(input: $input) {
    id
    numberID
    name
    claimEndTime
  }
}

Variables:

{
  "input": {
    "daoId": 2,
    "nftCoreId": 0,
    "name": "eeeeee",
    "description": "eeeeee",
    "thumbnail": "",
    "startTime": 1694793600,
    "endTime": 1698336000,
    "status": "Active",
    "formula": "",
    "cap": 1,
    "gasType": "Gas",
    "isPrivate": true,
    "type": "Bounty",
    "requireIntegrate": false,
    "nftTemplates": [],
    "tokenReward": {
      "tokenLogo": "",
      "tokenDecimal": "",
      "userTokenAmount": "",
      "tokenAddress": "",
      "tokenSymbol": "",
      "tokenRewardId": 0
    },
    "children": [],
    "distributionType": "RAFFLE",
    "rewardName": "ee",
    "credentialGroups": [
      {
        "conditions": [
          {
            "expression": "true"
          }
        ],
        "conditionRelation": "ALL",
        "rewards": [
          {
            "expression": "5",
            "rewardType": "LOYALTYPOINTS"
          },
          {
            "expression": "1",
            "rewardType": "CUSTOM"
          }
        ],
        "credentials": []
      }
    ],
    "taskConfig": {
      "rewardConfigs": []
    },
    "rewardType": "EVM",
    "rewardInfo": {}
  }
}

Response:

{
  "data": {
    "campaign": {
      "id": "GCFEXUtxc1",
      "numberID": 5448,
      "name": "eeeeee",
      "claimEndTime": null
    }
  }
}

Claim OAT campaigns on third-party website

Use GraphQL API get campaign info

Request:

mutation claim {
  prepareParticipate(
    input: {
      signature: "" # keep empty
      campaignID: "{{campaignHashID}}" # campaign hash id
      address: "{{userAddr}}" # user address
    }
  ) {
    allow # Is allow user claim nft
    disallowReason # Disallow reason
  }
}

Response:

{
  "data": {
    "prepareParticipate": {
      "allow": true,
      "disallowReason": ""
    }
  }
}

Space

Query campaign list

Arguments:

NameDescription
idSpace id.
aliasSpace alias.
campaignInputCampaigns query params.

Request:

query CampaignList(
  $id: Int
  $alias: String
  $campaignInput: ListCampaignInput!
) {
  space(id: $id, alias: $alias) {
    id
    name
    alias
    campaigns(input: $campaignInput) {
      pageInfo {
        endCursor
        hasNextPage
      }
      list {
        id
        name
      }
    }
  }
}

Variables:

{
  "alias": "bnbchain",
  "campaignInput": {
    "forAdmin": false,
    "first": 2,
    "after": "-1",
    "excludeChildren": true,
    "gasTypes": null,
    "credSources": null,
    "rewardTypes": null,
    "chains": null,
    "statuses": null,
    "listType": "Newest",
    "types": [
      "Drop",
      "MysteryBox",
      "Forge",
      "MysteryBoxWR",
      "Airdrop",
      "ExternalLink",
      "OptIn",
      "OptInEmail",
      "PowahDrop",
      "Parent",
      "Oat",
      "Bounty",
      "Token",
      "DiscordRole",
      "Mintlist",
      "Points",
      "PointsMysteryBox"
    ],
    "searchString": null
  }
}

Response:

{
  "data": {
    "space": {
      "id": "40",
      "name": "BNB Chain",
      "alias": "bnbchain",
      "campaigns": {
        "pageInfo": {
          "endCursor": "1",
          "hasNextPage": true
        },
        "list": [
          {
            "id": "GCU8jUP7RS",
            "name": "BNB Chain Ecosystem Catalyst Awards -  Trailblazers"
          },
          {
            "id": "GCis8Uj4gL",
            "name": "BNB Chain 3 YA NFT "
          }
        ]
      }
    }
  }
}

Query NFT holder by contract

Arguments:

NameDescription
addressContract address.
firstQuery limit.
afterQuery offset.

Request:

query nftHolders($address: String!, $first: Int!, $after: String!) {
  nftCore(address: $address) {
    holders(first: $first, after: $after) {
      totalCount
      pageInfo {
        startCursor
        endCursor
        hasNextPage
        hasPreviousPage
      }
      list {
        address
      }
    }
  }
}

Variables:

{
  "address": "0x9d3895D07bF07A791Ef8d015Ab10997D22179E5c",
  "first": 2,
  "after": "-1"
}

Response:

{
  "data": {
    "nftCore": {
      "holders": {
        "totalCount": 3,
        "pageInfo": {
          "startCursor": "0",
          "endCursor": "1",
          "hasNextPage": true,
          "hasPreviousPage": false
        },
        "list": [
          {
            "address": "0x000000000A38444e0a6E37d3b630d7e855a7cb13"
          },
          {
            "address": "0x00000015E180b01c40b881e10774Bc784bB6F4Eb"
          }
        ]
      }
    }
  }
}

Query leaderboard data

Overall

Arguments:

NameDescription
idSpace id.
firstQuery limit.
afterQuery offset.
orderSort by Points/GalxeID.
seasonIdQuery for season ranking. Overall ranking is null

Request:

query SpaceLeaderboard(
  $id: Int!
  $first: Int
  $after: String
  $order: LoyaltyPointsRankOrder
  $seasonId: Int
) {
  space(id: $id) {
    id
    name
    loyaltyPointsRanks(
      first: $first
      after: $after
      order: $order
      sprintId: $seasonId
    ) {
      pageInfo {
        startCursor
        endCursor
        hasNextPage
        hasPreviousPage
      }
      totalCount
      list {
        id
        rank
        points
        space {
          name
        }
        address {
          username
          id
          avatar
          address
          solanaAddress
          aptosAddress
          seiAddress
          twitterUserName
          discordUserName
        }
      }
    }
  }
}

Variables:

{
  "id": 40,
  "first": 2,
  "after": "-1",
  "order": "Points",
  "seasonId": null
}

Response:

{
  "data": {
    "space": {
      "id": "40",
      "name": "BNB Chain",
      "loyaltyPointsRanks": {
        "pageInfo": {
          "startCursor": "0",
          "endCursor": "2",
          "hasNextPage": true,
          "hasPreviousPage": false
        },
        "totalCount": 183473,
        "list": [
          {
            "id": "lbrank-0L1xIfY6d1VYrlKAFOmZvT-40",
            "rank": 1,
            "points": 300,
            "space": {
              "name": "BNB Chain"
            },
            "address": {
              "username": "HansaMR",
              "id": "0L1xIfY6d1VYrlKAFOmZvT",
              "avatar": "https://source.boringavatars.com/marble/120/0x61e305B027482358eCda2e7A56a150E0593e5cdA",
              "address": "0x61e305b027482358ecda2e7a56a150e0593e5cda",
              "solanaAddress": "",
              "aptosAddress": "",
              "seiAddress": "",
              "twitterUserName": "",
              "discordUserName": ""
            }
          },
          {
            "id": "lbrank-1L3UPNocTIIJid0tRIszgV-40",
            "rank": 1,
            "points": 300,
            "space": {
              "name": "BNB Chain"
            },
            "address": {
              "username": "barossafeed",
              "id": "1L3UPNocTIIJid0tRIszgV",
              "avatar": "https://d257b89266utxb.cloudfront.net/galaxy/images/avatar/0xc3b8e4fedb31c756fae84e0c65475dcbb6ffd308-1670560267167156585.png",
              "address": "0xc3b8e4fedb31c756fae84e0c65475dcbb6ffd308",
              "solanaAddress": "",
              "aptosAddress": "",
              "seiAddress": "",
              "twitterUserName": "",
              "discordUserName": ""
            }
          }
        ]
      }
    }
  }
}

Season

Arguments:

NameDescription
idSpace id.
firstQuery limit.
afterQuery offset.
orderSort by Points/GalxeID.
seasonIdQuery for season ranking.

Request:

query SpaceLeaderboard(
  $id: Int!
  $first: Int
  $after: String
  $order: LoyaltyPointsRankOrder
  $seasonId: Int
) {
  space(id: $id) {
    id
    name
    loyaltyPointsRanks(
      first: $first
      after: $after
      order: $order
      sprintId: $seasonId
    ) {
      pageInfo {
        startCursor
        endCursor
        hasNextPage
        hasPreviousPage
      }
      totalCount
      list {
        id
        rank
        points
        space {
          name
        }
        address {
          username
          id
          avatar
          address
          solanaAddress
          aptosAddress
          seiAddress
          twitterUserName
          discordUserName
        }
      }
    }
  }
}

Variables:

{
  "id": 40,
  "first": 2,
  "after": "-1",
  "order": "Points",
  "seasonId": 1
}

Response:

{
  "data": {
    "space": {
      "id": "40",
      "name": "BNB Chain",
      "loyaltyPointsRanks": {
        "pageInfo": {
          "startCursor": "0",
          "endCursor": "2",
          "hasNextPage": true,
          "hasPreviousPage": false
        },
        "totalCount": 183473,
        "list": [
          {
            "id": "lbrank-0L1xIfY6d1VYrlKAFOmZvT-40",
            "rank": 1,
            "points": 300,
            "space": {
              "name": "BNB Chain"
            },
            "address": {
              "username": "HansaMR",
              "id": "0L1xIfY6d1VYrlKAFOmZvT",
              "avatar": "https://source.boringavatars.com/marble/120/0x61e305B027482358eCda2e7A56a150E0593e5cdA",
              "address": "0x61e305b027482358ecda2e7a56a150e0593e5cda",
              "solanaAddress": "",
              "aptosAddress": "",
              "seiAddress": "",
              "twitterUserName": "",
              "discordUserName": ""
            }
          },
          {
            "id": "lbrank-1L3UPNocTIIJid0tRIszgV-40",
            "rank": 1,
            "points": 300,
            "space": {
              "name": "BNB Chain"
            },
            "address": {
              "username": "barossafeed",
              "id": "1L3UPNocTIIJid0tRIszgV",
              "avatar": "https://d257b89266utxb.cloudfront.net/galaxy/images/avatar/0xc3b8e4fedb31c756fae84e0c65475dcbb6ffd308-1670560267167156585.png",
              "address": "0xc3b8e4fedb31c756fae84e0c65475dcbb6ffd308",
              "solanaAddress": "",
              "aptosAddress": "",
              "seiAddress": "",
              "twitterUserName": "",
              "discordUserName": ""
            }
          }
        ]
      }
    }
  }
}

Distribute loyalty points

Prerequisite: generate an access token

mutation UpdateAccessToken($input: UpdateAccessTokenInput!) {
  updateAccessToken(input: $input) {
    accessToken
  }
}
{
  "input": {
    "address": "0x39b36ff83b60eb54d71758cffa3ab17d2d0b216c"
  }
}
{
  "data": {
    "updateAccessToken": {
      "accessToken": "your-access-token"
    }
  }
}

Task Creation

Header:

{
  "accessToken": "your-access-token"
}

Request:

mutation createTask {
  createTailoredTask(
    input: {
      title: "Connect to Galxe"
      description: "A user who connected to Galxe.com"
      link: "your_link"
      spaceId: 2
      tag: Once
      points: 10
      startTime: 0
    }
  ) {
    id
    title
    description
    link
    spaceId
    tag
    points
    startTime
  }
}

Response

{
  "data": {
    "createTailoredTask": {
      "id": "26",
      "title": "Connect to Galxe",
      "description": "A user who connected to Galxe.com",
      "link": "your_link",
      "spaceId": 2,
      "tag": "Once",
      "points": 10,
      "startTime": 0
    }
  }
}

Task Modification

Header:

{
  "accessToken": "your-access-token"
}

Request:

mutation updateTask {
  updateTailoredTask(
    input: {
      id: 26
      title: "update task title"
      description: "desc"
      link: "your_link"
      points: 10
      tag: Once
      startTime: 0
    }
  )
}

Response:

{
  "data": {
    "updateTailoredTask": true
  }
}

Task Deletion

Header:

{
  "accessToken": "your-access-token"
}

Request:

mutation deleteTask {
  deleteTailoredTask(id: 26)
}

Distributing Points via API

Request:

mutation {
  claimTailoredTaskLoyaltyPoints(
    id: 25
    addresses: [
      "0x447D24B00937BCc3fE5768c828fb2fae52c3e8C5"
      "0xaC1F963Ed7454d0D3295786E4Bcc47B961918C63"
    ]
  )
}

Response:

{
  "data": {
    "claimTailoredTaskLoyaltyPoints": true
  }
}

Credential

Query credential items

Header:

{
  "accessToken": "your-access-token"
}
query CredItems($id: ID!, $first: Int, $after: String, $searchString: String) {
  credential(id: $id) {
    id
    itemCount
    credentialItems(first: $first, after: $after, searchString: $searchString) {
      totalCount
      pageInfo {
        endCursor
        hasNextPage
      }
      list
    }
  }
}

example variables:

{id: "2544", first: 500, after: ""}

Open Access:

User

Query profile and credential

query ProfileCredentials($address: String!, $first: Int, $after: String) {
  addressInfo(address: $address) {
    addressEligibleCredentials(first: $first, after: $after) {
      pageInfo {
        endCursor
        hasNextPage
      }
      totalCount
      list {
        id
        name
      }
    }
  }
}

Credential

Get credential value

Depends on credSource, metadata field should use corresponding field.

E.g. if credSource is SPACE_USER, then the query should look like the following:

query credential($id: ID!, $eligibleAddress: String!) {
  credential(id: $id, eligibleAddress: $eligibleAddress) {
    name
    credSource
    dimensionConfig
    metadata {
      spaceUsers {
        spaceId
        schema {
          follow {
            id
            description
            title
            type
          }
          points {
            id
            description
            title
            type
          }
          participations {
            id
            description
            title
            type
          }
        }
        defaultValue {
          follow
          points
          participations
        }
      }
    }
    value {
      address
      spaceUsers {
        follow
        points
        participations
      }
    }
  }
}

Campaign

Query campaign participants

Arguments:

NameDescription
idCampaign hash id.
pfirstQuery limit.
pafterQuery offset.

Request:

query campaignParticipants($id: ID!, $pfirst: Int!, $pafter: String!) {
  campaign(id: $id) {
    id
    numberID
    numNFTMinted
    participants {
      participants(first: $pfirst, after: $pafter) {
        list {
          username
          avatar
          address
          email
          solanaAddress
          aptosAddress
          seiAddress
          discordUserID
        }
      }
      participantsCount
    }
  }
}

Variables:

{
  "id": "GCn45UjHXE",
  "pfirst": 1,
  "pafter": "-1"
}

Response:

{
  "data": {
    "campaign": {
      "id": "GCn45UjHXE",
      "numberID": 151178,
      "numNFTMinted": 0,
      "participants": {
        "participants": {
          "list": [
            {
              "username": "oojojoj",
              "avatar": "https://source.boringavatars.com/marble/120/0x00000000ccd193975907ddb660b4692bb4257f9f",
              "address": "0x00000000ccd193975907ddb660b4692bb4257f9f",
              "email": "",
              "solanaAddress": "",
              "aptosAddress": "",
              "seiAddress": "",
              "discordUserID": ""
            }
          ]
        },
        "participantsCount": 310277
      }
    }
  }
}

Space

Query campaign list

Arguments:

NameDescription
idSpace id.
aliasSpace alias.
campaignInputCampaigns query params.

Request:

query CampaignList(
  $id: Int
  $alias: String
  $campaignInput: ListCampaignInput!
) {
  space(id: $id, alias: $alias) {
    id
    name
    alias
    campaigns(input: $campaignInput) {
      pageInfo {
        endCursor
        hasNextPage
      }
      list {
        id
        name
      }
    }
  }
}

Variables:

{
  "alias": "bnbchain",
  "campaignInput": {
    "forAdmin": false,
    "first": 2,
    "after": "-1",
    "excludeChildren": true,
    "gasTypes": null,
    "credSources": null,
    "rewardTypes": null,
    "chains": null,
    "statuses": null,
    "listType": "Newest",
    "types": [
      "Drop",
      "MysteryBox",
      "Forge",
      "MysteryBoxWR",
      "Airdrop",
      "ExternalLink",
      "OptIn",
      "OptInEmail",
      "PowahDrop",
      "Parent",
      "Oat",
      "Bounty",
      "Token",
      "DiscordRole",
      "Mintlist",
      "Points",
      "PointsMysteryBox"
    ],
    "searchString": null
  }
}

Response:

{
  "data": {
    "space": {
      "id": "40",
      "name": "BNB Chain",
      "alias": "bnbchain",
      "campaigns": {
        "pageInfo": {
          "endCursor": "1",
          "hasNextPage": true
        },
        "list": [
          {
            "id": "GCU8jUP7RS",
            "name": "BNB Chain Ecosystem Catalyst Awards -  Trailblazers"
          },
          {
            "id": "GCis8Uj4gL",
            "name": "BNB Chain 3 YA NFT "
          }
        ]
      }
    }
  }
}

Query leaderboard data

Overall

Arguments:

NameDescription
idSpace id.
orderSort by Points/GalxeID.
seasonIdQuery for season ranking. Overall ranking is null
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.

Request:

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

Variables:

{
  "id": xx,
  "first": 2,
  "after": "-1",
  "order": "Points",
  "seasonId": null
}

Response:

{
  "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"
              }
            }
          },
          ...
        ]
      }
    }
  }
}

Query leaderboard data for one address

Arguments:

NameDescription
idSpace id.
seasonIdQuery for season ranking. Overall ranking is null

Request:

query SpaceLoyaltyPoints($id: Int, $address: String!, $seasonId: Int) {
  space(id: $id) {
    id
    addressLoyaltyPoints(address: $address, sprintId: $seasonId) {
      id
      points
      rank
    }
  }
}

Variables:

{
  "id": xx,
  "address": "xxxxx",
  "seasonId": null
}

Response:

{
  "data": {
    "space": {
      "id": "xx",
      "addressLoyaltyPoints": {
        "id": "sa-lb-xxx-xx",
        "points": 15,
        "rank": 10064,
      },
    }
  }
}