-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat 30: V1 Endpoints support - support for endpoints needed for Atlas
- Loading branch information
1 parent
4f6095e
commit 1efdc78
Showing
31 changed files
with
797 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Maestro.API.V1.Addresses where | ||
|
||
import Maestro.Client.V1.Core.Pagination | ||
import Maestro.Types.V1 | ||
import Servant.API | ||
import Servant.API.Generic | ||
|
||
data AddressesAPI route = AddressesAPI | ||
{ | ||
_decodeAddress | ||
:: route | ||
:- Capture "address" (TaggedText AddressToDecode) | ||
:> "decode" | ||
:> Get '[JSON] AddressInfo | ||
|
||
, _addressesUtxos | ||
:: route | ||
:- "utxos" | ||
:> QueryParam "resolve_datums" Bool | ||
:> QueryParam "with_cbor" Bool | ||
:> Pagination | ||
:> ReqBody '[JSON] [Bech32StringOf Address] | ||
:> Post '[JSON] PaginatedUtxoWithSlot | ||
|
||
-- , _addressUtxoRefs | ||
-- :: route | ||
-- :- Capture "address" Text | ||
-- :> "utxo_refs" | ||
-- :> Pagination | ||
-- :> Get '[JSON] [UtxoRef] | ||
|
||
} deriving (Generic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Maestro.API.V1.Datum where | ||
|
||
import Maestro.Types.V1 | ||
import Servant.API | ||
import Servant.API.Generic | ||
|
||
newtype DatumAPI route = | ||
DatumAPI | ||
{ | ||
_datumByHash | ||
:: route | ||
:- Capture "datum_hash" (HexStringOf DatumHash) | ||
:> Get '[JSON] Datum | ||
} deriving Generic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Maestro.API.V1.Pools where | ||
|
||
import Maestro.Client.V1.Core.Pagination | ||
import Maestro.Types.V1 | ||
import Servant.API | ||
import Servant.API.Generic | ||
|
||
data PoolsAPI route = PoolsAPI | ||
{ _listPools :: | ||
route | ||
:- Pagination | ||
:> Get '[JSON] PaginatedPoolListInfo | ||
} | ||
deriving (Generic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Maestro.API.V1.Transactions where | ||
|
||
import Maestro.Client.V1.Core.Pagination | ||
import Maestro.Types.V1 | ||
import Servant.API | ||
import Servant.API.Generic | ||
|
||
newtype TransactionsAPI route = TransactionsAPI | ||
{ _txOutputs :: | ||
route | ||
:- "transactions" | ||
:> "outputs" | ||
:> QueryParam "resolve_datums" Bool | ||
:> QueryParam "with_cbor" Bool | ||
:> Pagination | ||
:> ReqBody '[JSON] [OutputReference] | ||
:> Post '[JSON] PaginatedUtxo | ||
} | ||
deriving (Generic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Maestro.API.V1.TxManager where | ||
|
||
import qualified Data.ByteString as BS | ||
import qualified Data.Text as T | ||
import Maestro.Types.V1 | ||
import Servant.API | ||
import Servant.API.Generic | ||
|
||
newtype TxManagerAPI route = TxManagerAPI | ||
{ _monitoredTxSubmit :: | ||
route | ||
:- ReqBody' '[Required] '[CBORStream] BS.ByteString | ||
:> PostAccepted '[JSON] T.Text | ||
} | ||
deriving (Generic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
-- | 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 ( | ||
utxosAtMultiAddresses, | ||
) where | ||
|
||
import Maestro.API.V1 | ||
import Maestro.API.V1.Addresses | ||
import Maestro.Client.Env | ||
import Maestro.Client.V1.Core | ||
import Maestro.Types.Common (Address, Bech32StringOf) | ||
import Maestro.Types.V1 (PaginatedUtxoWithSlot) | ||
import Servant.API.Generic | ||
import Servant.Client | ||
|
||
addressClient :: MaestroEnv 'V1 -> AddressesAPI (AsClientT IO) | ||
addressClient = fromServant . _addresses . apiV1Client | ||
|
||
-- | Returns list of utxos for multiple addresses. | ||
utxosAtMultiAddresses :: | ||
-- | 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 Address in bech32 format to fetch utxo from. | ||
[Bech32StringOf Address] -> | ||
IO PaginatedUtxoWithSlot | ||
utxosAtMultiAddresses = _addressesUtxos . addressClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- | Module to query for /"datum"/ category of endpoints defined at [docs.gomaestro.org](https://docs.gomaestro.org/docs/category/datum). | ||
|
||
module Maestro.Client.V1.Datum | ||
( getDatumByHash | ||
) where | ||
|
||
import Maestro.API.V1 (_datum) | ||
import Maestro.API.V1.Datum | ||
import Maestro.Client.Env | ||
import Maestro.Client.V1.Core | ||
import Maestro.Types.V1 | ||
import Servant.API.Generic | ||
import Servant.Client | ||
|
||
datumClient :: MaestroEnv 'V1 -> DatumAPI (AsClientT IO) | ||
datumClient = fromServant . _datum . apiV1Client | ||
|
||
-- | Get information about the datum from it's hash. | ||
getDatumByHash :: MaestroEnv 'V1 -> HexStringOf DatumHash -> IO Datum | ||
getDatumByHash = _datumByHash . datumClient |
Oops, something went wrong.