Skip to content

Commit bdcec32

Browse files
authored
Update SpS Tutorial (#773)
1 parent 3949b8d commit bdcec32

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

website/pages/en/sps/introduction.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ It is really a matter of where you put your logic, in the subgraph or the Substr
1414

1515
Visit the following links for How-To Guides on using code-generation tooling to build your first end-to-end project quickly:
1616

17-
- [Solana](https://substreams.streamingfast.io/documentation/how-to-guides/intro-your-first-application/solana)
18-
- [EVM](https://substreams.streamingfast.io/documentation/how-to-guides/intro-your-first-application/evm)
19-
- [Injective](https://substreams.streamingfast.io/documentation/how-to-guides/intro-your-first-application/injective)
17+
- [Solana](https://substreams.streamingfast.io/documentation/how-to-guides/solana)
18+
- [EVM](https://substreams.streamingfast.io/documentation/how-to-guides/evm)
19+
- [Injective](https://substreams.streamingfast.io/documentation/how-to-guides/injective)

website/pages/en/sps/triggers-example.mdx

+12-12
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,7 @@ type MyTransfer @entity {
8787

8888
This schema defines a `MyTransfer` entity with fields such as `id`, `amount`, `source`, `designation`, and `signers`.
8989

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`
10191

10292
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:
10393

@@ -120,7 +110,7 @@ export function handleTriggers(bytes: Uint8Array): void {
120110
entity.designation = event.transfer!.accounts!.destination
121111

122112
if (event.transfer!.accounts!.signer!.single != null) {
123-
entity.signers = [event.transfer!.accounts!.signer!.single.signer]
113+
entity.signers = [event.transfer!.accounts!.signer!.single!.signer]
124114
} else if (event.transfer!.accounts!.signer!.multisig != null) {
125115
entity.signers = event.transfer!.accounts!.signer!.multisig!.signers
126116
}
@@ -130,6 +120,16 @@ export function handleTriggers(bytes: Uint8Array): void {
130120
}
131121
```
132122

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+
133133
## Conclusion
134134

135135
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

Comments
 (0)