use of com.radixdlt.api.core.openapitools.model.ConstructionBuildResponse in project radixdlt by radixdlt.
the class ConstructionBuildHandler method handleRequest.
@Override
public ConstructionBuildResponse handleRequest(ConstructionBuildRequest request) throws CoreApiException {
modelMapper.verifyNetwork(request.getNetworkIdentifier());
var operationTxBuilder = modelMapper.operationTxBuilder(request.getMessage(), request.getOperationGroups());
var feePayer = modelMapper.feePayerEntity(request.getFeePayer());
var disableAllocAndDestroy = request.getDisableResourceAllocateAndDestroy();
var disable = disableAllocAndDestroy != null && disableAllocAndDestroy;
TxBuilder builder;
try {
builder = radixEngine.constructWithFees(operationTxBuilder, disable, feePayer.accountAddress(), NotEnoughNativeTokensForFeesException::new);
} catch (TxBuilderException e) {
throw CoreApiException.badRequest(modelMapper.builderErrorDetails(e));
}
var unsignedTransaction = builder.buildForExternalSign();
return new ConstructionBuildResponse().unsignedTransaction(Bytes.toHexString(unsignedTransaction.blob())).payloadToSign(Bytes.toHexString(unsignedTransaction.hashToSign().asBytes()));
}
Aggregations