diff --git a/base_state.go b/base_state.go index 1b5c324..30dadca 100644 --- a/base_state.go +++ b/base_state.go @@ -112,3 +112,37 @@ func (p *BaseConversationState) IsChainTestnet() bool { func (c *BaseConversationState) IsValidChainInput(input string) bool { return networks.GetSubstreamsRegistry().Find(input) != nil } + +// GetPackageURL generates a probable GitHub URL for the project based on the project name and chain. +// Returns a URL in the format: https://github.com/username/{Name}-{ChainName} +// The 'username' is a placeholder that users should update with their actual GitHub username or organization. +func (p *BaseConversationState) GetPackageURL() string { + if p.Name == "" { + return "" + } + + chainSuffix := "" + if p.ChainName != "" { + chainSuffix = "-" + p.ChainName + } + + return "https://github.com/username/" + p.Name + chainSuffix +} + +// GetPackageDescription generates a description for the package based on the project name and chain. +// Returns a description using the Name field and ChainDisplayName() method result. +// Example: "Substreams module for my-project on Ethereum Mainnet" +func (p *BaseConversationState) GetPackageDescription() string { + if p.Name == "" { + return "Substreams module" + } + + desc := "Substreams module for " + p.Name + + chainDisplay := p.ChainDisplayName() + if chainDisplay != "" { + desc += " on " + chainDisplay + } + + return desc +} diff --git a/evm-events-calls-raw/templates/sql/substreams.yaml.gotmpl b/evm-events-calls-raw/templates/sql/substreams.yaml.gotmpl index 1440a3c..0730317 100644 --- a/evm-events-calls-raw/templates/sql/substreams.yaml.gotmpl +++ b/evm-events-calls-raw/templates/sql/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: sql: https://github.com/streamingfast/substreams-sink-sql/releases/download/protodefs-v{{ .SQLImportVersion }}/substreams-sink-sql-protodefs-v{{ .SQLImportVersion }}.spkg diff --git a/evm-events-calls-raw/templates/substreams.yaml.gotmpl b/evm-events-calls-raw/templates/substreams.yaml.gotmpl index 3e83a07..c506e18 100644 --- a/evm-events-calls-raw/templates/substreams.yaml.gotmpl +++ b/evm-events-calls-raw/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: ethcommon: https://spkg.io/streamingfast/ethereum-common-v0.3.3.spkg diff --git a/evm-events-calls/templates/sql/substreams.yaml.gotmpl b/evm-events-calls/templates/sql/substreams.yaml.gotmpl index 1440a3c..0730317 100644 --- a/evm-events-calls/templates/sql/substreams.yaml.gotmpl +++ b/evm-events-calls/templates/sql/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: sql: https://github.com/streamingfast/substreams-sink-sql/releases/download/protodefs-v{{ .SQLImportVersion }}/substreams-sink-sql-protodefs-v{{ .SQLImportVersion }}.spkg diff --git a/evm-events-calls/templates/substreams.yaml.gotmpl b/evm-events-calls/templates/substreams.yaml.gotmpl index 7e431cf..4d2c22d 100644 --- a/evm-events-calls/templates/substreams.yaml.gotmpl +++ b/evm-events-calls/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: ethcommon: https://spkg.io/streamingfast/ethereum-common-v0.3.3.spkg diff --git a/evm-hello-world/templates/substreams.yaml.gotmpl b/evm-hello-world/templates/substreams.yaml.gotmpl index 379319e..9b6f09a 100644 --- a/evm-hello-world/templates/substreams.yaml.gotmpl +++ b/evm-hello-world/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} protobuf: files: diff --git a/injective-events/templates/substreams.yaml.gotmpl b/injective-events/templates/substreams.yaml.gotmpl index 679842d..0832db5 100644 --- a/injective-events/templates/substreams.yaml.gotmpl +++ b/injective-events/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .Name }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: injective: https://github.com/streamingfast/substreams-foundational-modules/releases/download/injective-common-v0.2.5/injective-common-v0.2.5.spkg diff --git a/injective-hello-world/templates/substreams.yaml.gotmpl b/injective-hello-world/templates/substreams.yaml.gotmpl index 2afbb44..ecabc0e 100644 --- a/injective-hello-world/templates/substreams.yaml.gotmpl +++ b/injective-hello-world/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: cosmos: https://github.com/streamingfast/substreams-cosmos/releases/download/v0.1.5/cosmos-v0.1.5.spkg diff --git a/mantra-events/templates/substreams.yaml.gotmpl b/mantra-events/templates/substreams.yaml.gotmpl index 010bc8a..b2ba873 100644 --- a/mantra-events/templates/substreams.yaml.gotmpl +++ b/mantra-events/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .Name }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: mantra: https://spkg.io/streamingfast/mantra-common-v0.1.1.spkg diff --git a/mantra-hello-world/templates/substreams.yaml.gotmpl b/mantra-hello-world/templates/substreams.yaml.gotmpl index 2afbb44..ecabc0e 100644 --- a/mantra-hello-world/templates/substreams.yaml.gotmpl +++ b/mantra-hello-world/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: cosmos: https://github.com/streamingfast/substreams-cosmos/releases/download/v0.1.5/cosmos-v0.1.5.spkg diff --git a/near-hello-world/templates/substreams.yaml.gotmpl b/near-hello-world/templates/substreams.yaml.gotmpl index 84b77a9..e5394e8 100644 --- a/near-hello-world/templates/substreams.yaml.gotmpl +++ b/near-hello-world/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: my_project version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} protobuf: files: diff --git a/sol-anchor/templates/substreams.yaml.gotmpl b/sol-anchor/templates/substreams.yaml.gotmpl index 3e345ae..3a3d093 100644 --- a/sol-anchor/templates/substreams.yaml.gotmpl +++ b/sol-anchor/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: solana: https://spkg.io/streamingfast/solana-common-v0.3.3.spkg diff --git a/sol-hello-world/templates/substreams.yaml.gotmpl b/sol-hello-world/templates/substreams.yaml.gotmpl index b1f0b14..ebfb53e 100644 --- a/sol-hello-world/templates/substreams.yaml.gotmpl +++ b/sol-hello-world/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: solana: https://spkg.io/streamingfast/solana-common-v0.3.3.spkg diff --git a/sol-transactions/templates/substreams.yaml.gotmpl b/sol-transactions/templates/substreams.yaml.gotmpl index e3439a1..a9ab84e 100644 --- a/sol-transactions/templates/substreams.yaml.gotmpl +++ b/sol-transactions/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .Name }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: solana: https://spkg.io/streamingfast/solana-common-v0.3.3.spkg diff --git a/starknet-events/templates/substreams.yaml.gotmpl b/starknet-events/templates/substreams.yaml.gotmpl index 7e70e29..1b66d87 100644 --- a/starknet-events/templates/substreams.yaml.gotmpl +++ b/starknet-events/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .Name }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: starknet: https://spkg.io/streamingfast/starknet-foundational-v0.1.4.spkg diff --git a/starknet-hello-world/templates/substreams.yaml.gotmpl b/starknet-hello-world/templates/substreams.yaml.gotmpl index 3457fa2..9c63e37 100644 --- a/starknet-hello-world/templates/substreams.yaml.gotmpl +++ b/starknet-hello-world/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: starknet: https://spkg.io/streamingfast/starknet-foundational-v0.1.4.spkg diff --git a/stellar-minimal/templates/substreams.yaml.gotmpl b/stellar-minimal/templates/substreams.yaml.gotmpl index daa8337..a7ee237 100644 --- a/stellar-minimal/templates/substreams.yaml.gotmpl +++ b/stellar-minimal/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: stellar: https://github.com/streamingfast/substreams-foundational-modules/releases/download/stellar-foundational-v0.5.0/stellar-foundational-v0.5.0.spkg diff --git a/stellar-transactions-operations/templates/substreams.yaml.gotmpl b/stellar-transactions-operations/templates/substreams.yaml.gotmpl index e267af0..920da35 100644 --- a/stellar-transactions-operations/templates/substreams.yaml.gotmpl +++ b/stellar-transactions-operations/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: stellar: stellar-foundational@v0.5.0 diff --git a/tron-hello-world/templates/substreams.yaml.gotmpl b/tron-hello-world/templates/substreams.yaml.gotmpl index 23521a3..65676d4 100644 --- a/tron-hello-world/templates/substreams.yaml.gotmpl +++ b/tron-hello-world/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: my_project version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: tron: https://spkg.io/v1/packages/tron_foundational/v0.1.2 # Input the Tron foundational modules (which allow you to filter on trasanctions) diff --git a/tron-transactions/templates/substreams.yaml.gotmpl b/tron-transactions/templates/substreams.yaml.gotmpl index eb11489..a71f236 100644 --- a/tron-transactions/templates/substreams.yaml.gotmpl +++ b/tron-transactions/templates/substreams.yaml.gotmpl @@ -2,6 +2,8 @@ specVersion: v0.1.0 package: name: {{ .GetModuleName }} version: v0.1.0 + url: {{ .GetPackageURL }} + description: {{ .GetPackageDescription }} imports: tron: https://spkg.io/v1/packages/tron_foundational/v0.1.2