api

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHandler

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

func NewAPIHandler

func NewAPIHandler(d *daemon.Daemon, authHandler *auth.Handler) *APIHandler

func (*APIHandler) CreateSpammer

func (ah *APIHandler) CreateSpammer(w http.ResponseWriter, r *http.Request)

CreateSpammer godoc @Id createSpammer @Summary Create a new spammer @Tags Spammer @Description Creates a new spammer with the given configuration @Accept json @Produce json @Param request body CreateSpammerRequest true "Spammer configuration" @Success 200 {object} int64 "Spammer ID" @Failure 400 {string} string "Invalid request" @Failure 401 {string} string "Unauthorized" @Failure 500 {string} string "Server Error" @Router /api/spammer [post]

func (*APIHandler) DeletePlugin added in v1.2.0

func (ah *APIHandler) DeletePlugin(w http.ResponseWriter, r *http.Request)

DeletePlugin godoc @Id deletePlugin @Summary Delete a plugin @Tags Plugin @Description Deletes a plugin by name. Fails if the plugin has running spammers. @Param name path string true "Plugin name" @Success 200 "Success" @Failure 400 {string} string "Plugin has running spammers" @Failure 404 {string} string "Plugin not found" @Failure 500 {string} string "Server Error" @Router /api/plugins/{name} [delete]

func (*APIHandler) DeleteSpammer

func (ah *APIHandler) DeleteSpammer(w http.ResponseWriter, r *http.Request)

DeleteSpammer godoc @Id deleteSpammer @Summary Delete a spammer @Tags Spammer @Description Deletes a spammer and stops it if running @Param id path int true "Spammer ID" @Success 200 "Success" @Failure 400 {string} string "Invalid spammer ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Failure 500 {string} string "Server Error" @Router /api/spammer/{id} [delete]

func (*APIHandler) ExportSpammers added in v1.1.5

func (ah *APIHandler) ExportSpammers(w http.ResponseWriter, r *http.Request)

ExportSpammers godoc @Id exportSpammers @Summary Export spammers to YAML @Tags Spammer @Description Exports specified spammers or all spammers to YAML format @Accept json @Produce text/plain @Param request body ExportSpammersRequest false "Spammer IDs to export (optional)" @Success 200 {string} string "YAML configuration" @Failure 400 {string} string "Invalid request" @Failure 401 {string} string "Unauthorized" @Failure 500 {string} string "Server Error" @Router /api/spammers/export [post]

func (*APIHandler) GetAuditLog added in v1.1.9

func (ah *APIHandler) GetAuditLog(w http.ResponseWriter, r *http.Request)

GetAuditLog godoc @Id getAuditLog @Summary Get a specific audit log entry @Tags Audit @Description Returns a specific audit log entry by ID @Produce json @Param id path int true "Audit log ID" @Success 200 {object} AuditLogEntry "Success" @Failure 400 {string} string "Invalid audit log ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Audit log not found" @Failure 500 {string} string "Server Error" @Router /api/audit-logs/{id} [get]

func (*APIHandler) GetAuditLogStats added in v1.1.9

func (ah *APIHandler) GetAuditLogStats(w http.ResponseWriter, r *http.Request)

GetAuditLogStats godoc @Id getAuditLogStats @Summary Get audit log statistics @Tags Audit @Description Returns statistics about audit logs including counts by type and recent activity @Produce json @Param days query int false "Number of days to include in stats (default: 30)" @Success 200 {object} AuditLogStatsResponse "Success" @Failure 401 {string} string "Unauthorized" @Failure 500 {string} string "Server Error" @Router /api/audit-logs/stats [get]

func (*APIHandler) GetAuditLogs added in v1.1.9

func (ah *APIHandler) GetAuditLogs(w http.ResponseWriter, r *http.Request)

