run

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Overview

Package run implements the gnoweb run feature.

It serves the maketx-run scratchpad at the $run web query of an existing realm or package (e.g. /r/demo/boards$run). The page is served whole: a starter script that runs against the package, and the `gnokey maketx run` command in $help's two modes. The browser makes the script editable and keeps the command in step with the fields.

Index

Constants

This section is empty.

Variables

View Source
var PageTemplate = template.Must(template.Must(
	template.New("").ParseFS(templateFS, "templates/page.html"),
).ParseFS(components.SharedPartialsFS(), "btn_copy.html", "insecure_warning.html"))

PageTemplate is the run scratchpad page, with the shared copy button and Fast mode warning. Pre-parsed at init so a misconfigured template surfaces immediately, not on the first request.

Functions

func NewPageView

func NewPageView(data RunData) *components.View

NewPageView wraps the run template.

Types

type Deps

type Deps struct {
	// Domain is the chain domain (e.g. "gno.land"), used to build the
	// fully-qualified package import path stamped on the rendered page.
	Domain string

	// Remote is the RPC endpoint the printed commands talk to.
	Remote string

	// ChainId is the chain ID the printed commands sign for.
	ChainId string

	// Highlighter renders the script as served, before the editor loads.
	// Optional: without it the script is served as plain text.
	Highlighter components.SnippetHighlighter
}

Deps gathers the dependencies the run Handler needs.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler owns the run feature state.

func New

func New(deps Deps) *Handler

New returns a Run handler. An empty Domain defaults to "gno.land".

func (*Handler) GetRunView

func (h *Handler) GetRunView(u *weburl.GnoURL, funcs []*doc.JSONFunc) (int, *components.View)

GetRunView renders the run page of the package at u, whose functions funcs lists (from its qdoc): the caller has checked that it exists.

type RunData

type RunData struct {
	PkgPath string // full path, e.g. "gno.land/r/demo/boards"
	Remote  string // e.g. "https://rpc.gno.land:443"
	ChainId string // e.g. "portal-loop"
	Gas     components.Gas
	// Script is the script the editor opens with, and ScriptHTML the same
	// script highlighted, shown until the editor loads (or without JS).
	Script     string
	ScriptHTML template.HTML
}

RunData is the render payload for templates/page.html.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL