Skip to content

Commit 0a7047b

Browse files
Update substreams-powered-subgraphs.mdx (#666)
* Update substreams-powered-subgraphs.mdx Annotation of `rust` block of codes with the `rust` field in the code snippet * Run `pnpm check:fix` --------- Co-authored-by: Eduard Voiculescu <[email protected]>
1 parent 41e66f6 commit 0a7047b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

website/pages/en/cookbook/substreams-powered-subgraphs.mdx

+3-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ message Contract {
4545

4646
The core logic of the Substreams package is a `map_contract` module in `lib.rs`, which processes every block, filtering for Create calls which did not revert, returning `Contracts`:
4747

48-
```
48+
```rust
4949
#[substreams::handlers::map]
5050
fn map_contract(block: eth::v2::Block) -> Result<Contracts, substreams::errors::Error> {
5151
let contracts = block
@@ -71,7 +71,7 @@ A Substreams package can be used by a subgraph as long as it has a module which
7171

7272
> The `substreams_entity_change` crate also has a dedicated `Tables` function for simply generating entity changes ([documentation](https://docs.rs/substreams-entity-change/1.2.2/substreams_entity_change/tables/index.html)). The Entity Changes generated must be compatible with the `schema.graphql` entities defined in the `subgraph.graphql` of the corresponding subgraph.
7373
74-
```
74+
```rust
7575
#[substreams::handlers::map]
7676
pub fn graph_out(contracts: Contracts) -> Result<EntityChanges, substreams::errors::Error> {
7777
// hash map of name to a table
@@ -90,7 +90,7 @@ pub fn graph_out(contracts: Contracts) -> Result<EntityChanges, substreams::erro
9090

9191
These types and modules are pulled together in `substreams.yaml`:
9292

93-
```
93+
```yaml
9494
specVersion: v0.1.0
9595
package:
9696
name: 'substreams_test' # the name to be used in the .spkg
@@ -124,7 +124,6 @@ modules: # specify modules with their inputs and outputs.
124124
- map: map_contract
125125
output:
126126
type: proto:substreams.entity.v1.EntityChanges # this type can be consumed by Graph Node
127-
128127
```
129128
130129
You can check the overall "flow" from a Block, to `map_contract` to `graph_out` by running `substreams graph`:

0 commit comments

Comments
 (0)