mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 12:10:05 +00:00
d077483577
* v3 import renamings * tidy * fmt * rev * Update beacon-chain/core/epoch/precompute/reward_penalty_test.go * Update beacon-chain/core/helpers/validators_test.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/alias.go * Update beacon-chain/db/iface/BUILD.bazel * Update beacon-chain/db/kv/kv.go * Update beacon-chain/db/kv/state.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go * Update beacon-chain/sync/initial-sync/service.go * fix deps * fix bad replacements * fix bad replacements * change back * gohashtree version * fix deps Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com>
53 lines
1.8 KiB
Go
53 lines
1.8 KiB
Go
package apimiddleware
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
"github.com/prysmaticlabs/prysm/v3/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",
|
|
"/eth/v1/remotekeys",
|
|
"/eth/v1/validator/{pubkey}/feerecipient",
|
|
"/eth/v1/validator/{pubkey}/gas_limit",
|
|
}
|
|
}
|
|
|
|
// 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{}
|
|
case "/eth/v1/remotekeys":
|
|
endpoint.GetResponse = &listRemoteKeysResponseJson{}
|
|
endpoint.PostRequest = &importRemoteKeysRequestJson{}
|
|
endpoint.PostResponse = &importRemoteKeysResponseJson{}
|
|
endpoint.DeleteRequest = &deleteRemoteKeysRequestJson{}
|
|
endpoint.DeleteResponse = &deleteRemoteKeysResponseJson{}
|
|
case "/eth/v1/validator/{pubkey}/feerecipient":
|
|
endpoint.GetResponse = &getFeeRecipientByPubkeyResponseJson{}
|
|
endpoint.PostRequest = &setFeeRecipientByPubkeyRequestJson{}
|
|
case "/eth/v1/validator/{pubkey}/gas_limit":
|
|
endpoint.GetResponse = &getGasLimitResponseJson{}
|
|
default:
|
|
return nil, errors.New("invalid path")
|
|
}
|
|
endpoint.Path = path
|
|
return &endpoint, nil
|
|
}
|