Skip to content

Commit

Permalink
Merge pull request #410 from IntersectMBO/smelc/move-renderSafeHashAs…
Browse files Browse the repository at this point in the history
…Hex-from-cardano-node

Move renderSafeHashAsHex from cardano-node
  • Loading branch information
smelc authored Dec 22, 2023
2 parents 3bad3e8 + 5d9cb77 commit d589604
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cardano-api/internal/Cardano/Api/Hash.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ module Cardano.Api.Hash
( Hash
, CastHash(..)
, AsType(AsHash)
, renderSafeHashAsHex
) where

import Cardano.Api.HasTypeProxy

import qualified Cardano.Crypto.Hash as Hash
import qualified Cardano.Ledger.SafeHash as Ledger

import Data.Kind (Type)
import qualified Data.Text as Text


data family Hash keyrole :: Type
Expand All @@ -23,3 +28,6 @@ instance HasTypeProxy a => HasTypeProxy (Hash a) where
data AsType (Hash a) = AsHash (AsType a)
proxyToAsType _ = AsHash (proxyToAsType (Proxy :: Proxy a))


renderSafeHashAsHex :: Ledger.SafeHash c tag -> Text.Text
renderSafeHashAsHex = Hash.hashToTextAsHex . Ledger.extractHash
1 change: 1 addition & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ module Cardano.Api (
-- used in many other places.
Hash,
castHash,
renderSafeHashAsHex,

-- * Payment addresses
-- | Constructing and inspecting normal payment addresses
Expand Down

0 comments on commit d589604

Please sign in to comment.