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

feat: introduce GraphQL queries for Market #347

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

boscohyun
Copy link
Member

Changes

MongoDB packages version

Downgrade the version of the MongoDB packages for some projects to 2.27 due to compatibility issues with the HotChocolate packages.

New GarphQL queries

  • productIds: Retrieve a list of product ids that a specific avatar has listed in the market.
  • product: Look up a product by product Id.
  • products: Retrieve all products in the marketplace.

Examples

productIds

query {
  productIds(avatarAddress: "EAe8e93fc5E4f1daF343eAf5Dc581Aa80F8C79c1")
}
{
  "data": {
    "productIds": [
      "db9bd6eb-a699-4a46-9687-76b2c1f02098",
      "855110d2-8da0-4569-8ac2-6b1db2704f28",
      "0bf58812-b011-4b03-bb65-39851449e36a",
      "2fcb5601-d736-4db7-839c-7e0580c2f788",
      "e1e723ec-3335-40ee-980c-6143d1b37e04",
      "21da4e5a-41c7-4947-8e5e-2546d436029b",
      "3dde0901-22c0-49f7-96f9-ec850ed45076",
      "01269b97-1653-40d2-81b5-d17cc8c5b3d8"
    ]
  }
}

product

query {
  product(productId: "db9bd6eb-a699-4a46-9687-76b2c1f02098") {
    productId
    productType
    price {
      quantity
      ticker
    }
    sellerAgentAddress
    sellerAvatarAddress
  }
}
{
  "data": {
    "product": {
      "productId": "db9bd6eb-a699-4a46-9687-76b2c1f02098",
      "productType": "NON_FUNGIBLE",
      "price": {
        "quantity": "30",
        "ticker": "NCG"
      },
      "sellerAgentAddress": "0xd43DF71271D5bDC3657429C3a9490C6C1ee90E2C",
      "sellerAvatarAddress": "0xEAe8e93fc5E4f1daF343eAf5Dc581Aa80F8C79c1"
    }
  }
}

products

query {
  products(skip: 1, take: 2) {
    items {
      avatarAddress
      object {
        productId
        productType
        price {
          quantity
          ticker
        }
        sellerAgentAddress
        sellerAvatarAddress
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
    }
  }
}
{
  "data": {
    "products": {
      "items": [
        {
          "avatarAddress": "0xEAe8e93fc5E4f1daF343eAf5Dc581Aa80F8C79c1",
          "object": {
            "productId": "855110d2-8da0-4569-8ac2-6b1db2704f28",
            "productType": "NON_FUNGIBLE",
            "price": {
              "quantity": "32",
              "ticker": "NCG"
            },
            "sellerAgentAddress": "0xd43DF71271D5bDC3657429C3a9490C6C1ee90E2C",
            "sellerAvatarAddress": "0xEAe8e93fc5E4f1daF343eAf5Dc581Aa80F8C79c1"
          }
        },
        {
          "avatarAddress": "0xEAe8e93fc5E4f1daF343eAf5Dc581Aa80F8C79c1",
          "object": {
            "productId": "0bf58812-b011-4b03-bb65-39851449e36a",
            "productType": "NON_FUNGIBLE",
            "price": {
              "quantity": "1",
              "ticker": "NCG"
            },
            "sellerAgentAddress": "0xd43DF71271D5bDC3657429C3a9490C6C1ee90E2C",
            "sellerAvatarAddress": "0xEAe8e93fc5E4f1daF343eAf5Dc581Aa80F8C79c1"
          }
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": true
      }
    }
  }
}

@boscohyun boscohyun requested review from moreal, Atralupus and a team September 27, 2024 11:19
@boscohyun boscohyun self-assigned this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

1 participant