Documentation
¶
Index ¶
- func CleanupOldActions(ctx context.Context, db *sql.DB) error
- func GetActionStats(ctx context.Context, db *sql.DB) (string, error)
- func GetDemoSidechainSlots(ctx context.Context, db *sql.DB) ([]uint32, error)
- func GetDemoSidechains(ctx context.Context, db *sql.DB) ([]*pb.ListSidechainsResponse_Sidechain, error)
- func GetRecentActions(ctx context.Context, db *sql.DB, limit uint32) ([]*pb.RecentAction, error)
- func InsertDemoAction(ctx context.Context, db *sql.DB, action *DemoAction) error
- func UpdateDemoBalance(ctx context.Context, db *sql.DB, slot uint32, additionalSats int64) error
- type ActionType
- type DemoAction
- type DemoSidechain
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupOldActions ¶
CleanupOldActions removes actions older than 7 days to keep the table small
func GetActionStats ¶
GetActionStats returns summary statistics for demo actions
func GetDemoSidechainSlots ¶
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 ¶
GetRecentActions returns recent demo actions from the database
func InsertDemoAction ¶
InsertDemoAction inserts a new demo action into the database
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 ¶
GetDemoSidechainsForActions returns sidechain info needed for action generation