GetAuditLogs godoc @Id getAuditLogs @Summary Get audit logs @Tags Audit @Description Returns paginated audit logs with optional filtering @Produce json @Param user_email query string false "Filter by user email" @Param action_type query string false "Filter by action type" @Param entity_type query string false "Filter by entity type (spammer, client, system)" @Param entity_id query string false "Filter by entity ID" @Param start_time query int false "Start time (unix timestamp)" @Param end_time query int false "End time (unix timestamp)" @Param page query int false "Page number (default: 1)" @Param page_size query int false "Page size (default: 50, max: 1000)" @Success 200 {object} AuditLogResponse "Success" @Failure 400 {string} string "Invalid parameters" @Failure 401 {string} string "Unauthorized" @Failure 500 {string} string "Server Error" @Router /api/audit-logs [get]

func (*APIHandler) GetClients added in v1.1.5

func (ah *APIHandler) GetClients(w http.ResponseWriter, r *http.Request)

GetClients godoc @Id getClients @Summary Get all clients @Tags Client @Description Returns a list of all clients with their details @Produce json @Success 200 {array} ClientEntry "Success" @Router /api/clients [get]

func (*APIHandler) GetGraphsDashboard added in v1.1.6

func (ah *APIHandler) GetGraphsDashboard(w http.ResponseWriter, r *http.Request)

@Summary Get graphs dashboard data @Tags Graphs @Description Returns comprehensive graphs data for the dashboard including all spammers, totals, and time-series data @Produce json @Success 200 {object} GraphsDashboardResponse "Success" @Failure 401 {string} string "Unauthorized" @Failure 500 {string} string "Server Error" @Router /api/graphs/dashboard [get]

func (*APIHandler) GetPendingTransactions added in v1.1.8

func (ah *APIHandler) GetPendingTransactions(w http.ResponseWriter, r *http.Request)

GetPendingTransactions godoc @Id getPendingTransactions @Summary Get pending transactions (global or wallet-specific) @Tags Wallet @Description Returns a list of pending transactions, optionally filtered by wallet address @Produce json @Param wallet query string false "Wallet address to filter by (optional)" @Success 200 {array} PendingTransactionEntry "Success" @Failure 400 {string} string "Invalid wallet address" @Failure 500 {string} string "Server Error" @Router /api/pending-transactions [get]

func (*APIHandler) GetPlugin added in v1.2.0

func (ah *APIHandler) GetPlugin(w http.ResponseWriter, r *http.Request)

GetPlugin godoc @Id getPlugin @Summary Get a specific plugin @Tags Plugin @Description Returns details of a specific plugin by name @Produce json @Param name path string true "Plugin name" @Success 200 {object} PluginEntry "Success" @Failure 404 {string} string "Plugin not found" @Failure 500 {string} string "Server Error" @Router /api/plugins/{name} [get]

func (*APIHandler) GetPlugins added in v1.2.0

func (ah *APIHandler) GetPlugins(w http.ResponseWriter, r *http.Request)

GetPlugins godoc @Id getPlugins @Summary Get all plugins @Tags Plugin @Description Returns a list of all registered plugins with their status @Produce json @Success 200 {array} PluginEntry "Success" @Failure 500 {string} string "Server Error" @Router /api/plugins [get]

func (*APIHandler) GetScenarioConfig

func (ah *APIHandler) GetScenarioConfig(w http.ResponseWriter, r *http.Request)

GetScenarioConfig godoc @Id getScenarioConfig @Summary Get scenario configuration @Tags Scenario @Description Returns the default configuration for a specific scenario @Produce text/plain @Param name path string true "Scenario name" @Success 200 {string} string "YAML configuration" @Failure 404 {string} string "Scenario not found" @Failure 500 {string} string "Server Error" @Router /api/scenarios/{name}/config [get]

func (*APIHandler) GetScenarios

func (ah *APIHandler) GetScenarios(w http.ResponseWriter, r *http.Request)

GetScenarios godoc @Id getScenarios @Summary Get all scenarios @Tags Scenario @Description Returns a list of all scenarios organized by category @Produce json @Success 200 {array} ScenarioCategory "Success" @Failure 400 {string} string "Failure" @Failure 500 {string} string "Server Error" @Router /api/scenarios [get]

func (*APIHandler) GetSpammerDetails

func (ah *APIHandler) GetSpammerDetails(w http.ResponseWriter, r *http.Request)

