Skip to content

Cardano Client Lib adapter

View Markdown ↗

testkit-ccl adapts YanoDevnetTestKit to Cardano Client Lib’s BackendService API. It is useful for Java tests where application code already depends on CCL abstractions and should run against an in-process Yano devnet.

This module is intentionally separate from testkit so the base testkit does not pull in cardano-client-backend.

In a JUnit 5 project already using the Java testkit, add the matching adapter version:

testImplementation "org.yanoproject:yano-testkit-ccl:${yanoVersion}"
  • YanoBackendService.from(kit): creates a CCL BackendService backed by a YanoDevnetTestKit.

Implemented service areas include the pieces needed for common devnet transaction workflows:

  • UtxoService
  • TransactionService
  • EpochService
  • BlockService

Unsupported CCL services fail loudly instead of returning misleading empty results.

import com.bloxbean.cardano.client.backend.api.BackendService;
import org.yanoproject.testkit.ccl.YanoBackendService;
import org.yanoproject.testkit.devnet.YanoDevnetExtension;
import org.yanoproject.testkit.devnet.YanoDevnetTestKit;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
class CclIntegrationTest {
@RegisterExtension
static YanoDevnetExtension yano = YanoDevnetExtension.devnet().startNode();
@Test
void usesCclBackendService(YanoDevnetTestKit kit) throws Exception {
BackendService backendService = YanoBackendService.from(kit);
var tip = backendService.getBlockService().getLatestBlock().getValue();
var params = backendService.getEpochService().getProtocolParameters().getValue();
// Pass backendService to application code that expects CCL.
}
}

YanoBackendService is embedded and in-process. It reads and writes through the public Yano testkit roles. It does not start a Yano app process and it does not use HTTP.

For tests that need the production HTTP surface, use testkit’s YanoAppProcess and a normal HTTP-backed CCL backend such as BFBackendService.

Protocol parameters are mapped from Yano’s runtime snapshots when available. The fallback JSON mapper supports both Cardano node-style camel-case protocol params and Blockfrost-compatible snake-case protocol params.

This adapter does not expose runtime internals and does not attempt to implement the full CCL backend surface. Add support only when a real Yano devnet workflow needs it, and prefer failing loudly for unsupported methods.