
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@kodadot1/uniquery
Advanced tools
Universal GraphQL query builder for KodaDot
GraphQL builder for KodaDot API

Add Uniquery to your project
# with npm
npm install @kodadot1/uniquery
# with yarn
yarn add @kodadot1/uniquery
# with pnpm
pnpm install @kodadot1/uniquery
Import:
// ESM
import { getClient } from '@kodadot1/uniquery'
// CommonJS
const { getClient } = require('@kodadot1/uniquery')
const client = getClient()
const query = client.collectionListByIssuer('vikiival')
console.log(query)
{
query: 'query { collections: collectionEntities(filter: { issuer: { equalTo: vikiival } }) { nodes { id, metadata, currentOwner, issuer } } }',
variables: {}
}
As we were onboarding developers for our NFT Gallery, most of the developers have seen GraphQL for the first. We wanted to make it easier for them to get started with KodaDot API. Uniquery is a simple tool to help you build GraphQL queries for KodaDot API.
Without Uniquery you would have to write something like this:
query itemListByCollectionIdList {
nft: nftEntities(where: {collection: { id_eq: "2305670031" }}) {
id
metadata
currentOwner
issuer
}
}
With Uniquery you can write this:
const id = '2305670031'
const client = getClient()
const query = client.itemListByCollectionId(id)
To be aware every client function returns GraphQuery object
This GraphQuery object represents a GraphQL query that should be passed to your preffered fetch library (fetch, axios, ohmyfetch)
Note: Uniquery is not a GraphQL client. It's a tool to help you build GraphQL queries It's possible to use it with any GraphQL client (such as Apollo)
We have currently two implementations
import { getClient } from '@kodadot1/uniquery'
const client = getClient('bsx')
const id = '2305670031'
const query = client.collectionById(id)
const result = await client.fetch(query)
⚠️: If you want to use
.fetchmethod on client, you need to pass chain prefix as parameter
import { ask } from '@kodadot1/uniquery'
const id = '2305670031'
const result = await ask(`/bsx/itemByCollection/${id}`)
extendFields - extends default list with newly provided valuesgetClient - returns GrahpQL query buildergetUrl - returns GrahpQL indexer urlSquidClient - returns SquidClient instanceFrom REST:
ask - obtain data from GraphQL indexer by selected routepathToRequest - converts route to corresponding GraphQL queryREST implementation supports only functions that requires exactly one parameter. Please open a pull-request if you know how to fix this
git clone https://github.com/kodadot/uniquery.git
cd uniquery
corepack enable
or
npm i -g corepack
pnpm install
pnpm dev
Made with đź’›
Published under MIT License.
FAQs
Universal GraphQL query builder for KodaDot
The npm package @kodadot1/uniquery receives a total of 437 weekly downloads. As such, @kodadot1/uniquery popularity was classified as not popular.
We found that @kodadot1/uniquery demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.