Check out the sdk quickstart guide for help setting up your client.
Usage
import { downlinkClient } from './config'
const data = await downlinkClient.customQuery({ ... })
import { TransmissionsClient } from '@tx-kit/sdk'
import { BASE_MAINNET_SUBGRAPH_URL } from '@tx-kit/sdk/constants'
import { CreatePublicClient, CreateWalletClient } from 'viem'
import { base } from 'viem/chains'
const publicClient = createPublicClient({
chain: base,
transport: http()
})
const walletClient = createWalletClient({
account, // from local private key or browser wallet
chain: base,
transport: http()
})
export const { downlinkClient } = new TransmissionsClient({
publicClient,
walletClient,
chain: base,
apiConfig: {
serverUrl: BASE_MAINNET_SUBGRAPH_URL
}
})
Returns
any
Parameters
query
- type:
DocumentNode
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
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
)