stakeAddresses, Options options) throws ApiException;
+
/**
* Account UTxOs
- * Get a list of all UTxOs for a given stake address (account)
+ * Get a list of all UTxOs for a given stake address (account)s
* 200 - List of account UTxOs associated with stake address
*
400 - The server cannot process the request due to invalid input
*
401 - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
*
404 - The server does not recognise the combination of endpoint and parameters provided
*
- * @param stakeAddress Cardano staking address (reward account) in bech32 format
- * @param options Filtering and Pagination options (optional)
- * @return Result of Type List of {@link AccountUTxO} associated with stake address
+ * @param stakeAddresses List of Cardano stake address(es) in bech32 format
+ * @param extended Controls whether or not certain optional fields supported by a given endpoint are populated as a part of the call
+ * @param options Filtering and Pagination options (optional)
+ * @return Result of Type List of {@link UTxO} associated with stake address
* @throws ApiException if an error occurs while attempting to invoke the API
*/
- Result> getAccountUTxOs(String stakeAddress, Options options) throws ApiException;
+ Result> getAccountUTxOs(List stakeAddresses, boolean extended, Options options) throws ApiException;
/**
- * Account Information (Cached)
- * Get the cached account information for given stake addresses (accounts)
- * 200 - Success!
+ * Account Txs
+ * Get a list of all Txs for a given stake address (account)
+ *
200 - List of Txs associated with stake address (account)
+ *
400 - The server cannot process the request due to invalid input
*
401 - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
*
404 - The server does not recognise the combination of endpoint and parameters provided
*
- * @param stakeAddresses List of Cardano stake address(es) in bech32 format (required)
- * @param options Filtering and Pagination options (optional)
- * @return Result of Type List of {@link AccountInfo} per the specified payment or staking address
+ * @param stakeAddress Cardano staking address (reward account) in bech32 format
+ * @param afterBlockHeight Block height for specifying time delta
+ * @param options Filtering and Pagination options (optional)
+ * @return Result of Type List of {@link AccountTx} associated with stake address (account)
* @throws ApiException if an error occurs while attempting to invoke the API
*/
- Result> getCachedAccountInformation(List stakeAddresses, Options options) throws ApiException;
+ Result> getAccountTxs(String stakeAddress, Integer afterBlockHeight, Options options) throws ApiException;
/**
* Account Rewards
@@ -124,10 +142,10 @@ public interface AccountService {
* @param addressList Array of Cardano stake address(es) in bech32 format (required)
* @param epochNo Only fetch information for a specific epoch (optional)
* @param options Filtering and Pagination options (optional)
- * @return Result of Type List of {@link AccountAssets}
+ * @return Result of Type List of {@link AccountAsset}
* @throws ApiException if an error occurs while attempting to invoke the API
*/
- Result> getAccountAssets(List addressList, Integer epochNo, Options options) throws ApiException;
+ Result> getAccountAssets(List addressList, Integer epochNo, Options options) throws ApiException;
/**
* Account History
diff --git a/src/main/java/rest/koios/client/backend/api/account/api/AccountApi.java b/src/main/java/rest/koios/client/backend/api/account/api/AccountApi.java
index c25fea8..962d4f0 100644
--- a/src/main/java/rest/koios/client/backend/api/account/api/AccountApi.java
+++ b/src/main/java/rest/koios/client/backend/api/account/api/AccountApi.java
@@ -1,6 +1,7 @@
package rest.koios.client.backend.api.account.api;
import rest.koios.client.backend.api.account.model.*;
+import rest.koios.client.backend.api.base.common.UTxO;
import retrofit2.Call;
import retrofit2.http.*;
@@ -31,16 +32,6 @@ public interface AccountApi {
@POST("account_info")
Call> getAccountInformation(@Body Map requestBody, @QueryMap Map paramsMap);
- /**
- * Get Account UTxOs
- *
- * @param stakeAddress Cardano staking address (reward account) in bech32 format
- * @param paramsMap Query Params
- * @return List of account UTxOs associated with stake address
- */
- @GET("account_utxos")
- Call> getAccountUTxOs(@Query("_stake_address") String stakeAddress, @QueryMap Map paramsMap);
-
/**
* Get Account Information (Cached)
*
@@ -51,6 +42,27 @@ public interface AccountApi {
@POST("account_info_cached")
Call> getCachedAccountInformation(@Body Map requestBody, @QueryMap Map paramsMap);
+ /**
+ * Get Account UTxOs
+ *
+ * @param requestBody Json Body containing List of Cardano stake address(es) in bech32 format
+ * @param paramsMap Query Params
+ * @return List of account UTxOs associated with stake address
+ */
+ @POST("account_utxos")
+ Call> getAccountUTxOs(@Body Map requestBody, @QueryMap Map paramsMap);
+
+ /**
+ * Get Account Txs
+ *
+ * @param paramsMap Query Params
+ * @param stakeAddress Cardano staking address (reward account) in bech32 format
+ * @param blockHeight Block height for specifying time delta
+ * @return List of Txs associated with stake address (account)
+ */
+ @GET("account_txs")
+ Call> getAccountTxs(@Query("_stake_address") String stakeAddress, @Query("_after_block_height") Integer blockHeight, @QueryMap Map paramsMap);
+
/**
* Get Account Rewards
*
@@ -89,7 +101,7 @@ public interface AccountApi {
* @return Native asset balance of an account
*/
@POST("account_assets")
- Call> getAccountAssets(@Body Map requestBody, @QueryMap Map paramsMap);
+ Call> getAccountAssets(@Body Map requestBody, @QueryMap Map paramsMap);
/**
* Get Account History
diff --git a/src/main/java/rest/koios/client/backend/api/account/impl/AccountServiceImpl.java b/src/main/java/rest/koios/client/backend/api/account/impl/AccountServiceImpl.java
index ec661af..e9bc75e 100644
--- a/src/main/java/rest/koios/client/backend/api/account/impl/AccountServiceImpl.java
+++ b/src/main/java/rest/koios/client/backend/api/account/impl/AccountServiceImpl.java
@@ -5,6 +5,7 @@
import rest.koios.client.backend.api.account.model.*;
import rest.koios.client.backend.api.base.BaseService;
import rest.koios.client.backend.api.base.Result;
+import rest.koios.client.backend.api.base.common.UTxO;
import rest.koios.client.backend.api.base.exception.ApiException;
import rest.koios.client.backend.factory.options.Options;
import retrofit2.Call;
@@ -59,11 +60,13 @@ public Result> getAccountInformation(List stakeAddress
}
@Override
- public Result> getAccountUTxOs(String stakeAddress, Options options) throws ApiException {
- validateBech32(stakeAddress);
- Call> call = accountApi.getAccountUTxOs(stakeAddress, optionsToParamMap(options));
+ public Result> getCachedAccountInformation(List stakeAddresses, Options options) throws ApiException {
+ for (String address : stakeAddresses) {
+ validateBech32(address);
+ }
+ Call> call = accountApi.getCachedAccountInformation(buildBody("_stake_addresses", stakeAddresses, null, null, null), optionsToParamMap(options));
try {
- Response> response = (Response) execute(call);
+ Response> response = (Response) execute(call);
return processResponse(response);
} catch (IOException e) {
throw new ApiException(e.getMessage(), e);
@@ -71,13 +74,31 @@ public Result> getAccountUTxOs(String stakeAddress, Options op
}
@Override
- public Result> getCachedAccountInformation(List stakeAddresses, Options options) throws ApiException {
- for (String address : stakeAddresses) {
- validateBech32(address);
+ public Result> getAccountUTxOs(List stakeAddresses, boolean extended, Options options) throws ApiException {
+ for (String stakeAddress : stakeAddresses) {
+ validateBech32(stakeAddress);
}
- Call> call = accountApi.getCachedAccountInformation(buildBody("_stake_addresses", stakeAddresses, null, null, null), optionsToParamMap(options));
+ Call> call = accountApi.getAccountUTxOs(buildBodyUTxOs(stakeAddresses, extended), optionsToParamMap(options));
try {
- Response> response = (Response) execute(call);
+ Response> response = (Response) execute(call);
+ return processResponse(response);
+ } catch (IOException e) {
+ throw new ApiException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Result> getAccountTxs(String stakeAddress, Integer afterBlockHeight, Options options) throws ApiException {
+ validateBech32(stakeAddress);
+ if (afterBlockHeight == null) {
+ afterBlockHeight = 0;
+ }
+ if (afterBlockHeight < 0) {
+ throw new ApiException("Non Positive \"afterBlockHeight\" Value");
+ }
+ Call> call = accountApi.getAccountTxs(stakeAddress, afterBlockHeight, optionsToParamMap(options));
+ try {
+ Response> response = (Response) execute(call);
return processResponse(response);
} catch (IOException e) {
throw new ApiException(e.getMessage(), e);
@@ -130,16 +151,16 @@ public Result> getAccountAddresses(List addressList
}
@Override
- public Result> getAccountAssets(List addressList, Integer epochNo, Options options) throws ApiException {
+ public Result> getAccountAssets(List addressList, Integer epochNo, Options options) throws ApiException {
for (String address : addressList) {
validateBech32(address);
}
if (epochNo != null) {
validateEpoch(epochNo);
}
- Call> call = accountApi.getAccountAssets(buildBody("_stake_addresses", addressList, epochNo, null, null), optionsToParamMap(options));
+ Call> call = accountApi.getAccountAssets(buildBody("_stake_addresses", addressList, epochNo, null, null), optionsToParamMap(options));
try {
- Response> response = (Response) execute(call);
+ Response> response = (Response) execute(call);
return processResponse(response);
} catch (IOException e) {
throw new ApiException(e.getMessage(), e);
@@ -177,4 +198,11 @@ private Map buildBody(String arrayObjString, List list,
}
return bodyMap;
}
+
+ private Map buildBodyUTxOs(List stakeAddresses, boolean extended) {
+ Map bodyMap = new HashMap<>();
+ bodyMap.put("_stake_addresses", stakeAddresses);
+ bodyMap.put("_extended", extended);
+ return bodyMap;
+ }
}
diff --git a/src/main/java/rest/koios/client/backend/api/account/model/AccountAssets.java b/src/main/java/rest/koios/client/backend/api/account/model/AccountAsset.java
similarity index 74%
rename from src/main/java/rest/koios/client/backend/api/account/model/AccountAssets.java
rename to src/main/java/rest/koios/client/backend/api/account/model/AccountAsset.java
index 926bdb5..7ed2d84 100644
--- a/src/main/java/rest/koios/client/backend/api/account/model/AccountAssets.java
+++ b/src/main/java/rest/koios/client/backend/api/account/model/AccountAsset.java
@@ -6,9 +6,7 @@
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
-import rest.koios.client.backend.api.common.Asset;
-
-import java.util.List;
+import rest.koios.client.backend.api.base.common.Asset;
/**
* Account Assets
@@ -18,15 +16,10 @@
@ToString
@NoArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
-public class AccountAssets {
+public class AccountAsset extends Asset {
/**
* Cardano staking address (reward account) in bech32 format
*/
private String stakeAddress;
-
- /**
- * List of Assets
- */
- private List assetList;
}
diff --git a/src/main/java/rest/koios/client/backend/api/account/model/AccountUTxO.java b/src/main/java/rest/koios/client/backend/api/account/model/AccountTx.java
similarity index 63%
rename from src/main/java/rest/koios/client/backend/api/account/model/AccountUTxO.java
rename to src/main/java/rest/koios/client/backend/api/account/model/AccountTx.java
index f2e5661..e7ed2f0 100644
--- a/src/main/java/rest/koios/client/backend/api/account/model/AccountUTxO.java
+++ b/src/main/java/rest/koios/client/backend/api/account/model/AccountTx.java
@@ -8,34 +8,24 @@
import lombok.ToString;
/**
- * AccountUTxO
+ * Account Tx
*/
@Getter
@Setter
@ToString
@NoArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
-public class AccountUTxO {
+public class AccountTx {
/**
- * Hash of transaction for UTxO
+ * Hash identifier of the transaction
*/
private String txHash;
/**
- * Index of UTxO in the transaction
+ * Epoch number of the block
*/
- private Integer txIndex;
-
- /**
- * A Cardano payment/base address (bech32 encoded) for transaction's input UTxO
- */
- private String address;
-
- /**
- * Total sum of ADA on the UTxO
- */
- private String value;
+ private Integer epochNo;
/**
* Block height
diff --git a/src/main/java/rest/koios/client/backend/api/address/AddressService.java b/src/main/java/rest/koios/client/backend/api/address/AddressService.java
index 49685b1..6bd3bb2 100644
--- a/src/main/java/rest/koios/client/backend/api/address/AddressService.java
+++ b/src/main/java/rest/koios/client/backend/api/address/AddressService.java
@@ -1,9 +1,10 @@
package rest.koios.client.backend.api.address;
-import rest.koios.client.backend.api.common.TxHash;
+import rest.koios.client.backend.api.base.common.TxHash;
import rest.koios.client.backend.api.address.model.AddressAsset;
import rest.koios.client.backend.api.address.model.AddressInfo;
import rest.koios.client.backend.api.base.Result;
+import rest.koios.client.backend.api.base.common.UTxO;
import rest.koios.client.backend.api.base.exception.ApiException;
import rest.koios.client.backend.factory.options.Options;
import rest.koios.client.backend.factory.options.SortType;
@@ -43,6 +44,36 @@ public interface AddressService {
*/
Result getAddressInformation(List addressList, SortType utxoSortType, Options options) throws ApiException;
+ /**
+ * Address UTXOs
+ * Get UTxO set for given addresses
+ * 200 - List of address UTxOs
+ *
401 - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
+ *
404 - The server does not recognise the combination of endpoint and parameters provided
+ *
+ * @param addresses List of Cardano payment address(es) in bech32 format
+ * @param extended Controls whether or not certain optional fields supported by a given endpoint are populated as a part of the call
+ * @param options Filtering and Pagination options (optional)
+ * @return Result of Type List of address {@link UTxO}s.
+ * @throws ApiException if an error occurs while attempting to invoke the API
+ */
+ Result> getAddressUTxOs(List addresses, boolean extended, Options options) throws ApiException;
+
+ /**
+ * UTxOs from payment credentials
+ * Get UTxO details for requested payment credentials
+ * 200 - List of address UTxOs
+ *
401 - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
+ *
404 - The server does not recognise the combination of endpoint and parameters provided
+ *
+ * @param paymentCredentials List of Cardano payment credential(s) in hex format
+ * @param extended Controls whether or not certain optional fields supported by a given endpoint are populated as a part of the call
+ * @param options Filtering and Pagination options (optional)
+ * @return Result of Type List of address {@link UTxO}s.
+ * @throws ApiException if an error occurs while attempting to invoke the API
+ */
+ Result> getUTxOsFromPaymentCredentials(List paymentCredentials, boolean extended, Options options) throws ApiException;
+
/**
* Address Transactions with Filtering, Pagination, Ordering Options
* Get the transaction hash list of input address array
diff --git a/src/main/java/rest/koios/client/backend/api/address/api/AddressApi.java b/src/main/java/rest/koios/client/backend/api/address/api/AddressApi.java
index b96e2b5..257dcfe 100644
--- a/src/main/java/rest/koios/client/backend/api/address/api/AddressApi.java
+++ b/src/main/java/rest/koios/client/backend/api/address/api/AddressApi.java
@@ -1,8 +1,9 @@
package rest.koios.client.backend.api.address.api;
-import rest.koios.client.backend.api.common.TxHash;
+import rest.koios.client.backend.api.base.common.TxHash;
import rest.koios.client.backend.api.address.model.AddressAsset;
import rest.koios.client.backend.api.address.model.AddressInfo;
+import rest.koios.client.backend.api.base.common.UTxO;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
@@ -27,12 +28,33 @@ public interface AddressApi {
@POST("address_info")
Call> getAddressInformation(@Body Map requestBody, @QueryMap Map paramsMap);
+ /**
+ * Get Address UTxOs
+ *
+ * @param requestBody Json Body containing List of Cardano payment address(es) in bech32 format
+ * @param paramsMap Query Params
+ * @return List of complete UTxO information
+ */
+ @POST("address_utxos")
+ Call> getAddressUTxOs(@Body Map requestBody, @QueryMap Map paramsMap);
+
+ /**
+ * UTxOs from payment credentials
+ * Get UTxO details for requested payment credentials
+ *
+ * @param requestBody Json Body containing List of Cardano payment credential(s) in hex format
+ * @param paramsMap Query Params
+ * @return List of complete UTxO information
+ */
+ @POST("credential_utxos")
+ Call> getUTxOsFromPaymentCredentials(@Body Map requestBody, @QueryMap Map paramsMap);
+
/**
* Address Transactions
* Get the transaction hash list of input address array, optionally filtering after specified block height (inclusive)
*
* @param requestBody Array of Cardano payment address(es) in bech32 format
- * @param paramsMap Options and Filters Map
+ * @param paramsMap Options and Filters Map
* @return List of {@link TxHash}
*/
@POST("address_txs")
diff --git a/src/main/java/rest/koios/client/backend/api/address/impl/AddressServiceImpl.java b/src/main/java/rest/koios/client/backend/api/address/impl/AddressServiceImpl.java
index d137031..4c8d783 100644
--- a/src/main/java/rest/koios/client/backend/api/address/impl/AddressServiceImpl.java
+++ b/src/main/java/rest/koios/client/backend/api/address/impl/AddressServiceImpl.java
@@ -1,13 +1,14 @@
package rest.koios.client.backend.api.address.impl;
-import rest.koios.client.backend.api.address.AddressService;
import rest.koios.client.backend.api.address.api.AddressApi;
+import rest.koios.client.backend.api.address.AddressService;
import rest.koios.client.backend.api.address.model.AddressAsset;
import rest.koios.client.backend.api.address.model.AddressInfo;
import rest.koios.client.backend.api.base.BaseService;
import rest.koios.client.backend.api.base.Result;
+import rest.koios.client.backend.api.base.common.UTxO;
import rest.koios.client.backend.api.base.exception.ApiException;
-import rest.koios.client.backend.api.common.TxHash;
+import rest.koios.client.backend.api.base.common.TxHash;
import rest.koios.client.backend.factory.options.Options;
import rest.koios.client.backend.factory.options.SortType;
import retrofit2.Call;
@@ -65,6 +66,34 @@ public Result getAddressInformation(List addressList, SortT
}
}
+ @Override
+ public Result> getAddressUTxOs(List addresses, boolean extended, Options options) throws ApiException {
+ for (String address : addresses) {
+ validateBech32(address);
+ }
+ Call> call = addressApi.getAddressUTxOs(buildBodyUTxOs(addresses, extended), optionsToParamMap(options));
+ try {
+ Response> response = (Response) execute(call);
+ return processResponse(response);
+ } catch (IOException e) {
+ throw new ApiException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public Result> getUTxOsFromPaymentCredentials(List paymentCredentials, boolean extended, Options options) throws ApiException {
+ for (String address : paymentCredentials) {
+ validateHexFormat(address);
+ }
+ Call> call = addressApi.getUTxOsFromPaymentCredentials(buildBodyUTxOsFromPaymentCredentials(paymentCredentials, extended), optionsToParamMap(options));
+ try {
+ Response> response = (Response) execute(call);
+ return processResponse(response);
+ } catch (IOException e) {
+ throw new ApiException(e.getMessage(), e);
+ }
+ }
+
@Override
public Result> getAddressTransactions(List addressList, Options options) throws ApiException {
return getAddressTransactions(addressList,0,options);
@@ -131,4 +160,18 @@ private Map buildBody(String arrayObjString, List list, I
}
return bodyMap;
}
+
+ private Map buildBodyUTxOs(List addresses, boolean extended) {
+ Map bodyMap = new HashMap<>();
+ bodyMap.put("_addresses", addresses);
+ bodyMap.put("_extended", extended);
+ return bodyMap;
+ }
+
+ private Map buildBodyUTxOsFromPaymentCredentials(List paymentCredentials, boolean extended) {
+ Map bodyMap = new HashMap<>();
+ bodyMap.put("_payment_credentials", paymentCredentials);
+ bodyMap.put("_extended", extended);
+ return bodyMap;
+ }
}
diff --git a/src/main/java/rest/koios/client/backend/api/address/model/AddressAsset.java b/src/main/java/rest/koios/client/backend/api/address/model/AddressAsset.java
index 0fbe18e..67e71a8 100644
--- a/src/main/java/rest/koios/client/backend/api/address/model/AddressAsset.java
+++ b/src/main/java/rest/koios/client/backend/api/address/model/AddressAsset.java
@@ -6,9 +6,7 @@
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
-import rest.koios.client.backend.api.common.Asset;
-
-import java.util.List;
+import rest.koios.client.backend.api.base.common.Asset;
/**
* Address Asset
@@ -18,15 +16,10 @@
@ToString
@NoArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
-public class AddressAsset {
+public class AddressAsset extends Asset {
/**
* A Cardano payment/base address (bech32 encoded) for transaction's input UTxO
*/
private String address;
-
- /**
- * An array of assets on the UTxO
- */
- private List assetList;
}
diff --git a/src/main/java/rest/koios/client/backend/api/address/model/AddressUtxo.java b/src/main/java/rest/koios/client/backend/api/address/model/AddressUtxo.java
index 706a0ea..bb15f52 100644
--- a/src/main/java/rest/koios/client/backend/api/address/model/AddressUtxo.java
+++ b/src/main/java/rest/koios/client/backend/api/address/model/AddressUtxo.java
@@ -3,9 +3,9 @@
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.*;
-import rest.koios.client.backend.api.common.Asset;
-import rest.koios.client.backend.api.common.InlineDatum;
-import rest.koios.client.backend.api.common.ReferenceScript;
+import rest.koios.client.backend.api.base.common.Asset;
+import rest.koios.client.backend.api.base.common.InlineDatum;
+import rest.koios.client.backend.api.base.common.ReferenceScript;
import java.util.ArrayList;
diff --git a/src/main/java/rest/koios/client/backend/api/asset/AssetService.java b/src/main/java/rest/koios/client/backend/api/asset/AssetService.java
index 0c44584..97cf58f 100644
--- a/src/main/java/rest/koios/client/backend/api/asset/AssetService.java
+++ b/src/main/java/rest/koios/client/backend/api/asset/AssetService.java
@@ -1,8 +1,9 @@
package rest.koios.client.backend.api.asset;
-import rest.koios.client.backend.api.common.TxHash;
import rest.koios.client.backend.api.asset.model.*;
import rest.koios.client.backend.api.base.Result;
+import rest.koios.client.backend.api.base.common.TxHash;
+import rest.koios.client.backend.api.base.common.UTxO;
import rest.koios.client.backend.api.base.exception.ApiException;
import rest.koios.client.backend.factory.options.Options;
import rest.koios.client.utils.Tuple;
@@ -56,22 +57,6 @@ public interface AssetService {
*/
Result> getAssetsAddresses(String assetPolicy, String assetName, Options options) throws ApiException;
- /**
- * Assets Address List with Filtering, Pagination, Ordering Options
- * Get a list of all addresses for a given asset
- * 200 - Success!
- *
401 - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
- *
404 - The server does not recognise the combination of endpoint and parameters provided
- *
- * @param assetPolicy Asset Policy ID in hexadecimal format (hex) (required)
- * @param assetName Asset Name in hexadecimal format (hex) (required)
- * @param options Filtering and Pagination options (optional)
- * @return Result of Type List of {@link AssetAddress}
- * @throws ApiException if an error occurs while attempting to invoke the API
- */
- @Deprecated(forRemoval = true)
- Result> getAssetsAddressList(String assetPolicy, String assetName, Options options) throws ApiException;
-
/**
* NFT Address
* Get the address where specified NFT currently reside on.
@@ -83,10 +68,10 @@ public interface AssetService {
* @param assetPolicy Asset Policy ID in hexadecimal format (hex) (required)
* @param assetName Asset Name in hexadecimal format (hex) (optional)
* @param options Filtering and Pagination options (optional)
- * @return Result of Type List of {@link AssetAddress} holding the given token
+ * @return Result of Type List of {@link PaymentAddress} holding the given token
* @throws ApiException if an error occurs while attempting to invoke the API
*/
- Result> getNFTAddress(String assetPolicy, String assetName, Options options) throws ApiException;
+ Result> getNFTAddress(String assetPolicy, String assetName, Options options) throws ApiException;
/**
* Asset Information
@@ -117,6 +102,22 @@ public interface AssetService {
*/
Result getAssetInformationBulk(List> assetList, Options options) throws ApiException;
+ /**
+ * Asset UTxOs
+ * Get the UTXO information of a list of assets
+ * 200 - List of UTxOs for given asset list
+ *
400 - The server cannot process the request due to invalid input
+ *
401 - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
+ *
404 - The server does not recognise the combination of endpoint and parameters provided
+ *
+ * @param assetList List of Tuple of policy ID and asset names (hex)
+ * @param extended Controls whether or not certain optional fields supported by a given endpoint are populated as a part of the call
+ * @param options Filtering and Pagination options (optional)
+ * @return Result of Type List of {@link UTxO} for given asset list
+ * @throws ApiException if an error occurs while attempting to invoke the API
+ */
+ Result> getAssetUTxOs(List> assetList, Boolean extended, Options options) throws ApiException;
+
/**
* Asset History with Filtering, Pagination, Ordering Options
* Get the mint/burn history of an asset
@@ -147,21 +148,6 @@ public interface AssetService {
*/
Result> getPolicyAssetInformation(String assetPolicy, Options options) throws ApiException;
- /**
- * Asset Policy Information
- * Get the information for all assets under the same policy
- * 200 - Array of detailed information of assets under the same policy
- *
401 - The selected server has restricted the endpoint to be only usable via authentication. The authentication supplied was not authorized to access the endpoint
- *
404 - 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 PolicyAssetInfo}
- * @throws ApiException if an error occurs while attempting to invoke the API
- */
- @Deprecated(forRemoval = true)
- Result> getAssetPolicyInformation(String assetPolicy, Options options) throws ApiException;
-
/**
* Policy Asset List
* Get the list of asset under the given policy (including balances)
diff --git a/src/main/java/rest/koios/client/backend/api/asset/api/AssetApi.java b/src/main/java/rest/koios/client/backend/api/asset/api/AssetApi.java
index e399fe6..a872e44 100644
--- a/src/main/java/rest/koios/client/backend/api/asset/api/AssetApi.java
+++ b/src/main/java/rest/koios/client/backend/api/asset/api/AssetApi.java
@@ -1,7 +1,8 @@
package rest.koios.client.backend.api.asset.api;
-import rest.koios.client.backend.api.common.TxHash;
import rest.koios.client.backend.api.asset.model.*;
+import rest.koios.client.backend.api.base.common.TxHash;
+import rest.koios.client.backend.api.base.common.UTxO;
import retrofit2.Call;
import retrofit2.http.*;
@@ -46,7 +47,7 @@ public interface AssetApi {
* @return List of payment addresses holding the given token
*/
@GET("asset_nft_address")
- Call> getNFTAddress(String assetPolicy, String assetName, @QueryMap Map paramsMap);
+ Call> getNFTAddress(@Query("_asset_policy") String assetPolicy, @Query("_asset_name") String assetName, @QueryMap Map paramsMap);
@GET("asset_info")
Call> getAssetInformation(@Query("_asset_policy") String assetPolicy, @Query("_asset_name") String assetName);
@@ -61,6 +62,16 @@ public interface AssetApi {
@POST("asset_info")
Call> getAssetInformationBulk(@Body Map assetList, @QueryMap Map paramsMap);
+ /**
+ * Get Asset UTxOs
+ *
+ * @param requestBody Json Body containing List of policy ID and asset names (hex)
+ * @param paramsMap Query Params
+ * @return List of account UTxOs associated with stake address
+ */
+ @POST("asset_utxos")
+ Call> getAssetUTxOs(@Body Map requestBody, @QueryMap Map paramsMap);
+
@GET("asset_history")
Call> getAssetHistory(@Query("_asset_policy") String assetPolicy, @Query("_asset_name") String assetName, @QueryMap Map paramsMap);
diff --git a/src/main/java/rest/koios/client/backend/api/asset/impl/AssetServiceImpl.java b/src/main/java/rest/koios/client/backend/api/asset/impl/AssetServiceImpl.java
index 9ad0585..5f8cf43 100644
--- a/src/main/java/rest/koios/client/backend/api/asset/impl/AssetServiceImpl.java
+++ b/src/main/java/rest/koios/client/backend/api/asset/impl/AssetServiceImpl.java
@@ -1,11 +1,12 @@
package rest.koios.client.backend.api.asset.impl;
-import rest.koios.client.backend.api.common.TxHash;
import rest.koios.client.backend.api.asset.AssetService;
import rest.koios.client.backend.api.asset.api.AssetApi;
import rest.koios.client.backend.api.asset.model.*;
import rest.koios.client.backend.api.base.BaseService;
import rest.koios.client.backend.api.base.Result;
+import rest.koios.client.backend.api.base.common.TxHash;
+import rest.koios.client.backend.api.base.common.UTxO;
import rest.koios.client.backend.api.base.exception.ApiException;
import rest.koios.client.backend.factory.options.Options;
import rest.koios.client.utils.Tuple;
@@ -72,17 +73,12 @@ public Result> getAssetsAddresses(String assetPolicy, String
}
@Override
- public Result> getAssetsAddressList(String assetPolicy, String assetName, Options options) throws ApiException {
- return this.getAssetsAddresses(assetPolicy, assetName, options);
- }
-
- @Override
- public Result> getNFTAddress(String assetPolicy, String assetName, Options options) throws ApiException {
+ public Result> getNFTAddress(String assetPolicy, String assetName, Options options) throws ApiException {
validateHexFormat(assetPolicy);
validateHexFormat(assetName);
- Call> call = assetApi.getNFTAddress(assetPolicy, assetName, optionsToParamMap(options));
+ Call> call = assetApi.getNFTAddress(assetPolicy, assetName, optionsToParamMap(options));
try {
- Response> response = (Response) execute(call);
+ Response> response = (Response) execute(call);
return processResponse(response);
} catch (IOException e) {
throw new ApiException(e.getMessage(), e);
@@ -120,6 +116,24 @@ public Result getAssetInformationBulk(List> getAssetUTxOs(List> assetList, Boolean extended, Options options) throws ApiException {
+ if (assetList == null) {
+ return badRequestResult("The server cannot process the request due to invalid input");
+ }
+ for (Tuple tuple : assetList) {
+ validateHexFormat(tuple._1);
+ validateHexFormat(tuple._2);
+ }
+ Call> call = assetApi.getAssetUTxOs(buildBodyUTxOs(assetList, extended), optionsToParamMap(options));
+ try {
+ Response> response = (Response) execute(call);
+ return processResponse(response);
+ } catch (IOException e) {
+ throw new ApiException(e.getMessage(), e);
+ }
+ }
+
@Override
public Result> getAssetHistory(String assetPolicy, String assetName, Options options) throws ApiException {
validateHexFormat(assetPolicy);
@@ -145,11 +159,6 @@ public Result> getPolicyAssetInformation(String assetPolic
}
}
- @Override
- public Result> getAssetPolicyInformation(String assetPolicy, Options options) throws ApiException {
- return getPolicyAssetInformation(assetPolicy, options);
- }
-
@Override
public Result> getPolicyAssetList(String assetPolicy, Options options) throws ApiException {
validateHexFormat(assetPolicy);
@@ -205,4 +214,18 @@ private Map buildBody(String arrayObjString, List buildBodyUTxOs(List> list, boolean extended) {
+ Map bodyMap = new HashMap<>();
+ List> lists = new ArrayList<>();
+ list.forEach(tuple -> {
+ List tupleList = new ArrayList<>();
+ tupleList.add(tuple._1);
+ tupleList.add(tuple._2);
+ lists.add(tupleList);
+ });
+ bodyMap.put("_asset_list", lists);
+ bodyMap.put("_extended", extended);
+ return bodyMap;
+ }
}
diff --git a/src/main/java/rest/koios/client/backend/api/asset/model/Asset.java b/src/main/java/rest/koios/client/backend/api/asset/model/Asset.java
index fab32da..f868900 100644
--- a/src/main/java/rest/koios/client/backend/api/asset/model/Asset.java
+++ b/src/main/java/rest/koios/client/backend/api/asset/model/Asset.java
@@ -20,7 +20,12 @@ public class Asset {
private String policyId;
/**
- * AssetNames Object
+ * Asset Name (hex)
*/
- private AssetNames assetNames;
+ private String assetName;
+
+ /**
+ * The CIP14 fingerprint of the asset
+ */
+ private String fingerprint;
}
diff --git a/src/main/java/rest/koios/client/backend/api/asset/model/AssetAddress.java b/src/main/java/rest/koios/client/backend/api/asset/model/AssetAddress.java
index 0286c15..ba39f2a 100644
--- a/src/main/java/rest/koios/client/backend/api/asset/model/AssetAddress.java
+++ b/src/main/java/rest/koios/client/backend/api/asset/model/AssetAddress.java
@@ -15,12 +15,7 @@
@ToString
@NoArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
-public class AssetAddress {
-
- /**
- * A Cardano payment/base address (bech32 encoded) for transaction's input UTxO
- */
- private String paymentAddress;
+public class AssetAddress extends PaymentAddress {
/**
* Asset balance on the payment address
diff --git a/src/main/java/rest/koios/client/backend/api/asset/model/AssetInformation.java b/src/main/java/rest/koios/client/backend/api/asset/model/AssetInformation.java
index a40f73c..2be035e 100644
--- a/src/main/java/rest/koios/client/backend/api/asset/model/AssetInformation.java
+++ b/src/main/java/rest/koios/client/backend/api/asset/model/AssetInformation.java
@@ -43,6 +43,11 @@ public class AssetInformation {
*/
private String mintingTxHash;
+ /**
+ * Total supply for the asset
+ */
+ private String totalSupply;
+
/**
* Count of total mint transactions
*/
@@ -54,22 +59,22 @@ public class AssetInformation {
private Integer burnCnt;
/**
- * A JSON array containing details about metadata within transaction
+ * UNIX timestamp of the first asset mint
*/
- private JsonNode mintingTxMetadata;
+ private Long creationTime;
/**
- * Asset metadata registered on the Cardano Token Registry
+ * Latest minting transaction metadata (aligns with CIP-25)
*/
- private TokenRegistryMetadata tokenRegistryMetadata;
+ private JsonNode mintingTxMetadata;
/**
- * Total Supply
+ * Asset metadata registered on the Cardano Token Registry
*/
- private String totalSupply;
+ private TokenRegistryMetadata tokenRegistryMetadata;
/**
- * UNIX timestamp of the first asset mint
+ * CIP 68 metadata if present for asset
*/
- private Long creationTime;
+ private JsonNode cip68Metadata;
}
diff --git a/src/main/java/rest/koios/client/backend/api/asset/model/AssetNames.java b/src/main/java/rest/koios/client/backend/api/asset/model/PaymentAddress.java
similarity index 53%
rename from src/main/java/rest/koios/client/backend/api/asset/model/AssetNames.java
rename to src/main/java/rest/koios/client/backend/api/asset/model/PaymentAddress.java
index f7284cd..fabe080 100644
--- a/src/main/java/rest/koios/client/backend/api/asset/model/AssetNames.java
+++ b/src/main/java/rest/koios/client/backend/api/asset/model/PaymentAddress.java
@@ -2,27 +2,23 @@
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
-import lombok.*;
-
-import java.util.ArrayList;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
/**
- * Asset Names
+ * Asset Address
*/
@Getter
@Setter
@ToString
@NoArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
-public class AssetNames {
-
- /**
- * Asset Names (hex)
- */
- private ArrayList hex;
+public class PaymentAddress {
/**
- * Asset Names (ASCII)
+ * A Cardano payment/base address (bech32 encoded) for transaction's input UTxO
*/
- private ArrayList ascii;
+ private String paymentAddress;
}
diff --git a/src/main/java/rest/koios/client/backend/api/common/Asset.java b/src/main/java/rest/koios/client/backend/api/base/common/Asset.java
similarity index 93%
rename from src/main/java/rest/koios/client/backend/api/common/Asset.java
rename to src/main/java/rest/koios/client/backend/api/base/common/Asset.java
index 5cfc315..b9da0bc 100644
--- a/src/main/java/rest/koios/client/backend/api/common/Asset.java
+++ b/src/main/java/rest/koios/client/backend/api/base/common/Asset.java
@@ -1,4 +1,4 @@
-package rest.koios.client.backend.api.common;
+package rest.koios.client.backend.api.base.common;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
diff --git a/src/main/java/rest/koios/client/backend/api/common/InlineDatum.java b/src/main/java/rest/koios/client/backend/api/base/common/InlineDatum.java
similarity index 87%
rename from src/main/java/rest/koios/client/backend/api/common/InlineDatum.java
rename to src/main/java/rest/koios/client/backend/api/base/common/InlineDatum.java
index 92fe738..e8ef896 100644
--- a/src/main/java/rest/koios/client/backend/api/common/InlineDatum.java
+++ b/src/main/java/rest/koios/client/backend/api/base/common/InlineDatum.java
@@ -1,4 +1,4 @@
-package rest.koios.client.backend.api.common;
+package rest.koios.client.backend.api.base.common;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
@@ -19,7 +19,7 @@
public class InlineDatum {
/**
- * Datum (hex)
+ * Datum bytes (hex)
*/
private String bytes;
diff --git a/src/main/java/rest/koios/client/backend/api/common/ReferenceScript.java b/src/main/java/rest/koios/client/backend/api/base/common/ReferenceScript.java
similarity index 93%
rename from src/main/java/rest/koios/client/backend/api/common/ReferenceScript.java
rename to src/main/java/rest/koios/client/backend/api/base/common/ReferenceScript.java
index 4123406..7cc41c3 100644
--- a/src/main/java/rest/koios/client/backend/api/common/ReferenceScript.java
+++ b/src/main/java/rest/koios/client/backend/api/base/common/ReferenceScript.java
@@ -1,4 +1,4 @@
-package rest.koios.client.backend.api.common;
+package rest.koios.client.backend.api.base.common;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
diff --git a/src/main/java/rest/koios/client/backend/api/common/TxHash.java b/src/main/java/rest/koios/client/backend/api/base/common/TxHash.java
similarity index 92%
rename from src/main/java/rest/koios/client/backend/api/common/TxHash.java
rename to src/main/java/rest/koios/client/backend/api/base/common/TxHash.java
index 54d0774..be1ce49 100644
--- a/src/main/java/rest/koios/client/backend/api/common/TxHash.java
+++ b/src/main/java/rest/koios/client/backend/api/base/common/TxHash.java
@@ -1,4 +1,4 @@
-package rest.koios.client.backend.api.common;
+package rest.koios.client.backend.api.base.common;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
diff --git a/src/main/java/rest/koios/client/backend/api/base/common/UTxO.java b/src/main/java/rest/koios/client/backend/api/base/common/UTxO.java
new file mode 100644
index 0000000..cfd9ed3
--- /dev/null
+++ b/src/main/java/rest/koios/client/backend/api/base/common/UTxO.java
@@ -0,0 +1,91 @@
+package rest.koios.client.backend.api.base.common;
+
+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;
+
+import java.util.List;
+
+/**
+ * UTxO
+ */
+@Getter
+@Setter
+@ToString
+@NoArgsConstructor
+@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
+public class UTxO {
+
+ /**
+ * Hash identifier of the transaction
+ */
+ private String txHash;
+
+ /**
+ * Index of UTxO in the transaction
+ */
+ private Integer txIndex;
+
+ /**
+ * A Cardano payment/base address (bech32 encoded)
+ */
+ private String address;
+
+ /**
+ * Total sum of ADA on the UTxO
+ */
+ private String value;
+
+ /**
+ * Cardano staking address (reward account) in bech32 format
+ */
+ private String stakeAddress;
+
+ /**
+ * Payment credential
+ */
+ private String paymentCred;
+
+ /**
+ * Epoch number of the block
+ */
+ private Integer epochNo;
+
+ /**
+ * Block height
+ */
+ private Integer blockHeight;
+
+ /**
+ * UNIX timestamp of the block
+ */
+ private Integer blockTime;
+
+ /**
+ * The Hash of the Plutus Data
+ */
+ private String datumHash;
+
+ /**
+ * Allows datums to be attached to UTxO (CIP-32)
+ */
+ private InlineDatum inlineDatum;
+
+ /**
+ * Allow reference scripts to be used to satisfy script requirements during validation, rather than requiring the spending transaction to do so. (CIP-33)
+ */
+ private ReferenceScript referenceScript;
+
+ /**
+ * List of assets on the UTxO
+ */
+ private List assetList;
+
+ /**
+ * True if the UTXO has been spent
+ */
+ private Boolean isSpent;
+}
diff --git a/src/main/java/rest/koios/client/backend/api/block/impl/BlockServiceImpl.java b/src/main/java/rest/koios/client/backend/api/block/impl/BlockServiceImpl.java
index babe57b..81e386f 100644
--- a/src/main/java/rest/koios/client/backend/api/block/impl/BlockServiceImpl.java
+++ b/src/main/java/rest/koios/client/backend/api/block/impl/BlockServiceImpl.java
@@ -3,8 +3,8 @@
import rest.koios.client.backend.api.base.BaseService;
import rest.koios.client.backend.api.base.Result;
import rest.koios.client.backend.api.base.exception.ApiException;
-import rest.koios.client.backend.api.block.BlockService;
import rest.koios.client.backend.api.block.api.BlockApi;
+import rest.koios.client.backend.api.block.BlockService;
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;
diff --git a/src/main/java/rest/koios/client/backend/api/block/model/Block.java b/src/main/java/rest/koios/client/backend/api/block/model/Block.java
index c815b8e..868d317 100644
--- a/src/main/java/rest/koios/client/backend/api/block/model/Block.java
+++ b/src/main/java/rest/koios/client/backend/api/block/model/Block.java
@@ -2,7 +2,10 @@
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
-import lombok.*;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
/**
* Block
@@ -60,14 +63,14 @@ public class Block {
private String vrfKey = null;
/**
- * Counter value of the operational certificate used to create this block
+ * Pool ID in bech32 format
*/
- private Integer opCertCounter = null;
+ private String pool = null;
/**
- * Pool ID in bech32 format
+ * Counter value of the operational certificate used to create this block
*/
- private String pool = null;
+ private Integer opCertCounter = null;
/**
* The protocol major version
diff --git a/src/main/java/rest/koios/client/backend/api/block/model/BlockInfo.java b/src/main/java/rest/koios/client/backend/api/block/model/BlockInfo.java
index 2eb0836..1687fc7 100644
--- a/src/main/java/rest/koios/client/backend/api/block/model/BlockInfo.java
+++ b/src/main/java/rest/koios/client/backend/api/block/model/BlockInfo.java
@@ -2,7 +2,10 @@
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
-import lombok.*;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
/**
* Block Information
diff --git a/src/main/java/rest/koios/client/backend/api/block/model/BlockTxHash.java b/src/main/java/rest/koios/client/backend/api/block/model/BlockTxHash.java
index 3656512..dc0fd33 100644
--- a/src/main/java/rest/koios/client/backend/api/block/model/BlockTxHash.java
+++ b/src/main/java/rest/koios/client/backend/api/block/model/BlockTxHash.java
@@ -23,7 +23,22 @@ public class BlockTxHash {
private String blockHash;
/**
- * Array of Hash identifiers of the transaction
+ * Hash identifier of the transaction
*/
- private String[] txHashes;
+ private String txHash;
+
+ /**
+ * Epoch number of the block
+ */
+ private Integer epochNo;
+
+ /**
+ * Block height
+ */
+ private Integer blockHeight;
+
+ /**
+ * UNIX timestamp of the block
+ */
+ private Integer blockTime;
}
diff --git a/src/main/java/rest/koios/client/backend/api/epoch/helper/CostModelsDeserializer.java b/src/main/java/rest/koios/client/backend/api/epoch/helper/CostModelsDeserializer.java
deleted file mode 100644
index 0f5f640..0000000
--- a/src/main/java/rest/koios/client/backend/api/epoch/helper/CostModelsDeserializer.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package rest.koios.client.backend.api.epoch.helper;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.TextNode;
-
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * Cost Models Json Deserializer
- */
-public class CostModelsDeserializer extends JsonDeserializer