GetSpammerDetails godoc @Id getSpammerDetails @Summary Get spammer details @Tags Spammer @Description Returns detailed information about a specific spammer @Produce json @Param id path int true "Spammer ID" @Success 200 {object} SpammerDetails "Success" @Failure 400 {string} string "Invalid spammer ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Router /api/spammer/{id} [get]

func (*APIHandler) GetSpammerLibraryIndex added in v1.1.6

func (ah *APIHandler) GetSpammerLibraryIndex(w http.ResponseWriter, r *http.Request)

GetSpammerLibraryIndex godoc @Id getSpammerLibraryIndex @Summary Get spammer library index @Tags SpammerLibrary @Description Returns the index of available spammer configurations from GitHub @Produce json @Success 200 {object} SpammerLibraryIndex "Success" @Failure 500 {string} string "Server Error" @Router /api/spammer-library/index [get]

func (*APIHandler) GetSpammerList

func (ah *APIHandler) GetSpammerList(w http.ResponseWriter, r *http.Request)

GetSpammerList godoc @Id getSpammerList @Summary Get all spammers @Tags Spammer @Description Returns a list of all configured spammers @Produce json @Success 200 {array} SpammerListEntry "Success" @Router /api/spammers [get]

func (*APIHandler) GetSpammerLogs

func (ah *APIHandler) GetSpammerLogs(w http.ResponseWriter, r *http.Request)

GetSpammerLogs godoc @Id getSpammerLogs @Summary Get spammer logs @Tags Spammer @Description Returns the most recent logs for a specific spammer @Produce json @Param id path int true "Spammer ID" @Success 200 {array} LogEntry "Success" @Failure 400 {string} string "Invalid spammer ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Router /api/spammer/{id}/logs [get]

func (*APIHandler) GetSpammerTimeSeries added in v1.1.6

func (ah *APIHandler) GetSpammerTimeSeries(w http.ResponseWriter, r *http.Request)

@Summary Get time-series data for a specific spammer @Tags Graphs @Description Returns detailed time-series graphs data for a specific spammer @Produce json @Param id path int true "Spammer ID" @Success 200 {object} SpammerTimeSeriesResponse "Success" @Failure 400 {string} string "Invalid spammer ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Failure 500 {string} string "Server Error" @Router /api/graphs/spammer/{id}/timeseries [get]

func (*APIHandler) GetVersion added in v1.1.6

func (ah *APIHandler) GetVersion(w http.ResponseWriter, r *http.Request)

GetVersion godoc @Id getVersion @Summary Get spamoor version @Tags Version @Description Returns the current spamoor version information @Produce json @Success 200 {object} VersionResponse "Success" @Router /api/version [get]

func (*APIHandler) ImportSpammers added in v1.1.5

func (ah *APIHandler) ImportSpammers(w http.ResponseWriter, r *http.Request)

ImportSpammers godoc @Id importSpammers @Summary Import spammers from YAML data or URL @Tags Spammer @Description Imports spammers from YAML data or URL with validation and deduplication @Accept json @Produce json @Param request body ImportSpammersRequest true "Import configuration" @Success 200 {object} daemon.ImportResult "Success" @Failure 400 {string} string "Invalid request" @Failure 401 {string} string "Unauthorized" @Failure 500 {string} string "Server Error" @Router /api/spammers/import [post]

func (*APIHandler) PauseSpammer

func (ah *APIHandler) PauseSpammer(w http.ResponseWriter, r *http.Request)

PauseSpammer godoc @Id pauseSpammer @Summary Pause a spammer @Tags Spammer @Description Pauses a running spammer @Param id path int true "Spammer ID" @Success 200 "Success" @Failure 400 {string} string "Invalid spammer ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Failure 500 {string} string "Server Error" @Router /api/spammer/{id}/pause [post]

func (*APIHandler) ReclaimFunds added in v1.1.4

func (ah *APIHandler) ReclaimFunds(w http.ResponseWriter, r *http.Request)

ReclaimFunds godoc @Id reclaimFunds @Summary Reclaim funds from a spammer @Tags Spammer @Description Reclaims funds from a spammer's wallet pool back to the root wallet @Param id path int true "Spammer ID" @Success 200 "Success" @Failure 400 {string} string "Invalid spammer ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Failure 500 {string} string "Server Error" @Router /api/spammer/{id}/reclaim [post]

