com.bloxbean.cardano.client.backend.api.DefaultProtocolParamsSupplier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cardano-client-backend Show documentation
Show all versions of cardano-client-backend Show documentation
Cardano Client Lib Backend Api Module
package com.bloxbean.cardano.client.backend.api;
import com.bloxbean.cardano.client.api.ProtocolParamsSupplier;
import com.bloxbean.cardano.client.api.exception.ApiException;
import com.bloxbean.cardano.client.api.exception.ApiRuntimeException;
import com.bloxbean.cardano.client.api.model.ProtocolParams;
import com.bloxbean.cardano.client.api.model.Result;
public class DefaultProtocolParamsSupplier implements ProtocolParamsSupplier {
private EpochService epochService;
public DefaultProtocolParamsSupplier(EpochService epochService) {
this.epochService = epochService;
}
@Override
public ProtocolParams getProtocolParams() {
try {
Result result = epochService.getProtocolParameters();
if (result.isSuccessful())
return result.getValue();
else
throw new ApiRuntimeException("Error fetching protocol params : " + result);
} catch (ApiException apiException) {
throw new ApiRuntimeException("Error fetching protocol params", apiException);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy