0.6.0 • Published 2 years ago
@polywrap/graph-node-plugin-js v0.6.0
@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
0.5.0
2 years ago
0.4.1
2 years ago
0.6.0
2 years ago
0.4.0
2 years ago
0.3.0
2 years ago
0.2.0
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.1-prealpha.93
2 years ago
0.0.1-prealpha.92
2 years ago
0.0.1-prealpha.91
2 years ago
0.0.1-prealpha.90
2 years ago
0.0.1-prealpha.89
2 years ago
0.0.1-prealpha.88
2 years ago
0.0.1-prealpha.87
2 years ago
0.0.1-prealpha.86
2 years ago