func (*APIHandler) RegisterPlugin added in v1.2.0

func (ah *APIHandler) RegisterPlugin(w http.ResponseWriter, r *http.Request)

RegisterPlugin godoc @Id registerPlugin @Summary Register a new plugin @Tags Plugin @Description Registers a plugin from URL, local path, or file upload @Accept multipart/form-data @Produce json @Param type formData string true "Source type: url, local, or upload" @Param path formData string false "URL or local path (required for url/local types)" @Param file formData file false "Plugin archive file (required for upload type)" @Success 200 {object} RegisterPluginResponse "Success" @Failure 400 {string} string "Invalid request" @Failure 500 {string} string "Server Error" @Router /api/plugins [post]

func (*APIHandler) ReloadPlugin added in v1.2.0

func (ah *APIHandler) ReloadPlugin(w http.ResponseWriter, r *http.Request)

ReloadPlugin godoc @Id reloadPlugin @Summary Reload a plugin from its source @Tags Plugin @Description Re-loads a plugin from its original source (URL or local path) @Param name path string true "Plugin name" @Success 200 {object} RegisterPluginResponse "Success" @Failure 400 {string} string "Plugin has running spammers or source type not supported" @Failure 404 {string} string "Plugin not found" @Failure 500 {string} string "Server Error" @Router /api/plugins/{name}/reload [post]

func (*APIHandler) SendTransaction added in v1.1.10

func (ah *APIHandler) SendTransaction(w http.ResponseWriter, r *http.Request)

SendTransaction godoc @Id sendTransaction @Summary Send a transaction from the root wallet @Tags Wallet @Description Sends a transaction from the root wallet with specified parameters @Accept json @Produce json @Param request body SendTransactionRequest true "Transaction parameters" @Success 200 {object} SendTransactionResponse "Success" @Failure 400 {object} ErrorResponse "Invalid request" @Failure 401 {string} string "Unauthorized" @Failure 500 {object} ErrorResponse "Server Error" @Router /api/root-wallet/send-transaction [post]

func (*APIHandler) StartSpammer

func (ah *APIHandler) StartSpammer(w http.ResponseWriter, r *http.Request)

StartSpammer godoc @Id startSpammer @Summary Start a spammer @Tags Spammer @Description Starts a specific spammer @Param id path int true "Spammer ID" @Success 200 "Success" @Failure 400 {string} string "Invalid spammer ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Failure 500 {string} string "Server Error" @Router /api/spammer/{id}/start [post]

func (*APIHandler) StreamGraphs added in v1.1.6

func (ah *APIHandler) StreamGraphs(w http.ResponseWriter, r *http.Request)

@Summary Stream real-time graphs updates @Tags Graphs @Description Provides real-time graphs updates via Server-Sent Events (SSE) @Produce text/event-stream @Success 200 {string} string "SSE stream" @Failure 401 {string} string "Unauthorized" @Router /api/graphs/stream [get]

func (*APIHandler) StreamSpammerLogs

func (ah *APIHandler) StreamSpammerLogs(w http.ResponseWriter, r *http.Request)

StreamSpammerLogs godoc @Id streamSpammerLogs @Summary Stream spammer logs @Tags Spammer @Description Streams logs for a specific spammer using Server-Sent Events @Produce text/event-stream @Param id path int true "Spammer ID" @Param since query string false "Timestamp to start from (RFC3339Nano)" @Success 200 {string} string "SSE stream of log entries" @Failure 400 {string} string "Invalid spammer ID" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Failure 500 {string} string "Streaming unsupported" @Router /api/spammer/{id}/logs/stream [get]

func (*APIHandler) UpdateClientEnabled added in v1.1.5

func (ah *APIHandler) UpdateClientEnabled(w http.ResponseWriter, r *http.Request)

UpdateClientEnabled godoc @Id updateClientEnabled @Summary Update client enabled state @Tags Client @Description Updates the enabled state for a specific client @Accept json @Param index path int true "Client index" @Param request body UpdateClientEnabledRequest true "New enabled state" @Success 200 "Success" @Failure 400 {string} string "Invalid client index" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Client not found" @Router /api/client/{index}/enabled [put]

