net.query syntax

Write your graphql query in playground, copy it and insert into SDK's net.query function. Define variables and execute it.

About net.query function

Whenever you need to poll realtime data from GraphQL API with SDK - use net.query function.

Write your graphql query in playground, copy it and insert into SDK's net.query function. Define variables and execute it.

See All the functions available in API here

Usage

Pass parameters via variables object

You can pass variables via a separate parameter (graphql-style). You just copy the query from playground and replace the param values with $param_name and then pass parameters via additional object like this:

await client.net.query({
    query: `query MyQuery($utime: Int){
    blockchain {
        master_seq_no_range(time_end: $utime) { end }
    }
}`,
    variables: { utime },
})

Pass parameters inline

await client.net.query({
    query: `
    blockchain {
        master_seq_no_range(time_end: ${utime}) { end }
    }`
})

Last updated

#35:

Change request updated