description |
---|
Query GraphQL for Arweave Blocks and Transactions data |
You can query for everything that Arweave GraphQL endpoint supports. For instance, single transaction, more than one transaction, single block, more than one block.
The function that we will be using is queryGQL
. For implementation details, see below.
import { queryGQL } from 'arweavekit/graphql';
const response = await queryGQL(queryString, options);
You must supply queryGQL
with two inputs.
QueryString:``
string
- A valid GraphQL query string.Options:``
object
- An options object.gateway:``
string
- Gateway url likearweave.net
filters:``
object
- Filters object likefirst: 100
. In case of no filters, pass an empty object.
The expected response will be an object with following fields.
status:``
number
- Query HTTP status code. Example, 200.data:``
object | null
- Successful response will return GraphQL node or list of GraphQL edges and in case of failure null will be returned here.errors:``
GraphQLError[] | null
- Incase of failure you can expect this field to be non-nullish and a list of GraphQLError is provided.GraphQLError:``
object
- GraphQL error object contains following fields:message:``
string
- Error message in string formatextensions:``
object
- This object has a fieldcode
and its supposed to provide you with error code.