func (*APIHandler) UpdateClientGroup added in v1.1.5

func (ah *APIHandler) UpdateClientGroup(w http.ResponseWriter, r *http.Request)

UpdateClientGroup godoc @Id updateClientGroup @Summary Update client group @Tags Client @Description Updates the group(s) for a specific client. Supports both single group (backward compatibility) and multiple groups. @Accept json @Param index path int true "Client index" @Param request body UpdateClientGroupRequest true "New group name(s)" @Success 200 "Success" @Failure 400 {string} string "Invalid client index" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Client not found" @Router /api/client/{index}/group [put]

func (*APIHandler) UpdateClientName added in v1.1.6

func (ah *APIHandler) UpdateClientName(w http.ResponseWriter, r *http.Request)

UpdateClientName godoc @Id updateClientName @Summary Update client name override @Tags Client @Description Updates the name override for a specific client @Accept json @Param index path int true "Client index" @Param request body UpdateClientNameRequest true "New name override" @Success 200 "Success" @Failure 400 {string} string "Invalid client index" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Client not found" @Router /api/client/{index}/name [put]

func (*APIHandler) UpdateClientType added in v1.1.9

func (ah *APIHandler) UpdateClientType(w http.ResponseWriter, r *http.Request)

UpdateClientType godoc @Id updateClientType @Summary Update client type @Tags Client @Description Updates the type for a specific client (e.g., 'client' or 'builder') @Accept json @Param index path int true "Client index" @Param request body UpdateClientTypeRequest true "New client type" @Success 200 "Success" @Failure 400 {string} string "Invalid client index or type" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Client not found" @Router /api/client/{index}/type [put]

func (*APIHandler) UpdateSpammer

func (ah *APIHandler) UpdateSpammer(w http.ResponseWriter, r *http.Request)

UpdateSpammer godoc @Id updateSpammer @Summary Update a spammer @Tags Spammer @Description Updates an existing spammer's configuration @Accept json @Param id path int true "Spammer ID" @Param request body UpdateSpammerRequest true "Updated configuration" @Success 200 "Success" @Failure 400 {string} string "Invalid request" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Spammer not found" @Failure 500 {string} string "Server Error" @Router /api/spammer/{id} [put]

type AuditLogEntry added in v1.1.9

type AuditLogEntry struct {
	ID         int64  `json:"id"`
	UserEmail  string `json:"user_email"`
	ActionType string `json:"action_type"`
	EntityType string `json:"entity_type"`
	EntityID   string `json:"entity_id"`
	EntityName string `json:"entity_name"`
	Diff       string `json:"diff"`
	Metadata   string `json:"metadata"`
	Timestamp  int64  `json:"timestamp"`
}

AuditLogEntry represents an audit log entry in the API response

type AuditLogResponse added in v1.1.9

type AuditLogResponse struct {
	Logs       []AuditLogEntry `json:"logs"`
	TotalCount int64           `json:"total_count"`
	Page       int             `json:"page"`
	PageSize   int             `json:"page_size"`
	TotalPages int             `json:"total_pages"`
}

AuditLogResponse represents the paginated audit log response

type AuditLogStatsResponse added in v1.1.9

type AuditLogStatsResponse struct {
	TotalLogs        int64                `json:"total_logs"`
	LogsByActionType map[string]int64     `json:"logs_by_action_type"`
	LogsByEntityType map[string]int64     `json:"logs_by_entity_type"`
	LogsByUser       map[string]int64     `json:"logs_by_user"`
	RecentActivity   []AuditLogEntry      `json:"recent_activity"`
	TimeRange        map[string]time.Time `json:"time_range"`
}

AuditLogStatsResponse represents audit log statistics

type ClientEntry added in v1.1.5

type ClientEntry struct {
	Index        int      `json:"index"`
	Name         string   `json:"name"`
	Group        string   `json:"group"`  // First group for backward compatibility
	Groups       []string `json:"groups"` // All groups
	Type         string   `json:"type"`   // Client type (client, builder)
	Version      string   `json:"version"`
	BlockHeight  uint64   `json:"block_height"`
	IsReady      bool     `json:"ready"`
	RpcHost      string   `json:"rpc_host"`
	Enabled      bool     `json:"enabled"`
	NameOverride string   `json:"name_override,omitempty"`
}

