Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing AddressService api call #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export BF_IPFS_PROJECT_ID=<Blockfrost 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
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/io/blockfrost/sdk/api/AddressService.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ public interface AddressService {
*/
List<AddressUtxo> 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&lt;AddressUtxo&gt;
*/
List<AddressUtxo> 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.
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/io/blockfrost/sdk/impl/AddressServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ public List<AddressUtxo> getAddressUtxos(String address, int count, int page, Or
}
}

@Override
public List<AddressUtxo> getAddressUtxosGivenAsset(String address, String asset, int count, int page, OrderEnum order) throws APIException {

validateAddress(address);

Call<List<AddressUtxo>> addressUtxoCall = addressesApi.addressesAddressUtxosGivenAssetGet(getProjectId(), address, asset, count, page, order.name());

try {
Response<List<AddressUtxo>> addressUtxoResponse = addressUtxoCall.execute();
return processResponse(addressUtxoResponse);
} catch (IOException exp) {
throw new APIException("Exception while fetching address utxos for address: " + address, exp);
}
}


@Override
public List<AddressUtxo> getAddressUtxos(String address, int count, int page) throws APIException {
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/io/blockfrost/sdk/impl/retrofit/AddressesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,25 @@ Call<List<AddressUtxo>> 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&lt;List&lt;Object&gt;&gt;
*/
@GET("addresses/{address}/utxos/{asset}")
Call<List<AddressUtxo>> 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
);

}
Loading