Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterMinipoolRoute ¶
func RegisterMinipoolRoute[ContextType IMinipoolCallContext[DataType], DataType any]( router *mux.Router, functionName string, factory IMinipoolCallContextFactory[ContextType, DataType], ctx context.Context, logger *log.Logger, serviceProvider *services.ServiceProvider, )
Registers a new route with the router, which will invoke the provided factory to create and execute the context for the route when it's called; use this for complex calls that will iterate over and query each minipool in the node
Types ¶
type IMinipoolCallContext ¶
type IMinipoolCallContext[DataType any] interface { // Initialize the context with any bootstrapping, requirements checks, or bindings it needs to set up Initialize() (types.ResponseStatus, error) // Used to get any supplemental state required during initialization - anything in here will be fed into an rp.Query() multicall GetState(node *node.Node, mc *batch.MultiCaller) // Check the initialized state after being queried to see if the response needs to be updated and the query can be ended prematurely // Return true if the function should continue, or false if it needs to end and just return the response as-is CheckState(node *node.Node, data *DataType) bool // Get whatever details of the given minipool are necessary; this will be passed into an rp.BatchQuery call, one run per minipool // belonging to the node GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int) // Prepare the response data using all of the provided artifacts PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *DataType) (types.ResponseStatus, error) }
Wrapper for callbacks used by functions that will query all of the node's minipools - they follow this pattern: Create bindings, query the chain, return prematurely if some state isn't correct, query all of the minipools, and process them to populate a response. Structs implementing this will handle the caller-specific functionality.
type IMinipoolCallContextFactory ¶
type IMinipoolCallContextFactory[ContextType IMinipoolCallContext[DataType], DataType any] interface { // Create the context for the route Create(args url.Values) (ContextType, error) }
Interface for minipool call context factories - these will be invoked during route handling to create the unique context for the route
type MinipoolHandler ¶
type MinipoolHandler struct {
// contains filtered or unexported fields
}
func NewMinipoolHandler ¶
func NewMinipoolHandler(logger *log.Logger, ctx context.Context, serviceProvider *services.ServiceProvider) *MinipoolHandler
func (*MinipoolHandler) RegisterRoutes ¶
func (h *MinipoolHandler) RegisterRoutes(router *mux.Router)
Source Files ¶
- begin-reduce-bond-details.go
- begin-reduce-bond.go
- can-change-withdrawal-creds.go
- change-withdrawal-creds.go
- close-details.go
- close.go
- delegate-details.go
- dissolve-details.go
- dissolve.go
- distribute-details.go
- distribute.go
- exit-details.go
- exit.go
- handler.go
- import-key.go
- minipool-context.go
- promote-details.go
- promote.go
- reduce-bond-details.go
- reduce-bond.go
- refund-details.go
- refund.go
- rescue-dissolved-details.go
- rescue-dissolved.go
- rollback-delegates.go
- set-use-latest-delegates.go
- settings.go
- stake-details.go
- stake.go
- status.go
- upgrade-delegates.go
- utils.go
- vanity.go