ClientEntry represents a client in the API response

type CreateSpammerRequest

type CreateSpammerRequest struct {
	Name             string `json:"name"`
	Description      string `json:"description"`
	Scenario         string `json:"scenario"`
	Config           string `json:"config"`
	StartImmediately bool   `json:"startImmediately"`
}

CreateSpammerRequest represents the request body for creating a new spammer

type ErrorResponse added in v1.1.10

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse represents an error response

type ExportSpammersRequest added in v1.1.5

type ExportSpammersRequest struct {
	SpammerIDs []int64 `json:"spammer_ids,omitempty"` // If empty, exports all spammers
}

ExportSpammersRequest represents the request body for exporting spammers

type GitHubFile added in v1.1.6

type GitHubFile struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Sha         string `json:"sha"`
	Size        int    `json:"size"`
	URL         string `json:"url"`
	HTMLURL     string `json:"html_url"`
	GitURL      string `json:"git_url"`
	DownloadURL string `json:"download_url"`
	Type        string `json:"type"`
}

GitHubFile represents a file from GitHub API

type GraphsDashboardResponse added in v1.1.6

type GraphsDashboardResponse struct {
	TimeRange  TimeRange            `json:"range"`
	Spammers   []SpammerMetricsData `json:"spammers"`
	Totals     TotalMetricsData     `json:"totals"`
	Others     OthersMetricsData    `json:"others"`
	DataPoints []GraphsDataPoint    `json:"data"`
}

GraphsDashboardResponse represents the main dashboard graphs data

type GraphsDataPoint added in v1.1.6

type GraphsDataPoint struct {
	Timestamp        time.Time                    `json:"ts"`
	StartBlockNumber uint64                       `json:"startBlock"`
	EndBlockNumber   uint64                       `json:"endBlock"`
	BlockCount       uint64                       `json:"blocks"`
	TotalGasUsed     uint64                       `json:"totalGas"`
	OthersGasUsed    uint64                       `json:"othersGas"`
	SpammerData      map[string]*SpammerBlockData `json:"spammers"` // spammerID -> detailed data
}

GraphsDataPoint represents a single time-series data point for the graphs

type ImportSpammersRequest added in v1.1.5

type ImportSpammersRequest struct {
	Input string `json:"input"` // Can be YAML data or a URL
}

ImportSpammersRequest represents the request body for importing spammers

type LogEntry

type LogEntry struct {
	Time    string            `json:"time"`
	Level   string            `json:"level"`
	Message string            `json:"message"`
	Fields  map[string]string `json:"fields"`
}

type OthersMetricsData added in v1.1.6

type OthersMetricsData struct {
	GasUsedInWindow uint64 `json:"gasUsed"`
}

OthersMetricsData represents metrics for non-spammer transactions

type PendingTransactionEntry added in v1.1.8

type PendingTransactionEntry struct {
	Hash             string `json:"hash"`
	WalletAddress    string `json:"wallet_address"`
	WalletName       string `json:"wallet_name"`   // Human-readable wallet name
	ScenarioName     string `json:"scenario_name"` // Scenario name (if applicable)
	SpammerID        int64  `json:"spammer_id"`    // Spammer ID (if applicable)
	Nonce            uint64 `json:"nonce"`
	Value            string `json:"value"`              // In wei as string
	ValueFormatted   string `json:"value_formatted"`    // Formatted for display
	Fee              string `json:"fee"`                // In wei as string
	FeeFormatted     string `json:"fee_formatted"`      // Formatted for display
	BaseFee          string `json:"base_fee"`           // In wei as string
	BaseFeeFormatted string `json:"base_fee_formatted"` // Formatted for display
	SubmittedAt      string `json:"submitted_at"`       // RFC3339 timestamp
	RebroadcastCount uint64 `json:"rebroadcast_count"`
	LastRebroadcast  string `json:"last_rebroadcast"` // RFC3339 timestamp
	RLPEncoded       string `json:"rlp_encoded"`      // RLP encoded transaction as hex string
}

