-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paul Harris <paul.harris@consensys.net>
- Loading branch information
Showing
21 changed files
with
896 additions
and
26 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
19 changes: 19 additions & 0 deletions
19
...n-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/PendingBalanceDeposit.json
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,19 @@ | ||
{ | ||
"title" : "PendingBalanceDeposit", | ||
"type" : "object", | ||
"required" : [ "index", "amount" ], | ||
"properties" : { | ||
"index" : { | ||
"type" : "string", | ||
"description" : "unsigned 64 bit integer", | ||
"example" : "1", | ||
"format" : "uint64" | ||
}, | ||
"amount" : { | ||
"type" : "string", | ||
"description" : "unsigned 64 bit integer", | ||
"example" : "1", | ||
"format" : "uint64" | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...on-test/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/PendingConsolidation.json
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,19 @@ | ||
{ | ||
"title" : "PendingConsolidation", | ||
"type" : "object", | ||
"required" : [ "source_index", "target_index" ], | ||
"properties" : { | ||
"source_index" : { | ||
"type" : "string", | ||
"description" : "unsigned 64 bit integer", | ||
"example" : "1", | ||
"format" : "uint64" | ||
}, | ||
"target_index" : { | ||
"type" : "string", | ||
"description" : "unsigned 64 bit integer", | ||
"example" : "1", | ||
"format" : "uint64" | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...est/resources/tech/pegasys/teku/beaconrestapi/beacon/schema/PendingPartialWithdrawal.json
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,25 @@ | ||
{ | ||
"title" : "PendingPartialWithdrawal", | ||
"type" : "object", | ||
"required" : [ "index", "amount", "withdrawable_epoch" ], | ||
"properties" : { | ||
"index" : { | ||
"type" : "string", | ||
"description" : "unsigned 64 bit integer", | ||
"example" : "1", | ||
"format" : "uint64" | ||
}, | ||
"amount" : { | ||
"type" : "string", | ||
"description" : "unsigned 64 bit integer", | ||
"example" : "1", | ||
"format" : "uint64" | ||
}, | ||
"withdrawable_epoch" : { | ||
"type" : "string", | ||
"description" : "unsigned 64 bit integer", | ||
"example" : "1", | ||
"format" : "uint64" | ||
} | ||
} | ||
} |
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
.../serializer/src/main/java/tech/pegasys/teku/api/schema/electra/PendingBalanceDeposit.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 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.api.schema.electra; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Optional; | ||
import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; | ||
import tech.pegasys.teku.infrastructure.unsigned.UInt64; | ||
import tech.pegasys.teku.spec.SpecVersion; | ||
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsElectra; | ||
|
||
public class PendingBalanceDeposit { | ||
|
||
@JsonProperty("index") | ||
public final int index; | ||
|
||
@JsonProperty("amount") | ||
public final UInt64 amount; | ||
|
||
public PendingBalanceDeposit( | ||
@JsonProperty("index") int index, @JsonProperty("amount") UInt64 amount) { | ||
this.index = index; | ||
this.amount = amount; | ||
} | ||
|
||
public PendingBalanceDeposit( | ||
final tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingBalanceDeposit | ||
internalPendingBalanceDeposit) { | ||
this.index = internalPendingBalanceDeposit.getIndex(); | ||
this.amount = internalPendingBalanceDeposit.getAmount(); | ||
} | ||
|
||
public tech.pegasys.teku.spec.datastructures.state.versions.electra.PendingBalanceDeposit | ||
asInternalPendingBalanceDeposit(final SpecVersion spec) { | ||
final Optional<SchemaDefinitionsElectra> schemaDefinitionsElectra = | ||
spec.getSchemaDefinitions().toVersionElectra(); | ||
if (schemaDefinitionsElectra.isEmpty()) { | ||
throw new IllegalArgumentException( | ||
"Could not create PendingBalanceDeposit for pre-electra spec"); | ||
} | ||
return schemaDefinitionsElectra | ||
.get() | ||
.getPendingBalanceDepositSchema() | ||
.create(SszUInt64.of(UInt64.valueOf(this.index)), SszUInt64.of(this.amount)); | ||
} | ||
} |
Oops, something went wrong.