> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spaceport.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Class: Query

[query/client](../modules/query_client).QueryClient

Query Client for interacting with The Graph API
This client provides methods for querying indexed blockchain data

## Table of contents

#### Methods

* [getEnvironment](#getenvironment)
* [getGraphQLClient](#getgraphqlclient)
* [executeQuery](#executequery)

### Properties

* [graphqlClient](#graphqlclient)
* [environment](#environment)
* [listings](#listings)
* [agreements](#agreements)
* [smartLicenses](#smartlicenses)

### constructor

• **new QueryClient**(`environment`): [`QueryClient`](./query)

Create a new QueryClient instance

#### Parameters

| Name          | Type                                                  | Description                                                                     |
| :------------ | :---------------------------------------------------- | :------------------------------------------------------------------------------ |
| `environment` | [`SpaceportChainType`](.././index#spaceportchaintype) | Chain environment (e.g., "local", "devnet", "testnet") or SpaceportSDK instance |

#### Returns

[`QueryClient`](./query)

## Methods

### getEnvironment

▸ **getEnvironment**(): [`SpaceportChainType`](.././index#spaceportchaintype)

Get the current environment

#### Returns

[`SpaceportChainType`](.././index#spaceportchaintype)

### getGraphQLClient

▸ **getGraphQLClient**(): `Client`

Get the GraphQL client

#### Returns

`Client`

### executeQuery

▸ **executeQuery**\<`T`, `V`>(`query`, `variables?`): `Promise`\<`T`>

Execute a GraphQL query

#### Type parameters

| Name | Type                                                                    |
| :--- | :---------------------------------------------------------------------- |
| `T`  | `T`                                                                     |
| `V`  | extends `Record`\<`string`, `unknown`> = `Record`\<`string`, `unknown`> |

#### Parameters

| Name         | Type     | Description                |
| :----------- | :------- | :------------------------- |
| `query`      | `string` | The GraphQL query document |
| `variables?` | `V`      | Query variables            |

#### Returns

`Promise`\<`T`>

The query result

## Properties

### graphqlClient

• **graphqlClient**: `Client`

### environment

• **environment**: [`SpaceportChainType`](.././index#spaceportchaintype)

### listings

• **listings**: [`ListingsQueryModule`](./modules/listings-query-module)

### agreements

• **agreements**: [`AgreementsQueryModule`](./modules/agreements-query-module)

### smartLicenses

• **smartLicenses**: [`SmartLicensesQueryModule`](./modules/smart-licenses-query-module)
