blockfrost-api 0.5.0.0 → 0.6.0.0
raw patch · 24 files changed
+366/−53 lines, 24 filesdep +containersdep ~aeson
Dependencies added: containers
Dependency ranges changed: aeson
Files
- CHANGELOG.md +46/−0
- blockfrost-api.cabal +5/−2
- src/Blockfrost/API/Cardano/Scripts.hs +8/−0
- src/Blockfrost/Env.hs +2/−0
- src/Blockfrost/Lens.hs +1/−1
- src/Blockfrost/Types/Cardano/Accounts.hs +15/−0
- src/Blockfrost/Types/Cardano/Addresses.hs +12/−3
- src/Blockfrost/Types/Cardano/Assets.hs +4/−0
- src/Blockfrost/Types/Cardano/Blocks.hs +4/−0
- src/Blockfrost/Types/Cardano/Epochs.hs +78/−12
- src/Blockfrost/Types/Cardano/Genesis.hs +1/−1
- src/Blockfrost/Types/Cardano/Pools.hs +3/−1
- src/Blockfrost/Types/Cardano/Scripts.hs +38/−7
- src/Blockfrost/Types/Cardano/Transactions.hs +16/−11
- src/Blockfrost/Types/Shared.hs +2/−0
- src/Blockfrost/Types/Shared/ValidationPurpose.hs +20/−0
- test/Cardano/Accounts.hs +15/−5
- test/Cardano/Addresses.hs +15/−3
- test/Cardano/Assets.hs +9/−3
- test/Cardano/Blocks.hs +4/−0
- test/Cardano/Epochs.hs +31/−0
- test/Cardano/Pools.hs +2/−0
- test/Cardano/Scripts.hs +18/−2
- test/Cardano/Transactions.hs +17/−2
CHANGELOG.md view
@@ -1,3 +1,49 @@+# Version [0.6.0.0](https://github.com/blockfrost/blockfrost-haskell/compare/v0.5.0.0...v0.6.0.0) (2022-08-31)++* Additions+ * `AccountReward` now contains additional `type` field refering to `RewardType`+ * `AssetTransaction` grows `blockTime` field+ * `PoolInfo` grows `blocksEpoch` field with number of blocks minted in the current epoch+ * Vasil related+ * `ScriptDatumCBOR` type and `_getScriptDatumCBOR` route+ * Both `UtxoInput` and `UtxoOutput` now has+ * `inlineDatum` field with `Maybe InlineDatum` type+ * `referenceScriptHash` field with `Maybe ScriptHash` type+ * `UtxoInput` now has `reference` field indicating that input is a reference input+ * `UtxoOutput` now has `collateral` field when UTXO is a collateral output+ * `AddressUtxo` now also has `inlineDatum` and `referenceScriptHash` fields+ * `CostModels` data type which is now returned as part of `ProtocolParameters`+ * `Block` now has `opCert` and `opCertCounter` fields+ * `Preprod` and `Preview` environments++* Changes+ * `ValidationPurpose` type moved from `Blockfrost.Types.Cardano.Transactions` to `Blockfrost.Types.Shared.ValidationPurpose`+ * `dataHash` field of `AddressUtxo` changes type from `Maybe Text` to `Maybe DatumHash`+ * `datumHash` field of `TransactionRedeemer` is now deprecated in favor of `redeemerDataHash` field+ * `datumHash` field of `ScriptRedeemer` is now deprecated in favor of `redeemerDataHash` field+ * and also changes type from `Text` to `DataHash`+ * `ScriptType`+ * `Plutus` type is now `PlutusV1`+ * adds `PlutusV2`+ * `ProtocolParameters`+ * `coinsPerUtxoWord` is now deprecated, prefer `coinsPerUtxoSize`+ * `coinsPerUtxoSize` is now+ * Cost per UTxO **word** for Alonzo.+ * Cost per UTxO **byte** for Babbage and later.+ * `extraEntropy` field changes type from `Maybe Value` to `Maybe Text`+ * `ProtocolParams`+ * types of following fields changed from `Double` to `Rational`+ * `a0`+ * `rho`+ * `tau`+ * `decentralisationParam`+ * `priceMem`+ * `priceStep`+ * `PoolInfo`+ * type of `marginCost` field changes from `Double` to `Rational`+ * `Genesis`+ * type of `activeSlotsCoefficient` field changes from `Double` to `Rational`+ # Version [0.5.0.0](https://github.com/blockfrost/blockfrost-haskell/compare/v0.4.0.1...v0.5.0.0) (2022-06-06) * Fix return type of `_getEpochStakeByPool` from `StakeDistribution` to `PoolStakeDistribution`
blockfrost-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: blockfrost-api-version: 0.5.0.0+version: 0.6.0.0 synopsis: API definitions for blockfrost.io description: Core types and Servant API description homepage: https://github.com/blockfrost/blockfrost-haskell@@ -112,6 +112,7 @@ , Blockfrost.Types.Shared.PolicyId , Blockfrost.Types.Shared.PoolId , Blockfrost.Types.Shared.Quantity+ , Blockfrost.Types.Shared.ValidationPurpose , Blockfrost.Util.LensRules , Blockfrost.Util.Pagination , Blockfrost.Util.Sorting@@ -121,10 +122,11 @@ autogen-modules: Paths_blockfrost_api build-depends: base >= 4.7 && < 5 , bytestring+ , containers , data-default-class , text , time- , aeson+ , aeson >= 2.0 && < 3.0 , deriving-aeson , lens >= 5.0 && < 5.1 , template-haskell@@ -159,6 +161,7 @@ , blockfrost-api , aeson , bytestring+ , containers , text , data-default , safe-money
src/Blockfrost/API/Cardano/Scripts.hs view
@@ -45,6 +45,14 @@ :> "datum" :> Capture "datum_hash" DatumHash :> Get '[JSON] ScriptDatum+ , _getScriptDatumCBOR+ :: route+ :- Summary "Datum CBOR value"+ :> Description "Query CBOR serialised datum by its hash"+ :> "datum"+ :> Capture "datum_hash" DatumHash+ :> "cbor"+ :> Get '[JSON] ScriptDatumCBOR , _getScriptJSON :: route :- Summary "Script JSON"
src/Blockfrost/Env.hs view
@@ -18,6 +18,8 @@ Ipfs | Mainnet | Testnet+ | Preprod+ | Preview | Localhost deriving (Eq, Read, Show, Ord, Generic)
src/Blockfrost/Lens.hs view
@@ -13,7 +13,7 @@ makeLensesWith blockfrostFieldRules ''URLVersion makeFields ''AccountInfo-makeFields ''AccountReward+makeLensesWith blockfrostFieldRules ''AccountReward makeFields ''AccountHistory makeFields ''AccountDelegation makeFields ''AccountRegistration
src/Blockfrost/Types/Cardano/Accounts.hs view
@@ -2,6 +2,7 @@ module Blockfrost.Types.Cardano.Accounts ( AccountInfo (..)+ , RewardType (..) , AccountReward (..) , AccountHistory (..) , AccountDelegation (..)@@ -47,11 +48,21 @@ , _accountInfoPoolId = pure "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy" } +-- | Reward type+data RewardType = Leader | Member | PoolDepositRefund+ deriving stock (Show, Eq, Generic)+ deriving (FromJSON, ToJSON)+ via CustomJSON '[ConstructorTagModifier '[CamelToKebab]] RewardType++instance ToSample RewardType where+ toSamples = pure $ samples [ Leader, Member, PoolDepositRefund ]+ -- | Reward received by an account data AccountReward = AccountReward { _accountRewardEpoch :: Epoch -- ^ Epoch of the associated reward , _accountRewardAmount :: Lovelaces -- ^ Rewards for given epoch in Lovelaces , _accountRewardPoolId :: PoolId -- ^ Bech32 pool ID being delegated to+ , _accountRewardType :: RewardType -- ^ Reward type } deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON)@@ -63,21 +74,25 @@ { _accountRewardEpoch = 214 , _accountRewardAmount = 1395265 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = Member } , AccountReward { _accountRewardEpoch = 215 , _accountRewardAmount = 58632 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = Leader } , AccountReward { _accountRewardEpoch = 216 , _accountRewardAmount = 0 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = Leader } , AccountReward { _accountRewardEpoch = 217 , _accountRewardAmount = 1395265 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = PoolDepositRefund } ]
src/Blockfrost/Types/Cardano/Addresses.hs view
@@ -8,12 +8,13 @@ , AddressTransaction (..) ) where -import Blockfrost.Types.Shared-import Data.Text (Text) import Deriving.Aeson import qualified Money import Servant.Docs (ToSample (..), samples, singleSample) +import Blockfrost.Types.Cardano.Scripts (InlineDatum (..))+import Blockfrost.Types.Shared+ -- | Information about Cardano address data AddressInfo = AddressInfo { _addressInfoAddress :: Address -- ^ Bech32 encoded addresses@@ -84,7 +85,9 @@ , _addressUtxoOutputIndex :: Integer -- ^ UTXO index in the transaction , _addressUtxoAmount :: [Amount] -- ^ Amounts of Lovelaces or tokens , _addressUtxoBlock :: BlockHash -- ^ Block hash of the UTXO- , _addressUtxoDataHash :: Maybe Text -- ^ Block hash of the UTXO+ , _addressUtxoDataHash :: Maybe DatumHash -- ^ The hash of the transaction output datum+ , _addressUtxoInlineDatum :: Maybe InlineDatum -- ^ CBOR encoded inline datum+ , _addressUtxoReferenceScriptHash :: Maybe ScriptHash -- ^ The hash of the reference script of the output } deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON) via CustomJSON '[FieldLabelModifier '[StripPrefix "_addressUtxo", CamelToSnake]] AddressUtxo@@ -97,6 +100,8 @@ , _addressUtxoAmount = [ AdaAmount 42000000 ] , _addressUtxoBlock = "7eb8e27d18686c7db9a18f8bbcfe34e3fed6e047afaa2d969904d15e934847e6" , _addressUtxoDataHash = Just "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710"+ , _addressUtxoInlineDatum = Nothing+ , _addressUtxoReferenceScriptHash = Nothing } , AddressUtxo { _addressUtxoTxHash = "4c4e67bafa15e742c13c592b65c8f74c769cd7d9af04c848099672d1ba391b49"@@ -104,6 +109,8 @@ , _addressUtxoAmount = [ AdaAmount 729235000 ] , _addressUtxoBlock = "953f1b80eb7c11a7ffcd67cbd4fde66e824a451aca5a4065725e5174b81685b7" , _addressUtxoDataHash = Nothing+ , _addressUtxoInlineDatum = Nothing+ , _addressUtxoReferenceScriptHash = Nothing } , AddressUtxo { _addressUtxoTxHash = "768c63e27a1c816a83dc7b07e78af673b2400de8849ea7e7b734ae1333d100d2"@@ -118,6 +125,8 @@ ] , _addressUtxoBlock = "5c571f83fe6c784d3fbc223792627ccf0eea96773100f9aedecf8b1eda4544d7" , _addressUtxoDataHash = Nothing+ , _addressUtxoInlineDatum = Nothing+ , _addressUtxoReferenceScriptHash = Nothing } ]
src/Blockfrost/Types/Cardano/Assets.hs view
@@ -172,6 +172,7 @@ { _assetTransactionTxHash :: TxHash -- ^ Hash of the transaction , _assetTransactionTxIndex :: Integer -- ^ Transaction index within the block , _assetTransactionBlockHeight :: Integer -- ^ Block height+ , _assetTransactionBlockTime :: POSIXTime -- ^ Block creation time in UNIX time } deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON)@@ -183,16 +184,19 @@ { _assetTransactionTxHash = "8788591983aa73981fc92d6cddbbe643959f5a784e84b8bee0db15823f575a5b" , _assetTransactionTxIndex = 6 , _assetTransactionBlockHeight = 69+ , _assetTransactionBlockTime = 1635505891 } , AssetTransaction { _assetTransactionTxHash = "52e748c4dec58b687b90b0b40d383b9fe1f24c1a833b7395cdf07dd67859f46f" , _assetTransactionTxIndex = 9 , _assetTransactionBlockHeight = 4547+ , _assetTransactionBlockTime = 1635505987 } , AssetTransaction { _assetTransactionTxHash = "e8073fd5318ff43eca18a852527166aa8008bee9ee9e891f585612b7e4ba700b" , _assetTransactionTxIndex = 0 , _assetTransactionBlockHeight = 564654+ , _assetTransactionBlockTime = 1834505492 } ]
src/Blockfrost/Types/Cardano/Blocks.hs view
@@ -27,6 +27,8 @@ , _blockOutput :: Maybe Lovelaces -- ^ Total output within the block in Lovelaces , _blockFees :: Maybe Lovelaces -- ^ Total fees within the block in Lovelaces , _blockBlockVrf :: Maybe Text -- ^ VRF key of the block+ , _blockOpCert :: Maybe Text -- ^ The hash of the operational certificate of the block producer+ , _blockOpCertCounter :: Maybe Quantity -- ^ The value of the counter used to produce the operational certificate , _blockPreviousBlock :: Maybe BlockHash -- ^ Hash of the previous block , _blockNextBlock :: Maybe BlockHash -- ^ Hash of the next block , _blockConfirmations :: Integer -- ^ Number of block confirmations@@ -49,6 +51,8 @@ , _blockOutput = pure 128314491794 , _blockFees = pure 592661 , _blockBlockVrf = pure "vrf_vk1wf2k6lhujezqcfe00l6zetxpnmh9n6mwhpmhm0dvfh3fxgmdnrfqkms8ty"+ , _blockOpCert = pure "da905277534faf75dae41732650568af545134ee08a3c0392dbefc8096ae177c"+ , _blockOpCertCounter = pure 18 , _blockPreviousBlock = pure "43ebccb3ac72c7cebd0d9b755a4b08412c9f5dcb81b8a0ad1e3c197d29d47b05" , _blockNextBlock = pure "8367f026cf4b03e116ff8ee5daf149b55ba5a6ec6dec04803b8dc317721d15fa" , _blockConfirmations = 4698
src/Blockfrost/Types/Cardano/Epochs.hs view
@@ -4,15 +4,24 @@ ( EpochInfo (..) , PoolStakeDistribution (..) , ProtocolParams (..)+ , CostModels (..) , StakeDistribution (..) ) where import Blockfrost.Types.Shared-import Data.Aeson (Value)+import Data.Aeson (object, FromJSON (..), ToJSON (..), withObject)+import Data.Map (Map) import Data.Text (Text) import Deriving.Aeson import Servant.Docs (ToSample (..), singleSample) +import qualified Data.Aeson.Key+import qualified Data.Aeson.KeyMap+import qualified Data.Char+import qualified Data.Map++import Blockfrost.Types.Cardano.Scripts (ScriptType (..))+ -- | Information about an epoch data EpochInfo = EpochInfo { _epochInfoEpoch :: Epoch -- ^ Epoch number@@ -45,7 +54,6 @@ , _epochInfoActiveStake = pure 784953934049314 } - -- | Protocol parameters data ProtocolParams = ProtocolParams { _protocolParamsEpoch :: Epoch -- ^ Epoch number@@ -58,20 +66,19 @@ , _protocolParamsPoolDeposit :: Lovelaces -- ^ The amount of a pool registration deposit in Lovelaces , _protocolParamsEMax :: Integer -- ^ Epoch bound on pool retirement , _protocolParamsNOpt :: Integer -- ^ Desired number of pools- , _protocolParamsA0 :: Double -- ^ Pool pledge influence- , _protocolParamsRho :: Double -- ^ Monetary expansion- , _protocolParamsTau :: Double -- ^ Treasury expansion- , _protocolParamsDecentralisationParam :: Double -- ^ Percentage of blocks produced by federated nodes- , _protocolParamsExtraEntropy :: Maybe Value -- ^ Seed for extra entropy+ , _protocolParamsA0 :: Rational -- ^ Pool pledge influence+ , _protocolParamsRho :: Rational -- ^ Monetary expansion+ , _protocolParamsTau :: Rational -- ^ Treasury expansion+ , _protocolParamsDecentralisationParam :: Rational -- ^ Percentage of blocks produced by federated nodes+ , _protocolParamsExtraEntropy :: Maybe Text -- ^ Seed for extra entropy , _protocolParamsProtocolMajorVer :: Integer -- ^ Accepted protocol major version , _protocolParamsProtocolMinorVer :: Integer -- ^ Accepted protocol minor version , _protocolParamsMinUtxo :: Lovelaces -- ^ Minimum UTXO value , _protocolParamsMinPoolCost :: Lovelaces -- ^ Minimum stake cost forced on the pool , _protocolParamsNonce :: Text -- ^ Epoch number only used once- -- cost models- -- https://github.com/input-output-hk/cardano-db-sync/pull/758- , _protocolParamsPriceMem :: Double -- ^ The per word cost of script memory usage- , _protocolParamsPriceStep :: Double -- ^ The cost of script execution step usage+ , _protocolParamsCostModels :: CostModels -- ^ Cost models parameters for Plutus Core scripts+ , _protocolParamsPriceMem :: Rational -- ^ The per word cost of script memory usage+ , _protocolParamsPriceStep :: Rational -- ^ The cost of script execution step usage , _protocolParamsMaxTxExMem :: Quantity -- ^ The maximum number of execution memory allowed to be used in a single transaction , _protocolParamsMaxTxExSteps :: Quantity -- ^ The maximum number of execution steps allowed to be used in a single transaction , _protocolParamsMaxBlockExMem :: Quantity -- ^ The maximum number of execution memory allowed to be used in a single block@@ -79,7 +86,8 @@ , _protocolParamsMaxValSize :: Quantity -- ^ The maximum Val size , _protocolParamsCollateralPercent :: Integer -- ^ The percentage of the transactions fee which must be provided as collateral when including non-native scripts , _protocolParamsMaxCollateralInputs :: Integer -- ^ The maximum number of collateral inputs allowed in a transaction- , _protocolParamsCoinsPerUtxoWord :: Lovelaces -- ^ The cost per UTxO word+ , _protocolParamsCoinsPerUtxoSize :: Lovelaces -- ^ The cost per UTxO size. Cost per UTxO *word* for Alozno. Cost per UTxO *byte* for Babbage and later+ , _protocolParamsCoinsPerUtxoWord :: Lovelaces -- ^ The cost per UTxO word (DEPRECATED) } deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON)@@ -108,6 +116,7 @@ , _protocolParamsMinUtxo = 1000000 , _protocolParamsMinPoolCost = 340000000 , _protocolParamsNonce = "1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81"+ , _protocolParamsCostModels = costModelsSample , _protocolParamsPriceMem = 0.0577 , _protocolParamsPriceStep = 0.0000721 , _protocolParamsMaxTxExMem = 10000000@@ -117,8 +126,65 @@ , _protocolParamsMaxValSize = 5000 , _protocolParamsCollateralPercent = 150 , _protocolParamsMaxCollateralInputs = 3+ , _protocolParamsCoinsPerUtxoSize = 34482 , _protocolParamsCoinsPerUtxoWord = 34482 }++newtype CostModels = CostModels { unCostModels :: Map ScriptType (Map Text Integer) }+ deriving (Eq, Show, Generic)++instance ToJSON CostModels where+ toJSON =+ object+ . map (\(lang, params) ->+ ( Data.Aeson.Key.fromString $ show lang+ , object+ $ map (\(key, param) ->+ ( Data.Aeson.Key.fromText key+ , toJSON param)+ )+ $ Data.Map.toList params+ ))+ . Data.Map.toList+ . unCostModels++instance FromJSON CostModels where+ parseJSON = withObject "CostModel" $ \o -> do+ let parseParams = withObject "CostModelParams" $ \po -> do+ mapM (parseJSON . toJSON) $ Data.Aeson.KeyMap.toList po++ langs <- mapM+ (\(kLang, vParams) -> do+ l <- parseJSON+ $ toJSON+ $ (\(x:xs) -> Data.Char.toLower x:xs)+ $ Data.Aeson.Key.toString kLang+ ps <- parseParams vParams+ pure (l, Data.Map.fromList ps)+ )+ $ Data.Aeson.KeyMap.toList o++ pure $ CostModels $ Data.Map.fromList langs++costModelsSample :: CostModels+costModelsSample = CostModels+ $ Data.Map.fromList+ [ ( PlutusV1+ , Data.Map.fromList+ [ ("addInteger-cpu-arguments-intercept", 197209)+ , ("addInteger-cpu-arguments-slope", 0)+ ]+ )+ , (PlutusV2+ , Data.Map.fromList+ [ ("addInteger-cpu-arguments-intercept", 197209)+ , ("addInteger-cpu-arguments-slope", 0)+ ]+ )+ ]++instance ToSample CostModels where+ toSamples = pure $ singleSample costModelsSample -- | Active stake distribution for an epoch data StakeDistribution = StakeDistribution
src/Blockfrost/Types/Cardano/Genesis.hs view
@@ -13,7 +13,7 @@ -- | Information about blockchain genesis data Genesis = Genesis- { _genesisActiveSlotsCoefficient :: Double -- ^ The proportion of slots in which blocks should be issued+ { _genesisActiveSlotsCoefficient :: Rational -- ^ The proportion of slots in which blocks should be issued , _genesisUpdateQuorum :: Integer -- ^ Determines the quorum needed for votes on the protocol parameter updates , _genesisMaxLovelaceSupply :: Lovelaces -- ^ The total number of lovelace in the system , _genesisNetworkMagic :: Integer -- ^ Network identifier
src/Blockfrost/Types/Cardano/Pools.hs view
@@ -41,6 +41,7 @@ , _poolInfoHex :: Text -- ^ Hexadecimal pool ID. , _poolInfoVrfKey :: Text -- ^ VRF key hash , _poolInfoBlocksMinted :: Integer -- ^ Total minted blocks+ , _poolInfoBlocksEpoch :: Integer -- ^ Number of blocks minted in the current epoch , _poolInfoLiveStake :: Lovelaces , _poolInfoLiveSize :: Double , _poolInfoLiveSaturation :: Double@@ -49,7 +50,7 @@ , _poolInfoActiveSize :: Double , _poolInfoDeclaredPledge :: Lovelaces -- ^ Stake pool certificate pledge , _poolInfoLivePledge :: Lovelaces -- ^ Stake pool current pledge- , _poolInfoMarginCost :: Double -- ^ Margin tax cost of the stake pool+ , _poolInfoMarginCost :: Rational -- ^ Margin tax cost of the stake pool , _poolInfoFixedCost :: Lovelaces -- ^ Fixed tax cost of the stake pool , _poolInfoRewardAccount :: Address -- ^ Bech32 reward account of the stake pool , _poolInfoOwners :: [Address]@@ -67,6 +68,7 @@ , _poolInfoHex = "0f292fcaa02b8b2f9b3c8f9fd8e0bb21abedb692a6d5058df3ef2735" , _poolInfoVrfKey = "0b5245f9934ec2151116fb8ec00f35fd00e0aa3b075c4ed12cce440f999d8233" , _poolInfoBlocksMinted = 69+ , _poolInfoBlocksEpoch = 4 , _poolInfoLiveStake = 6900000000 , _poolInfoLiveSize = 0.42 , _poolInfoLiveSaturation = 0.93
src/Blockfrost/Types/Cardano/Scripts.hs view
@@ -5,26 +5,27 @@ , ScriptType (..) , ScriptRedeemer (..) , ScriptDatum (..)+ , ScriptDatumCBOR (..)+ , InlineDatum (..) , ScriptJSON (..) , ScriptCBOR (..) ) where -import Data.Aeson (Value, object, (.=))+import Data.Aeson (Value, object, (.=), FromJSON (..), ToJSON (..)) import Data.Text (Text) import Deriving.Aeson import Servant.Docs (ToSample (..), samples, singleSample) import Blockfrost.Types.Shared-import Blockfrost.Types.Cardano.Transactions (ValidationPurpose(Spend)) -- | Script type-data ScriptType = Plutus | Timelock- deriving stock (Show, Eq, Generic)+data ScriptType = PlutusV1 | PlutusV2 | Timelock+ deriving stock (Show, Eq, Ord, Generic) deriving (FromJSON, ToJSON) via CustomJSON '[ConstructorTagModifier '[ToLower]] ScriptType instance ToSample ScriptType where- toSamples = pure $ samples [ Plutus, Timelock ]+ toSamples = pure $ samples [ PlutusV1, PlutusV2, Timelock ] -- | Script info data Script = Script@@ -40,7 +41,7 @@ toSamples = pure $ singleSample Script { _scriptScriptHash = "67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656"- , _scriptType = Plutus+ , _scriptType = PlutusV1 , _scriptSerialisedSize = Just 3119 } @@ -49,7 +50,8 @@ { _scriptRedeemerTxHash :: TxHash -- ^ Hash of the transaction , _scriptRedeemerTxIndex :: Integer -- ^ Index of the redeemer within a transaction , _scriptRedeemerPurpose :: ValidationPurpose -- ^ Validation purpose- , _scriptRedeemerDatumHash :: Text -- ^ Datum hash+ , _scriptRedeemerRedeemerDataHash :: DatumHash -- ^ Datum hash of the redeemer+ , _scriptRedeemerDatumHash :: DatumHash -- ^ Datum hash (DEPRECATED) , _scriptRedeemerUnitMem :: Quantity -- ^ The budget in Memory to run a script , _scriptRedeemerUnitSteps :: Quantity -- ^ The budget in Steps to run a script , _scriptRedeemerFee :: Lovelaces -- ^ The fee consumed to run the script@@ -64,6 +66,7 @@ { _scriptRedeemerTxHash = "1a0570af966fb355a7160e4f82d5a80b8681b7955f5d44bec0dce628516157f0" , _scriptRedeemerTxIndex = 0 , _scriptRedeemerPurpose = Spend+ , _scriptRedeemerRedeemerDataHash = "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec" , _scriptRedeemerDatumHash = "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec" , _scriptRedeemerUnitMem = 1700 , _scriptRedeemerUnitSteps = 476468@@ -81,6 +84,34 @@ $ singleSample $ ScriptDatum $ object [ "int" .= (42 :: Int) ]++newtype ScriptDatumCBOR = ScriptDatumCBOR { _scriptDatumCborCbor :: Text }+ deriving stock (Show, Eq, Generic)+ deriving (FromJSON, ToJSON)+ via CustomJSON '[FieldLabelModifier '[StripPrefix "_scriptDatumCbor", CamelToSnake]] ScriptDatumCBOR++instance ToSample ScriptDatumCBOR where+ toSamples =+ pure+ $ singleSample+ $ ScriptDatumCBOR "19a6aa"++newtype InlineDatum = InlineDatum { unInlineDatum :: ScriptDatumCBOR }+ deriving stock (Show, Eq, Generic)++instance ToJSON InlineDatum where+ toJSON = toJSON . _scriptDatumCborCbor . unInlineDatum+ toEncoding = toEncoding . _scriptDatumCborCbor . unInlineDatum++instance FromJSON InlineDatum where+ parseJSON = fmap (InlineDatum . ScriptDatumCBOR) <$> parseJSON++instance ToSample InlineDatum where+ toSamples =+ pure+ $ singleSample+ $ InlineDatum+ $ ScriptDatumCBOR "19a6aa" newtype ScriptJSON = ScriptJSON { _scriptJsonJson :: Maybe Value } deriving stock (Show, Eq, Generic)
src/Blockfrost/Types/Cardano/Transactions.hs view
@@ -5,7 +5,6 @@ , TransactionUtxos (..) , UtxoInput (..) , UtxoOutput (..)- , ValidationPurpose (..) , TransactionRedeemer (..) , TransactionStake (..) , TransactionDelegation (..)@@ -26,6 +25,7 @@ import Servant.Docs (ToSample (..), samples, singleSample) import Blockfrost.Types.Cardano.Pools+import Blockfrost.Types.Cardano.Scripts (InlineDatum (..), ScriptDatumCBOR (..)) import Blockfrost.Types.Shared -- | Information about a transaction@@ -90,6 +90,9 @@ , _utxoInputOutputIndex :: Integer -- ^ UTXO index in the transaction , _utxoInputCollateral :: Bool -- ^ UTXO is a script collateral input , _utxoInputDataHash :: Maybe DatumHash -- ^ The hash of the transaction output datum+ , _utxoInputInlineDatum :: Maybe InlineDatum -- ^ CBOR encoded inline datum+ , _utxoInputReferenceScriptHash :: Maybe ScriptHash -- ^ The hash of the reference script of the input+ , _utxoInputReference :: Bool -- ^ Whether the input is a reference transaction input } deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON)@@ -107,6 +110,9 @@ , _utxoInputOutputIndex = 0 , _utxoInputCollateral = False , _utxoInputDataHash = Just "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710"+ , _utxoInputInlineDatum = Nothing+ , _utxoInputReferenceScriptHash = Just "13a3efd825703a352a8f71f4e2758d08c28c564e8dfcce9f77776ad1"+ , _utxoInputReference = False } -- | Transaction output UTxO@@ -115,6 +121,9 @@ , _utxoOutputAmount :: [Amount] -- ^ Transaction output amounts , _utxoOutputDataHash :: Maybe DatumHash -- ^ The hash of the transaction output datum , _utxoOutputOutputIndex :: Integer -- ^ UTXO index in the transaction+ , _utxoOutputCollateral :: Bool -- ^ UTXO is a script collateral output+ , _utxoOutputInlineDatum :: Maybe InlineDatum -- ^ CBOR encoded inline datum+ , _utxoOutputReferenceScriptHash :: Maybe ScriptHash -- ^ The hash of the reference script of the output } deriving stock (Show, Eq, Generic) deriving (FromJSON, ToJSON) via CustomJSON '[FieldLabelModifier '[StripPrefix "_utxoOutput", CamelToSnake]] UtxoOutput@@ -129,6 +138,9 @@ , _utxoOutputAmount = sampleAmounts , _utxoOutputDataHash = Just "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710" , _utxoOutputOutputIndex = 0+ , _utxoOutputCollateral = False+ , _utxoOutputInlineDatum = Just $ InlineDatum $ ScriptDatumCBOR "19a6aa"+ , _utxoOutputReferenceScriptHash = Just "13a3efd825703a352a8f71f4e2758d08c28c564e8dfcce9f77776ad1" } -- | Transaction UTxOs@@ -159,21 +171,13 @@ 12 ] --- | Validation purpose-data ValidationPurpose = Spend | Mint | Cert | Reward- deriving stock (Show, Eq, Generic)- deriving (FromJSON, ToJSON)- via CustomJSON '[ConstructorTagModifier '[ToLower]] ValidationPurpose--instance ToSample ValidationPurpose where- toSamples = pure $ samples [ Spend, Mint, Cert, Reward ]- -- | Transaction redeemer data TransactionRedeemer = TransactionRedeemer { _transactionRedeemerTxIndex :: Integer -- ^ Index of the redeemer within a transaction , _transactionRedeemerPurpose :: ValidationPurpose -- ^ Validation purpose , _transactionRedeemerScriptHash:: ScriptHash -- ^ Script hash- , _transactionRedeemerDatumHash :: DatumHash -- ^ Datum hash+ , _transactionRedeemerRedeemerDataHash :: DatumHash -- ^ Redeemer data hash+ , _transactionRedeemerDatumHash :: DatumHash -- ^ Datum hash (DEPRECATED) , _transactionRedeemerUnitMem :: Quantity -- ^ The budget in Memory to run a script , _transactionRedeemerUnitSteps :: Quantity -- ^ The budget in Steps to run a script , _transactionRedeemerFee :: Lovelaces -- ^ The fee consumed to run the script@@ -188,6 +192,7 @@ { _transactionRedeemerTxIndex = 0 , _transactionRedeemerPurpose = Spend , _transactionRedeemerScriptHash = "ec26b89af41bef0f7585353831cb5da42b5b37185e0c8a526143b824"+ , _transactionRedeemerRedeemerDataHash = "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec" , _transactionRedeemerDatumHash = "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec" , _transactionRedeemerUnitMem = 1700 , _transactionRedeemerUnitSteps = 476468
@@ -18,6 +18,7 @@ , module Blockfrost.Types.Shared.Slot , module Blockfrost.Types.Shared.ScriptHash , module Blockfrost.Types.Shared.TxHash+ , module Blockfrost.Types.Shared.ValidationPurpose ) where import Blockfrost.Types.Shared.Ada@@ -37,3 +38,4 @@ import Blockfrost.Types.Shared.Slot import Blockfrost.Types.Shared.ScriptHash import Blockfrost.Types.Shared.TxHash+import Blockfrost.Types.Shared.ValidationPurpose
@@ -0,0 +1,20 @@+-- | Transaction or script redeemer validation purpose+module Blockfrost.Types.Shared.ValidationPurpose+ ( ValidationPurpose (..)+ ) where++import Deriving.Aeson+import Servant.Docs (ToSample (..), samples)++import Blockfrost.Types.Shared.Opts++-- | Validation purpose+data ValidationPurpose = Spend | Mint | Cert | Reward+ deriving stock (Show, Eq, Generic)+ deriving (FromJSON, ToJSON)+ via CustomJSON '[ConstructorTagModifier '[ToLower]] ValidationPurpose++instance ToSample ValidationPurpose where+ toSamples = pure $ samples [ Spend, Mint, Cert, Reward ]++
test/Cardano/Accounts.hs view
@@ -90,27 +90,32 @@ { "epoch": 215, "amount": "12695385",- "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",+ "type": "member" }, { "epoch": 216, "amount": "12695385",- "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",+ "type": "leader" }, { "epoch": 216, "amount": "3586329",- "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",+ "type": "leader" }, { "epoch": 217, "amount": "0",- "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",+ "type": "leader" }, { "epoch": 218, "amount": "1395265",- "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ "pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",+ "type": "pool-deposit-refund" } ] |]@@ -120,26 +125,31 @@ { _accountRewardEpoch = 215 , _accountRewardAmount = 12695385 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = Member } , AccountReward { _accountRewardEpoch = 216 , _accountRewardAmount = 12695385 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = Leader } , AccountReward { _accountRewardEpoch = 216 , _accountRewardAmount = 3586329 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = Leader } , AccountReward { _accountRewardEpoch = 217 , _accountRewardAmount = 0 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = Leader } , AccountReward { _accountRewardEpoch = 218 , _accountRewardAmount = 1395265 , _accountRewardPoolId = "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"+ , _accountRewardType = PoolDepositRefund } ]
test/Cardano/Addresses.hs view
@@ -134,7 +134,9 @@ } ], "block": "7eb8e27d18686c7db9a18f8bbcfe34e3fed6e047afaa2d969904d15e934847e6",- "data_hash": "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710"+ "data_hash": "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710",+ "inline_datum": null,+ "reference_script_hash": null }, { "tx_hash": "4c4e67bafa15e742c13c592b65c8f74c769cd7d9af04c848099672d1ba391b49",@@ -147,7 +149,9 @@ } ], "block": "953f1b80eb7c11a7ffcd67cbd4fde66e824a451aca5a4065725e5174b81685b7",- "data_hash": null+ "data_hash": null,+ "inline_datum": null,+ "reference_script_hash": null }, { "tx_hash": "768c63e27a1c816a83dc7b07e78af673b2400de8849ea7e7b734ae1333d100d2",@@ -164,7 +168,9 @@ } ], "block": "5c571f83fe6c784d3fbc223792627ccf0eea96773100f9aedecf8b1eda4544d7",- "data_hash": null+ "data_hash": null,+ "inline_datum": null,+ "reference_script_hash": null } ] |]@@ -176,6 +182,8 @@ , _addressUtxoAmount = [ AdaAmount 42000000 ] , _addressUtxoBlock = "7eb8e27d18686c7db9a18f8bbcfe34e3fed6e047afaa2d969904d15e934847e6" , _addressUtxoDataHash = Just "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710"+ , _addressUtxoInlineDatum = Nothing+ , _addressUtxoReferenceScriptHash = Nothing } , AddressUtxo { _addressUtxoTxHash = "4c4e67bafa15e742c13c592b65c8f74c769cd7d9af04c848099672d1ba391b49"@@ -183,6 +191,8 @@ , _addressUtxoAmount = [ AdaAmount 729235000 ] , _addressUtxoBlock = "953f1b80eb7c11a7ffcd67cbd4fde66e824a451aca5a4065725e5174b81685b7" , _addressUtxoDataHash = Nothing+ , _addressUtxoInlineDatum = Nothing+ , _addressUtxoReferenceScriptHash = Nothing } , AddressUtxo { _addressUtxoTxHash = "768c63e27a1c816a83dc7b07e78af673b2400de8849ea7e7b734ae1333d100d2"@@ -197,6 +207,8 @@ ] , _addressUtxoBlock = "5c571f83fe6c784d3fbc223792627ccf0eea96773100f9aedecf8b1eda4544d7" , _addressUtxoDataHash = Nothing+ , _addressUtxoInlineDatum = Nothing+ , _addressUtxoReferenceScriptHash = Nothing } ]
test/Cardano/Assets.hs view
@@ -167,17 +167,20 @@ { "tx_hash": "8788591983aa73981fc92d6cddbbe643959f5a784e84b8bee0db15823f575a5b", "tx_index": 6,- "block_height": 69+ "block_height": 69,+ "block_time": 1635505891 }, { "tx_hash": "52e748c4dec58b687b90b0b40d383b9fe1f24c1a833b7395cdf07dd67859f46f", "tx_index": 9,- "block_height": 4547+ "block_height": 4547,+ "block_time": 1635505987 }, { "tx_hash": "e8073fd5318ff43eca18a852527166aa8008bee9ee9e891f585612b7e4ba700b", "tx_index": 0,- "block_height": 564654+ "block_height": 564654,+ "block_time": 1834505492 } ] |]@@ -187,16 +190,19 @@ { _assetTransactionTxHash = "8788591983aa73981fc92d6cddbbe643959f5a784e84b8bee0db15823f575a5b" , _assetTransactionTxIndex = 6 , _assetTransactionBlockHeight = 69+ , _assetTransactionBlockTime = 1635505891 } , AssetTransaction { _assetTransactionTxHash = "52e748c4dec58b687b90b0b40d383b9fe1f24c1a833b7395cdf07dd67859f46f" , _assetTransactionTxIndex = 9 , _assetTransactionBlockHeight = 4547+ , _assetTransactionBlockTime = 1635505987 } , AssetTransaction { _assetTransactionTxHash = "e8073fd5318ff43eca18a852527166aa8008bee9ee9e891f585612b7e4ba700b" , _assetTransactionTxIndex = 0 , _assetTransactionBlockHeight = 564654+ , _assetTransactionBlockTime = 1834505492 } ]
test/Cardano/Blocks.hs view
@@ -41,6 +41,8 @@ "output": "128314491794", "fees": "592661", "block_vrf": "vrf_vk1wf2k6lhujezqcfe00l6zetxpnmh9n6mwhpmhm0dvfh3fxgmdnrfqkms8ty",+ "op_cert": "da905277534faf75dae41732650568af545134ee08a3c0392dbefc8096ae177c",+ "op_cert_counter": "18", "previous_block": "43ebccb3ac72c7cebd0d9b755a4b08412c9f5dcb81b8a0ad1e3c197d29d47b05", "next_block": "8367f026cf4b03e116ff8ee5daf149b55ba5a6ec6dec04803b8dc317721d15fa", "confirmations": 4698@@ -60,6 +62,8 @@ , _blockOutput = pure $ 128314491794 , _blockFees = pure $ 592661 , _blockBlockVrf = pure "vrf_vk1wf2k6lhujezqcfe00l6zetxpnmh9n6mwhpmhm0dvfh3fxgmdnrfqkms8ty"+ , _blockOpCert = pure "da905277534faf75dae41732650568af545134ee08a3c0392dbefc8096ae177c"+ , _blockOpCertCounter = pure 18 , _blockPreviousBlock = pure "43ebccb3ac72c7cebd0d9b755a4b08412c9f5dcb81b8a0ad1e3c197d29d47b05" , _blockNextBlock = pure "8367f026cf4b03e116ff8ee5daf149b55ba5a6ec6dec04803b8dc317721d15fa" , _blockConfirmations = 4698
test/Cardano/Epochs.hs view
@@ -7,6 +7,7 @@ where import Data.Aeson (decode, eitherDecode, encode)+import qualified Data.Map import Data.Text (Text) import qualified Money import Test.Hspec@@ -88,6 +89,17 @@ "min_utxo": "1000000", "min_pool_cost": "340000000", "nonce": "1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81",+ "cost_models": {+ "PlutusV1": {+ "addInteger-cpu-arguments-intercept": 197209,+ "addInteger-cpu-arguments-slope": 0+ },+ "PlutusV2":+ {+ "addInteger-cpu-arguments-intercept": 197209,+ "addInteger-cpu-arguments-slope": 0+ }+ }, "price_mem": 0.0577, "price_step": 0.0000721, "max_tx_ex_mem": "10000000",@@ -97,6 +109,7 @@ "max_val_size": "5000", "collateral_percent": 150, "max_collateral_inputs": 3,+ "coins_per_utxo_size": "34482", "coins_per_utxo_word": "34482" } |]@@ -123,6 +136,22 @@ , _protocolParamsMinUtxo = 1000000 , _protocolParamsMinPoolCost = 340000000 , _protocolParamsNonce = "1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81"+ , _protocolParamsCostModels =+ CostModels+ $ Data.Map.fromList+ [ ( PlutusV1+ , Data.Map.fromList+ [ ("addInteger-cpu-arguments-intercept", 197209)+ , ("addInteger-cpu-arguments-slope", 0)+ ]+ )+ , (PlutusV2+ , Data.Map.fromList+ [ ("addInteger-cpu-arguments-intercept", 197209)+ , ("addInteger-cpu-arguments-slope", 0)+ ]+ )+ ] , _protocolParamsPriceMem = 0.0577 , _protocolParamsPriceStep = 0.0000721 , _protocolParamsMaxTxExMem = 10000000@@ -132,6 +161,8 @@ , _protocolParamsMaxValSize = 5000 , _protocolParamsCollateralPercent = 150 , _protocolParamsMaxCollateralInputs = 3+ , _protocolParamsCoinsPerUtxoSize = 34482+ -- deprecated , _protocolParamsCoinsPerUtxoWord = 34482 }
test/Cardano/Pools.hs view
@@ -86,6 +86,7 @@ "hex": "0f292fcaa02b8b2f9b3c8f9fd8e0bb21abedb692a6d5058df3ef2735", "vrf_key": "0b5245f9934ec2151116fb8ec00f35fd00e0aa3b075c4ed12cce440f999d8233", "blocks_minted": 69,+ "blocks_epoch": 4, "live_stake": "6900000000", "live_size": 0.42, "live_saturation": 0.93,@@ -117,6 +118,7 @@ , _poolInfoHex = "0f292fcaa02b8b2f9b3c8f9fd8e0bb21abedb692a6d5058df3ef2735" , _poolInfoVrfKey = "0b5245f9934ec2151116fb8ec00f35fd00e0aa3b075c4ed12cce440f999d8233" , _poolInfoBlocksMinted = 69+ , _poolInfoBlocksEpoch = 4 , _poolInfoLiveStake = 6900000000 , _poolInfoLiveSize = 0.42 , _poolInfoLiveSaturation = 0.93
test/Cardano/Scripts.hs view
@@ -37,6 +37,11 @@ `shouldBe` Right scriptDatumExpected + it "parses script datum cbor sample" $ do+ eitherDecode scriptDatumCBORSample+ `shouldBe`+ Right scriptDatumCBORExpected+ it "parses script JSON sample" $ do eitherDecode scriptJSONSample `shouldBe`@@ -71,7 +76,7 @@ scriptSample = [r| { "script_hash": "67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656",- "type": "plutus",+ "type": "plutusV1", "serialised_size": 3119 } |]@@ -79,7 +84,7 @@ scriptSampleExpected = Script { _scriptScriptHash = "67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656"- , _scriptType = Plutus+ , _scriptType = PlutusV1 , _scriptSerialisedSize = Just 3119 } @@ -88,6 +93,7 @@ "tx_hash": "1a0570af966fb355a7160e4f82d5a80b8681b7955f5d44bec0dce628516157f0", "tx_index": 0, "purpose": "spend",+ "redeemer_data_hash": "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec", "datum_hash": "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec", "unit_mem": "1700", "unit_steps": "476468",@@ -100,6 +106,8 @@ { _scriptRedeemerTxHash = "1a0570af966fb355a7160e4f82d5a80b8681b7955f5d44bec0dce628516157f0" , _scriptRedeemerTxIndex = 0 , _scriptRedeemerPurpose = Spend+ , _scriptRedeemerRedeemerDataHash = "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec"+ -- deprecated , _scriptRedeemerDatumHash = "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec" , _scriptRedeemerUnitMem = 1700 , _scriptRedeemerUnitSteps = 476468@@ -115,6 +123,14 @@ |] scriptDatumExpected = ScriptDatum $ object ["int" .= (42 :: Int)]++scriptDatumCBORSample = [r|+{+ "cbor": "19a6aa"+}+|]++scriptDatumCBORExpected = ScriptDatumCBOR "19a6aa" scriptJSONSample = [r| {
test/Cardano/Transactions.hs view
@@ -161,7 +161,10 @@ "tx_hash": "1a0570af966fb355a7160e4f82d5a80b8681b7955f5d44bec0dce628516157f0", "output_index": 0, "collateral": false,- "data_hash": "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710"+ "data_hash": "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710",+ "inline_datum": null,+ "reference_script_hash": "13a3efd825703a352a8f71f4e2758d08c28c564e8dfcce9f77776ad1",+ "reference": false } ], "outputs": [@@ -178,7 +181,10 @@ } ], "data_hash": "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710",- "output_index": 0+ "output_index": 0,+ "collateral": false,+ "inline_datum": "19a6aa",+ "reference_script_hash": "13a3efd825703a352a8f71f4e2758d08c28c564e8dfcce9f77776ad1" } ] }@@ -193,6 +199,9 @@ , _utxoInputOutputIndex = 0 , _utxoInputCollateral = False , _utxoInputDataHash = Just "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710"+ , _utxoInputInlineDatum = Nothing+ , _utxoInputReferenceScriptHash = Just "13a3efd825703a352a8f71f4e2758d08c28c564e8dfcce9f77776ad1"+ , _utxoInputReference = False } utxoOutSample :: UtxoOutput@@ -202,6 +211,9 @@ , _utxoOutputAmount = sampleAmounts , _utxoOutputDataHash = Just "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710" , _utxoOutputOutputIndex = 0+ , _utxoOutputCollateral = False+ , _utxoOutputInlineDatum = Just $ InlineDatum $ ScriptDatumCBOR "19a6aa"+ , _utxoOutputReferenceScriptHash = Just "13a3efd825703a352a8f71f4e2758d08c28c564e8dfcce9f77776ad1" } transactionUtxosExpected =@@ -216,6 +228,7 @@ "tx_index": 0, "purpose": "spend", "script_hash": "ec26b89af41bef0f7585353831cb5da42b5b37185e0c8a526143b824",+ "redeemer_data_hash": "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec", "datum_hash": "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec", "unit_mem": "1700", "unit_steps": "476468",@@ -228,6 +241,8 @@ { _transactionRedeemerTxIndex = 0 , _transactionRedeemerPurpose = Spend , _transactionRedeemerScriptHash = "ec26b89af41bef0f7585353831cb5da42b5b37185e0c8a526143b824"+ , _transactionRedeemerRedeemerDataHash = "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec"+ -- deprecated , _transactionRedeemerDatumHash = "923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec" , _transactionRedeemerUnitMem = 1700 , _transactionRedeemerUnitSteps = 476468