Search in sources :

Example 1 with ConstructionSubmitResponse

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

the class ConstructionSubmitHandler method handleRequest.

@Override
public ConstructionSubmitResponse handleRequest(ConstructionSubmitRequest request) throws CoreApiException {
    modelMapper.verifyNetwork(request.getNetworkIdentifier());
    var txn = modelMapper.txn(request.getSignedTransaction());
    try {
        radixEngineStateComputer.addToMempool(txn);
        return new ConstructionSubmitResponse().transactionIdentifier(modelMapper.transactionIdentifier(txn.getId())).duplicate(false);
    } catch (MempoolDuplicateException e) {
        return new ConstructionSubmitResponse().transactionIdentifier(modelMapper.transactionIdentifier(txn.getId())).duplicate(true);
    } catch (MempoolFullException e) {
        throw modelMapper.mempoolFullException(e);
    } catch (MempoolRejectedException e) {
        var reException = (RadixEngineException) e.getCause();
        throw modelMapper.radixEngineException(reException);
    }
}
Also used : MempoolDuplicateException(com.radixdlt.mempool.MempoolDuplicateException) MempoolRejectedException(com.radixdlt.mempool.MempoolRejectedException) ConstructionSubmitResponse(com.radixdlt.api.core.openapitools.model.ConstructionSubmitResponse) MempoolFullException(com.radixdlt.mempool.MempoolFullException)

Aggregations

ConstructionSubmitResponse (com.radixdlt.api.core.openapitools.model.ConstructionSubmitResponse)1 MempoolDuplicateException (com.radixdlt.mempool.MempoolDuplicateException)1 MempoolFullException (com.radixdlt.mempool.MempoolFullException)1 MempoolRejectedException (com.radixdlt.mempool.MempoolRejectedException)1