This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

arca-gql
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

arca-gql - a fork of ar-gql to add functionality

Version

A JavaScript/TypeScript package that makes interaction with the Arweave GraphQL endpoint simple and easy.

Installation

# npm
npm i arca-gql
# yarn
yarn add arca-gql

Functions

run(query, variables?)

The run function receives as input a required GraphQL query (compatible with the Arweave GraphQL endpoint) and an optional object of GraphQL variables for the query.

The function returns the result of this query with the variables passed in, if any, returned by the Arweave GraphQL endpoint.

all(query, variables?)

Similar to the run function, the all function receives a query and optional variables.

The one key difference is that it returns all possible transactions returned from running this query. As the Arweave GraphQL endpoint is paginated, this returns all the data by traversing through the pages.

The query passed in must follow the outline shown below:

query($cursor: String) {
  transactions(
    # your query parameters
      
    # standard template below
    after: $cursor
    first: 100
  ) {
    pageInfo {
      hasNextPage
    }
    edges {
      cursor
      node {
        # what tx data you want to query for:
        
      }
    }
  }
}

tx(id)

The tx function recieves as an input a valid Arweave transaction id. The function will then return all metadata information about the transaction that the GraphQL endpoint supports.

fetchTxTag(id, name)

This function will fetch all tags for the supplied transaction. Then, if it finds a tag with the name provided, it will return the tag value. Else, it will return undefined.

setEndpointUrl(GQL_URL)

Set the GQL endpoint. Defaults to https://arweave.net/graphql.

Readme

Keywords

none

Package Sidebar

Install

npm i arca-gql

Weekly Downloads

1

Version

0.0.9

License

MIT

Unpacked Size

15.6 kB

Total Files

13

Last publish

Collaborators

  • rosmcmahon