Skip to content

Commit

Permalink
feat: utxos by multiple payment credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
sourabhxyz committed Apr 8, 2024
1 parent bdab74c commit eb2db38
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Maestro/API/V1/Addresses.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ data AddressesAPI route = AddressesAPI
:> Pagination
:> Get '[JSON] PaginatedUtxoWithSlot

, paymentCredentialsUtxos
:: route
:- "cred"
:> "utxos"
:> QueryParam "resolve_datums" Bool
:> QueryParam "with_cbor" Bool
:> Pagination
:> ReqBody '[JSON] [Bech32StringOf PaymentCredentialAddress]
:> Get '[JSON] PaginatedUtxoWithSlot

, paymentCredentialTxs
:: route
:- "cred"
Expand Down
16 changes: 16 additions & 0 deletions src/Maestro/Client/V1/Addresses.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Maestro.Client.V1.Addresses (
utxosAtMultiAddresses,
getRefsAtAddress,
utxosByPaymentCredential,
utxosByMultiPaymentCredentials,
txsByAddress,
txsByPaymentCredential,
) where
Expand Down Expand Up @@ -83,6 +84,21 @@ utxosByPaymentCredential ::
IO PaginatedUtxoWithSlot
utxosByPaymentCredential = paymentCredentialUtxos . addressClient

-- | Returns list of utxos for multiple payment credentials.
utxosByMultiPaymentCredentials ::
-- | The Maestro Environment.
MaestroEnv 'V1 ->
-- | 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 ->
-- | The pagination attributes.
Cursor ->
-- | List of payment credential in bech32 format to fetch utxo from.
[Bech32StringOf PaymentCredentialAddress] ->
IO PaginatedUtxoWithSlot
utxosByMultiPaymentCredentials = paymentCredentialsUtxos . addressClient

-- | Returns transactions in which the specified address spent or received funds.
--
-- Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
Expand Down

0 comments on commit eb2db38

Please sign in to comment.