-
Notifications
You must be signed in to change notification settings - Fork 852
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add engine_getClientVersionV1 (#7512)
* add engine_getClientVersionV1 Signed-off-by: Matilda Clerke <[email protected]>
- Loading branch information
1 parent
b57310f
commit e0aa4f6
Showing
23 changed files
with
316 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...perledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineGetClientVersionV1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.engine; | ||
|
||
import org.hyperledger.besu.ethereum.ProtocolContext; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.ExecutionEngineJsonRpcMethod; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.EngineGetClientVersionResultV1; | ||
|
||
import io.vertx.core.Vertx; | ||
|
||
public class EngineGetClientVersionV1 extends ExecutionEngineJsonRpcMethod { | ||
private static final String ENGINE_CLIENT_CODE = "BU"; | ||
private static final String ENGINE_CLIENT_NAME = "Besu"; | ||
|
||
private final String clientVersion; | ||
private final String commit; | ||
|
||
public EngineGetClientVersionV1( | ||
final Vertx vertx, | ||
final ProtocolContext protocolContext, | ||
final EngineCallListener engineCallListener, | ||
final String clientVersion, | ||
final String commit) { | ||
super(vertx, protocolContext, engineCallListener); | ||
this.clientVersion = clientVersion; | ||
this.commit = commit; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return RpcMethod.ENGINE_GET_CLIENT_VERSION_V1.getMethodName(); | ||
} | ||
|
||
@Override | ||
public JsonRpcResponse syncResponse(final JsonRpcRequestContext request) { | ||
return new JsonRpcSuccessResponse( | ||
request.getRequest().getId(), | ||
new EngineGetClientVersionResultV1( | ||
ENGINE_CLIENT_CODE, ENGINE_CLIENT_NAME, clientVersion, commit)); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...yperledger/besu/ethereum/api/jsonrpc/internal/results/EngineGetClientVersionResultV1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.results; | ||
|
||
import com.fasterxml.jackson.annotation.JsonGetter; | ||
|
||
public class EngineGetClientVersionResultV1 { | ||
private final String code; | ||
private final String name; | ||
private final String version; | ||
private final String commit; | ||
|
||
public EngineGetClientVersionResultV1( | ||
final String code, final String name, final String version, final String commit) { | ||
this.code = code; | ||
this.name = name; | ||
this.version = version; | ||
this.commit = commit; | ||
} | ||
|
||
@JsonGetter(value = "code") | ||
public String getCode() { | ||
return code; | ||
} | ||
|
||
@JsonGetter(value = "name") | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@JsonGetter(value = "version") | ||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
@JsonGetter(value = "commit") | ||
public String getCommit() { | ||
return commit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.