This package has been deprecated

Author message:

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

@polywrap/graph-node-plugin-js
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

@polywrap/graph-node-plugin-js

Graph Node Plugin allows the Polywrap JS Client to send queries to the Graph Node.

Usage

import { graphNodePlugin } from "@polywrap/graph-node-plugin-js";
import { PolywrapClient } from "@polywrap/client-js";

export async function foo({

  const graphNodePluginURI = "ens/graph-node.polywrap.eth";
  const provider = "https://api.thegraph.com";

  // initialize client with the graph node plugin
  const client = new PolywrapClient({
    plugins: [{
      uri,
      plugin: graphNodePlugin({
        provider
      })
    }]
  });

  // and send invocations to the subgraph
  const response = await client.invoke({
    uri: graphNodePluginURI,
    method: "querySubgraph",
    args: {
      subgraphAuthor: "ensdomains",
      subgraphName: "ens",
      query: `{
        domains(first: 5) {
          id
          name
          labelName
          labelhash
        }
        transfers(first: 5) {
          id
          domain {
            id
          }
          blockNumber
          transactionID
        }
      }`
    }
  });

  // or instantiate the plugin
  const plugin = graphNodePlugin({
    provider
  });

  // and send invocations to the subgraph
  const response' = await plugin.querySubgraph({
    subgraphAuthor: "ensdomains",
    subgraphName: "ens",
    query: `{
      domains(first: 5) {
        id
        name
        labelName
        labelhash
      }
      transfers(first: 5) {
        id
        domain {
          id
        }
        blockNumber
        transactionID
      }
    }`,
  }, client)
});

For more usage examples see src/__tests__.

API

Full API in src/schema.graphql

Readme

Keywords

none

Package Sidebar

Install

npm i @polywrap/graph-node-plugin-js

Weekly Downloads

2

Version

0.6.0

License

MIT

Unpacked Size

43.3 kB

Total Files

21

Last publish

Collaborators

  • dorgjelli
  • polywrap-build-bot