use of com.radixdlt.api.core.openapitools.model.ConstructionSubmitRequest 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()));
}
Aggregations