Skip to content

Commit

Permalink
OK then, script hash is 28 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Jan 19, 2021
1 parent 70d1afe commit 95f48b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/core/src/Cardano/Wallet/Primitive/Types/Hash.hs
Expand Up @@ -66,7 +66,7 @@ instance FromText (Hash "Genesis") where fromText = hashFromText 32
instance FromText (Hash "Block") where fromText = hashFromText 32
instance FromText (Hash "BlockHeader") where fromText = hashFromText 32
instance FromText (Hash "RewardAccount") where fromText = hashFromText 28
instance FromText (Hash "TokenPolicy") where fromText = hashFromText 32
instance FromText (Hash "TokenPolicy") where fromText = hashFromText 28 -- Script Hash

hashFromText
:: forall t. (KnownSymbol t)
Expand Down
Expand Up @@ -62,4 +62,4 @@ mkTokenPolicyId c
"Unable to generate token policy id from character: " <> show c

tokenPolicyIdHexStringLength :: Int
tokenPolicyIdHexStringLength = 64
tokenPolicyIdHexStringLength = 56
6 changes: 3 additions & 3 deletions lib/core/test/unit/Cardano/Wallet/Api/Malformed.hs
Expand Up @@ -233,13 +233,13 @@ instance Malformed (PathParam (ApiT DerivationIndex)) where
\Indexes with suffixes are called 'Hardened'."

instance Wellformed (PathParam (ApiT TokenPolicyId)) where
wellformed = [PathParam $ T.replicate 64 "0"]
wellformed = [PathParam $ T.replicate 56 "0"]

instance Malformed (PathParam (ApiT TokenPolicyId)) where
malformed = first PathParam <$>
[ ( "faff", msgWrongLength )
, ( T.replicate 65 "0", msgWrongLength )
, ( T.replicate 64 "x", msgMalformed )
, ( T.replicate 57 "0", msgWrongLength )
, ( T.replicate 56 "x", msgMalformed )
]
where
msgWrongLength = "TokenPolicyId should be 32 bytes long"
Expand Down

0 comments on commit 95f48b7

Please sign in to comment.