EVER SDK
Developer ToolsEver PlatformForum
  • Ever SDK
  • Quick start (JavaScript)
  • Add EVER to your backend
  • Reference
    • Types and Methods
      • Modules
      • Module abi
      • Module boc
      • Module client
      • Module crypto
      • Module debot
      • Module net
      • Module processing
      • Module proofs
      • Module tvm
      • Module utils
    • Error API
    • Error Codes
    • JavaScript Reference
    • Rust Reference
  • Samples
    • JavaScript Samples
  • guides
    • Installation
      • Add SDK to your App
    • Configuration
      • Endpoint Configuration
      • Message Expiration
      • Message Retry
      • Config Reference
    • Work with contracts
      • Add Contract to your App
      • Use your own Giver
      • Deploy
      • Run on-chain
      • Run ABI Get Method
      • Run Fift Get Method
      • Query/Subscribe for messages(events)
      • Decode Messages(Event)
      • External Signing
      • Emulate Transaction
      • Estimate Fees
      • Validate address, convert address
      • Monitor Messages
      • Trace message processing with REMP
    • Crypto
      • Mnemonics and Keys
    • Queries and subscriptions
      • Use-cases
      • How to work with net module
      • net.query syntax
      • Data pagination
      • Subscribe to Updates
      • Query Collection
      • Aggregate Collection
  • For Binding Developers
    • How to work with Application Objects in binding generators
    • JSON Interface to Ton Client
  • Links
    • Ever SDK repository
    • AppKit JS documentation
Powered by GitBook
On this page
  • About net.query function
  • Usage
  • Pass parameters via variables object
  • Pass parameters inline

Was this helpful?

  1. guides
  2. Queries and subscriptions

net.query syntax

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

PreviousHow to work with net moduleNextData pagination

Last updated 1 year ago

Was this helpful?

About net.query function

Whenever you need to poll realtime data from GraphQL API with SDK - use 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 }
    }`
})

See this sample to understand how to pass variables to the queries

sdk-samples/core-examples/node-js/pagination at master · everx-labs/sdk-samplesGitHub
Logo
net.query