PendingTransactionEntry represents a pending transaction in the API response

type PluginEntry added in v1.2.0

type PluginEntry struct {
	Name               string   `json:"name"`
	SourceType         string   `json:"source_type"`
	SourcePath         string   `json:"source_path"`
	MetadataName       string   `json:"metadata_name,omitempty"`
	MetadataBuildTime  string   `json:"metadata_build_time,omitempty"`
	MetadataGitVersion string   `json:"metadata_git_version,omitempty"`
	Scenarios          []string `json:"scenarios"`
	Enabled            bool     `json:"enabled"`
	LoadError          string   `json:"load_error,omitempty"`
	RunningCount       int32    `json:"running_count"`
	IsLoaded           bool     `json:"is_loaded"`
	Deprecated         bool     `json:"deprecated"`
	CreatedAt          int64    `json:"created_at"`
	UpdatedAt          int64    `json:"updated_at"`
}

PluginEntry represents a plugin in the API response.

type RegisterPluginRequest added in v1.2.0

type RegisterPluginRequest struct {
	Type string `json:"type"` // "url", "local", or "upload" (upload uses multipart)
	Path string `json:"path"` // URL or local path
}

RegisterPluginRequest represents the request body for registering a plugin.

type RegisterPluginResponse added in v1.2.0

type RegisterPluginResponse struct {
	Name      string   `json:"name"`
	Scenarios []string `json:"scenarios"`
}

RegisterPluginResponse represents the response after registering a plugin.

type SSEState added in v1.1.6

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

SSE state tracking

type ScenarioCategory added in v1.1.16

type ScenarioCategory struct {
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Scenarios   []*ScenarioEntry    `json:"scenarios,omitempty"`
	Children    []*ScenarioCategory `json:"children,omitempty"`
}

ScenarioCategory represents a category of scenarios in the API response.

type ScenarioEntry added in v1.1.16

type ScenarioEntry struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Plugin      string `json:"plugin,omitempty"` // Plugin name if from a plugin, empty for native scenarios
}

ScenarioEntry represents a single scenario in the API response.

type SendTransactionRequest added in v1.1.10

type SendTransactionRequest struct {
	To       string `json:"to"`                 // Target address (required)
	Value    string `json:"value"`              // Amount in specified unit (required)
	Unit     string `json:"unit"`               // Unit: "eth", "gwei", or "wei" (required)
	Data     string `json:"data,omitempty"`     // Hex encoded calldata (optional, default: "0x")
	GasLimit uint64 `json:"gasLimit,omitempty"` // Gas limit (optional; 0 = auto: 21,000 pre-Amsterdam, MinIntrinsicGas or 21k+112·cpsb on Amsterdam, 100,000 for contract calls)
	MaxFee   string `json:"maxFee,omitempty"`   // Max fee per gas in gwei (optional)
	MaxTip   string `json:"maxTip,omitempty"`   // Max priority fee per gas in gwei (optional)
}

SendTransactionRequest represents the request body for sending a transaction from root wallet

type SendTransactionResponse added in v1.1.10

type SendTransactionResponse struct {
	TxHash string `json:"txHash"`
	Nonce  uint64 `json:"nonce"`
}

SendTransactionResponse represents the response after sending a transaction

type SpammerBlockData added in v1.1.6

type SpammerBlockData struct {
	GasUsed          uint64 `json:"gas"`
	ConfirmedTxCount uint64 `json:"confirmed"`
	PendingTxCount   uint64 `json:"pending"`
	SubmittedTxCount uint64 `json:"submitted"`
}

SpammerBlockData represents a spammer's data within a time period

type SpammerDetails

type SpammerDetails struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Scenario    string `json:"scenario"`
	Config      string `json:"config"`
	Status      int    `json:"status"`
}

SpammerDetails represents detailed information about a spammer

type SpammerLibraryEntry added in v1.1.6

