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: website/pages/en/sps/sps-intro.mdx
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,14 @@ title: Introduction
4
4
5
5
By leveraging a Substreams package (`.yaml`) as a data source, your subgraph gains access to pre-extracted, indexed blockchain data, enabling more efficient and scalable data handling, especially when dealing with large or complex blockchain networks.
6
6
7
-
This technology opens up more efficient and versatile indexing for diverse blockchain environments. For more information on how to build a Substreams-powered subgraph, [click here](./triggers.mdx). You can also visit the following links for How-To Guides on using code-generation tooling to scaffold your first end to end project quickly:
7
+
This technology opens up more efficient and versatile indexing for diverse blockchain environments. For more information on how to build a Substreams-powered subgraph, [click here](./triggers.mdx). You can also visit the following links for How-To Guides on using code-generation tooling to scaffold your first end to end project quickly:
A Substreams package is a precompiled binary file that defines the specific data you want to extract from the blockchain—similar to the `mapping.ts` file in traditional subgraphs.
16
-
17
-
Visit [substreams.dev](https://substreams.dev/) to explore a growing collection of ready-to-use Substreams packages across various blockchain networks that can be easily integrated into your subgraph. If you can’t find a suitable Substreams package and want to build your own, click [here](https://thegraph.com/docs/en/substreams/) for detailed instructions on creating a custom package tailored to your needs.
15
+
A Substreams package is a precompiled binary file that defines the specific data you want to extract from the blockchain—similar to the `mapping.ts` file in traditional subgraphs.
18
16
17
+
Visit [substreams.dev](https://substreams.dev/) to explore a growing collection of ready-to-use Substreams packages across various blockchain networks that can be easily integrated into your subgraph. If you can’t find a suitable Substreams package and want to build your own, click [here](https://thegraph.com/docs/en/substreams/) for detailed instructions on creating a custom package tailored to your needs.
Copy file name to clipboardExpand all lines: website/pages/en/sps/triggers-example.mdx
+31-35Lines changed: 31 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Example Susbtreams Trigger
3
3
---
4
4
5
-
Here you’ll walk through a Solana based example for setting up your Substreams-powered subgraph project. If you haven’t already, first check out the [Getting Started Guide](https://github.com/streamingfast/substreams/blob/enol/how-to-guides/docs/new/how-to-guides/intro-how-to-guides.md) for more information on how to initialize your project.
5
+
Here you’ll walk through a Solana based example for setting up your Substreams-powered subgraph project. If you haven’t already, first check out the [Getting Started Guide](https://github.com/streamingfast/substreams/blob/enol/how-to-guides/docs/new/how-to-guides/intro-how-to-guides.md) for more information on how to initialize your project.
6
6
7
7
Consider the following example of a Substreams manifest (`substreams.yaml`), a configuration file similar to the `subgraph.yaml`, using the SPL token program Id:
Now see the corresponding subgraph manifest **(`subgraph.yaml`)** using a Substreams package as the data source:
37
35
38
36
```yaml
@@ -57,45 +55,44 @@ dataSources:
57
55
handler: handleTriggers
58
56
```
59
57
60
-
Once your manifests are created, define in the `schema.graphql` the data fields you’d like saved in your subgraph entities:
58
+
Once your manifests are created, define in the `schema.graphql` the data fields you’d like saved in your subgraph entities:
61
59
62
60
```graphql
63
61
type MyTransfer @entity {
64
-
id: ID!
65
-
amount: String!
66
-
source: String!
67
-
designation: String!
68
-
signers: [String!]!
62
+
id: ID!
63
+
amount: String!
64
+
source: String!
65
+
designation: String!
66
+
signers: [String!]!
69
67
}
70
68
```
71
69
72
70
The Protobuf object is generated in AssemblyScript by running `npm run protogen` after running `substreams codegen subgraph` in the devcontainer, so you can import it in the subgraph code. Then transform your decoded Substreams data within the `src/mappings.ts` file, just like in a standard subgraph:
73
71
74
72
```tsx
75
-
import { Protobuf } from "as-proto/assembly";
76
-
import { Events as protoEvents } from "./pb/sf/solana/spl/token/v1/Events";
77
-
import { MyTransfer } from "../generated/schema";
73
+
import { Protobuf } from 'as-proto/assembly'
74
+
import { Events as protoEvents } from './pb/sf/solana/spl/token/v1/Events'
75
+
import { MyTransfer } from '../generated/schema'
78
76
79
77
export function handleTriggers(bytes: Uint8Array): void {
@@ -107,5 +104,4 @@ Here's what you’re seeing in the `mappings.ts`:
107
104
2. Looping over the transactions
108
105
3. Create a new subgraph entity for every transaction
109
106
110
-
> Note: It's beneficial to have more of your logic in Substreams, as it allows for a parallelized model, whereas triggers are linearly consumed in `graph-node`.
111
-
>
107
+
> Note: It's beneficial to have more of your logic in Substreams, as it allows for a parallelized model, whereas triggers are linearly consumed in `graph-node`.
Copy file name to clipboardExpand all lines: website/pages/en/sps/triggers.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
----
2
2
title: Substreams Triggers
3
-
----
3
+
---
4
+
5
+
-
4
6
5
7
Substreams triggers allow you to integrate Substreams data directly into your subgraph. By importing the [Protobuf definitions](https://substreams.streamingfast.io/documentation/develop/creating-protobuf-schemas#protobuf-overview) emitted by your Substreams module, you can receive and process this data in your subgraph's handler. This enables efficient and streamlined data handling within the subgraph framework.
Copy file name to clipboardExpand all lines: website/pages/en/substreams.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Substreams
4
4
5
5

6
6
7
-
Substreams is a powerful blockchain indexing technology designed to enhance performance and scalability within The Graph Network. It offers the following features:
7
+
Substreams is a powerful blockchain indexing technology designed to enhance performance and scalability within The Graph Network. It offers the following features:
8
8
9
9
-**Accelerated Indexing**: Substreams reduces subgraph indexing time thanks to a parallelized engine, enabling faster data retrieval and processing.
10
10
-**Multi-Chain Support**: Substreams expand indexing capabilities beyond EVM-based chains, supporting ecosystems like Solana, Injective, Starknet, and Vara.
0 commit comments