Check out the sdk quickstart guide for help setting up your client.

Usage

Returns

any

Parameters

query

  • type: DocumentNode

The query to execute.

import { TokenFragment } from "@tx-kit/sdk/subgraph"

const data = await downlinkClient.customQuery({
    gql`
        query {
            channels(limit: 10) {
                id
                tokens(first: 10) {
                    ...TokenFragment
                }
            }   
            ${TOKEN_FRAGMENT}
        }`,
    ...
})

variables (optional)

  • type: GqlVariables

Variables to pass to the query

type GqlVariables = {
    [key: string]: string | number | boolean | undefined | string[] | object
}
const data = await downlinkClient.customQuery(
    gql`
        query($timestamp: Int!) {
            channels(
                where: { tokens_: { blockTimestamp_gt: $timestamp } }
                limit: 10
            ) {
                id
                tokens(first: 10) {
                    ...TokenFragment
                }
            }   
            ${TOKEN_FRAGMENT}
        }`,
    { timestamp: Math.floor(Date.now() / 1000) - 60 * 60 * 24 * 7 } // 1 week
)