type SpammerLibraryEntry struct {
	File         string   `json:"file"`
	Name         string   `json:"name"`
	Description  string   `json:"description"`
	Tags         []string `json:"tags"`
	SpammerCount int      `json:"spammer_count"`
	Scenarios    []string `json:"scenarios"`
	MinVersion   string   `json:"min_version,omitempty"`
}

SpammerLibraryEntry represents a spammer config from the library

type SpammerLibraryIndex added in v1.1.6

type SpammerLibraryIndex struct {
	Generated time.Time             `json:"generated"`
	Configs   []SpammerLibraryEntry `json:"configs"`
	CachedAt  time.Time             `json:"cached_at"`
	BaseURL   string                `json:"base_url"`
}

SpammerLibraryIndex represents the index of all available configs

type SpammerListEntry

type SpammerListEntry struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Scenario    string `json:"scenario"`
	Status      int    `json:"status"`
	CreatedAt   string `json:"created_at"` // RFC3339Nano formatted timestamp
}

type SpammerMetricsData added in v1.1.6

type SpammerMetricsData struct {
	ID               uint64 `json:"id"`
	Name             string `json:"name"`
	PendingTxCount   uint64 `json:"pending"`
	ConfirmedTxCount uint64 `json:"confirmed"`
	SubmittedTxCount uint64 `json:"submitted"`
	GasUsedInWindow  uint64 `json:"gasUsed"`
	LastUpdate       string `json:"updated"`
	Status           int    `json:"status"` // Running status from daemon
}

SpammerMetricsData represents metrics for a single spammer

type SpammerTimeSeriesPoint added in v1.1.6

type SpammerTimeSeriesPoint struct {
	Timestamp        time.Time `json:"timestamp"`
	BlockNumber      uint64    `json:"blockNumber"`
	GasUsed          uint64    `json:"gasUsed"`
	ConfirmedTxCount uint64    `json:"confirmedTxCount"`
	PendingTxCount   uint64    `json:"pendingTxCount"`
}

SpammerTimeSeriesPoint represents a single time-series point for a spammer

type SpammerTimeSeriesResponse added in v1.1.6

type SpammerTimeSeriesResponse struct {
	SpammerID   uint64                   `json:"spammerId"`
	SpammerName string                   `json:"spammerName"`
	TimeRange   TimeRange                `json:"timeRange"`
	DataPoints  []SpammerTimeSeriesPoint `json:"dataPoints"`
}

SpammerTimeSeriesResponse represents time-series data for a specific spammer

type TimeRange added in v1.1.6

type TimeRange struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

TimeRange represents the time range of collected metrics

type TotalMetricsData added in v1.1.6

type TotalMetricsData struct {
	PendingTxCount   uint64 `json:"pending"`
	ConfirmedTxCount uint64 `json:"confirmed"`
	SubmittedTxCount uint64 `json:"submitted"`
	GasUsedInWindow  uint64 `json:"gasUsed"`
}

TotalMetricsData represents aggregated metrics across all spammers

type UpdateClientEnabledRequest added in v1.1.5

type UpdateClientEnabledRequest struct {
	Enabled bool `json:"enabled"`
}

UpdateClientEnabledRequest represents the request body for updating a client's enabled state

type UpdateClientGroupRequest added in v1.1.5

type UpdateClientGroupRequest struct {
	Group  string   `json:"group,omitempty"`  // Single group for backward compatibility
	Groups []string `json:"groups,omitempty"` // Multiple groups
}

UpdateClientGroupRequest represents the request body for updating a client group

type UpdateClientNameRequest added in v1.1.6

type UpdateClientNameRequest struct {
	NameOverride string `json:"name_override"`
}

UpdateClientNameRequest represents the request body for updating a client's name override

type UpdateClientTypeRequest added in v1.1.9

type UpdateClientTypeRequest struct {
	ClientType string `json:"client_type"`
}

UpdateClientTypeRequest represents the request body for updating a client's type

type UpdateSpammerRequest

type UpdateSpammerRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Config      string `json:"config"`
}

UpdateSpammerRequest represents the request body for updating a spammer

type VersionResponse added in v1.1.6

type VersionResponse struct {
	Version string `json:"version"`
	Release string `json:"release"`
}

VersionResponse represents version information

Jump to

Keyboard shortcuts

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