mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 02:02:18 +00:00
64f64f06bf
* removing flag requirement, can run web3signer without predefined public keys * placeholders for remote-keymanager-api * adding proto and accountschangedfeed * updating generated code * fix imports * fixing interface * adding work in progress apimiddleware code * started implementing functions for remote keymanager api * fixing generted code from proto * fixing protos * fixing import format * fixing proto generation again , didn't fix the first time * fixing imports again * continuing on implementing functions * implementing add function * implementing delete API function * handling errors for API * removing unusedcode and fixing format * fixing bazel * wip enable --web when running web3signer * fixing wallet check for web3signer * fixing apis * adding list remote keys unit test * import remote keys test * delete pubkeys tests * moving location of tests * adding unit tests * adding placeholder functions * adding more unit tests * fixing bazel * fixing build * fixing already slice issue with unit test * fixing linting * Update validator/client/validator.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/keymanager/types.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/node/node.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/keymanager/types.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/client/validator.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * adding comment on proto based on review * Update validator/keymanager/remote-web3signer/keymanager.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/keymanager/remote-web3signer/keymanager.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * adding generated code based on review * updating based on feedback * fixing imports * fixing formatting * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * fixing event call * fixing dependency * updating bazel * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * addressing comment from review Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl>
46 lines
1.4 KiB
Go
46 lines
1.4 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",
|
|
"/eth/v1/remotekeys",
|
|
}
|
|
}
|
|
|
|
// 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{}
|
|
default:
|
|
return nil, errors.New("invalid path")
|
|
}
|
|
endpoint.Path = path
|
|
return &endpoint, nil
|
|
}
|