blockfrost-client 0.1.0.0 → 0.2.0.0
raw patch · 6 files changed
+125/−7 lines, 6 filesdep ~blockfrost-apiPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: blockfrost-api
API changes (from Hackage documentation)
+ Blockfrost.Client: getAddressUtxosAsset :: Address -> AssetId -> BlockfrostClient [AddressUtxo]
+ Blockfrost.Client: getAddressUtxosAsset' :: Address -> AssetId -> Paged -> SortOrder -> BlockfrostClient [AddressUtxo]
+ Blockfrost.Client: getScript :: ScriptHash -> BlockfrostClient Script
+ Blockfrost.Client: getScriptCBOR :: ScriptHash -> BlockfrostClient ScriptCBOR
+ Blockfrost.Client: getScriptDatum :: DatumHash -> BlockfrostClient ScriptDatum
+ Blockfrost.Client: getScriptJSON :: ScriptHash -> BlockfrostClient ScriptJSON
+ Blockfrost.Client: getScriptRedeemers :: ScriptHash -> BlockfrostClient [ScriptRedeemer]
+ Blockfrost.Client: getScriptRedeemers' :: ScriptHash -> Paged -> SortOrder -> BlockfrostClient [ScriptRedeemer]
+ Blockfrost.Client: listScripts :: BlockfrostClient [ScriptHash]
+ Blockfrost.Client: listScripts' :: Paged -> SortOrder -> BlockfrostClient [ScriptHash]
+ Blockfrost.Client.Cardano.Addresses: getAddressUtxosAsset :: Address -> AssetId -> BlockfrostClient [AddressUtxo]
+ Blockfrost.Client.Cardano.Addresses: getAddressUtxosAsset' :: Address -> AssetId -> Paged -> SortOrder -> BlockfrostClient [AddressUtxo]
+ Blockfrost.Client.Cardano.Scripts: getScript :: ScriptHash -> BlockfrostClient Script
+ Blockfrost.Client.Cardano.Scripts: getScriptCBOR :: ScriptHash -> BlockfrostClient ScriptCBOR
+ Blockfrost.Client.Cardano.Scripts: getScriptDatum :: DatumHash -> BlockfrostClient ScriptDatum
+ Blockfrost.Client.Cardano.Scripts: getScriptJSON :: ScriptHash -> BlockfrostClient ScriptJSON
+ Blockfrost.Client.Cardano.Scripts: getScriptRedeemers :: ScriptHash -> BlockfrostClient [ScriptRedeemer]
+ Blockfrost.Client.Cardano.Scripts: getScriptRedeemers' :: ScriptHash -> Paged -> SortOrder -> BlockfrostClient [ScriptRedeemer]
+ Blockfrost.Client.Cardano.Scripts: listScripts :: BlockfrostClient [ScriptHash]
+ Blockfrost.Client.Cardano.Scripts: listScripts' :: Paged -> SortOrder -> BlockfrostClient [ScriptHash]
+ Blockfrost.Client.Cardano.Transactions: getTxRedeemers :: TxHash -> BlockfrostClient [TransactionRedeemer]
- Blockfrost.Client: getAddressUtxos :: Address -> BlockfrostClient [AddressUTXO]
+ Blockfrost.Client: getAddressUtxos :: Address -> BlockfrostClient [AddressUtxo]
- Blockfrost.Client: getAddressUtxos' :: Address -> Paged -> SortOrder -> BlockfrostClient [AddressUTXO]
+ Blockfrost.Client: getAddressUtxos' :: Address -> Paged -> SortOrder -> BlockfrostClient [AddressUtxo]
- Blockfrost.Client.Cardano.Addresses: getAddressUtxos :: Address -> BlockfrostClient [AddressUTXO]
+ Blockfrost.Client.Cardano.Addresses: getAddressUtxos :: Address -> BlockfrostClient [AddressUtxo]
- Blockfrost.Client.Cardano.Addresses: getAddressUtxos' :: Address -> Paged -> SortOrder -> BlockfrostClient [AddressUTXO]
+ Blockfrost.Client.Cardano.Addresses: getAddressUtxos' :: Address -> Paged -> SortOrder -> BlockfrostClient [AddressUtxo]
Files
- CHANGELOG.md +13/−1
- blockfrost-client.cabal +4/−3
- src/Blockfrost/Client.hs +12/−0
- src/Blockfrost/Client/Cardano/Addresses.hs +17/−3
- src/Blockfrost/Client/Cardano/Scripts.hs +71/−0
- src/Blockfrost/Client/Cardano/Transactions.hs +8/−0
CHANGELOG.md view
@@ -1,4 +1,16 @@-# Version [0.1.0.0](https://github.com/blockfrost/blockfrost-haskell/compare/initial...0.1.0.0) (2021-09-14)+# Version [0.2.0.0](https://github.com/blockfrost/blockfrost-haskell/compare/v0.1.0.0...v0.2.0.0) (2021-10-29)++* Alonzo additions+ * `getTxRedeemers` for `/txs/${hash}/redeemers` endpoint+ * `listScripts` for `/scripts` endpoint, principled `listScripts'`+ * `getScript` for `/scripts/${script_hash}` endpoint+ * `getScriptRedeemers` for `/scripts/${script_hash}/redeemers` endpoint, principled `getScriptRedeemers'`+ * `getAddressUtxosAsset` for `/addresses/${address}/utxos/${asset}`, principled `getAddressUtxosAsset'`+ * `getScriptDatum` for `/scripts/datum/${datum_hash}` endpoint+ * `getScriptJSON` for `/scripts/${script_hash}/json` endpoint+ * `getScriptCBOR` for `/scripts/${script_hash}/cbor` endpoint++# Version [0.1.0.0](https://github.com/blockfrost/blockfrost-haskell/compare/initial...v0.1.0.0) (2021-09-14) * Added `allPages`, re-exported couple more pagination helpers * Initial release
blockfrost-client.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: blockfrost-client-version: 0.1.0.0+version: 0.2.0.0 synopsis: blockfrost.io basic client description: Simple Blockfrost clients for use with transformers or mtl homepage: https://github.com/blockfrost/blockfrost-haskell@@ -9,7 +9,7 @@ author: blockfrost.io maintainer: srk@48.io copyright: 2021 blockfrost.io-category: Web+category: Cardano build-type: Simple @@ -59,11 +59,12 @@ , Blockfrost.Client.Cardano.Metadata , Blockfrost.Client.Cardano.Network , Blockfrost.Client.Cardano.Pools+ , Blockfrost.Client.Cardano.Scripts , Blockfrost.Client.Cardano.Transactions , Blockfrost.Client.IPFS , Blockfrost.Client.NutLink build-depends: base >= 4.7 && < 5- , blockfrost-api+ , blockfrost-api ^>= 0.2 , blockfrost-client-core , bytestring , directory
src/Blockfrost/Client.hs view
@@ -36,6 +36,8 @@ , getAddressDetails , getAddressUtxos , getAddressUtxos'+ , getAddressUtxosAsset+ , getAddressUtxosAsset' , getAddressTransactions , getAddressTransactions' -- Cardano - Assets@@ -109,6 +111,15 @@ , getPoolBlocks' , getPoolUpdates , getPoolUpdates'+ -- Cardano - Scripts+ , listScripts+ , listScripts'+ , getScript+ , getScriptRedeemers+ , getScriptRedeemers'+ , getScriptDatum+ , getScriptJSON+ , getScriptCBOR -- Cardano - Transactions , getTx , getTxUtxos@@ -154,6 +165,7 @@ import Blockfrost.Client.Cardano.Metadata import Blockfrost.Client.Cardano.Network import Blockfrost.Client.Cardano.Pools+import Blockfrost.Client.Cardano.Scripts import Blockfrost.Client.Cardano.Transactions import Blockfrost.Client.IPFS import Blockfrost.Client.NutLink
src/Blockfrost/Client/Cardano/Addresses.hs view
@@ -5,6 +5,8 @@ , getAddressDetails , getAddressUtxos , getAddressUtxos'+ , getAddressUtxosAsset+ , getAddressUtxosAsset' , getAddressTransactions , getAddressTransactions' ) where@@ -30,17 +32,29 @@ getAddressDetails :: Address -> BlockfrostClient AddressDetails getAddressDetails a = go (`getAddressDetails_` a) -getAddressUtxos_ :: Project -> Address -> Paged -> SortOrder -> BlockfrostClient [AddressUTXO]+getAddressUtxos_ :: Project -> Address -> Paged -> SortOrder -> BlockfrostClient [AddressUtxo] getAddressUtxos_ = _addressUtxos . addressesClient -- | UTXOs of the address. -- Allows custom paging and ordering using @Paged@ and @SortOrder@.-getAddressUtxos' :: Address -> Paged -> SortOrder -> BlockfrostClient [AddressUTXO]+getAddressUtxos' :: Address -> Paged -> SortOrder -> BlockfrostClient [AddressUtxo] getAddressUtxos' a pg s = go (\p -> getAddressUtxos_ p a pg s) -- | UTXOs of the address.-getAddressUtxos :: Address -> BlockfrostClient [AddressUTXO]+getAddressUtxos :: Address -> BlockfrostClient [AddressUtxo] getAddressUtxos a = getAddressUtxos' a def def++getAddressUtxosAsset_ :: Project -> Address -> AssetId -> Paged -> SortOrder -> BlockfrostClient [AddressUtxo]+getAddressUtxosAsset_ = _addressUtxosAsset . addressesClient++-- | UTXOs of the address containing specific asset.+-- Allows custom paging and ordering using @Paged@ and @SortOrder@.+getAddressUtxosAsset' :: Address -> AssetId-> Paged -> SortOrder -> BlockfrostClient [AddressUtxo]+getAddressUtxosAsset' addr asset pg s = go (\p -> getAddressUtxosAsset_ p addr asset pg s)++-- | UTXOs of the address containing specific asset.+getAddressUtxosAsset :: Address -> AssetId -> BlockfrostClient [AddressUtxo]+getAddressUtxosAsset addr asset = getAddressUtxosAsset' addr asset def def getAddressTransactions_ :: --- Project -> Address -> BlockfrostClient [AddressTransaction]
+ src/Blockfrost/Client/Cardano/Scripts.hs view
@@ -0,0 +1,71 @@+-- | Script queries++module Blockfrost.Client.Cardano.Scripts+ ( listScripts+ , listScripts'+ , getScript+ , getScriptRedeemers+ , getScriptRedeemers'+ , getScriptDatum+ , getScriptJSON+ , getScriptCBOR+ ) where++import Blockfrost.API+import Blockfrost.Client.Types+import Blockfrost.Types++scriptsClient :: Project -> ScriptsAPI (AsClientT BlockfrostClient)+scriptsClient = fromServant . _scripts . cardanoClient++listScripts_ :: Project -> Paged -> SortOrder -> BlockfrostClient [ScriptHash]+listScripts_ = _listScripts . scriptsClient++-- | List scripts+-- Allows custom paging and ordering using @Paged@ and @SortOrder@.+listScripts' :: Paged -> SortOrder -> BlockfrostClient [ScriptHash]+listScripts' pg s = go (\p -> listScripts_ p pg s)++-- | List scripts+listScripts :: BlockfrostClient [ScriptHash]+listScripts = listScripts' def def++getScript_ :: Project -> ScriptHash -> BlockfrostClient Script+getScript_ = _getScript . scriptsClient++-- | Get specific script information+getScript:: ScriptHash -> BlockfrostClient Script+getScript sh = go (`getScript_` sh)++getScriptRedeemers_ :: Project -> ScriptHash -> Paged -> SortOrder -> BlockfrostClient [ScriptRedeemer]+getScriptRedeemers_ = _getScriptRedeemers . scriptsClient++-- | Get redeemers of a specific script+-- Allows custom paging and ordering using @Paged@ and @SortOrder@.+getScriptRedeemers' :: ScriptHash -> Paged -> SortOrder -> BlockfrostClient [ScriptRedeemer]+getScriptRedeemers' sh pg s = go (\p -> getScriptRedeemers_ p sh pg s)++-- | Get redeemers of a specific script+getScriptRedeemers :: ScriptHash -> BlockfrostClient [ScriptRedeemer]+getScriptRedeemers sh = getScriptRedeemers' sh def def++getScriptDatum_ :: Project -> DatumHash -> BlockfrostClient ScriptDatum+getScriptDatum_ = _getScriptDatum . scriptsClient++-- | Get specific datum+getScriptDatum :: DatumHash -> BlockfrostClient ScriptDatum+getScriptDatum sh = go (`getScriptDatum_` sh)++getScriptJSON_ :: Project -> ScriptHash -> BlockfrostClient ScriptJSON+getScriptJSON_ = _getScriptJSON . scriptsClient++-- | Get a JSON representation of a `timelock` script+getScriptJSON :: ScriptHash -> BlockfrostClient ScriptJSON+getScriptJSON sh = go (`getScriptJSON_` sh)++getScriptCBOR_ :: Project -> ScriptHash -> BlockfrostClient ScriptCBOR+getScriptCBOR_ = _getScriptCBOR . scriptsClient++-- | Get a CBOR representation of a `plutus` script+getScriptCBOR :: ScriptHash -> BlockfrostClient ScriptCBOR+getScriptCBOR sh = go (`getScriptCBOR_` sh)
src/Blockfrost/Client/Cardano/Transactions.hs view
@@ -3,6 +3,7 @@ module Blockfrost.Client.Cardano.Transactions ( getTx , getTxUtxos+ , getTxRedeemers , getTxStakes , getTxDelegations , getTxWithdrawals@@ -34,6 +35,13 @@ -- | Get transaction UTXOs getTxUtxos :: TxHash -> BlockfrostClient TransactionUtxos getTxUtxos t = go (`getTxUtxos_` t)++getTxRedeemers_ :: Project -> TxHash -> BlockfrostClient [TransactionRedeemer]+getTxRedeemers_ = _txRedeemers . transactionsClient++-- | Get transaction redeemers+getTxRedeemers :: TxHash -> BlockfrostClient [TransactionRedeemer]+getTxRedeemers t = go (`getTxRedeemers_` t) getTxStakes_ :: Project -> TxHash -> BlockfrostClient [TransactionStake] getTxStakes_ = _txStakes . transactionsClient