From cbfb7c4626955a28cc73e6670f81d7368d9c901a Mon Sep 17 00:00:00 2001 From: Giovanni Gargiulo Date: Sun, 22 Oct 2023 20:32:06 +0100 Subject: [PATCH 1/2] fix: fixed gradle dependency name that was pointing to wrong project --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 66d87c8..85902eb 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ export BF_IPFS_PROJECT_ID= - For Gradle, add the following dependency to build.gradle ``` -compile 'com.bloxbean.cardano:cardano-client-lib:$version' +compile 'io.blockfrost:blockfrost-java:$version' ``` **Note:** Replace '$version' with the correct version number From 7e5d62a31a6fb853cacec86650007bd08136fbef Mon Sep 17 00:00:00 2001 From: Giovanni Gargiulo Date: Sun, 22 Oct 2023 21:35:56 +0100 Subject: [PATCH 2/2] feat: added *Address UTXOs of a given asset* api call --- .../io/blockfrost/sdk/api/AddressService.java | 13 ++++++++++++ .../sdk/impl/AddressServiceImpl.java | 15 +++++++++++++ .../sdk/impl/retrofit/AddressesApi.java | 21 +++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/src/main/java/io/blockfrost/sdk/api/AddressService.java b/src/main/java/io/blockfrost/sdk/api/AddressService.java index 8f76809..86be776 100644 --- a/src/main/java/io/blockfrost/sdk/api/AddressService.java +++ b/src/main/java/io/blockfrost/sdk/api/AddressService.java @@ -41,6 +41,19 @@ public interface AddressService { */ List getAddressUtxos(String address, int count, int page, OrderEnum order) throws APIException; + /** + * Address UTXOs of a given asset + * UTXOs of the address. + * + * @param address Bech32 address. (required) + * @param asset Concatenation of the policy_id and hex-encoded asset_name (required) + * @param count The number of results displayed on one page. + * @param page The page number for listing the results. + * @param order Ordered by tx index in the block. The ordering of items from the point of view of the blockchain, not the page listing itself. By default, we return oldest first, newest last. + * @return List<AddressUtxo> + */ + List getAddressUtxosGivenAsset(String address, String asset, int count, int page, OrderEnum order) throws APIException; + /** * Address UTXOs * UTXOs of the address ascending ordered by tx index in the block. diff --git a/src/main/java/io/blockfrost/sdk/impl/AddressServiceImpl.java b/src/main/java/io/blockfrost/sdk/impl/AddressServiceImpl.java index 8ead1cc..fd4f59f 100644 --- a/src/main/java/io/blockfrost/sdk/impl/AddressServiceImpl.java +++ b/src/main/java/io/blockfrost/sdk/impl/AddressServiceImpl.java @@ -73,6 +73,21 @@ public List getAddressUtxos(String address, int count, int page, Or } } + @Override + public List getAddressUtxosGivenAsset(String address, String asset, int count, int page, OrderEnum order) throws APIException { + + validateAddress(address); + + Call> addressUtxoCall = addressesApi.addressesAddressUtxosGivenAssetGet(getProjectId(), address, asset, count, page, order.name()); + + try { + Response> addressUtxoResponse = addressUtxoCall.execute(); + return processResponse(addressUtxoResponse); + } catch (IOException exp) { + throw new APIException("Exception while fetching address utxos for address: " + address, exp); + } + } + @Override public List getAddressUtxos(String address, int count, int page) throws APIException { diff --git a/src/main/java/io/blockfrost/sdk/impl/retrofit/AddressesApi.java b/src/main/java/io/blockfrost/sdk/impl/retrofit/AddressesApi.java index 7542a5a..981f364 100644 --- a/src/main/java/io/blockfrost/sdk/impl/retrofit/AddressesApi.java +++ b/src/main/java/io/blockfrost/sdk/impl/retrofit/AddressesApi.java @@ -81,4 +81,25 @@ Call> addressesAddressUtxosGet( @Query("order") String order ); + /** + * Address UTXOs of a given asset + * UTXOs of the address. + * + * @param address Bech32 address. (required) + * @param asset Concatenation of the policy_id and hex-encoded asset_name (required) + * @param count The number of results displayed on one page. (optional, default to 100) + * @param page The page number for listing the results. (optional, default to 1) + * @param order Ordered by tx index in the block. The ordering of items from the point of view of the blockchain, not the page listing itself. By default, we return oldest first, newest last. (optional, default to asc) + * @return Call<List<Object>> + */ + @GET("addresses/{address}/utxos/{asset}") + Call> addressesAddressUtxosGivenAssetGet( + @Header("project_id") String projectId, + @Path("address") String address, + @Path("asset") String asset, + @Query("count") Integer count, + @Query("page") Integer page, + @Query("order") String order + ); + }