use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class EntityHandlerTest method retrieve_validator_system_entity_on_genesis.
@Test
public void retrieve_validator_system_entity_on_genesis() throws Exception {
// Arrange
start();
// Act
var request = new EntityRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).entityIdentifier(coreModelMapper.entityIdentifierValidatorSystem(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(ValidatorBFTData.class, ValidatorData.class);
assertThat(response.getBalances()).containsExactly(coreModelMapper.nativeTokenAmount(getStakeAmount().toSubunits()));
}
use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class KeySignHandlerTest method sign_should_work_on_correct_transaction.
@Test
public void sign_should_work_on_correct_transaction() throws Exception {
// Arrange
start();
// Act
var from = REAddr.ofPubKeyAccount(selfKey());
var other = PrivateKeys.ofNumeric(2);
var to = REAddr.ofPubKeyAccount(other.getPublicKey());
var unsignedTxn = buildUnsignedTxn(from, to);
var request = new KeySignRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).publicKey(mapper.publicKey(selfKey())).unsignedTransaction(Bytes.toHexString(unsignedTxn));
var response = sut.handleRequest(request);
// Assert
assertThat(Bytes.fromHexString(response.getSignedTransaction())).isNotNull();
}
use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class KeySignHandlerTest method sign_should_fail_given_an_invalid_transaction.
@Test
public void sign_should_fail_given_an_invalid_transaction() throws Exception {
// Arrange
start();
// Act
var request = new KeySignRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).publicKey(mapper.publicKey(selfKey())).unsignedTransaction("badbadbadbad");
var response = handleRequestWithExpectedResponse(sut, request, UnexpectedError.class);
// Assert
assertThat(response.getDetails()).isInstanceOf(InvalidTransactionError.class);
}
use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class MempoolTransactionHandlerTest method retrieving_invalid_hash_should_throw.
@Test
public void retrieving_invalid_hash_should_throw() throws Exception {
// Arrange
start();
// Act
var request = new MempoolTransactionRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).transactionIdentifier(new TransactionIdentifier().hash("badbad"));
var response = handleRequestWithExpectedResponse(sut, request, UnexpectedError.class);
// Assert
assertThat(response.getDetails()).isInstanceOf(InvalidTransactionHashError.class);
}
use of com.radixdlt.api.core.openapitools.model.NetworkIdentifier in project radixdlt by radixdlt.
the class TransactionsHandlerTest method retrieving_illegal_state_version_should_throw_exception.
@Test
public void retrieving_illegal_state_version_should_throw_exception() 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, UnexpectedError.class);
// Assert
assertThat(response.getDetails()).isInstanceOf(InvalidPartialStateIdentifierError.class);
}
Aggregations