blockfrost-client 0.7.1.1 → 0.8.0.0
raw patch · 9 files changed
+159/−14 lines, 9 filesdep ~blockfrost-apidep ~servantPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: blockfrost-api, servant
API changes (from Hackage documentation)
+ Blockfrost.Client: deriveShelleyAddress :: MonadBlockfrost m => Text -> Integer -> Integer -> m DerivedAddress
+ Blockfrost.Client: getAccountAssociatedAddressesTotal :: MonadBlockfrost m => Address -> m AddressAssociatedTotal
+ Blockfrost.Client: getAddressInfoExtended :: MonadBlockfrost m => Address -> m AddressInfoExtended
+ Blockfrost.Client: listPoolsExtended :: MonadBlockfrost m => m [Pool]
+ Blockfrost.Client: listPoolsExtended' :: MonadBlockfrost m => Paged -> SortOrder -> m [Pool]
+ Blockfrost.Client: txEvaluate :: MonadBlockfrost m => CBORString -> m TxEval
+ Blockfrost.Client: txEvaluateUTXOs :: MonadBlockfrost m => TxEvalInput -> m TxEval
+ Blockfrost.Client.Cardano.Accounts: getAccountAssociatedAddressesTotal :: MonadBlockfrost m => Address -> m AddressAssociatedTotal
+ Blockfrost.Client.Cardano.Addresses: getAddressInfoExtended :: MonadBlockfrost m => Address -> m AddressInfoExtended
+ Blockfrost.Client.Cardano.Assets: parseStandardMetadata :: Maybe Value -> Maybe AssetOnChainMetadata
+ Blockfrost.Client.Cardano.Pools: listPoolsExtended :: MonadBlockfrost m => m [Pool]
+ Blockfrost.Client.Cardano.Pools: listPoolsExtended' :: MonadBlockfrost m => Paged -> SortOrder -> m [Pool]
+ Blockfrost.Client.Cardano.Utils: deriveShelleyAddress :: MonadBlockfrost m => Text -> Integer -> Integer -> m DerivedAddress
+ Blockfrost.Client.Cardano.Utils: txEvaluate :: MonadBlockfrost m => CBORString -> m TxEval
+ Blockfrost.Client.Cardano.Utils: txEvaluateUTXOs :: MonadBlockfrost m => TxEvalInput -> m TxEval
Files
- CHANGELOG.md +12/−0
- blockfrost-client.cabal +6/−4
- src/Blockfrost/Client.hs +9/−0
- src/Blockfrost/Client/Cardano/Accounts.hs +7/−0
- src/Blockfrost/Client/Cardano/Addresses.hs +8/−0
- src/Blockfrost/Client/Cardano/Assets.hs +2/−1
- src/Blockfrost/Client/Cardano/Pools.hs +18/−0
- src/Blockfrost/Client/Cardano/Utils.hs +62/−0
- src/Blockfrost/Client/Types.hs +35/−9
CHANGELOG.md view
@@ -1,3 +1,15 @@+# Version [0.8.0.0](https://github.com/blockfrost/blockfrost-haskell/compare/client-0.7.1.1...client-0.8.0.0) (2023-12-18)++* Allow servant `0.20` [#41](https://github.com/blockfrost/blockfrost-haskell/pull/41)+* Additions [#43](https://github.com/blockfrost/blockfrost-haskell/pull/43)+ * `getAccountAssociatedAddressesTotal` for `/accounts/:stake_address/addresses/total`+ * `getAddressInfoExtended` for `/addresses/:address/extended`+ * `listPoolsExtended` for `/pools/extended`+ * `/utils` API+ * `deriveShelleyAddress` for `/utils/addresses/xpub/:xpub/:role/:index`+ * `evaluateTx` for `/utils/txs/evaluate` endpoint+ * `evaluateTxUTXOs` for `/utils/txs/evaluate/utxos` endpoint+ # Version [0.7.1.1](https://github.com/blockfrost/blockfrost-haskell/compare/v0.7.1.0...client-0.7.1.1) (2023-01-10) * Allow blockfrost-api `0.8`
blockfrost-client.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: blockfrost-client-version: 0.7.1.1+version: 0.8.0.0 synopsis: blockfrost.io basic client description: Simple Blockfrost clients for use with transformers or mtl homepage: https://github.com/blockfrost/blockfrost-haskell@@ -14,9 +14,10 @@ extra-source-files:- CHANGELOG.md LICENSE README.md+extra-doc-files:+ CHANGELOG.md flag BuildFast Default: True@@ -61,10 +62,11 @@ , Blockfrost.Client.Cardano.Pools , Blockfrost.Client.Cardano.Scripts , Blockfrost.Client.Cardano.Transactions+ , Blockfrost.Client.Cardano.Utils , Blockfrost.Client.IPFS , Blockfrost.Client.NutLink build-depends: base >= 4.7 && < 5- , blockfrost-api >= 0.7.1+ , blockfrost-api >= 0.9 , blockfrost-client-core ^>= 0.6 , bytestring , directory@@ -72,7 +74,7 @@ , filepath , text , mtl- , servant >= 0.18 && < 0.20+ , servant >= 0.18 && < 0.21 , servant-client , servant-client-core
src/Blockfrost/Client.hs view
@@ -31,10 +31,12 @@ , getAccountMirs' , getAccountAssociatedAddresses , getAccountAssociatedAddresses'+ , getAccountAssociatedAddressesTotal , getAccountAssociatedAssets , getAccountAssociatedAssets' -- Cardano - Addresses , getAddressInfo+ , getAddressInfoExtended , getAddressDetails , getAddressUtxos , getAddressUtxos'@@ -101,6 +103,8 @@ -- Cardano - Pools , listPools , listPools'+ , listPoolsExtended+ , listPoolsExtended' , listRetiredPools , listRetiredPools' , listRetiringPools@@ -139,6 +143,10 @@ , getTxMetadataCBOR , getTxRedeemers , submitTx+ -- Cardano - Utils+ , deriveShelleyAddress+ , txEvaluate+ , txEvaluateUTXOs -- IPFS , ipfsAdd , ipfsGateway@@ -174,6 +182,7 @@ import Blockfrost.Client.Cardano.Pools import Blockfrost.Client.Cardano.Scripts import Blockfrost.Client.Cardano.Transactions+import Blockfrost.Client.Cardano.Utils import Blockfrost.Client.IPFS import Blockfrost.Client.NutLink import Blockfrost.Client.Types
src/Blockfrost/Client/Cardano/Accounts.hs view
@@ -16,6 +16,7 @@ , getAccountMirs' , getAccountAssociatedAddresses , getAccountAssociatedAddresses'+ , getAccountAssociatedAddressesTotal , getAccountAssociatedAssets , getAccountAssociatedAssets' ) where@@ -145,6 +146,12 @@ -- that accepts 'Paged' argument. getAccountAssociatedAddresses :: MonadBlockfrost m => Address -> m [AddressAssociated] getAccountAssociatedAddresses a = getAccountAssociatedAddresses' a def def++getAccountAssociatedAddressesTotal_ :: MonadBlockfrost m => Project -> Address -> m AddressAssociatedTotal+getAccountAssociatedAddressesTotal_ = _accountAssociatedTotal . accountsClient++getAccountAssociatedAddressesTotal :: MonadBlockfrost m => Address -> m AddressAssociatedTotal+getAccountAssociatedAddressesTotal a = go (`getAccountAssociatedAddressesTotal_` a) getAccountAssociatedAssets_ :: MonadBlockfrost m => Project -> Address -> Paged -> SortOrder -> m [Amount] getAccountAssociatedAssets_ = _accountAssociatedAssets . accountsClient
src/Blockfrost/Client/Cardano/Addresses.hs view
@@ -2,6 +2,7 @@ module Blockfrost.Client.Cardano.Addresses ( getAddressInfo+ , getAddressInfoExtended , getAddressDetails , getAddressUtxos , getAddressUtxos'@@ -24,6 +25,13 @@ -- | Obtain information about a specific address. getAddressInfo :: MonadBlockfrost m => Address -> m AddressInfo getAddressInfo a = go (`getAddressInfo_` a)++getAddressInfoExtended_ :: MonadBlockfrost m => Project -> Address -> m AddressInfoExtended+getAddressInfoExtended_ = _addressInfoExtended . addressesClient++-- | Obtain extended information about a specific address.+getAddressInfoExtended :: MonadBlockfrost m => Address -> m AddressInfoExtended+getAddressInfoExtended a = go (`getAddressInfoExtended_` a) getAddressDetails_ :: MonadBlockfrost m => Project -> Address -> m AddressDetails getAddressDetails_ = _addressDetails . addressesClient
src/Blockfrost/Client/Cardano/Assets.hs view
@@ -12,6 +12,7 @@ , getAssetAddresses' , getAssetsByPolicy , getAssetsByPolicy'+ , parseStandardMetadata ) where import Blockfrost.API@@ -42,7 +43,7 @@ -- | Information about a specific asset getAssetDetails :: MonadBlockfrost m => AssetId -> m AssetDetails-getAssetDetails a = go (`getAssetDetails_` a)+getAssetDetails a = parseStandardMetadataInDetails <$> go (`getAssetDetails_` a) getAssetHistory_ :: MonadBlockfrost m => Project -> AssetId -> Paged -> SortOrder -> m [AssetHistory] getAssetHistory_ = _assetHistory . assetsClient
src/Blockfrost/Client/Cardano/Pools.hs view
@@ -3,6 +3,8 @@ module Blockfrost.Client.Cardano.Pools ( listPools , listPools'+ , listPoolsExtended+ , listPoolsExtended' , listRetiredPools , listRetiredPools' , listRetiringPools@@ -42,6 +44,22 @@ -- that accepts 'Paged' argument. listPools :: MonadBlockfrost m => m [PoolId] listPools = listPools' def def++listPoolsExtended_ :: MonadBlockfrost m => Project -> Paged -> SortOrder -> m [Pool]+listPoolsExtended_ = _listPoolsExtended . poolsClient++-- | List registered stake pools with additional info+-- Allows custom paging and ordering using 'Paged' and 'SortOrder'.+listPoolsExtended' :: MonadBlockfrost m => Paged -> SortOrder -> m [Pool]+listPoolsExtended' pg s = go (\p -> listPoolsExtended_ p pg s)++-- | List registered stake pools with additional info.+--+-- Queries 100 entries. To query all entries use 'Blockfrost.Client.Core.allPages'+-- with principled variant of this function (suffixed with @'@)+-- that accepts 'Paged' argument.+listPoolsExtended :: MonadBlockfrost m => m [Pool]+listPoolsExtended = listPoolsExtended' def def listRetiredPools_ :: MonadBlockfrost m => Project -> Paged -> SortOrder -> m [PoolEpoch] listRetiredPools_ = _listRetiredPools . poolsClient
+ src/Blockfrost/Client/Cardano/Utils.hs view
@@ -0,0 +1,62 @@+-- | Utility queries++module Blockfrost.Client.Cardano.Utils+ ( deriveShelleyAddress+ , txEvaluate+ , txEvaluateUTXOs+ ) where++import Data.Text (Text)+import Blockfrost.API+import Blockfrost.Client.Types+import Blockfrost.Types++utilsClient :: MonadBlockfrost m => Project -> UtilsAPI (AsClientT m)+utilsClient = fromServant . _utils . cardanoClient++-- | Derive Shelley address from xpub key+deriveShelleyAddress_+ :: MonadBlockfrost m+ => Project+ -> Text -- ^ Hexadecimal xpub+ -> Integer -- ^ Account role+ -> Integer -- ^ Address index+ -> m DerivedAddress+deriveShelleyAddress_ = _deriveAddr . utilsClient++-- | Derive Shelley address from xpub key+deriveShelleyAddress+ :: MonadBlockfrost m+ => Text -- ^ Hexadecimal xpub+ -> Integer -- ^ Account role+ -> Integer -- ^ Address index+ -> m DerivedAddress+deriveShelleyAddress xpub role index = go (\p -> deriveShelleyAddress_ p xpub role index)++txEvaluate_+ :: MonadBlockfrost m+ => Project+ -> CBORString+ -> m TxEval+txEvaluate_ = _txEvaluate . utilsClient++-- | Submit a transaction for execution units evaluation+txEvaluate+ :: MonadBlockfrost m+ => CBORString+ -> m TxEval+txEvaluate txCbor = go (`txEvaluate_` txCbor)++txEvaluateUTXOs_+ :: MonadBlockfrost m+ => Project+ -> TxEvalInput+ -> m TxEval+txEvaluateUTXOs_ = _txEvaluateUTXOs . utilsClient++-- | Submit a transaction for execution units evaluation (additional UTXO set)+txEvaluateUTXOs+ :: MonadBlockfrost m+ => TxEvalInput+ -> m TxEval+txEvaluateUTXOs txei = go (`txEvaluateUTXOs_` txei)
src/Blockfrost/Client/Types.hs view
@@ -64,7 +64,9 @@ liftBlockfrostClient act = BlockfrostClientT $ do (env, _proj) <- ask liftIO (runClientM act env)- >>= either (throwError . fromServantClientError) pure+ >>= either+ (throwError . fromServantClientError)+ pure getConf = BlockfrostClientT ask instance MonadBlockfrost ClientM where@@ -72,13 +74,24 @@ getConf = newClientConfig instance MonadBlockfrost IO where- liftBlockfrostClient act = getConf >>= \(env, _prj) -> runClientM act env >>= either (error . show) pure+ liftBlockfrostClient act =+ getConf+ >>= \(env, _prj) ->+ runClientM act env+ >>= either+ (error . show)+ pure getConf = newClientConfig -apiClient :: MonadBlockfrost m => BlockfrostAPI (AsClientT m)+apiClient+ :: MonadBlockfrost m+ => BlockfrostAPI (AsClientT m) apiClient = genericClientHoist liftBlockfrostClient -api0Client :: MonadBlockfrost m => Project -> BlockfrostV0API (AsClientT m)+api0Client+ :: MonadBlockfrost m+ => Project+ -> BlockfrostV0API (AsClientT m) api0Client = fromServant . _apiV0 apiClient -- ** Client runner@@ -92,7 +105,8 @@ -- | Run @BlockfrostClientT@, using provided @Project@ runBlockfrostClientT- :: MonadIO m => Project+ :: MonadIO m+ => Project -> BlockfrostClientT m a -> m (Either BlockfrostError a) runBlockfrostClientT proj act = do@@ -125,14 +139,26 @@ -- ** Service clients -commonClient :: MonadBlockfrost m => Project -> CommonAPI (AsClientT m)+commonClient+ :: MonadBlockfrost m+ => Project+ -> CommonAPI (AsClientT m) commonClient = fromServant . _common . api0Client -cardanoClient :: MonadBlockfrost m => Project -> CardanoAPI (AsClientT m)+cardanoClient+ :: MonadBlockfrost m+ => Project+ -> CardanoAPI (AsClientT m) cardanoClient = fromServant . _cardano . api0Client -ipfsClient :: MonadBlockfrost m => Project -> IPFSAPI (AsClientT m)+ipfsClient+ :: MonadBlockfrost m+ => Project+ -> IPFSAPI (AsClientT m) ipfsClient = fromServant . _ipfs . api0Client -nutLinkClient :: MonadBlockfrost m => Project -> NutLinkAPI (AsClientT m)+nutLinkClient+ :: MonadBlockfrost m+ => Project+ -> NutLinkAPI (AsClientT m) nutLinkClient = fromServant . _nutLink . api0Client