use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class TransactionsHandlerTest method retrieve_last_state_version.
@Test
public void retrieve_last_state_version() throws Exception {
// Arrange
start();
// Act
var request = new CommittedTransactionsRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).limit(1L).stateIdentifier(new PartialStateIdentifier().stateVersion(1L));
var response = handleRequestWithExpectedResponse(sut, request, CommittedTransactionsResponse.class);
// Assert
assertThat(response.getTransactions()).isEmpty();
var stateAccumulator = response.getStateIdentifier().getTransactionAccumulator();
var genesisAccumulator = genesis.getProof().getAccumulatorState().getAccumulatorHash().asBytes();
assertThat(stateAccumulator).isEqualTo(Bytes.toHexString(genesisAccumulator));
}
use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier 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;
}
use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class EntityHandlerTest method retrieve_validator_entity_on_genesis.
@Test
public void retrieve_validator_entity_on_genesis() throws Exception {
// Arrange
start();
// Act
var request = new EntityRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).entityIdentifier(coreModelMapper.entityIdentifier(selfKey()));
var response = handleRequestWithExpectedResponse(sut, request, EntityResponse.class);
// Assert
var stateAccumulator = response.getStateIdentifier().getTransactionAccumulator();
var genesisAccumulator = genesis.getProof().getAccumulatorState().getAccumulatorHash().asBytes();
assertThat(stateAccumulator).isEqualTo(Bytes.toHexString(genesisAccumulator));
assertThat(response.getDataObjects()).hasOnlyElementsOfTypes(ValidatorAllowDelegation.class, ValidatorMetadata.class, ValidatorSystemMetadata.class, PreparedValidatorOwner.class, PreparedValidatorFee.class, PreparedValidatorRegistered.class);
assertThat(response.getBalances()).isEmpty();
}
use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class EntityHandlerTest method retrieve_system_entity_on_genesis.
@Test
public void retrieve_system_entity_on_genesis() throws Exception {
// Arrange
start();
// Act
var request = new EntityRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).entityIdentifier(new EntityIdentifier().address("system"));
var response = handleRequestWithExpectedResponse(sut, request, EntityResponse.class);
// Assert
var stateAccumulator = response.getStateIdentifier().getTransactionAccumulator();
var genesisAccumulator = genesis.getProof().getAccumulatorState().getAccumulatorHash().asBytes();
assertThat(stateAccumulator).isEqualTo(Bytes.toHexString(genesisAccumulator));
assertThat(response.getBalances()).isEmpty();
assertThat(response.getDataObjects()).isNotEmpty();
}
use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class EntityHandlerTest method retrieve_native_token_on_genesis.
@Test
public void retrieve_native_token_on_genesis() throws Exception {
// Arrange
start();
// Act
var request = new EntityRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).entityIdentifier(coreModelMapper.entityIdentifier(REAddr.ofNativeToken(), "xrd"));
var response = handleRequestWithExpectedResponse(sut, request, EntityResponse.class);
// Assert
var stateAccumulator = response.getStateIdentifier().getTransactionAccumulator();
var genesisAccumulator = genesis.getProof().getAccumulatorState().getAccumulatorHash().asBytes();
assertThat(stateAccumulator).isEqualTo(Bytes.toHexString(genesisAccumulator));
assertThat(response.getBalances()).isEmpty();
assertThat(response.getDataObjects()).hasAtLeastOneElementOfType(TokenData.class);
assertThat(response.getDataObjects()).hasAtLeastOneElementOfType(TokenMetadata.class);
}
Aggregations