You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/based-applications/developers/BA-SDK/README.md
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,9 @@ npm i @ssv-labs/bapps-sdk
39
39
40
40
## Example Usage
41
41
42
+
The `extendedConfig` parameter in th `BasedAppsSDK` constructor is optional, if not provided, the SDK will use the development endpoint. Bear in mind that this is rate limited, though, so it is strongly advised to use an API key with the free plan.
43
+
For more information regarding your subgraph API key, please refer to the [dedicated Subgraph page](../subgraph.md#based-application-subgraph).
Copy file name to clipboardExpand all lines: docs/based-applications/developers/subgraph.md
+40-3Lines changed: 40 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,50 @@ sidebar_position: 4
6
6
7
7
# Based Application Subgraph
8
8
9
+
The Graph is a decentralized indexing protocol for the Ethereum (and other EVM-compatible) blockchains. It allows to process data produced by smart contracts and apply logic to it, making it easier and faster to query.
10
+
11
+
The Graph can be used for querying data related to the SSV protocol and develop applications on top of it.
12
+
13
+
:::info
14
+
### New to GraphQL?
15
+
16
+
Before diving into subgraph queries, get familiar with GraphQL basics: [Learn GraphQL](https://graphql.org/learn/)
17
+
:::
18
+
19
+
A Subgraph that implements the necessary logic to index all the events emitted by the SSV smart contract has been developed, and the code is open source, you can [find it here](https://github.com/ssvlabs/ssv-subgraph).
20
+
9
21
All of the data for a based application is stored in the Based Application Subgraph.
10
22
11
-
## Querying the Subgraph
23
+
## Querying SSV Protocol smart contract data
24
+
25
+
Currently, only the [Hoodi Testnet](https://thegraph.com/explorer/subgraphs/F4AU5vPCuKfHvnLsusibxJEiTN7ELCoYTvnzg3YHGYbh?view=Query&chain=arbitrum-one) subgraph has Based Applications data, as Based Applications are currently still on testnet phase.
26
+
27
+
There are a few ways to access smart contract data through The Graph.
28
+
29
+
### Subgraph Playground user interface
30
+
31
+
First of all, you can access the Subgraph page on the Graph Explorer, and use it to experiment and prototype queries using the provided Playground.
32
+
33
+

34
+
35
+
It's possible to access the underlying GraphQL schema, by clicking the _folder icon_ on the right of the playground. This is self-documenting, similarly (and more) to Swagger for a RESTful API, but it's also more powerful, since it will allow you to build queries through simple point-and-click interactions.
36
+
37
+
Once you are satisfied with the query you built, click on the _Play_ button in the center to launch it and obtain the result.
38
+
39
+

40
+
41
+
42
+
Further documentation about the schema can be accessed by clicking on the _book icon_ on the right of the Playground window.
43
+
44
+
### Query API
45
+
46
+
The screenshot below shows the lower section of the _Query_ page.
47
+
48
+

12
49
13
-
The subgraph can be queried at this API for holesky: `https://api.studio.thegraph.com/query/71118/based-applications-ssv-holesky/version/latest`
50
+
It provides instructions on how to query this subgraph programmatically, using the public endpoint and an API-key. You can generate your own API key by visiting the [Subgraph Studio page](https://thegraph.com/studio/apikeys/), and selecting API Keys at the top. The free plan allows 100 thousand queries per month, which should be plenty for your development needs.
14
51
15
-
**Subgraphs for Hoodi will be available soon.**
52
+
Delving deeper into programmatically querying the endpoint: in order do this, you would need to know exactly the query you want to perform, and then perform a `POST` request to the provided endpoint, adding the API key as a header to the request.
The `extendedConfig` parameter is optional, if not provided, the SDK will use the development endpoint. Bear in mind that this is rate limited, though, so it is strongly advised to use an API key with the free plan.
72
+
For more information regarding your subgraph API key, please refer to the [dedicated Subgraph page](../tools/ssv-subgraph/README.md).
Copy file name to clipboardExpand all lines: docs/developers/tools/ssv-subgraph/README.md
+8-40Lines changed: 8 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -23,63 +23,31 @@ A series of examples of the most useful queries and the data accessible via the
23
23
24
24
## Querying SSV Protocol smart contract data
25
25
26
-
Currently, there are two official Subgraphs deployed, one for [Ethereum Mainnet](https://thegraph.com/explorer/subgraphs/7V45fKPugp9psQjgrGsfif98gWzCyC6ChN7CW98VyQnr?view=Playground\&chain=arbitrum-one)
27
-
28
-
**Explorer for Hoodi will be available soon.**
26
+
Currently, there are two official Subgraphs deployed, one for [Ethereum Mainnet](https://thegraph.com/explorer/subgraphs/7V45fKPugp9psQjgrGsfif98gWzCyC6ChN7CW98VyQnr?view=Playground\&chain=arbitrum-one) and one for the [Hoodi Testnet](https://thegraph.com/explorer/subgraphs/F4AU5vPCuKfHvnLsusibxJEiTN7ELCoYTvnzg3YHGYbh?view=Query&chain=arbitrum-one)
29
27
30
28
There are a few ways to access SSV smart contract data through The Graph.
31
29
32
30
### Subgraph Playground user interface
33
31
34
32
First of all, you can access the Subgraph page on the Graph Explorer, and use it to experiment and prototype queries using the provided Playground.
35
33
36
-

34
+

37
35
38
36
It's possible to access the underlying GraphQL schema, by clicking the _folder icon_ on the right of the playground. This is self-documenting, similarly (and more) to Swagger for a RESTful API, but it's also more powerful, since it will allow you to build queries through simple point-and-click interactions.
39
37
40
38
Once you are satisfied with the query you built, click on the _Play_ button in the center to launch it and obtain the result.
41
39
42
-

40
+

43
41
44
42
45
43
Further documentation about the schema can be accessed by clicking on the _book icon_ on the right of the Playground window.
46
44
47
-
### Developer API
48
-
49
-
:::info
50
-
The developer API is rate limited and should only be used for infrequent queries that are not data heavy, like a single owner nonce, or the cluster snapshot information for a single cluster.
51
-
:::
52
-
53
-
The developer API is typically not publicly accessed, but it is provided below, to foster development of applications built on the SSV protocol. Here are the Developer endpoints for the two deployed Subgraphs:
54
-
55
-
#### Developer API for Ethereum Mainnet SSV Subgraph
Despite being rate limited, this endpoint should be sufficient for every development use case.
68
-
69
-
In order to use it, you would need to know exactly the query you want to perform, and then perform a `POST` request to the provided endpoint.
70
-
71
-
Furthermore, a simple project aimed at providing an example of how to use the subgraph to substitute the [`ssv-scanner`](/developers/tools/ssv-scanner) tool can be found in this repository: [SSV Scanner Demo Repository](https://github.com/raekwonIII/ssv-scanner-demo)
72
-
73
-
### Production API
74
-
75
-
As previously mentioned, the Developer API is accessible to anyone for free, but it's rate limited. As such, it should be used for sporadic, light requests.
76
-
77
-
For demanding and very frequent requests, you should be using the Production API, for which the data is provided by decentralized indexers, who get rewarded by the protocol tokenomics for providing the service.
45
+
### Query API
78
46
79
-
In order to use this endpoint, head over to the Subgraph's page and click on the _Query_button.
47
+
The screenshot below shows the lower section of the _Query_page.
80
48
81
-

49
+

82
50
83
-
As you can see, the provided URL requires an APIkey, follow the documentation in the page, to find out how to create one.
51
+
It provides instructions on how to query this subgraph programmatically, using the public endpoint and an API-key. You can generate your own API key by visiting the [Subgraph Studio page](https://thegraph.com/studio/apikeys/), and selecting API Keys at the top. The free plan allows 100 thousand queries per month, which should be plenty for your development needs.
84
52
85
-
Once you have obtained your API key, you can essentially follow the instructions in the previous section, only substituting the URL in the examples with your new endpoint.
53
+
Delving deeper into programmatically querying the endpoint: in order do this, you would need to know exactly the query you want to perform, and then perform a `POST` request to the provided endpoint, adding the API key as a header to the request.
0 commit comments