diff --git a/command-line/test/Command/Address/InspectSpec.hs b/command-line/test/Command/Address/InspectSpec.hs index fbcae2160..cdd06f4a0 100644 --- a/command-line/test/Command/Address/InspectSpec.hs +++ b/command-line/test/Command/Address/InspectSpec.hs @@ -39,6 +39,14 @@ spec = describeCmd [ "address", "inspect" ] $ do specInspectAddress ["Shelley", "by pointer"] "addr1gw2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer5ph3wczvf2x4v58t" + -- reward account: keyhash28 + specInspectAddress ["Shelley", "by value"] + "addr1upshvetj09hxjcm9v9jxgunjv4ehxmr0d3hkcmmvdakx7mq726p32" + + -- reward account: scripthash32 + specInspectAddress ["Shelley", "by value"] + "addr17pshvetj09hxjcm9v9jxgunjv4ehxmr0d3hkcmmvdakx7mrgdp5xsnxe5e6" + specInspectMalformed "💩" diff --git a/core/lib/Cardano/Address/Style/Shelley.hs b/core/lib/Cardano/Address/Style/Shelley.hs index 087f1c802..e4fd660a2 100644 --- a/core/lib/Cardano/Address/Style/Shelley.hs +++ b/core/lib/Cardano/Address/Style/Shelley.hs @@ -55,6 +55,7 @@ module Cardano.Address.Style.Shelley -- Internals , minSeedLengthBytes , pubkeyHashSize + , scriptHashSize ) where import Prelude @@ -507,6 +508,22 @@ inspectShelleyAddress addr -- 1000: byron address 0b10000000 -> inspectByronAddress addr <|> inspectIcarusAddress addr + -- 1110: reward account: keyhash28 + 0b11100000 | BS.length rest == pubkeyHashSize -> + Just $ Json.object + [ "address_style" .= Json.String "Shelley" + , "stake_reference" .= Json.String "by value" + , "stake_key_hash" .= base16 (BS.take pubkeyHashSize rest) + , "network_tag" .= network + ] + -- 1111: reward account: scripthash32 + 0b11110000 | BS.length rest == scriptHashSize -> + Just $ Json.object + [ "address_style" .= Json.String "Shelley" + , "stake_reference" .= Json.String "by value" + , "script_hash" .= base16 (BS.take scriptHashSize rest) + , "network_tag" .= network + ] _ -> Nothing where