Search in sources :

Example 1 with EngineConfigurationRequest

use of com.radixdlt.api.core.openapitools.model.EngineConfigurationRequest in project radixdlt by radixdlt.

the class EngineConfigurationHandlerTest method engine_configuration_should_return_correct_data.

@Test
public void engine_configuration_should_return_correct_data() throws Exception {
    // Arrange
    start();
    // Act
    var request = new EngineConfigurationRequest().networkIdentifier(networkIdentifier());
    var response = handleRequestWithExpectedResponse(sut, request, EngineConfigurationResponse.class);
    // Assert
    assertThat(response.getCheckpoints()).hasSize(1);
    assertThat(response.getCheckpoints().get(0).getCheckpointTransaction()).isEqualTo(Bytes.toHexString(genesis.getTxns().get(0).getPayload()));
    assertThat(response.getForks()).allMatch(fork -> fork.getEngineConfiguration().getMaximumMessageLength() == 255);
}
Also used : EngineConfigurationRequest(com.radixdlt.api.core.openapitools.model.EngineConfigurationRequest) ApiTest(com.radixdlt.api.ApiTest) Test(org.junit.Test)

Example 2 with EngineConfigurationRequest

use of com.radixdlt.api.core.openapitools.model.EngineConfigurationRequest in project radixdlt by radixdlt.

the class NodeApiClient method submit.

public void submit(NodeTransactionAction action, boolean disableResourceAllocateAndDestroy) throws Exception {
    var networkIdentifier = networkIdentifier();
    var engineConfigurationResponse = engineConfigurationHandler.handleRequest(new EngineConfigurationRequest().networkIdentifier(networkIdentifier));
    var keyListResponse = keyListHandler.handleRequest(new KeyListRequest().networkIdentifier(networkIdentifier));
    var nodePublicKey = keyListResponse.getPublicKeys().get(0).getPublicKey();
    var configuration = engineConfigurationResponse.getForks().get(0).getEngineConfiguration();
    var accountIdentifier = deriveAccount(nodePublicKey);
    var operationGroups = action.toOperationGroups(configuration, this::selfDerive);
    var buildRequest = new ConstructionBuildRequest().networkIdentifier(networkIdentifier).feePayer(accountIdentifier).operationGroups(operationGroups).disableResourceAllocateAndDestroy(disableResourceAllocateAndDestroy);
    var buildResponse = constructionBuildHandler.handleRequest(buildRequest);
    var unsignedTransaction = buildResponse.getUnsignedTransaction();
    var response = keySignHandler.handleRequest(new KeySignRequest().networkIdentifier(networkIdentifier).publicKey(nodePublicKey).unsignedTransaction(unsignedTransaction));
    constructionSubmitHandler.handleRequest(new ConstructionSubmitRequest().networkIdentifier(networkIdentifier).signedTransaction(response.getSignedTransaction()));
}
Also used : EngineConfigurationRequest(com.radixdlt.api.core.openapitools.model.EngineConfigurationRequest) ConstructionBuildRequest(com.radixdlt.api.core.openapitools.model.ConstructionBuildRequest) KeyListRequest(com.radixdlt.api.core.openapitools.model.KeyListRequest) KeySignRequest(com.radixdlt.api.core.openapitools.model.KeySignRequest) ConstructionSubmitRequest(com.radixdlt.api.core.openapitools.model.ConstructionSubmitRequest)

Aggregations

EngineConfigurationRequest (com.radixdlt.api.core.openapitools.model.EngineConfigurationRequest)2 ApiTest (com.radixdlt.api.ApiTest)1 ConstructionBuildRequest (com.radixdlt.api.core.openapitools.model.ConstructionBuildRequest)1 ConstructionSubmitRequest (com.radixdlt.api.core.openapitools.model.ConstructionSubmitRequest)1 KeyListRequest (com.radixdlt.api.core.openapitools.model.KeyListRequest)1 KeySignRequest (com.radixdlt.api.core.openapitools.model.KeySignRequest)1 Test (org.junit.Test)1