relay

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidatorsPath string = "validators"
	InfoPath       string = "info"
)

Variables

This section is empty.

Functions

func HandleError

func HandleError(w http.ResponseWriter, logger *slog.Logger, code int, err error)

Handles an error

func HandleSuccess

func HandleSuccess(w http.ResponseWriter, logger *slog.Logger, data any)

Handles a success

func NewBaseHandler

func NewBaseHandler(sp swcommon.IStakeWiseServiceProvider, logger *slog.Logger, ctx context.Context) *baseHandler

Create a new base handler

func ProcessApiRequest

func ProcessApiRequest(logger *slog.Logger, w http.ResponseWriter, r *http.Request, requestBody any) (url.Values, map[string]string)

Logs the request and returns the query args and path args

Types

type InfoResponse added in v1.3.0

type InfoResponse struct {
	Network string `json:"network"`
}

Response to the StakeWise Operator for an info reqest See https://docs.stakewise.io/operator/alternative-key-management/api-mode

type RelayServer

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

func NewRelayServer

func NewRelayServer(sp swcommon.IStakeWiseServiceProvider, ip string, port uint16) (*RelayServer, error)

func (*RelayServer) GetLogPath

func (s *RelayServer) GetLogPath() string

Get the path to the log file

func (*RelayServer) GetPort

func (s *RelayServer) GetPort() uint16

Get the port the server is listening on

func (*RelayServer) Start

func (s *RelayServer) Start(wg *sync.WaitGroup) error

Starts listening for incoming HTTP requests

func (*RelayServer) Stop

func (s *RelayServer) Stop() error

Stops the HTTP listener

type ValidatorInfo

type ValidatorInfo struct {
	// The public key of the validator
	PublicKey beacon.ValidatorPubkey `json:"public_key"`

	// The signature of the validator's deposit data
	DepositSignature string `json:"deposit_signature"`

	// The amount of Gwei to send for the deposit
	AmountGwei uint64 `json:"amount_gwei"`

	// The signature of the validator's exit message
	ExitSignature string `json:"exit_signature"`
}

Info about a validator that can be deposited See https://docs.stakewise.io/for-operators/operator-service/running-as-api-service

type ValidatorsRequest

type ValidatorsRequest struct {
	// The address of the vault that validators will be created for
	Vault common.Address `json:"vault"`

	// The validator index to start from when creating signed exit messages
	ValidatorsStartIndex int `json:"validators_start_index"`

	// Number of validators in current batch. Maximum batch size is determined by prococol config, currently 10.
	ValidatorsBatchSize int `json:"validators_batch_size"`

	// Total number of validators supplied by vault assets.
	// validators_total should be more than or equal to validators_count.
	// Relayer may use this value to allocate larger portions of validators in background.
	ValidatorsTotal int `json:"validators_total"`
}

Request from the StakeWise Operator to get validators See https://docs.stakewise.io/for-operators/operator-service/running-as-api-service

type ValidatorsResponse

type ValidatorsResponse struct {
	// List of validator deposit info that can be used
	Validators []ValidatorInfo `json:"validators"`

	// The signature from NodeSet for the validators
	ValidatorsManagerSignature string `json:"validators_manager_signature"`
}

Response to the StakeWise Operator for a request to get validators See https://docs.stakewise.io/for-operators/operator-service/running-as-api-service

Jump to

Keyboard shortcuts

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