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
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ Using [Entity Changes](https://substreams.streamingfast.io/documentation/consume
12
12
13
13
It is really a matter of where you put your logic, in the subgraph or the Substreams. Keep in mind that having more of your logic in Substreams benefits from a parallelized model, whereas triggers will be linearly consumed in graph-node.
14
14
15
-
16
15
Visit the following links for How-To Guides on using code-generation tooling to build your first end-to-end project quickly:
Copy file name to clipboardExpand all lines: website/pages/en/sps/triggers-example.mdx
+38-40Lines changed: 38 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,11 @@ Before starting, make sure to:
12
12
## Step 1: Initialize Your Project
13
13
14
14
1. Open your Dev Container and run the following command to initialize your project:
15
-
16
-
```bash
17
-
substreams init
18
-
```
19
-
15
+
16
+
```bash
17
+
substreams init
18
+
```
19
+
20
20
2. Select the "minimal" project option.
21
21
3. Replace the contents of the generated `substreams.yaml` file with the following configuration, which filters transactions for the Orca account on the SPL token program ID:
You will generate a`subgraph.yaml` manifest which imports the Substreams package as a data source:
57
56
58
57
```yaml
59
-
...
60
58
59
+
---
61
60
dataSources:
62
61
- kind: substreams
63
62
name: my_project_sol
@@ -79,11 +78,11 @@ Define the fields you want to save in your subgraph entities by updating the `sc
79
78
80
79
```graphql
81
80
type MyTransfer @entity {
82
-
id: ID!
83
-
amount: String!
84
-
source: String!
85
-
designation: String!
86
-
signers: [String!]!
81
+
id: ID!
82
+
amount: String!
83
+
source: String!
84
+
designation: String!
85
+
signers: [String!]!
87
86
}
88
87
```
89
88
@@ -104,30 +103,29 @@ This command converts the Protobuf definitions into AssemblyScript, allowing you
104
103
With the Protobuf objects generated, you can now handle the decoded Substreams data in your `mappings.ts` file found in the `./src` directory. The example below demonstrates how to extract to subgraph entities the non-derived transfers associated to the Orca account id:
105
104
106
105
```ts
107
-
import { Protobuf } from "as-proto/assembly";
108
-
import { Events as protoEvents } from "./pb/sf/solana/spl/token/v1/Events";
109
-
import { MyTransfer } from "../generated/schema";
106
+
import { Protobuf } from 'as-proto/assembly'
107
+
import { Events as protoEvents } from './pb/sf/solana/spl/token/v1/Events'
108
+
import { MyTransfer } from '../generated/schema'
110
109
111
110
export function handleTriggers(bytes: Uint8Array): void {
0 commit comments