diff --git a/cmd/substreams/gui.go b/cmd/substreams/gui.go index fa761c46..722017a1 100644 --- a/cmd/substreams/gui.go +++ b/cmd/substreams/gui.go @@ -70,10 +70,31 @@ func runGui(cmd *cobra.Command, args []string) (err error) { default: return fmt.Errorf("too many arguments") } - // TODO: validate that the manifest is a valid substreams package + + requestParams := sflags.MustGetStringArray(cmd, "params") + + paramsStringMap := make(map[string]struct{}) + for _, parameter := range requestParams { + moduleName := strings.Split(parameter, "=")[0] + paramsStringMap[moduleName] = struct{}{} + } + + readerOptions := []manifest.Option{} + + if len(requestParams) != 0 { + params, err := manifest.ParseParams(requestParams) + if err != nil { + return fmt.Errorf("parsing params: %w", err) + } + readerOptions = append(readerOptions, manifest.WithParams(params)) + } + + if sflags.MustGetBool(cmd, "skip-package-validation") { + readerOptions = append(readerOptions, manifest.SkipPackageValidationReader()) + } // Safe guard to ensure that the manifest file exists - manifestReader, err := manifest.NewReader(manifestPath) + manifestReader, err := manifest.NewReader(manifestPath, readerOptions...) if err != nil { return fmt.Errorf("manifest reader: %w", err) } @@ -102,14 +123,9 @@ func runGui(cmd *cobra.Command, args []string) (err error) { network := sflags.MustGetString(cmd, "network") if network == "" { network = packageBundle.Package.Network - } - - requestParams := sflags.MustGetStringArray(cmd, "params") - - paramsStringMap := make(map[string]struct{}) - for _, parameter := range requestParams { - moduleName := strings.Split(parameter, "=")[0] - paramsStringMap[moduleName] = struct{}{} + if network == "" { + return fmt.Errorf("network not set, please provide a network") + } } defaultParams := make([]string, 0) diff --git a/tui2/pages/output/output.go b/tui2/pages/output/output.go index ba9e6978..cfd9d04c 100644 --- a/tui2/pages/output/output.go +++ b/tui2/pages/output/output.go @@ -250,7 +250,7 @@ func (o *Output) Update(msg tea.Msg) (tea.Model, tea.Cmd) { o.searchEnabled = true cmds = append(cmds, common.SetModalComponentCmd(o.searchCtx)) case "F": - o.bytesRepresentation = (o.bytesRepresentation + 1) % 3 + o.bytesRepresentation = (o.bytesRepresentation + 1) % 4 o.statusBar.SetBytesRepresentation(o.bytesRepresentation) o.setOutputViewContent(true) case "N": diff --git a/tui2/pages/request/newinstance.go b/tui2/pages/request/newinstance.go index 0752041e..7ebe03f2 100644 --- a/tui2/pages/request/newinstance.go +++ b/tui2/pages/request/newinstance.go @@ -80,9 +80,11 @@ func (c *Config) NewInstance() (out *Instance, err error) { } readerOptions = append(readerOptions, manifest.WithParams(params)) } + if c.OverrideNetwork != "" { readerOptions = append(readerOptions, manifest.WithOverrideNetwork(c.OverrideNetwork)) } + if c.SkipPackageValidation { readerOptions = append(readerOptions, manifest.SkipPackageValidationReader()) }