-
Notifications
You must be signed in to change notification settings - Fork 156
Section safe subgraph generation tool #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
43db0e2
be97885
89301a3
c940a8a
82bd70f
d097fc2
e9c4408
38db427
d7ab8d8
2f17d6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,7 +230,11 @@ For some entity types the `id` is constructed from the id's of two other entitie | |
|
|
||
| ### Built-In Scalar Types | ||
|
|
||
| #### GraphQL Supported Scalars | ||
|
|
||
|
|
||
|
|
||
|
|
||
| GraphQL Supported Scalars | ||
|
|
||
| We support the following scalars in our GraphQL API: | ||
|
|
||
|
|
@@ -560,6 +564,49 @@ import { Gravatar } from '../generated/schema' | |
|
|
||
| Code generation does not check your mapping code in `src/mapping.ts`. If you want to check that before trying to deploy your subgraph to the Graph Explorer, you can run `yarn build` and fix any syntax errors that the TypeScript compiler might find. | ||
|
|
||
|
|
||
| ### Safe Subgraph Code Generator | ||
|
|
||
| [Subgraph Uncrashable](https://float-capital.github.io/float-subgraph-uncrashable/) is code generation tool that generates a set of helper functions from the graphql schema of the project and ensures that all interactions with entities in the your subgraph are completely safe and consistent. | ||
SvenMuller95 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #### Why integrate with Subgraph Uncrashable? | ||
|
|
||
| **Continuous Uptime** | ||
|
|
||
| Mishandled entities cause subgraphs to crash, which can be very disruptive for projects that are dependent on the graph. Set up helper functions to make your subgraphs “uncrashable” and ensure business continuity. | ||
SvenMuller95 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **Completely Safe** | ||
|
|
||
| Common problems seen in subgraph development are issues of loading undefined entities, not setting or initializing all values of entities, and race conditions on loading and saving entities. Ensure all interactions with entities are completely atomic. | ||
|
|
||
| **User Configurable** | ||
|
|
||
| Set default values and configure the level of security checks that suits your individual project's needs. Warning logs are recorded indicating where there is a breach of subgraph logic to help patch the issue to ensure data accuracy. | ||
|
|
||
| **Key Features** | ||
|
|
||
| The code generation tool accommodates **all** subgraph types and is configurable for users to set sane defaults on values. The code generation will use this config to generate helper functions that are to the users specification. | ||
|
|
||
| The framework also includes a way (via the config file) to create custom but safe setter functions for groups of entity variables. This way it is impossible for the user to load/use a stale graph entity and it is also impossible to forget to save or set a variable that is required by the function. | ||
|
|
||
| Warning logs are recorded as logs indicating where there is a breach of subgraph logic to help patch the issue to ensure data accuracy. These logs can be viewed in the The Graph's hosted service under the 'Logs' section. | ||
|
|
||
|
|
||
| Subgraph Uncrashable can be installed using the Graph CLI as an optional flag. | ||
SvenMuller95 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```sh | ||
| graph codegen [--output-dir <OUTPUT_DIR>] [<MANIFEST>] | ||
| ``` | ||
|
|
||
| Run the graph uncrashable codegen via the graph-cli: | ||
|
|
||
| ```sh | ||
| graph codegen -u` | ||
SvenMuller95 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| Visit the [subgraph uncrashable documentation](https://float-capital.github.io/float-subgraph-uncrashable/docs/) or watch this [video tutorial](https://float-capital.github.io/float-subgraph-uncrashable/docs/tutorial) to learn more and to get started with developing safer subgraphs. | ||
|
||
|
|
||
|
|
||
| ## Data Source Templates | ||
|
|
||
| A common pattern in Ethereum smart contracts is the use of registry or factory contracts, where one contract creates, manages, or references an arbitrary number of other contracts that each have their own state and events. The addresses of these sub-contracts may or may not be known upfront and many of these contracts may be created and/or added over time. This is why, in such cases, defining a single data source or a fixed number of data sources is impossible and a more dynamic approach is needed: _data source templates_. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.