Skip to content

Commit 484b8d0

Browse files
committed
Edits
1 parent 671a8ac commit 484b8d0

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

website/pages/en/developing/developer-faqs.mdx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
title: Developer FAQs
33
---
44

5-
This page summarizes some of the common questions for developers building on The Graph.
5+
This page summarizes some of the most common questions for developers building on The Graph.
66

77
## Subgraph Related
88

99
### 1. What is a subgraph?
1010

11-
A subgraph is a custom API built on blockchain data. Subgraphs are queried using the GraphQL query language and are deployed to a Graph Node using The Graph CLI. Once deployed and published to The Graph's decentralized network, Indexers process subgraphs and make them available for subgraph consumers to query them.
11+
A subgraph is a custom API built on blockchain data. Subgraphs are queried using the GraphQL query language and are deployed to a Graph Node using The Graph CLI. Once deployed and published to The Graph's decentralized network, Indexers process subgraphs and make them available for subgraph consumers to query.
1212

1313
### 2. What is the first step to create a subgraph?
1414

1515
To successfully create a subgraph, you will need to install The Graph CLI. Review the [Quick Start](/quick-start/) to get started. For detailed information, see [Creating a Subgraph](/developing/creating-a-subgraph/).
1616

1717
### 3. Can I still create a subgraph if my smart contracts don't have events?
1818

19-
It is highly recommended that you structure your smart contracts to have events associated with data you are interested in querying. Event handlers in the subgraph are triggered by contract events and are by far the fastest way to retrieve useful data.
19+
It is highly recommended that you structure your smart contracts to have events associated with data you are interested in querying. Event handlers in the subgraph are triggered by contract events and are the fastest way to retrieve useful data.
2020

2121
If the contracts you work with do not contain events, your subgraph can use call and block handlers to trigger indexing. However, this is not recommended, as performance will be significantly slower.
2222

@@ -28,35 +28,35 @@ No. Once a subgraph is created, the associated GitHub account cannot be changed.
2828

2929
You can deploy a new version of your subgraph to Subgraph Studio using the CLI. This action maintains your subgraph private, but once you’re happy with it, you can publish to Graph Explorer. This will create a new version of your subgraph that Curators can start signaling on.
3030

31-
### 6. When listening to multiple contracts, is it possible to select the contract order to listen to events?
31+
### 6. Is it possible to duplicate a subgraph to another account or endpoint without redeploying?
3232

33-
Within a subgraph, the events are always processed in the order they appear in the blocks, regardless of whether that is across multiple contracts or not.
33+
You have to redeploy the subgraph, but if the subgraph ID (IPFS hash) doesn't change, it won't have to sync from the beginning.
3434

3535
### 7. How do I call a contract function or access a public state variable from my subgraph mappings?
3636

