view

package
v0.0.0-...-2a8bcf1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	*tview.Application

	Context *Context
	Control *Controls
	Main    *tview.Flex
	// contains filtered or unexported fields
}

func NewApp

func NewApp(chainURL string, chainID *big.Int) (*App, error)

NewApp starts the explorer pointed at the given chain URL and ID

func (*App) AddContext

func (app *App) AddContext(text string)

Add adds the given text to the context view without clearing the existing text

func (*App) Search

func (app *App) Search()

func (*App) ShowBlock

func (app *App) ShowBlock(client *ethclient.Client, numberOrHash any)

func (*App) ShowChainSummary

func (app *App) ShowChainSummary(client *ethclient.Client)

func (*App) ShowTransaction

func (app *App) ShowTransaction(client *ethclient.Client, hash string)

func (*App) UpdateContext

func (app *App) UpdateContext(text string)

Update updates the context view with the given text

func (*App) UpdateControls

func (app *App) UpdateControls(controls *ControlMapping)

UpdateControls updates what controls the app can use and displays them in the control view

type Context

type Context struct {
	*tview.TextView
	// contains filtered or unexported fields
}

Context is the view that displays the current context of the application, usually the chain URL and ID, but also errors and loading messages

func NewContextView

func NewContextView(chainURL string, chainID *big.Int) *Context

type Control

type Control struct {
	Key         string
	Description string
	// Order is used to sort controls when displayed to the user. Default controls are always first
	Order uint
	Fn    func()
}

Control is a key press that triggers a function

type ControlMapping

type ControlMapping struct {
	NormalControls  NormalKeyControls
	SpecialControls SpecialKeyControls
}

ControlMapping is a mapping of controls to their key and description

type Controls

type Controls struct {
	*tview.TextView
	// contains filtered or unexported fields
}

Controls is the view that displays the current controls available to the user

func NewControlView

func NewControlView() *Controls

type NormalKeyControls

type NormalKeyControls map[rune]Control

NormalKeyControls is a mapping of a "normal" key press (rune) to a Control

type SearchType

type SearchType string
const (
	BlockNumber SearchType = "Block Number"
	Hash        SearchType = "Hash"
)

type SpecialKeyControls

type SpecialKeyControls map[tcell.Key]Control

SpecialKeyControls is a mapping of a "special" key press (e.g. CTRL+C) to a Control

Jump to

Keyboard shortcuts

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