diff --git a/CHANGELOG.md b/CHANGELOG.md index 13fdd3c..e5a80db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Revision history for `maestro-sdk` +## [1.3.0](https://github.com/maestro-org/haskell-sdk/compare/v1.2.0..v1.3.0) -- 2023-11-27 + +* Removed deprecated `/datum` endpoint in favour of `/datums`, [#42](https://github.com/maestro-org/haskell-sdk/pull/42). +* Support for endpoint to query UTxOs at a single address, [#42](https://github.com/maestro-org/haskell-sdk/pull/42). + +## [1.2.0](https://github.com/maestro-org/haskell-sdk/compare/v1.1.0..v1.2.0) -- 2023-10-18 + +* Incorporating updated response when submitting the transaction, [#41](https://github.com/maestro-org/haskell-sdk/pull/41). + ## [1.1.0](https://github.com/maestro-org/haskell-sdk/compare/v1.0.0..v1.1.0) -- 2023-09-23 * Support of v0 family of endpoints have been dropped, [#33](https://github.com/maestro-org/haskell-sdk/pull/33). diff --git a/maestro-sdk.cabal b/maestro-sdk.cabal index 0df89b4..609e30b 100644 --- a/maestro-sdk.cabal +++ b/maestro-sdk.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: maestro-sdk -version: 1.1.0 +version: 1.3.0 synopsis: Maestro Blockchain Indexer SDK description: Maestro provides blockchain indexers, APIs and event management systems for the Cardano blockchain. license: Apache-2.0 diff --git a/src/Maestro/API/V1.hs b/src/Maestro/API/V1.hs index b1ddc66..1cd12ee 100644 --- a/src/Maestro/API/V1.hs +++ b/src/Maestro/API/V1.hs @@ -17,7 +17,7 @@ data MaestroApiV1 route = MaestroApiV1 , accounts :: route :- "accounts" :> ToServantApi AccountsAPI , addresses :: route :- "addresses" :> ToServantApi AddressesAPI , blocks :: route :- "blocks" :> ToServantApi BlocksAPI - , datum :: route :- "datum" :> ToServantApi DatumAPI + , datums :: route :- "datums" :> ToServantApi DatumAPI , pools :: route :- "pools" :> ToServantApi PoolsAPI , txManager :: route :- "txmanager" :> ToServantApi TxManagerAPI , transactions :: route :- "transactions" :> ToServantApi TransactionsAPI diff --git a/src/Maestro/API/V1/Addresses.hs b/src/Maestro/API/V1/Addresses.hs index 9f4d1df..b8c102a 100644 --- a/src/Maestro/API/V1/Addresses.hs +++ b/src/Maestro/API/V1/Addresses.hs @@ -13,6 +13,16 @@ data AddressesAPI route = AddressesAPI :> "decode" :> Get '[JSON] AddressInfo + , addressUtxos + :: route + :- Capture "address" (Bech32StringOf Address) + :> "utxos" + :> QueryParam "resolve_datums" Bool + :> QueryParam "with_cbor" Bool + :> QueryParam "asset" NonAdaNativeToken + :> Pagination + :> Get '[JSON] PaginatedUtxoWithSlot + , addressesUtxos :: route :- "utxos" diff --git a/src/Maestro/API/V1/Blocks.hs b/src/Maestro/API/V1/Blocks.hs index f17f13c..5bf1f18 100644 --- a/src/Maestro/API/V1/Blocks.hs +++ b/src/Maestro/API/V1/Blocks.hs @@ -5,12 +5,12 @@ import Servant.API import Servant.API.Generic data BlocksAPI route = BlocksAPI - { -- | Get details of the specified block by hash + { -- | Get details of the specified block by hash. blockByHash :: route :- Capture "hash_or_height" BlockHash :> Get '[JSON] TimestampedBlockDetails - -- | Get details of the specified block by height + -- | Get details of the specified block by height. , blockByHeight :: route :- Capture "hash_or_height" BlockHeight diff --git a/src/Maestro/Client/V1/Addresses.hs b/src/Maestro/Client/V1/Addresses.hs index 0213d51..37a2e09 100644 --- a/src/Maestro/Client/V1/Addresses.hs +++ b/src/Maestro/Client/V1/Addresses.hs @@ -1,6 +1,7 @@ -- | Module to query for /"addresses"/ category of endpoints defined at [docs.gomaestro.org](https://docs.gomaestro.org/docs/category/addresses). module Maestro.Client.V1.Addresses ( + utxosAtAddress, utxosAtMultiAddresses, getRefsAtAddress, utxosByPaymentCredential, @@ -11,7 +12,8 @@ import Maestro.API.V1.Addresses import Maestro.Client.Env import Maestro.Client.V1.Core import Maestro.Types.Common (Address, Bech32StringOf) -import Maestro.Types.V1 (PaginatedOutputReferenceObject, +import Maestro.Types.V1 (NonAdaNativeToken, + PaginatedOutputReferenceObject, PaginatedUtxoWithSlot, PaymentCredentialAddress) import Servant.API.Generic @@ -35,6 +37,23 @@ utxosAtMultiAddresses :: IO PaginatedUtxoWithSlot utxosAtMultiAddresses = addressesUtxos . addressClient +-- | Returns list of utxos for a given address. +utxosAtAddress :: + -- | The Maestro Environment. + MaestroEnv 'V1 -> + -- | Address in bech32 format to fetch utxo from. + Bech32StringOf Address -> + -- | Query param to include the corresponding datums for datum hashes. + Maybe Bool -> + -- | Query Param to include the CBOR encodings of the transaction outputs in the response. + Maybe Bool -> + -- | Query Param to return for only those UTxOs which contain this given asset. + Maybe NonAdaNativeToken -> + -- | The pagination attributes. + Cursor -> + IO PaginatedUtxoWithSlot +utxosAtAddress = addressUtxos . addressClient + -- | UTxO IDs for all the unspent transaction outputs at an address. getRefsAtAddress :: MaestroEnv 'V1 -> diff --git a/src/Maestro/Client/V1/Datum.hs b/src/Maestro/Client/V1/Datum.hs index c68c9d9..895b0b0 100644 --- a/src/Maestro/Client/V1/Datum.hs +++ b/src/Maestro/Client/V1/Datum.hs @@ -4,7 +4,7 @@ module Maestro.Client.V1.Datum ( getDatumByHash ) where -import Maestro.API.V1 (datum) +import Maestro.API.V1 (datums) import Maestro.API.V1.Datum import Maestro.Client.Env import Maestro.Client.V1.Core @@ -13,7 +13,7 @@ import Servant.API.Generic import Servant.Client datumClient :: MaestroEnv 'V1 -> DatumAPI (AsClientT IO) -datumClient = fromServant . datum . apiV1Client +datumClient = fromServant . datums . apiV1Client -- | Get information about the datum from it's hash. getDatumByHash :: MaestroEnv 'V1 -> HexStringOf DatumHash -> IO TimestampedDatum