13
13
14
14
package tech .pegasys .teku .validator .client .restapi .apis ;
15
15
16
- import static tech .pegasys .teku .infrastructure .http .HttpStatusCodes .SC_NOT_FOUND ;
17
16
import static tech .pegasys .teku .infrastructure .http .HttpStatusCodes .SC_OK ;
18
17
import static tech .pegasys .teku .infrastructure .json .types .CoreTypes .STRING_TYPE ;
19
18
import static tech .pegasys .teku .validator .client .restapi .ValidatorRestApi .TAG_GRAFFITI ;
20
19
import static tech .pegasys .teku .validator .client .restapi .ValidatorTypes .PARAM_PUBKEY_TYPE ;
21
20
22
21
import com .fasterxml .jackson .core .JsonProcessingException ;
23
- import java .nio .charset .StandardCharsets ;
24
22
import java .util .Objects ;
25
23
import java .util .Optional ;
26
24
import java .util .function .Function ;
27
- import org .apache .tuweni . bytes . Bytes32 ;
25
+ import org .apache .commons . lang3 . NotImplementedException ;
28
26
import tech .pegasys .teku .bls .BLSPublicKey ;
29
27
import tech .pegasys .teku .infrastructure .json .types .SerializableTypeDefinition ;
30
28
import tech .pegasys .teku .infrastructure .restapi .endpoints .EndpointMetadata ;
31
29
import tech .pegasys .teku .infrastructure .restapi .endpoints .RestApiEndpoint ;
32
30
import tech .pegasys .teku .infrastructure .restapi .endpoints .RestApiRequest ;
33
- import tech .pegasys .teku .validator .client .KeyManager ;
34
- import tech .pegasys .teku .validator .client .Validator ;
35
31
36
32
public class GetGraffiti extends RestApiEndpoint {
37
33
public static final String ROUTE = "/eth/v1/validator/{pubkey}/graffiti" ;
38
- private final KeyManager keyManager ;
39
34
40
35
private static final SerializableTypeDefinition <GraffitiResponse > GRAFFITI_TYPE =
41
36
SerializableTypeDefinition .object (GraffitiResponse .class )
@@ -49,7 +44,7 @@ public class GetGraffiti extends RestApiEndpoint {
49
44
.withField ("data" , GRAFFITI_TYPE , Function .identity ())
50
45
.build ();
51
46
52
- public GetGraffiti (final KeyManager keyManager ) {
47
+ public GetGraffiti () {
53
48
super (
54
49
EndpointMetadata .get (ROUTE )
55
50
.operationId ("getGraffiti" )
@@ -63,25 +58,11 @@ public GetGraffiti(final KeyManager keyManager) {
63
58
.withAuthenticationResponses ()
64
59
.withNotFoundResponse ()
65
60
.build ());
66
- this .keyManager = keyManager ;
67
61
}
68
62
69
63
@ Override
70
64
public void handleRequest (RestApiRequest request ) throws JsonProcessingException {
71
- final BLSPublicKey publicKey = request .getPathParameter (PARAM_PUBKEY_TYPE );
72
-
73
- final Optional <Validator > maybeValidator = keyManager .getValidatorByPublicKey (publicKey );
74
- if (maybeValidator .isEmpty ()) {
75
- request .respondError (SC_NOT_FOUND , "Validator not found" );
76
- return ;
77
- }
78
-
79
- String graffiti = maybeValidator .get ().getGraffiti ().map (this ::processGraffitiBytes ).orElse ("" );
80
- request .respondOk (new GraffitiResponse (publicKey , graffiti ));
81
- }
82
-
83
- private String processGraffitiBytes (final Bytes32 graffiti ) {
84
- return new String (graffiti .toArrayUnsafe (), StandardCharsets .UTF_8 ).strip ().replace ("\0 " , "" );
65
+ throw new NotImplementedException ("Not implemented" );
85
66
}
86
67
87
68
static class GraffitiResponse {
0 commit comments