Java
Overview
Koios Java Client is a Java REST Client library which allows interacting with Koios Server Instances using Java Objects.
Features
Installation
Clone AND Build with Maven
git clone https://github.com/cardano-community/koios-java-client.git
cd koios-java-client
mvn clean install
Example
Below there is an example to study, while to see the full koios-java-client documentation you can find it here
Mainnet
// Add the dependency to your project. For Maven, add the following to your pom.xml:
<dependency>
<groupId>io.github.cardano-community</groupId>
<artifactId>koios-java-client</artifactId>
<version>1.16.3</version>
</dependency>
// For Gradle, add the following to your build.gradle:
compile group: 'io.github.cardano-community', name: 'koios-java-client', version: '1.16.3'
// Get the Koios Backend Service:
BackendService backendService = BackendFactory.getKoiosMainnetService();
// Get the Koios Backend Services:
NetworkService networkService = backendService.getNetworkService();
EpochService epochService = backendService.getEpochService();
BlockService blockService = backendService.getBlockService();
TransactionsService transactionsService = backendService.getTransactionsService();
AddressService addressService = backendService.getAddressService();
// Use the AddressService to query a descending order of all address transactions since block number 42248 to block number 69447 (inclusive), limited to a maximum of 10 results:
String address = "addr_test1qrvaadv0h7atv366u6966u4rft2svjlf5uajy8lkpsgdrc24rnskuetxz2u3m5ac22s3njvftxcl2fc8k8kjr088ge0qz98xmv";
Options options = Options.builder()
.option(Limit.of(10))
.option(Offset.of(0))
.option(Order.by("block_height", SortType.DESC))
.option(Filter.of("block_height", FilterType.GTE, "42248"))
.option(Filter.of("block_height", FilterType.LTE, "69447")).build();
Result<List<TxHash>> transactionsResult = addressService.getAddressTransactions(List.of(address), options);