From 0efa579b1861ec7adcc99c3837e291f01928ba56 Mon Sep 17 00:00:00 2001 From: Dudi Edri Date: Sun, 5 May 2024 17:43:40 +0300 Subject: [PATCH] Koios Alignment with 1.1.1 Bump Version to 1.18.2 --- README.md | 18 +++-- pom.xml | 10 +-- .../api/account/model/StakeAddress.java | 14 +++- .../backend/api/asset/AssetService.java | 30 +++++++++ .../backend/api/asset/api/AssetApi.java | 13 ++++ .../api/asset/impl/AssetServiceImpl.java | 24 +++++++ .../backend/api/asset/model/AssetAddress.java | 15 +++++ .../backend/api/asset/model/AssetSummary.java | 5 ++ .../api/asset/model/PaymentAddress.java | 5 ++ .../api/asset/model/PolicyAssetMint.java | 67 +++++++++++++++++++ .../backend/api/block/BlockService.java | 23 +++++++ .../backend/api/block/api/BlockApi.java | 11 +++ .../api/block/impl/BlockServiceImpl.java | 32 +++++++-- .../client/backend/api/block/model/Block.java | 5 ++ .../backend/api/network/model/Withdrawal.java | 10 +++ .../backend/api/pool/model/PoolInfo.java | 2 +- .../AssetServiceMainnetIntegrationTest.java | 25 +++++++ .../AssetServicePreprodIntegrationTest.java | 25 +++++++ .../AssetServicePreviewIntegrationTest.java | 25 +++++++ .../BlockServiceMainnetIntegrationTest.java | 17 +++++ .../BlockServicePreprodIntegrationTest.java | 17 +++++ .../BlockServicePreviewIntegrationTest.java | 17 +++++ 22 files changed, 393 insertions(+), 17 deletions(-) create mode 100644 src/main/java/rest/koios/client/backend/api/asset/model/PolicyAssetMint.java diff --git a/README.md b/README.md index 4659f54..7677c9e 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca Get the information about block protocol distribution in epoch - Block + Block Block List Get summarised details about all blocks (paginated - latest first) @@ -108,6 +108,10 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca Block Transactions Get a list of all transactions included in a provided block + + Block Transactions (Detailed Info) + Get detailed information about transaction(s) for requested blocks + Transactions UTxO Info @@ -200,7 +204,7 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca Get the staking history of an account - Asset + Asset Asset List Get the list of all native assets (paginated) @@ -244,6 +248,10 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca Policy Asset Information Get the information for all assets under the same policy + + Policy Asset Mints + Get a list of mint or burn count details for all assets minted under a policy + Asset Summary Get the summary of an asset (total transactions exclude minting/total wallets include only wallets with asset balance) @@ -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 | @@ -352,13 +360,13 @@ Resource and maintenance requirements for Cardano blockchain components (e.g. ca io.github.cardano-community koios-java-client - 1.18.1 + 1.18.2 ``` - 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) diff --git a/pom.xml b/pom.xml index ac65b6d..eef5f83 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 io.github.cardano-community koios-java-client - 1.18.1 + 1.18.2 ${project.groupId}:${project.artifactId} Koios Java Client is a Java REST Client library which allows interacting with Koios Server Instances using Java Objects https://github.com/cardano-community/koios-java-client @@ -14,18 +14,18 @@ 11 UTF-8 2.9.0 - 2.15.2 + 2.16.1 4.10.0 1.3.2 - 2.0.7 + 2.0.12 2.0.9 4.4 1.18.30 - 1.76 + 1.77 5.10.1 3.11.0 3.5.0 - 3.2.2 + 3.2.3 1.3.2 0.8.11 3.3.0 diff --git a/src/main/java/rest/koios/client/backend/api/account/model/StakeAddress.java b/src/main/java/rest/koios/client/backend/api/account/model/StakeAddress.java index 4a67dcf..50b064d 100644 --- a/src/main/java/rest/koios/client/backend/api/account/model/StakeAddress.java +++ b/src/main/java/rest/koios/client/backend/api/account/model/StakeAddress.java @@ -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; } 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 97cf58f..3f6126a 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 @@ -73,6 +73,21 @@ public interface AssetService { */ Result> 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 + *

200 - Payment addresses currently holding the given NFT + *

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 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> getPolicyAssetAddressList(String assetPolicy, Options options) throws ApiException; + /** * Asset Information * Get the information of an asset incl first minting & token registry metadata @@ -148,6 +163,21 @@ public interface AssetService { */ Result> getPolicyAssetInformation(String assetPolicy, Options options) throws ApiException; + /** + * Policy Asset Mints + * Get a list of mint information for assets under requested policies + *

200 - List of mint or burn count details for all assets minted under a policy + *

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 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> getPolicyAssetMints(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 a872e44..1de07d6 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 @@ -49,6 +49,16 @@ public interface AssetApi { @GET("asset_nft_address") Call> getNFTAddress(@Query("_asset_policy") String assetPolicy, @Query("_asset_name") String assetName, @QueryMap Map 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> getPolicyAssetAddressList(@Query("_asset_policy") String assetPolicy, @QueryMap Map paramsMap); + @GET("asset_info") Call> getAssetInformation(@Query("_asset_policy") String assetPolicy, @Query("_asset_name") String assetName); @@ -78,6 +88,9 @@ public interface AssetApi { @GET("policy_asset_info") Call> getPolicyAssetInformation(@Query("_asset_policy") String assetPolicy, @QueryMap Map paramsMap); + @GET("policy_asset_mints") + Call> getPolicyAssetMints(@Query("_asset_policy") String assetPolicy, @QueryMap Map paramsMap); + /** * Get Policy Asset List * 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 5f8cf43..904f469 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 @@ -85,6 +85,18 @@ public Result> getNFTAddress(String assetPolicy, String ass } } + @Override + public Result> getPolicyAssetAddressList(String assetPolicy, Options options) throws ApiException { + validateHexFormat(assetPolicy); + Call> call = assetApi.getPolicyAssetAddressList(assetPolicy, optionsToParamMap(options)); + try { + Response> response = (Response) execute(call); + return processResponse(response); + } catch (IOException e) { + throw new ApiException(e.getMessage(), e); + } + } + @Override public Result getAssetInformation(String assetPolicy, String assetName) throws ApiException { validateHexFormat(assetPolicy); @@ -159,6 +171,18 @@ public Result> getPolicyAssetInformation(String assetPolic } } + @Override + public Result> getPolicyAssetMints(String assetPolicy, Options options) throws ApiException { + validateHexFormat(assetPolicy); + Call> call = assetApi.getPolicyAssetMints(assetPolicy, optionsToParamMap(options)); + try { + Response> response = (Response) execute(call); + return processResponse(response); + } catch (IOException e) { + throw new ApiException(e.getMessage(), e); + } + } + @Override public Result> getPolicyAssetList(String assetPolicy, Options options) throws ApiException { validateHexFormat(assetPolicy); 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 ba39f2a..6c5f116 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 @@ -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 */ diff --git a/src/main/java/rest/koios/client/backend/api/asset/model/AssetSummary.java b/src/main/java/rest/koios/client/backend/api/asset/model/AssetSummary.java index 09f58ca..5cd79b9 100644 --- a/src/main/java/rest/koios/client/backend/api/asset/model/AssetSummary.java +++ b/src/main/java/rest/koios/client/backend/api/asset/model/AssetSummary.java @@ -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; } diff --git a/src/main/java/rest/koios/client/backend/api/asset/model/PaymentAddress.java b/src/main/java/rest/koios/client/backend/api/asset/model/PaymentAddress.java index fabe080..28edcda 100644 --- a/src/main/java/rest/koios/client/backend/api/asset/model/PaymentAddress.java +++ b/src/main/java/rest/koios/client/backend/api/asset/model/PaymentAddress.java @@ -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; } diff --git a/src/main/java/rest/koios/client/backend/api/asset/model/PolicyAssetMint.java b/src/main/java/rest/koios/client/backend/api/asset/model/PolicyAssetMint.java new file mode 100644 index 0000000..87f7bcf --- /dev/null +++ b/src/main/java/rest/koios/client/backend/api/asset/model/PolicyAssetMint.java @@ -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; +} diff --git a/src/main/java/rest/koios/client/backend/api/block/BlockService.java b/src/main/java/rest/koios/client/backend/api/block/BlockService.java index 3fe37df..a17cae2 100644 --- a/src/main/java/rest/koios/client/backend/api/block/BlockService.java +++ b/src/main/java/rest/koios/client/backend/api/block/BlockService.java @@ -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; @@ -79,4 +80,26 @@ public interface BlockService { * @throws ApiException if an error occurs while attempting to invoke the API */ Result> getBlockTransactions(List blockHashes, Options options) throws ApiException; + + /** + * Block Transactions (Detailed Info) + * Get detailed information about transaction(s) for requested blocks + *

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 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> getBlockTransactionsInfo(List blockHashes, Boolean inputs, Boolean metadata, Boolean assets, + Boolean withdrawals, Boolean certs, Boolean scripts, Options options) throws ApiException; } diff --git a/src/main/java/rest/koios/client/backend/api/block/api/BlockApi.java b/src/main/java/rest/koios/client/backend/api/block/api/BlockApi.java index 7df662e..a8cd139 100644 --- a/src/main/java/rest/koios/client/backend/api/block/api/BlockApi.java +++ b/src/main/java/rest/koios/client/backend/api/block/api/BlockApi.java @@ -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; @@ -45,4 +46,14 @@ public interface BlockApi { */ @POST("block_txs") Call> getBlockTransactions(@Body Map requestBody, @QueryMap Map 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> getBlockTransactionsInfo(@Body Map requestBody, @QueryMap Map paramsMap); } 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 81e386f..9ad1d46 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 @@ -8,16 +8,14 @@ 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.Limit; import rest.koios.client.backend.factory.options.Options; import retrofit2.Call; import retrofit2.Response; import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Block Service Implementation @@ -100,6 +98,32 @@ public Result> getBlockTransactions(List blockHashes, } } + @Override + public Result> getBlockTransactionsInfo(List blockHashes, Boolean inputs, Boolean metadata, Boolean assets, Boolean withdrawals, Boolean certs, Boolean scripts, Options options) throws ApiException { + for (String blockHash : blockHashes) { + validateHexFormat(blockHash); + } + Call> call = blockApi.getBlockTransactionsInfo(buildBodyBlockTxInfo(blockHashes, inputs, metadata, assets, withdrawals, certs, scripts), optionsToParamMap(options)); + try { + Response> response = (Response) execute(call); + return processResponse(response); + } catch (IOException e) { + throw new ApiException(e.getMessage(), e); + } + } + + private Map buildBodyBlockTxInfo(List blockHashes, Boolean inputs, Boolean metadata, Boolean assets, Boolean withdrawals, Boolean certs, Boolean scripts) { + Map bodyMap = new HashMap<>(); + bodyMap.put("_block_hashes", blockHashes); + bodyMap.put("_inputs", Optional.ofNullable(inputs).orElse(false)); + bodyMap.put("_metadata", Optional.ofNullable(metadata).orElse(false)); + bodyMap.put("_assets", Optional.ofNullable(assets).orElse(false)); + bodyMap.put("_withdrawals", Optional.ofNullable(withdrawals).orElse(false)); + bodyMap.put("_certs", Optional.ofNullable(certs).orElse(false)); + bodyMap.put("_scripts", Optional.ofNullable(scripts).orElse(false)); + return bodyMap; + } + private Map buildBody(List blockHashes) { Map bodyMap = new HashMap<>(); bodyMap.put("_block_hashes", blockHashes); 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 868d317..8c86fe3 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 @@ -81,4 +81,9 @@ public class Block { * The protocol minor version */ private Integer protoMinor; + + /** + * Previous Hash of the current block + */ + private String parentHash; } diff --git a/src/main/java/rest/koios/client/backend/api/network/model/Withdrawal.java b/src/main/java/rest/koios/client/backend/api/network/model/Withdrawal.java index 2aadbc4..beb9abe 100644 --- a/src/main/java/rest/koios/client/backend/api/network/model/Withdrawal.java +++ b/src/main/java/rest/koios/client/backend/api/network/model/Withdrawal.java @@ -51,4 +51,14 @@ public class Withdrawal { * Cardano staking address (reward account) in bech32 format **/ private String stakeAddress; + + /** + * Epoch where amount is earned + */ + private Integer earnedEpoch; + + /** + * Epoch where the earned amount can be spent + */ + private Integer spendableEpoch; } diff --git a/src/main/java/rest/koios/client/backend/api/pool/model/PoolInfo.java b/src/main/java/rest/koios/client/backend/api/pool/model/PoolInfo.java index b1f0008..b092be7 100644 --- a/src/main/java/rest/koios/client/backend/api/pool/model/PoolInfo.java +++ b/src/main/java/rest/koios/client/backend/api/pool/model/PoolInfo.java @@ -112,7 +112,7 @@ public class PoolInfo { /** * Pool relative active stake share */ - private Long sigma; + private Double sigma; /** * Total pool blocks on chain diff --git a/src/test/java/rest/koios/client/backend/api/asset/AssetServiceMainnetIntegrationTest.java b/src/test/java/rest/koios/client/backend/api/asset/AssetServiceMainnetIntegrationTest.java index e075798..ceb6727 100644 --- a/src/test/java/rest/koios/client/backend/api/asset/AssetServiceMainnetIntegrationTest.java +++ b/src/test/java/rest/koios/client/backend/api/asset/AssetServiceMainnetIntegrationTest.java @@ -94,6 +94,15 @@ void getNFTAddressTest() throws ApiException { log.info(assetAddressesResult.getValue().toString()); } + @Test + void getPolicyAssetAddressListTest() throws ApiException { + String assetPolicy = "f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"; + Result> assetAddressesResult = assetService.getPolicyAssetAddressList(assetPolicy, Options.EMPTY); + Assertions.assertTrue(assetAddressesResult.isSuccessful()); + Assertions.assertNotNull(assetAddressesResult.getValue()); + log.info(assetAddressesResult.getValue().toString()); + } + @Test void getAssetInformationTest() throws ApiException { String assetPolicy = "d3501d9531fcc25e3ca4b6429318c2cc374dbdbcf5e99c1c1e5da1ff"; @@ -177,6 +186,22 @@ void getAssetPolicyInformationBadRequestTest() { assertInstanceOf(ApiException.class, exception); } + @Test + void getPolicyAssetMintsTest() throws ApiException { + String assetPolicy = "14696a4676909f4e3cb1f2e60e2e08e5abed70caf5c02699be971139"; + Result> policyAssetMintsResult = assetService.getPolicyAssetMints(assetPolicy, Options.EMPTY); + Assertions.assertTrue(policyAssetMintsResult.isSuccessful()); + Assertions.assertNotNull(policyAssetMintsResult.getValue()); + log.info(policyAssetMintsResult.getValue().toString()); + } + + @Test + void getPolicyAssetMintsBadRequestTest() { + String assetPolicy = "test"; + ApiException exception = assertThrows(ApiException.class, () -> assetService.getPolicyAssetMints(assetPolicy, Options.EMPTY)); + assertInstanceOf(ApiException.class, exception); + } + @Test void getAssetSummaryTest() throws ApiException { String assetPolicy = "d3501d9531fcc25e3ca4b6429318c2cc374dbdbcf5e99c1c1e5da1ff"; diff --git a/src/test/java/rest/koios/client/backend/api/asset/AssetServicePreprodIntegrationTest.java b/src/test/java/rest/koios/client/backend/api/asset/AssetServicePreprodIntegrationTest.java index e1a43bc..5edf326 100644 --- a/src/test/java/rest/koios/client/backend/api/asset/AssetServicePreprodIntegrationTest.java +++ b/src/test/java/rest/koios/client/backend/api/asset/AssetServicePreprodIntegrationTest.java @@ -79,6 +79,15 @@ void getNFTAddressTest() throws ApiException { log.info(assetAddressesResult.getValue().toString()); } + @Test + void getPolicyAssetAddressListTest() throws ApiException { + String assetPolicy = "002126e5e7cb2f5b6ac52ef2cdb9308ff58bf6e3b62e29df447cec72"; + Result> assetAddressesResult = assetService.getPolicyAssetAddressList(assetPolicy, Options.EMPTY); + Assertions.assertTrue(assetAddressesResult.isSuccessful()); + Assertions.assertNotNull(assetAddressesResult.getValue()); + log.info(assetAddressesResult.getValue().toString()); + } + @Test void getAssetInformationTest() throws ApiException { String assetPolicy = "80de4ee0ffde8ba05726707f2adba0e65963eff5aaba164af358e71b"; @@ -165,6 +174,22 @@ void getAssetPolicyInformationBadRequestTest() { assertInstanceOf(ApiException.class, exception); } + @Test + void getPolicyAssetMintsTest() throws ApiException { + String assetPolicy = "80de4ee0ffde8ba05726707f2adba0e65963eff5aaba164af358e71b"; + Result> policyAssetMintsResult = assetService.getPolicyAssetMints(assetPolicy, Options.EMPTY); + Assertions.assertTrue(policyAssetMintsResult.isSuccessful()); + Assertions.assertNotNull(policyAssetMintsResult.getValue()); + log.info(policyAssetMintsResult.getValue().toString()); + } + + @Test + void getPolicyAssetMintsBadRequestTest() { + String assetPolicy = "test"; + ApiException exception = assertThrows(ApiException.class, () -> assetService.getPolicyAssetMints(assetPolicy, Options.EMPTY)); + assertInstanceOf(ApiException.class, exception); + } + @Test void getAssetSummaryTest() throws ApiException { String assetPolicy = "80de4ee0ffde8ba05726707f2adba0e65963eff5aaba164af358e71b"; diff --git a/src/test/java/rest/koios/client/backend/api/asset/AssetServicePreviewIntegrationTest.java b/src/test/java/rest/koios/client/backend/api/asset/AssetServicePreviewIntegrationTest.java index e20a6f6..2d999a0 100644 --- a/src/test/java/rest/koios/client/backend/api/asset/AssetServicePreviewIntegrationTest.java +++ b/src/test/java/rest/koios/client/backend/api/asset/AssetServicePreviewIntegrationTest.java @@ -79,6 +79,15 @@ void getNFTAddressTest() throws ApiException { log.info(assetAddressesResult.getValue().toString()); } + @Test + void getPolicyAssetAddressListTest() throws ApiException { + String assetPolicy = "005b8ca355aec6125531ebea89bf9ef8df90121ea5717f0c55027e35"; + Result> assetAddressesResult = assetService.getPolicyAssetAddressList(assetPolicy, Options.EMPTY); + Assertions.assertTrue(assetAddressesResult.isSuccessful()); + Assertions.assertNotNull(assetAddressesResult.getValue()); + log.info(assetAddressesResult.getValue().toString()); + } + @Test void getAssetInformationTest() throws ApiException { String assetPolicy = "9a50f458ebffb4c3f9d6f9f3d45426b2de6cf2512254f4bfa3d8f410"; @@ -165,6 +174,22 @@ void getAssetPolicyInformationBadRequestTest() { assertInstanceOf(ApiException.class, exception); } + @Test + void getPolicyAssetMintsTest() throws ApiException { + String assetPolicy = "9a50f458ebffb4c3f9d6f9f3d45426b2de6cf2512254f4bfa3d8f410"; + Result> policyAssetMintsResult = assetService.getPolicyAssetMints(assetPolicy, Options.EMPTY); + Assertions.assertTrue(policyAssetMintsResult.isSuccessful()); + Assertions.assertNotNull(policyAssetMintsResult.getValue()); + log.info(policyAssetMintsResult.getValue().toString()); + } + + @Test + void getPolicyAssetMintsBadRequestTest() { + String assetPolicy = "test"; + ApiException exception = assertThrows(ApiException.class, () -> assetService.getPolicyAssetMints(assetPolicy, Options.EMPTY)); + assertInstanceOf(ApiException.class, exception); + } + @Test void getAssetSummaryTest() throws ApiException { String assetPolicy = "9a50f458ebffb4c3f9d6f9f3d45426b2de6cf2512254f4bfa3d8f410"; diff --git a/src/test/java/rest/koios/client/backend/api/block/BlockServiceMainnetIntegrationTest.java b/src/test/java/rest/koios/client/backend/api/block/BlockServiceMainnetIntegrationTest.java index 12825ce..52c9652 100644 --- a/src/test/java/rest/koios/client/backend/api/block/BlockServiceMainnetIntegrationTest.java +++ b/src/test/java/rest/koios/client/backend/api/block/BlockServiceMainnetIntegrationTest.java @@ -10,6 +10,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.BackendFactory; import rest.koios.client.backend.factory.options.Limit; import rest.koios.client.backend.factory.options.Options; @@ -117,4 +118,20 @@ void getBlockTransactionsBadRequestTest() { ApiException exception = assertThrows(ApiException.class, () -> blockService.getBlockTransactions(List.of(hash), Options.EMPTY)); assertInstanceOf(ApiException.class, exception); } + + @Test + void getBlockTransactionsInfoTest() throws ApiException { + String hash = "f6192a1aaa6d3d05b4703891a6b66cd757801c61ace86cbe5ab0d66e07f601ab"; + Result> blockTransactionsResult = blockService.getBlockTransactionsInfo(List.of(hash), true, true, true, true, true, true, Options.EMPTY); + Assertions.assertTrue(blockTransactionsResult.isSuccessful()); + Assertions.assertNotNull(blockTransactionsResult.getValue()); + log.info(blockTransactionsResult.getValue().toString()); + } + + @Test + void getBlockTransactionsInfoBadRequestTest() { + String hash = "test"; + ApiException exception = assertThrows(ApiException.class, () -> blockService.getBlockTransactionsInfo(List.of(hash), true, true, true, true, true, true, Options.EMPTY)); + assertInstanceOf(ApiException.class, exception); + } } diff --git a/src/test/java/rest/koios/client/backend/api/block/BlockServicePreprodIntegrationTest.java b/src/test/java/rest/koios/client/backend/api/block/BlockServicePreprodIntegrationTest.java index da2272f..510ed70 100644 --- a/src/test/java/rest/koios/client/backend/api/block/BlockServicePreprodIntegrationTest.java +++ b/src/test/java/rest/koios/client/backend/api/block/BlockServicePreprodIntegrationTest.java @@ -10,6 +10,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.BackendFactory; import rest.koios.client.backend.factory.options.Limit; import rest.koios.client.backend.factory.options.Options; @@ -105,4 +106,20 @@ void getBlockTransactionsBadRequestTest() { ApiException exception = assertThrows(ApiException.class, () -> blockService.getBlockTransactions(List.of(hash), Options.EMPTY)); assertInstanceOf(ApiException.class, exception); } + + @Test + void getBlockTransactionsInfoTest() throws ApiException { + String hash = "065b9f0a52b3d3897160a065a7fe2bcb64b2bf635937294ade457de6a7bfd2a4"; + Result> blockTransactionsResult = blockService.getBlockTransactionsInfo(List.of(hash), true, true, true, true, true, true, Options.EMPTY); + Assertions.assertTrue(blockTransactionsResult.isSuccessful()); + Assertions.assertNotNull(blockTransactionsResult.getValue()); + log.info(blockTransactionsResult.getValue().toString()); + } + + @Test + void getBlockTransactionsInfoBadRequestTest() { + String hash = "test"; + ApiException exception = assertThrows(ApiException.class, () -> blockService.getBlockTransactionsInfo(List.of(hash), true, true, true, true, true, true, Options.EMPTY)); + assertInstanceOf(ApiException.class, exception); + } } diff --git a/src/test/java/rest/koios/client/backend/api/block/BlockServicePreviewIntegrationTest.java b/src/test/java/rest/koios/client/backend/api/block/BlockServicePreviewIntegrationTest.java index 8c86855..107241b 100644 --- a/src/test/java/rest/koios/client/backend/api/block/BlockServicePreviewIntegrationTest.java +++ b/src/test/java/rest/koios/client/backend/api/block/BlockServicePreviewIntegrationTest.java @@ -10,6 +10,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.BackendFactory; import rest.koios.client.backend.factory.options.Limit; import rest.koios.client.backend.factory.options.Options; @@ -105,4 +106,20 @@ void getBlockTransactionsBadRequestTest() { ApiException exception = assertThrows(ApiException.class, () -> blockService.getBlockTransactions(List.of(hash), Options.EMPTY)); assertInstanceOf(ApiException.class, exception); } + + @Test + void getBlockTransactionsInfoTest() throws ApiException { + String hash = "501fc2c3e3d03f61ec6d19d3f8feb38f3c3c30df66c68027abbd6c99b5acef0e"; + Result> blockTransactionsResult = blockService.getBlockTransactionsInfo(List.of(hash), true, true, true, true, true, true, Options.EMPTY); + Assertions.assertTrue(blockTransactionsResult.isSuccessful()); + Assertions.assertNotNull(blockTransactionsResult.getValue()); + log.info(blockTransactionsResult.getValue().toString()); + } + + @Test + void getBlockTransactionsInfoBadRequestTest() { + String hash = "test"; + ApiException exception = assertThrows(ApiException.class, () -> blockService.getBlockTransactionsInfo(List.of(hash), true, true, true, true, true, true, Options.EMPTY)); + assertInstanceOf(ApiException.class, exception); + } }