Skip to content

Commit

Permalink
Koios Alignment with 1.1.1 Bump Version to 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dudi Edri committed May 5, 2024
1 parent 8cbd7d4 commit 0efa579
Show file tree
Hide file tree
Showing 22 changed files with 393 additions and 17 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca
<td>Get the information about block protocol distribution in epoch</td>
</tr>
<tr>
<td rowspan="3">Block</td>
<td rowspan="4">Block</td>
<td>Block List</td>
<td>Get summarised details about all blocks (paginated - latest first)</td>
</tr>
Expand All @@ -108,6 +108,10 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca
<td>Block Transactions</td>
<td>Get a list of all transactions included in a provided block</td>
</tr>
<tr>
<td>Block Transactions (Detailed Info)</td>
<td>Get detailed information about transaction(s) for requested blocks</td>
</tr>
<tr>
<td rowspan="6">Transactions</td>
<td>UTxO Info</td>
Expand Down Expand Up @@ -200,7 +204,7 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca
<td>Get the staking history of an account</td>
</tr>
<tr>
<td rowspan="13">Asset</td>
<td rowspan="14">Asset</td>
<td>Asset List</td>
<td>Get the list of all native assets (paginated)</td>
</tr>
Expand Down Expand Up @@ -244,6 +248,10 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca
<td>Policy Asset Information</td>
<td>Get the information for all assets under the same policy</td>
</tr>
<tr>
<td>Policy Asset Mints</td>
<td>Get a list of mint or burn count details for all assets minted under a policy</td>
</tr>
<tr>
<td>Asset Summary</td>
<td>Get the summary of an asset (total transactions exclude minting/total wallets include only wallets with asset balance)</td>
Expand Down Expand Up @@ -335,7 +343,7 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca

| Koios Instance | Koios Java Client |
|:--------------:|:-----------------:|
| 1.1.0 | 1.18.1 |
| 1.1.1 | 1.18.2 |
| 1.0.10 | 1.17.3 |
| 1.0.9 | 1.16.3 |
| 1.0.8 | 1.15.2 |
Expand All @@ -352,13 +360,13 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca
<dependency>
<groupId>io.github.cardano-community</groupId>
<artifactId>koios-java-client</artifactId>
<version>1.18.1</version>
<version>1.18.2</version>
</dependency>
```

- For Gradle, add the following dependency to build.gradle
```
compile group: 'io.github.cardano-community', name: 'koios-java-client', version: '1.18.1'
compile group: 'io.github.cardano-community', name: 'koios-java-client', version: '1.18.2'
```

### Get Koios Backend Service (No API Token)
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.cardano-community</groupId>
<artifactId>koios-java-client</artifactId>
<version>1.18.1</version>
<version>1.18.2</version>
<name>${project.groupId}:${project.artifactId}</name>
<description>Koios Java Client is a Java REST Client library which allows interacting with Koios Server Instances using Java Objects</description>
<url>https://github.com/cardano-community/koios-java-client</url>
Expand All @@ -14,18 +14,18 @@
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<retrofit.version>2.9.0</retrofit.version>
<jackson-databind.version>2.15.2</jackson-databind.version>
<jackson-databind.version>2.16.1</jackson-databind.version>
<logging-interceptor.version>4.10.0</logging-interceptor.version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
<slf4j-api.version>2.0.7</slf4j-api.version>
<slf4j-api.version>2.0.12</slf4j-api.version>
<slf4j-reload4j.version>2.0.9</slf4j-reload4j.version>
<commons-collections4.version>4.4</commons-collections4.version>
<lombok.version>1.18.30</lombok.version>
<bcprov-jdk15to18.version>1.76</bcprov-jdk15to18.version>
<bcprov-jdk15to18.version>1.77</bcprov-jdk15to18.version>
<junit-jupiter.version>5.10.1</junit-jupiter.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
<maven-surefire-plugin.version>3.2.2</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.2.3</maven-surefire-plugin.version>
<junit-platform-surefire-provider.version>1.3.2</junit-platform-surefire-provider.version>
<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@
public class StakeAddress {

/**
* A Cardano staking address
* Cardano staking address (reward account) in bech32 format
*/
private String id;
private String stakeAddress;

/**
* Cardano staking address (reward account) in hex format
*/
private String stakeAddressHex;

/**
* Script hash in case the stake address is locked by a script
*/
private String scriptHash;
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ public interface AssetService {
*/
Result<List<PaymentAddress>> getNFTAddress(String assetPolicy, String assetName, Options options) throws ApiException;

/**
* Policy Asset Address List
* Get the list of addresses with quantity for each asset on the given policy
* <p><b>200</b> - Payment addresses currently holding the given NFT
* <p><b>400</b> - The server cannot process the request due to invalid input
* <p><b>401</b> - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
* <p><b>404</b> - The server does not recognise the combination of endpoint and parameters provided
*
* @param assetPolicy Asset Policy ID in hexadecimal format (hex) (required)
* @param options Filtering and Pagination options (optional)
* @return Result of Type List of {@link AssetAddress} for the given policy (including balances)
* @throws ApiException if an error occurs while attempting to invoke the API
*/
Result<List<AssetAddress>> getPolicyAssetAddressList(String assetPolicy, Options options) throws ApiException;

/**
* Asset Information
* Get the information of an asset incl first minting &amp; token registry metadata
Expand Down Expand Up @@ -148,6 +163,21 @@ public interface AssetService {
*/
Result<List<PolicyAssetInfo>> getPolicyAssetInformation(String assetPolicy, Options options) throws ApiException;

/**
* Policy Asset Mints
* Get a list of mint information for assets under requested policies
* <p><b>200</b> - List of mint or burn count details for all assets minted under a policy
* <p><b>400</b> - The server cannot process the request due to invalid input
* <p><b>401</b> - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
* <p><b>404</b> - The server does not recognise the combination of endpoint and parameters provided
*
* @param assetPolicy Asset Policy ID in hexadecimal format (hex) (required)
* @param options Filtering and Pagination options (optional)
* @return Result of Type List of {@link PolicyAssetMint}
* @throws ApiException if an error occurs while attempting to invoke the API
*/
Result<List<PolicyAssetMint>> getPolicyAssetMints(String assetPolicy, Options options) throws ApiException;

/**
* Policy Asset List
* Get the list of asset under the given policy (including balances)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ public interface AssetApi {
@GET("asset_nft_address")
Call<List<PaymentAddress>> getNFTAddress(@Query("_asset_policy") String assetPolicy, @Query("_asset_name") String assetName, @QueryMap Map<String, String> paramsMap);

/**
* Policy Asset Address List
*
* @param assetPolicy Asset Policy ID in hexadecimal format (hex)
* @param paramsMap Query Params
* @return List of addresses with quantity for each asset on the given policy
*/
@GET("policy_asset_addresses")
Call<List<AssetAddress>> getPolicyAssetAddressList(@Query("_asset_policy") String assetPolicy, @QueryMap Map<String, String> paramsMap);

@GET("asset_info")
Call<List<AssetInformation>> getAssetInformation(@Query("_asset_policy") String assetPolicy, @Query("_asset_name") String assetName);

Expand Down Expand Up @@ -78,6 +88,9 @@ public interface AssetApi {
@GET("policy_asset_info")
Call<List<PolicyAssetInfo>> getPolicyAssetInformation(@Query("_asset_policy") String assetPolicy, @QueryMap Map<String, String> paramsMap);

@GET("policy_asset_mints")
Call<List<PolicyAssetMint>> getPolicyAssetMints(@Query("_asset_policy") String assetPolicy, @QueryMap Map<String, String> paramsMap);

/**
* Get Policy Asset List
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public Result<List<PaymentAddress>> getNFTAddress(String assetPolicy, String ass
}
}

@Override
public Result<List<AssetAddress>> getPolicyAssetAddressList(String assetPolicy, Options options) throws ApiException {
validateHexFormat(assetPolicy);
Call<List<AssetAddress>> call = assetApi.getPolicyAssetAddressList(assetPolicy, optionsToParamMap(options));
try {
Response<List<AssetAddress>> response = (Response) execute(call);
return processResponse(response);
} catch (IOException e) {
throw new ApiException(e.getMessage(), e);
}
}

@Override
public Result<AssetInformation> getAssetInformation(String assetPolicy, String assetName) throws ApiException {
validateHexFormat(assetPolicy);
Expand Down Expand Up @@ -159,6 +171,18 @@ public Result<List<PolicyAssetInfo>> getPolicyAssetInformation(String assetPolic
}
}

@Override
public Result<List<PolicyAssetMint>> getPolicyAssetMints(String assetPolicy, Options options) throws ApiException {
validateHexFormat(assetPolicy);
Call<List<PolicyAssetMint>> call = assetApi.getPolicyAssetMints(assetPolicy, optionsToParamMap(options));
try {
Response<List<PolicyAssetMint>> response = (Response) execute(call);
return processResponse(response);
} catch (IOException e) {
throw new ApiException(e.getMessage(), e);
}
}

@Override
public Result<List<PolicyAsset>> getPolicyAssetList(String assetPolicy, Options options) throws ApiException {
validateHexFormat(assetPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class AssetAddress extends PaymentAddress {

/**
* Asset Name (hex)
*/
private String assetName;

/**
* A Cardano payment/base address (bech32 encoded)
*/
private String paymentAddress;

/**
* Cardano staking address (reward account) in bech32 format
*/
private String stakeAddress;

/**
* Asset balance on the payment address
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ public class AssetSummary {
* Total number of payment addresses (not belonging to registered wallets) holding the given asset
*/
private Long unstakedAddresses;

/**
* Total number of unique addresses holding the given asset
*/
private Long addresses;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ public class PaymentAddress {
* A Cardano payment/base address (bech32 encoded) for transaction's input UTxO
*/
private String paymentAddress;

/**
* Cardano staking address (reward account) in bech32 format
*/
private String stakeAddress;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package rest.koios.client.backend.api.asset.model;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
* Policy Asset Info
*/
@Getter
@Setter
@ToString
@NoArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class PolicyAssetMint {

/**
* Asset Name (hex)
*/
private String assetName;

/**
* Asset Name (ASCII)
*/
private String assetNameAscii;

/**
* The CIP14 fingerprint of the asset
*/
private String fingerprint;

/**
* Hash of the latest mint transaction
*/
private String mintingTxHash;

/**
* Total Supply
*/
private String totalSupply;

/**
* Count of total mint transactions
*/
private Integer mintCnt;

/**
* Count of total burn transactions
*/
private Integer burnCnt;

/**
* Creation Time
*/
private Integer creationTime;

/**
* A JSON array containing details about metadata within transaction
*/
private JsonNode mintingTxMetadata;

private Integer decimals;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import rest.koios.client.backend.api.block.model.Block;
import rest.koios.client.backend.api.block.model.BlockInfo;
import rest.koios.client.backend.api.block.model.BlockTxHash;
import rest.koios.client.backend.api.transactions.model.TxInfo;
import rest.koios.client.backend.factory.options.Options;

import java.util.List;
Expand Down Expand Up @@ -79,4 +80,26 @@ public interface BlockService {
* @throws ApiException if an error occurs while attempting to invoke the API
*/
Result<List<BlockTxHash>> getBlockTransactions(List<String> blockHashes, Options options) throws ApiException;

/**
* Block Transactions (Detailed Info)
* Get detailed information about transaction(s) for requested blocks
* <p><b>200</b> - Success!
* <p><b>401</b> - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
* <p><b>404</b> - The server does not recognise the combination of endpoint and parameters provided
*
* @param blockHashes List of Block Hashes in hex format (required)
* @param inputs Controls whether to include transaction inputs in the result
* @param metadata Controls whether to include transaction metadata in the result
* @param assets Controls whether to include assets involved within transaction the result
* @param withdrawals Controls whether to include any stake account reward withdrawals in the
* @param certs Controls whether to include transaction certificates in the result
* @param scripts Controls whether to include any details regarding
* @param options Filtering and Pagination options (optional)
* @return Result of Type List of {@link TxInfo} Included Transactions of a specific block
* @throws ApiException if an error occurs while attempting to invoke the API
*
*/
Result<List<TxInfo>> getBlockTransactionsInfo(List<String> blockHashes, Boolean inputs, Boolean metadata, Boolean assets,
Boolean withdrawals, Boolean certs, Boolean scripts, Options options) throws ApiException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import rest.koios.client.backend.api.block.model.Block;
import rest.koios.client.backend.api.block.model.BlockInfo;
import rest.koios.client.backend.api.block.model.BlockTxHash;
import rest.koios.client.backend.api.transactions.model.TxInfo;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
Expand Down Expand Up @@ -45,4 +46,14 @@ public interface BlockApi {
*/
@POST("block_txs")
Call<List<BlockTxHash>> getBlockTransactions(@Body Map<String, Object> requestBody, @QueryMap Map<String, String> paramsMap);

/**
* Get a list of all transactions included in provided blocks
*
* @param requestBody Array of Block Hash IDs
* @param paramsMap Options and Filters Map
* @return List of {@link BlockTxHash}
*/
@POST("block_tx_info")
Call<List<TxInfo>> getBlockTransactionsInfo(@Body Map<String, Object> requestBody, @QueryMap Map<String, String> paramsMap);
}
Loading

0 comments on commit 0efa579

Please sign in to comment.