mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-09 11:11:20 +00:00
424c8f6b46
* begin the middleware approach * attempt middleware * middleware works in tandem with web ui * handle delete as well * delete request * DELETE working * tool to perform imports * functioning * commentary * build * gaz * smol test * enable keymanager api use protonames * edit * one rule * rem gw * Fix custom compiler (cherry picked from commit 3b1f65919e04ddf7e07c8f60cba1be883a736476) * gen proto * imports * Update validator/node/node.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * remaining comments * update item * rpc * add * run gateway * simplify * rem flag * deep source Co-authored-by: prestonvanloon <preston@prysmaticlabs.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package apimiddleware
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
"github.com/prysmaticlabs/prysm/api/gateway/apimiddleware"
|
|
)
|
|
|
|
// ValidatorEndpointFactory creates endpoints used for running validator API calls through the API Middleware.
|
|
type ValidatorEndpointFactory struct {
|
|
}
|
|
|
|
func (f *ValidatorEndpointFactory) IsNil() bool {
|
|
return f == nil
|
|
}
|
|
|
|
// Paths is a collection of all valid validator API paths.
|
|
func (*ValidatorEndpointFactory) Paths() []string {
|
|
return []string{
|
|
"/eth/v1/keystores",
|
|
}
|
|
}
|
|
|
|
// Create returns a new endpoint for the provided API path.
|
|
func (*ValidatorEndpointFactory) Create(path string) (*apimiddleware.Endpoint, error) {
|
|
endpoint := apimiddleware.DefaultEndpoint()
|
|
switch path {
|
|
case "/eth/v1/keystores":
|
|
endpoint.GetResponse = &listKeystoresResponseJson{}
|
|
endpoint.PostRequest = &importKeystoresRequestJson{}
|
|
endpoint.PostResponse = &importKeystoresResponseJson{}
|
|
endpoint.DeleteRequest = &deleteKeystoresRequestJson{}
|
|
endpoint.DeleteResponse = &deleteKeystoresResponseJson{}
|
|
default:
|
|
return nil, errors.New("invalid path")
|
|
}
|
|
endpoint.Path = path
|
|
return &endpoint, nil
|
|
}
|