For Acki Nacki Developers
Acki Nacki docsFor DevelopersFor Validators
  • About Acki Nacki SDK
  • How to deploy a Multisig Wallet
  • Dapp ID Full Guide: creation, fees, centralized replenishment
  • Quick Starts
    • Quick Start TVM SDK JavaScript
    • GraphQL Quick Start
  • Reference
    • Core Library Reference
      • Modules
      • Module abi
      • Module boc
      • Module client
      • Module crypto
      • Module debot
      • Module net
      • Module processing
      • Module proofs
      • Module tvm
      • Module utils
    • Core Library Error API
    • Error Codes
    • TVM-CLI Reference
  • VM Instructions
    • Acki Nacki VM Instructions
    • Formal Verification
      • Acki Nacki VM Instructions Business-Level Specification
  • GraphQL
    • GraphQL API
    • Schema
    • Blockchain API
    • Query Collections: Query Language
    • Field Descriptions
    • Info API
    • Web Playground
    • Examples
  • ABI
    • ABI Specification
  • Examples
    • Client Libraries JS Examples
    • GraphQL API Examples
      • Connect to GraphQL API
      • Send message
      • Accounts
      • Blocks
      • Messages
      • Block and Transaction Pagination: Best Practice
      • Transactions
  • For Binding Developers
    • How to work with Application Objects in binding generators
    • JSON Interface to TVM Client
  • Links
    • TVM SDK repository
Powered by GitBook
On this page
  • About net.query function
  • Usage
  • Pass parameters via variables object
  • Pass parameters inline
  1. JS(TS) guides
  2. Queries

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:

If you use variables object, you need to wrap your query in query MyQuery(params){$param1: Param1Type}.

If the parameter is mandatory you must specify its type with exclamation mark on the end like this: query MyQuery(params){$param1: Param1Type!}

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 4 months ago