webui

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: GPL-3.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Bridgette Web UI

This package provides a web UI for the Bridgette application. It uses:

Features

  • Dashboard with bridge statistics
  • Timeline of deposits showing:
    • Time taken for deposits to appear on L2
    • Transaction details for both L1 and L2
    • Amount, sender, and receiver information

Development

To generate the templ code after modifying templates, run:

./generate.sh

Usage

The web UI is automatically started with the main application. You can access it at http://localhost:8085 by default (configurable with the --web-ui-addr flag).

# Example start command
./bridgette --l1-execution-url="..." --l2-execution-url="..." --web-ui-addr=":8085"

Documentation

Overview

templ: version: v0.3.943

Index

Constants

View Source
const (
	// ItemsPerPage defines how many deposits to show per page
	ItemsPerPage = 10
)

Variables

This section is empty.

Functions

func BridgePerformance

func BridgePerformance(stats map[string]interface{}, pathPrefix string) templ.Component

BridgePerformance contains the bridge performance stats

func Dashboard

func Dashboard(pathPrefix string) templ.Component

Dashboard is the main page template

func DashboardMetrics

func DashboardMetrics(stats map[string]interface{}, pathPrefix string) templ.Component

DashboardMetrics contains the metrics cards

func DepositItem

func DepositItem(deposit DepositPair) templ.Component

DepositItem displays a single deposit

func DepositsTimelineSection

func DepositsTimelineSection(deposits []DepositPair, page, totalPages int, pathPrefix string) templ.Component

DepositsTimelineSection contains the deposits timeline section

func GetBridgeStats

func GetBridgeStats(ctx context.Context, db *sql.DB) (map[string]interface{}, error)

GetBridgeStats returns statistics about the bridge

func GetTotalMatchedDeposits

func GetTotalMatchedDeposits(ctx context.Context, db *sql.DB) (int, error)

GetTotalMatchedDeposits returns the total number of matched deposits

func GetTotalUnmatchedDeposits

func GetTotalUnmatchedDeposits(ctx context.Context, db *sql.DB) (int, error)

GetTotalUnmatchedDeposits returns the total number of unmatched deposits

func Layout

func Layout(title string, pathPrefix string) templ.Component

func TimeSeriesChart

func TimeSeriesChart(pathPrefix string) templ.Component

TimeSeriesChart displays a chart of deposit time differences over time

func UnmatchedDepositItem

func UnmatchedDepositItem(deposit UnmatchedDeposit) templ.Component

UnmatchedDepositItem displays a single unmatched deposit

func UnmatchedDepositsSection

func UnmatchedDepositsSection(deposits []UnmatchedDeposit, page, totalPages int, pathPrefix string) templ.Component

UnmatchedDepositsSection contains the unmatched deposits section

Types

type DepositPair

type DepositPair struct {
	ID              int64
	FromAddress     string
	ToAddress       string
	Amount          float64
	L1BlockNumber   int64
	L2BlockNumber   int64
	L1Timestamp     time.Time
	L2Timestamp     time.Time
	TimeDiffSeconds int64
	TxHashL1        string
	TxHashL2        string
}

DepositPair represents a matched pair of L1 and L2 deposit events

func GetMatchedDeposits

func GetMatchedDeposits(ctx context.Context, db *sql.DB, limit, offset int) ([]DepositPair, error)

GetMatchedDeposits returns a list of matched deposit pairs with time difference information

type Server

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

Server represents the web UI server

func NewServer

func NewServer(db *sql.DB, logger *slog.Logger, addr string, pathPrefix string) *Server

NewServer creates a new web UI server

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the web UI server

type UnmatchedDeposit

type UnmatchedDeposit struct {
	ID               int64
	FromAddress      string
	ToAddress        string
	Amount           float64
	L1BlockNumber    int64
	L1Timestamp      time.Time
	TimeSinceSeconds int64
	TxHashL1         string
}

UnmatchedDeposit represents an unmatched L1 deposit event

func GetUnmatchedDeposits

func GetUnmatchedDeposits(ctx context.Context, db *sql.DB, limit, offset int) ([]UnmatchedDeposit, error)

GetUnmatchedDeposits returns a list of unmatched L1 deposit events

Jump to

Keyboard shortcuts

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