Skip to main content

Drop Queries

Query drops and their related data using GraphQL.

Basic Drop Queries

Get Single Drop

Retrieve a specific drop by ID or shortcode.
query GetDrop($id: ID, $shortcode: String) {
  drop(id: $id, shortcode: $shortcode) {
    id
    title
    description
    claimedAmount
    maxAmount
    claimRate
    remainingBalance
    tokenBalance
    isActive
    status
    type
    claimType
    shortcode
    imageUrl
    createdAt
    updatedAt
    creator {
      id
      username
      displayName
    }
    token {
      id
      name
      symbol
      totalSupply
      address
    }
  }
}
Variables:
{
  "id": "drop_abc123"
}
Response:
{
  "data": {
    "drop": {
      "id": "drop_abc123",
      "title": "Community Token Drop",
      "description": "A drop for early supporters",
      "claimedAmount": "25000",
      "maxAmount": "100000",
      "claimRate": 25.0,
      "remainingBalance": "75000",
      "tokenBalance": "75000",
      "isActive": true,
      "status": "ACTIVE",
      "type": "TOKEN",
      "claimType": "REGULAR",
      "shortcode": "community-drop",
      "imageUrl": "https://example.com/drop-image.png",
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-15T10:30:00Z",
      "creator": {
        "id": "user_xyz789",
        "username": "creator123",
        "displayName": "Creator Name"
      },
      "token": {
        "id": "token_def456",
        "name": "Community Token",
        "symbol": "COMM",
        "totalSupply": "1000000",
        "address": "0x123abc..."
      }
    }
  }
}

List Drops

Get multiple drops with filtering and pagination.
query GetDrops($creatorId: ID, $limit: Int, $offset: Int, $active: Boolean) {
  drops(
    creatorId: $creatorId
    limit: $limit
    offset: $offset
    active: $active
  ) {
    id
    title
    status
    type
    claimedAmount
    maxAmount
    claimRate
    claimCount
    isActive
    createdAt
    creator {
      username
      displayName
    }
    token {
      name
      symbol
    }
  }
}
Variables:
{
  "active": true,
  "limit": 10,
  "offset": 0
}

Get My Drops

Retrieve all drops created by the authenticated user.
query GetMyDrops {
  myDrops {
    id
    title
    description
    status
    type
    claimedAmount
    maxAmount
    claimRate
    claimCount
    remainingBalance
    isActive
    shortcode
    imageUrl
    createdAt
    token {
      name
      symbol
      totalSupply
    }
    claims {
      id
      amount
      claimedAt
      user {
        username
        displayName
      }
    }
  }
}

Get Recent Drops

Get the most recently created drops by the authenticated user.
query GetRecentDrops($limit: Int) {
  recentDrops(limit: $limit) {
    id
    title
    status
    type
    claimedAmount
    maxAmount
    claimRate
    estimatedValueUsd
    claimCount
    createdAt
    token {
      name
      symbol
    }
  }
}

Drop Analytics

Drop Dashboard Stats

Get comprehensive statistics for a specific drop.
query GetDropDashboardStats($dropId: ID!) {
  dropDashboardStats(id: $dropId) {
    totalClaims
    recentClaims
    claimRate
    totalAmount
    claimedAmount
    recentActivity {
      id
      type
      description
      timestamp
      metadata
    }
  }
}
Variables:
{
  "dropId": "drop_abc123"
}
Response:
{
  "data": {
    "dropDashboardStats": {
      "totalClaims": 250,
      "recentClaims": 15,
      "claimRate": 25.0,
      "totalAmount": "100000",
      "claimedAmount": "25000",
      "recentActivity": [
        {
          "id": "activity_1",
          "type": "claim",
          "description": "Alice claimed 100 tokens",
          "timestamp": "2024-01-15T15:30:00Z",
          "metadata": "{\"amount\": \"100\", \"txHash\": \"0x123...\"}"
        }
      ]
    }
  }
}

Advanced Drop Queries

Drop with Complete Relations

Get a drop with all its related data.
query GetDropWithRelations($id: ID!) {
  drop(id: $id) {
    id
    title
    description
    claimedAmount
    maxAmount
    claimRate
    remainingBalance
    tokenBalance
    isActive
    status
    type
    claimType
    shortcode
    imageUrl
    price
    supply
    estimatedValueUsd
    claimDeadline

    # Blockchain data
    dropObjectId
    adminCapId
    deploymentTxHash
    contractPackageId
    coinType

    # Relations
    creator {
      id
      username
      displayName
      bio
      avatar
    }

    token {
      id
      name
      symbol
      decimals
      totalSupply
      address
      description
      imageUrl
      status
      creator {
        username
        displayName
      }
    }

    claims(limit: 20) {
      id
      amount
      claimedAt
      txHash
      user {
        id
        username
        displayName
        avatar
      }
    }

    gatingConfig {
      id
      isActive
      rules {
        id
        key
        operator
        value
        description
      }
    }
  }
}

Multiple Drops with Filters

Get drops with different filtering criteria.
query GetFilteredDrops {
  activeDrops: drops(active: true, limit: 10) {
    id
    title
    claimRate
    isActive
  }

  draftDrops: drops(active: false, limit: 5) {
    id
    title
    status
  }

  recentDrops: recentDrops(limit: 5) {
    id
    title
    createdAt
  }
}

Error Handling

Drop Not Found

query GetNonExistentDrop {
  drop(id: "nonexistent") {
    id
    title
  }
}
Response:
{
  "data": {
    "drop": null
  }
}

Invalid Parameters

query GetDropsWithInvalidLimit {
  drops(limit: -1) {
    id
    title
  }
}
Response:
{
  "errors": [
    {
      "message": "Limit must be a positive integer",
      "locations": [{ "line": 2, "column": 3 }],
      "path": ["drops"]
    }
  ],
  "data": {
    "drops": null
  }
}

Best Practices

1. Request Only Needed Fields

# Good: Request only what you need
query GetDropTitles {
  drops {
    id
    title
    status
  }
}

# Avoid: Requesting all fields when not needed
query GetAllDropData {
  drops {
    id
    title
    description
    claimedAmount
    maxAmount
    # ... many other fields
  }
}

2. Use Pagination

query GetDropsPaginated($limit: Int, $offset: Int) {
  drops(limit: $limit, offset: $offset) {
    id
    title
    createdAt
  }
}

3. Handle Null Values

query GetDropSafely($id: ID!) {
  drop(id: $id) {
    id
    title
    description
    token {
      name
      symbol
    }
  }
}

Common Use Cases

Dashboard Overview

query DashboardOverview {
  myDrops {
    id
    title
    status
    claimRate
    claimCount
    estimatedValueUsd
  }

  recentDrops(limit: 5) {
    id
    title
    createdAt
  }
}

Drop Management

query DropManagement($dropId: ID!) {
  drop(id: $dropId) {
    id
    title
    status
    isActive
    claimedAmount
    maxAmount
    remainingBalance
    claimCount

    claims(limit: 10) {
      id
      amount
      claimedAt
      user {
        username
        displayName
      }
    }
  }
}

Public Drop Display

query PublicDropDisplay($shortcode: String!) {
  drop(shortcode: $shortcode) {
    id
    title
    description
    imageUrl
    claimedAmount
    maxAmount
    claimRate
    isActive
    tokenAmount
    claimType

    token {
      name
      symbol
      decimals
    }

    creator {
      username
      displayName
      avatar
    }
  }
}