From f4faa0f57e833e4a5a1634a2675bdb69c607e894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enol=20=C3=81lvarez?= Date: Wed, 18 Sep 2024 14:53:02 +0200 Subject: [PATCH 1/3] Update SpS tutorial code --- website/pages/en/sps/triggers-example.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/pages/en/sps/triggers-example.mdx b/website/pages/en/sps/triggers-example.mdx index d8d61566295e..1ea2784c143b 100644 --- a/website/pages/en/sps/triggers-example.mdx +++ b/website/pages/en/sps/triggers-example.mdx @@ -120,7 +120,7 @@ export function handleTriggers(bytes: Uint8Array): void { entity.designation = event.transfer!.accounts!.destination if (event.transfer!.accounts!.signer!.single != null) { - entity.signers = [event.transfer!.accounts!.signer!.single.signer] + entity.signers = [event.transfer!.accounts!.signer!.single!.signer] } else if (event.transfer!.accounts!.signer!.multisig != null) { entity.signers = event.transfer!.accounts!.signer!.multisig!.signers } From c79a3649d2b535fd311f50cb94f28f006d071df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enol=20=C3=81lvarez?= Date: Wed, 18 Sep 2024 15:31:41 +0200 Subject: [PATCH 2/3] Move sections --- website/pages/en/sps/triggers-example.mdx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/website/pages/en/sps/triggers-example.mdx b/website/pages/en/sps/triggers-example.mdx index 1ea2784c143b..64479efc0abf 100644 --- a/website/pages/en/sps/triggers-example.mdx +++ b/website/pages/en/sps/triggers-example.mdx @@ -87,17 +87,7 @@ type MyTransfer @entity { This schema defines a `MyTransfer` entity with fields such as `id`, `amount`, `source`, `designation`, and `signers`. -## Step 4: Generate Protobuf Files - -To generate Protobuf objects in AssemblyScript, run the following command: - -```bash -npm run protogen -``` - -This command converts the Protobuf definitions into AssemblyScript, allowing you to use them in the subgraph's handler. - -## Step 5: Handle Substreams Data in `mappings.ts` +## Step 4: Handle Substreams Data in `mappings.ts` 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: @@ -130,6 +120,16 @@ export function handleTriggers(bytes: Uint8Array): void { } ``` +## Step 5: Generate Protobuf Files + +To generate Protobuf objects in AssemblyScript, run the following command: + +```bash +npm run protogen +``` + +This command converts the Protobuf definitions into AssemblyScript, allowing you to use them in the subgraph's handler. + ## Conclusion 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. From 4a0327176cdf1b00d44bb137e95d7a408b0e139f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enol=20=C3=81lvarez?= Date: Wed, 18 Sep 2024 20:49:51 +0200 Subject: [PATCH 3/3] Fix Substreams links --- website/pages/en/sps/introduction.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/pages/en/sps/introduction.mdx b/website/pages/en/sps/introduction.mdx index 3e50521589af..12e3f81c6d53 100644 --- a/website/pages/en/sps/introduction.mdx +++ b/website/pages/en/sps/introduction.mdx @@ -14,6 +14,6 @@ It is really a matter of where you put your logic, in the subgraph or the Substr Visit the following links for How-To Guides on using code-generation tooling to build your first end-to-end project quickly: -- [Solana](https://substreams.streamingfast.io/documentation/how-to-guides/intro-your-first-application/solana) -- [EVM](https://substreams.streamingfast.io/documentation/how-to-guides/intro-your-first-application/evm) -- [Injective](https://substreams.streamingfast.io/documentation/how-to-guides/intro-your-first-application/injective) +- [Solana](https://substreams.streamingfast.io/documentation/how-to-guides/solana) +- [EVM](https://substreams.streamingfast.io/documentation/how-to-guides/evm) +- [Injective](https://substreams.streamingfast.io/documentation/how-to-guides/injective)