demo

package
v0.0.0-...-4904f9a Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupOldActions

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

CleanupOldActions removes actions older than 7 days to keep the table small

func GetActionStats

func GetActionStats(ctx context.Context, db *sql.DB) (string, error)

GetActionStats returns summary statistics for demo actions

func GetDemoSidechainSlots

func GetDemoSidechainSlots(ctx context.Context, db *sql.DB) ([]uint32, error)

GetDemoSidechainSlots returns the slot numbers of all demo sidechains

func GetDemoSidechains

func GetDemoSidechains(ctx context.Context, db *sql.DB) ([]*pb.ListSidechainsResponse_Sidechain, error)

GetDemoSidechains returns all demo sidechains from the database

func GetRecentActions

func GetRecentActions(ctx context.Context, db *sql.DB, limit uint32) ([]*pb.RecentAction, error)

GetRecentActions returns recent demo actions from the database

func InsertDemoAction

func InsertDemoAction(ctx context.Context, db *sql.DB, action *DemoAction) error

InsertDemoAction inserts a new demo action into the database

func UpdateDemoBalance

func UpdateDemoBalance(ctx context.Context, db *sql.DB, slot uint32, additionalSats int64) error

UpdateDemoBalance updates the balance of a demo sidechain

Types

type ActionType

type ActionType string

ActionType represents the type of sidechain action

const (
	ActionDeposit           ActionType = "deposit"
	ActionWithdrawal        ActionType = "withdrawal"
	ActionWithdrawalAck     ActionType = "withdrawal_ack"
	ActionSidechainProposal ActionType = "sidechain_proposal"
	ActionSidechainAck      ActionType = "sidechain_ack"
)

type DemoAction

type DemoAction struct {
	ID            int64
	ActionType    ActionType
	SidechainSlot uint32
	SidechainName string
	AmountSatoshi int64
	AckCount      uint32
	AckTotal      uint32
	ExtraInfo     string
	CreatedAt     int64
}

DemoAction represents a recent action in demo mode

func GenerateRandomAction

func GenerateRandomAction(sidechains []DemoSidechain) *DemoAction

GenerateRandomAction creates a random demo action

type DemoSidechain

type DemoSidechain struct {
	Slot           uint32
	Title          string
	Description    string
	BalanceSatoshi int64
	HashID1        string
	HashID2        string
	LastDepositAt  int64
}

DemoSidechain represents a sidechain in demo mode

func GetDemoSidechainsForActions

func GetDemoSidechainsForActions(ctx context.Context, db *sql.DB) ([]DemoSidechain, error)

GetDemoSidechainsForActions returns sidechain info needed for action generation

Jump to

Keyboard shortcuts

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