diff --git a/docs/new/consume/stream/javascript.md b/docs/new/consume/stream/javascript.md index 073471e9d..d3d2a3449 100644 --- a/docs/new/consume/stream/javascript.md +++ b/docs/new/consume/stream/javascript.md @@ -146,3 +146,40 @@ const main = async () => { Now, you can send the data anywhere and create your own custom sink! If you have created a sink and you think it can be reused by other developers, [let us know on Discord](https://discord.gg/jZwqxJAvRs)! The previous code is availalble [on GitHub](https://gist.github.com/enoldev/b9f32e045f47675bd5c20f92246aed84). + +### Passing Parameters + +The `@substreams/core` package exposes an `applyParams(...)` function, which allows you to dynamically pass parameters to the Substreams. + +```javascript +// ...imports omitted... +import { applyParams } from '@substreams/core'; // 1. + +const pkg = await fetchPackage() // 2. +const registry = createRegistry(pkg); + +const transport = createConnectTransport({ + baseUrl: "https://mainnet.sol.streamingfast.io:443", + interceptors: [createAuthInterceptor(TOKEN)], + useBinaryFormat: true, + jsonOptions: { + typeRegistry: registry, + }, +}); + +applyParams( // 3. + [`${MODULE}=parameter_name=parameter_value`], + pkg.modules.modules +); + +// ...code omitted... + +for await (const response of streamBlocks(transport, request)) { // 4. + // ...code omitted... +} +``` +1. Import the `applyParams` function. +2. Download the `spkg` file and create the package abstraction. +3. Apply the parameters to the package module(s). The formart should be: +`module_name=parameter_name=parameter_value`. +4. Stream blocks. \ No newline at end of file diff --git a/docs/new/references/manifests.md b/docs/new/references/manifests.md index 223851c76..b677b2c4c 100644 --- a/docs/new/references/manifests.md +++ b/docs/new/references/manifests.md @@ -177,6 +177,14 @@ or network: ethereum ``` +### image + +The `image` field specifies the icon displayed for the Substreams package, which is used in the [Substreams Regsitry](https://substreams.dev). The path is relative to the folder where the manifest is. + +```yaml +image: ./ethereum-icon.png +``` + ### sink The `sink` field specifies the sink you want to use to consume your data (for example, a database or a subgraph).