use of com.radixdlt.api.core.openapitools.model.EngineStatusRequest in project radixdlt by radixdlt.
the class EngineStatusHandlerTest method engine_configuration_should_return_correct_data.
@Test
public void engine_configuration_should_return_correct_data() throws Exception {
// Arrange
start();
// Act
var request = new EngineStatusRequest().networkIdentifier(new NetworkIdentifier().network("localnet"));
var response = handleRequestWithExpectedResponse(sut, request, EngineStatusResponse.class);
// Assert
assertThat(response.getValidatorSet()).containsExactly(new Validator().validatorAddress(addressing.forValidators().of(selfKey())).stake(getStakeAmount().toSubunits().toString()));
}
use of com.radixdlt.api.core.openapitools.model.EngineStatusRequest in project radixdlt by radixdlt.
the class NodeApiClient method getUnstakes.
public List<ResourceAmount> getUnstakes(REAddr addr, ECPublicKey validatorKey) {
var networkIdentifier = new NetworkIdentifier().network("localnet");
var unstakingDelayEpochLength = unstakingDelayEpochLength();
var unstakes = new ArrayList<ResourceAmount>();
try {
var statusResponse = engineStatusHandler.handleRequest(new EngineStatusRequest().networkIdentifier(networkIdentifier));
var curEpoch = statusResponse.getEngineStateIdentifier().getEpoch();
var maxEpoch = curEpoch + unstakingDelayEpochLength + 1;
for (long epochUnstake = curEpoch; epochUnstake <= maxEpoch; epochUnstake++) {
var response = entityHandler.handleRequest(new EntityRequest().networkIdentifier(networkIdentifier).entityIdentifier(coreModelMapper.entityIdentifierExitingStake(addr, validatorKey, epochUnstake)));
unstakes.addAll(response.getBalances());
}
} catch (CoreApiException e) {
throw new IllegalStateException(e);
}
return unstakes;
}
Aggregations