Skip to content

Commit

Permalink
add substreams tools default-endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Sep 13, 2024
1 parent ac053da commit d87d2e1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/release-notes/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
* Fix handling of 'special case' substreams module with only "params" as its input: should not skip this execution (used in graph-node for head tracking)
-> empty files in module cache with hash `d3b1920483180cbcd2fd10abcabbee431146f4c8` should be deleted for consistency

### CLI

* Add `substreams tools default-endpoint {network-name}` to help with auto-configuration tools

## v1.10.2

* `substreams gui`: fix panic in some conditions when streaming from block 0
Expand Down
27 changes: 27 additions & 0 deletions tools/default-endpoint.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package tools

import (
"fmt"

"github.com/spf13/cobra"
"github.com/streamingfast/substreams/manifest"
)

var defaultEndpointCmd = &cobra.Command{
Use: "default-endpoint {network-name}",
Short: "returns the default endpoint for a given network (the one used by default by the substreams CLI tool)",
Args: cobra.ExactArgs(1),
RunE: defaultEndpointE,
}

func init() {
Cmd.AddCommand(defaultEndpointCmd)
}

func defaultEndpointE(cmd *cobra.Command, args []string) error {
if endpoint := manifest.HardcodedEndpoints[args[0]]; endpoint != "" {
fmt.Println(endpoint)
return nil
}
return fmt.Errorf("no endpoint found for network %s", args[0])
}

0 comments on commit d87d2e1

Please sign in to comment.