3737
Take a look at `Access to smart contract` state inside the section [AssemblyScript API](/developing/graph-ts/api/#access-to-smart-contract-state).
3838

39-
### 8. Can I import ethers.js or other JS libraries into my subgraph mappings?
39+
### 8. Can I import `ethers.js` or other JS libraries into my subgraph mappings?
4040

4141
Not currently, as mappings are written in AssemblyScript.
4242

4343
One possible alternative solution to this is to store raw data in entities and perform logic that requires JS libraries on the client.
4444

45-
### 9. Is it possible to duplicate a subgraph to another account or endpoint without redeploying?
45+
### 9. When listening to multiple contracts, is it possible to select the contract order to listen to events?
4646

47-
You have to redeploy the subgraph, but if the subgraph ID (IPFS hash) doesn't change, it won't have to sync from the beginning.
47+
Within a subgraph, the events are always processed in the order they appear in the blocks, regardless of whether that is across multiple contracts or not.
4848

4949
### 10. How are templates different from data sources?
5050

51-
Templates allow you to create data sources on the quickly, while your subgraph is indexing. Your contract might spawn new contracts as people interact with it. Since you know the shape of those contracts (ABI, events, etc.) upfront, you can define how you want to index them in a template. When they are spawned, your subgraph will create a dynamic data source by supplying the contract address.
51+
Templates allow you to create data sources quickly, while your subgraph is indexing. Your contract might spawn new contracts as people interact with it. Since you know the shape of those contracts (ABI, events, etc.) upfront, you can define how you want to index them in a template. When they are spawned, your subgraph will create a dynamic data source by supplying the contract address.
5252

5353
Check out the "Instantiating a data source template" section on: [Data Source Templates](/developing/creating-a-subgraph#data-source-templates).
5454

55-
### 11. Is it possible to set up a subgraph using `graph init` from `graph-cli` with two contracts? Or should I manually add another datasource in `subgraph.yaml` after running `graph init`?
55+
### 11. Is it possible to set up a subgraph using `graph init` from `graph-cli` with two contracts? Or should I manually add another dataSource in `subgraph.yaml` after running `graph init`?
5656

57-
Yes. On `graph init` command itself you can add multiple datasources by entering contracts one after the other.
57+
Yes. On `graph init` command itself you can add multiple dataSources by entering contracts one after the other.
5858

59-
You can also use `graph add` command to add new datasource.
59+
You can also use `graph add` command to add a new dataSource.
6060

6161
### 12. In what order are the event, block, and call handlers triggered for a data source?
6262

@@ -72,23 +72,23 @@ You can run the following command:
7272
docker pull graphprotocol/graph-node:latest
7373
```
7474

75-
> Note: docker / docker-compose will always use whatever graph-node version was pulled the first time you ran it, so it is important to do this to make sure you are up to date with the latest version of graph-node.
75+
> Note: docker / docker-compose will always use whatever graph-node version was pulled the first time you ran it, so make sure you're up to date with the latest version of graph-node.
7676
7777
### 14. What is the recommended way to build "autogenerated" ids for an entity when handling events?
7878

7979
If only one entity is created during the event and if there's nothing better available, then the transaction hash + log index would be unique. You can obfuscate these by converting that to Bytes and then piping it through `crypto.keccak256` but this won't make it more unique.
8080

8181
### 15. Can I delete my subgraph?
8282

83-
It is not possible to delete subgraphs once they are created. However, you can [transfer and deprecate your subgraph](/managing/transfer-and-deprecate-a-subgraph/)
83+
It is not possible to delete subgraphs once they are created. However, you can [transfer and deprecate your subgraph](/managing/transfer-and-deprecate-a-subgraph/).
8484

8585
## Network Related
8686

8787
### 16. What networks are supported by The Graph?
8888

8989
You can find the list of the supported networks [here](/developing/supported-networks).
9090

91-
### 17. Is it possible to differentiate between networks (mainnet, Sepolia, local) from within event handlers?
91+
### 17. Is it possible to differentiate between networks (mainnet, Sepolia, local) within event handlers?
9292

9393
Yes. You can do this by importing `graph-ts` as per the example below:
9494

@@ -107,11 +107,11 @@ Yes. Sepolia supports block handlers, call handlers and event handlers. It shoul
107107

108108
### 19. Is it possible to specify what block to start indexing on?
109109

110-
Yes. `dataSources.source.startBlock` in the `subgraph.yaml` file specifies the number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created: [Start blocks](/developing/creating-a-subgraph#start-blocks)
110+
Yes. `dataSources.source.startBlock` in the `subgraph.yaml` file specifies the number of the block that the dataSource starts indexing from. In most cases, we suggest using the block where the contract was created: [Start blocks](/developing/creating-a-subgraph#start-blocks)
111111

112-
### 20. Are there some tips to increase the performance of indexing? My subgraph is taking a very long time to sync
112+
### 20. What are some tips to increase the performance of indexing? My subgraph is taking a very long time to sync
113113

114-
Yes, you should take a look at the optional start block feature to start indexing from the block that the contract was deployed: [Start blocks](/developing/creating-a-subgraph#start-blocks)
114+
Yes, you should take a look at the optional start block feature to start indexing from the block where the contract was deployed: [Start blocks](/developing/creating-a-subgraph#start-blocks)
115115

116116
### 21. Is there a way to query the subgraph directly to determine the latest block number it has indexed?
117117

@@ -133,11 +133,11 @@ someCollection(first: 1000, skip: <number>) { ... }
133133

134134
Currently, the recommended approach for a dapp is to add the key to the frontend and expose it to end users. That said, you can limit that key to a hostname, like _yourdapp.io_ and subgraph. The gateway is currently being run by Edge & Node. Part of the responsibility of a gateway is to monitor for abusive behavior and block traffic from malicious clients.
135135

136-
Miscellaneous
136+
## Miscellaneous
137137

138-
### 24. Is this possible to use Apollo Federation on top of graph-node?
138+
### 24. Is it possible to use Apollo Federation on top of graph-node?
139139

140-
Federation is not supported yet, although we do want to support it in the future. At the moment, something you can do is use schema stitching, either on the client or via a proxy service.
140+
Federation is not supported yet. At the moment, you can use schema stitching, either on the client or via a proxy service.
141141

142142
### 25. I want to contribute or add a GitHub issue. Where can I find the open source repositories?
143143

0 commit comments

Comments
 (0)