Skip to content

Dr-Mazen-Khaddaj/haskell-sdk

 
 

Repository files navigation

Maestro Logo

Haskell SDK for the Maestro Dapp Platform

Getting Started

  1. Add maestro-sdk to the build-depends of your project.
  2. Create a Maestro API key.
  3. Code below explains sample usage.
module Main (main) where

import           Control.Exception (try)
import           Maestro.Client.V1  -- @Maestro.Client.V1@ defines all the client utilities to query Maestro API endpoints.
import           Maestro.Types.V1  -- @Maestro.Types.V1@ defines all the types used.

main :: IO ()
main = do
  env <- mkMaestroEnv @'V1 "<Your-API-Key>" Preprod  -- This is how we create an environment against which we'll query endpoints.
  chainTip :: ChainTip <- getTimestampedData <$> getChainTip env  -- Maestro endpoint to get for chain-tip has data & timestamp against which data was calculated. All endpoints which are timestamped, has functions `getTimestampedData` to get for underlying data & `getTimestamp` to get the timestamp.
  addressesUTxOs :: Either MaestroError [UtxoWithSlot] <-
    try  -- To catch for any errors, given in type `MaestroError`.
    $ allPages  -- Since this endpoint is paged, we have a helper utility `allPages` to accumulate data from all the pages.
    $ flip
      (
        utxosAtMultiAddresses env
          (Just True)  -- We would like to have datums resolved. This is for @resolve_datums@ query parameter.
          (Just False)  -- We would not like to include CBOR encodings of the transaction outputs in the response.
      ) ["addr_test1...", "addr_test1...", "addr_test1..."]  -- Mention your list of addresses to query for.
  print addressesUTxOs

Documentation

Contributing

Meastro welcomes all contributors! Please see our contributing guidelines and code of conduct.

About

Haskell SDK for the Maestro Dapp Platform

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 98.8%
  • Nix 1.2%