forked from Consensys/teku
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2271309
commit 55b68e2
Showing
27 changed files
with
244 additions
and
129 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
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
73 changes: 73 additions & 0 deletions
73
.../src/main/java/tech/pegasys/teku/ethereum/json/types/beacon/GetGenesisApiDataBuilder.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,73 @@ | ||
/* | ||
* Copyright Consensys Software Inc., 2024 | ||
* | ||
* 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. | ||
*/ | ||
|
||
package tech.pegasys.teku.ethereum.json.types.beacon; | ||
|
||
import static tech.pegasys.teku.ethereum.json.types.SharedApiTypes.withDataWrapper; | ||
import static tech.pegasys.teku.infrastructure.json.types.CoreTypes.BYTES32_TYPE; | ||
import static tech.pegasys.teku.infrastructure.json.types.CoreTypes.BYTES4_TYPE; | ||
import static tech.pegasys.teku.infrastructure.json.types.CoreTypes.UINT64_TYPE; | ||
|
||
import org.apache.tuweni.bytes.Bytes32; | ||
import tech.pegasys.teku.infrastructure.bytes.Bytes4; | ||
import tech.pegasys.teku.infrastructure.json.types.DeserializableTypeDefinition; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
|
||
public class GetGenesisApiDataBuilder { | ||
public static final DeserializableTypeDefinition<GetGenesisApiData> GET_GENESIS_API_DATA_TYPE = | ||
withDataWrapper( | ||
"GetGenesisResponse", | ||
DeserializableTypeDefinition.object( | ||
GetGenesisApiData.class, GetGenesisApiDataBuilder.class) | ||
.initializer(GetGenesisApiDataBuilder::new) | ||
.finisher(GetGenesisApiDataBuilder::build) | ||
.withField( | ||
"genesis_time", | ||
UINT64_TYPE, | ||
GetGenesisApiData::getGenesisTime, | ||
GetGenesisApiDataBuilder::genesisTime) | ||
.withField( | ||
"genesis_validators_root", | ||
BYTES32_TYPE, | ||
GetGenesisApiData::getGenesisValidatorsRoot, | ||
GetGenesisApiDataBuilder::genesisValidatorsRoot) | ||
.withField( | ||
"genesis_fork_version", | ||
BYTES4_TYPE, | ||
GetGenesisApiData::getGenesisForkVersion, | ||
GetGenesisApiDataBuilder::genesisForkVersion) | ||
.build()); | ||
|
||
private UInt64 genesisTime; | ||
private Bytes32 genesisValidatorsRoot; | ||
private Bytes4 genesisForkVersion; | ||
|
||
public GetGenesisApiDataBuilder genesisTime(UInt64 genesisTime) { | ||
this.genesisTime = genesisTime; | ||
return this; | ||
} | ||
|
||
public GetGenesisApiDataBuilder genesisValidatorsRoot(Bytes32 genesisValidatorsRoot) { | ||
this.genesisValidatorsRoot = genesisValidatorsRoot; | ||
return this; | ||
} | ||
|
||
public GetGenesisApiDataBuilder genesisForkVersion(Bytes4 genesisForkVersion) { | ||
this.genesisForkVersion = genesisForkVersion; | ||
return this; | ||
} | ||
|
||
public GetGenesisApiData build() { | ||
return new GetGenesisApiData(genesisTime, genesisValidatorsRoot, genesisForkVersion); | ||
} | ||
} |
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.