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/triggers-example.mdx
+12-12
Original file line number
Diff line number
Diff line change
@@ -87,17 +87,7 @@ type MyTransfer @entity {
87
87
88
88
This schema defines a `MyTransfer` entity with fields such as `id`, `amount`, `source`, `designation`, and `signers`.
89
89
90
-
## Step 4: Generate Protobuf Files
91
-
92
-
To generate Protobuf objects in AssemblyScript, run the following command:
93
-
94
-
```bash
95
-
npm run protogen
96
-
```
97
-
98
-
This command converts the Protobuf definitions into AssemblyScript, allowing you to use them in the subgraph's handler.
99
-
100
-
## Step 5: Handle Substreams Data in `mappings.ts`
90
+
## Step 4: Handle Substreams Data in `mappings.ts`
101
91
102
92
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:
103
93
@@ -120,7 +110,7 @@ export function handleTriggers(bytes: Uint8Array): void {
@@ -130,6 +120,16 @@ export function handleTriggers(bytes: Uint8Array): void {
130
120
}
131
121
```
132
122
123
+
## Step 5: Generate Protobuf Files
124
+
125
+
To generate Protobuf objects in AssemblyScript, run the following command:
126
+
127
+
```bash
128
+
npm run protogen
129
+
```
130
+
131
+
This command converts the Protobuf definitions into AssemblyScript, allowing you to use them in the subgraph's handler.
132
+
133
133
## Conclusion
134
134
135
135
You’ve successfully set up a trigger-based Substreams-powered subgraph for a Solana SPL token. You can now further customize your schema, mappings, and modules to suit your specific use case.
0 commit comments