diff --git a/core/lib/Cardano/Address/Derivation.hs b/core/lib/Cardano/Address/Derivation.hs index 2532c6ecb..12f4d6501 100644 --- a/core/lib/Cardano/Address/Derivation.hs +++ b/core/lib/Cardano/Address/Derivation.hs @@ -356,7 +356,7 @@ data DerivationType = Hardened | Soft | WholeDomain class HardDerivation (key :: Depth -> * -> *) where type AccountIndexDerivationType key :: DerivationType type AddressIndexDerivationType key :: DerivationType - type WithAccountStyle key :: * + type WithRole key :: * -- | Derives account private key from the given root private key, using -- derivation scheme 2 (see @@ -375,7 +375,7 @@ class HardDerivation (key :: Depth -> * -> *) where -- @since 1.0.0 deriveAddressPrivateKey :: key 'AccountK XPrv - -> WithAccountStyle key + -> WithRole key -> Index (AddressIndexDerivationType key) 'AddressK -> key 'AddressK XPrv @@ -390,7 +390,7 @@ class HardDerivation key => SoftDerivation (key :: Depth -> * -> *) where -- @since 1.0.0 deriveAddressPublicKey :: key 'AccountK XPub - -> WithAccountStyle key + -> WithRole key -> Index 'Soft 'AddressK -> key 'AddressK XPub diff --git a/core/lib/Cardano/Address/Style/Byron.hs b/core/lib/Cardano/Address/Style/Byron.hs index 9487b77d4..ce97f32f6 100644 --- a/core/lib/Cardano/Address/Style/Byron.hs +++ b/core/lib/Cardano/Address/Style/Byron.hs @@ -220,7 +220,7 @@ instance Internal.GenMasterKey Byron where instance Internal.HardDerivation Byron where type AddressIndexDerivationType Byron = 'WholeDomain type AccountIndexDerivationType Byron = 'WholeDomain - type WithAccountStyle Byron = () + type WithRole Byron = () deriveAccountPrivateKey rootXPrv accIx = Byron { getKey = deriveXPrv DerivationScheme1 (getKey rootXPrv) accIx diff --git a/core/lib/Cardano/Address/Style/Icarus.hs b/core/lib/Cardano/Address/Style/Icarus.hs index b896a1de7..9e8dad2d5 100644 --- a/core/lib/Cardano/Address/Style/Icarus.hs +++ b/core/lib/Cardano/Address/Style/Icarus.hs @@ -219,7 +219,7 @@ instance Internal.GenMasterKey Icarus where instance Internal.HardDerivation Icarus where type AccountIndexDerivationType Icarus = 'Hardened type AddressIndexDerivationType Icarus = 'Soft - type WithAccountStyle Icarus = Role + type WithRole Icarus = Role deriveAccountPrivateKey (Icarus rootXPrv) accIx = let @@ -238,9 +238,9 @@ instance Internal.HardDerivation Icarus where deriveAddressPrivateKey (Icarus accXPrv) role addrIx = let - changeCode = toEnum @(Index 'Soft _) $ fromEnum role + roleCode = toEnum @(Index 'Soft _) $ fromEnum role changeXPrv = -- lvl4 derivation; soft derivation of change chain - deriveXPrv DerivationScheme2 accXPrv changeCode + deriveXPrv DerivationScheme2 accXPrv roleCode addrXPrv = -- lvl5 derivation; soft derivation of address index deriveXPrv DerivationScheme2 changeXPrv addrIx in @@ -249,9 +249,9 @@ instance Internal.HardDerivation Icarus where instance Internal.SoftDerivation Icarus where deriveAddressPublicKey (Icarus accXPub) role addrIx = fromMaybe errWrongIndex $ do - let changeCode = toEnum @(Index 'Soft _) $ fromEnum role + let roleCode = toEnum @(Index 'Soft _) $ fromEnum role changeXPub <- -- lvl4 derivation in bip44 is derivation of change chain - deriveXPub DerivationScheme2 accXPub changeCode + deriveXPub DerivationScheme2 accXPub roleCode addrXPub <- -- lvl5 derivation in bip44 is derivation of address chain deriveXPub DerivationScheme2 changeXPub addrIx return $ Icarus addrXPub diff --git a/core/lib/Cardano/Address/Style/Jormungandr.hs b/core/lib/Cardano/Address/Style/Jormungandr.hs index 8f3d8d554..1aa03808b 100644 --- a/core/lib/Cardano/Address/Style/Jormungandr.hs +++ b/core/lib/Cardano/Address/Style/Jormungandr.hs @@ -221,7 +221,7 @@ instance Internal.GenMasterKey Jormungandr where instance Internal.HardDerivation Jormungandr where type AccountIndexDerivationType Jormungandr = 'Hardened type AddressIndexDerivationType Jormungandr = 'Soft - type WithAccountStyle Jormungandr = Role + type WithRole Jormungandr = Role deriveAccountPrivateKey (Jormungandr rootXPrv) accIx = let @@ -240,9 +240,9 @@ instance Internal.HardDerivation Jormungandr where deriveAddressPrivateKey (Jormungandr accXPrv) role addrIx = let - changeCode = toEnum @(Index 'Soft _) $ fromEnum role + roleCode = toEnum @(Index 'Soft _) $ fromEnum role changeXPrv = -- lvl4 derivation; soft derivation of change chain - deriveXPrv DerivationScheme2 accXPrv changeCode + deriveXPrv DerivationScheme2 accXPrv roleCode addrXPrv = -- lvl5 derivation; soft derivation of address index deriveXPrv DerivationScheme2 changeXPrv addrIx in @@ -251,9 +251,9 @@ instance Internal.HardDerivation Jormungandr where instance Internal.SoftDerivation Jormungandr where deriveAddressPublicKey (Jormungandr accXPub) role addrIx = fromMaybe errWrongIndex $ do - let changeCode = toEnum @(Index 'Soft _) $ fromEnum role + let roleCode = toEnum @(Index 'Soft _) $ fromEnum role changeXPub <- -- lvl4 derivation in bip44 is derivation of change chain - deriveXPub DerivationScheme2 accXPub changeCode + deriveXPub DerivationScheme2 accXPub roleCode addrXPub <- -- lvl5 derivation in bip44 is derivation of address chain deriveXPub DerivationScheme2 changeXPub addrIx return $ Jormungandr addrXPub diff --git a/core/lib/Cardano/Address/Style/Shelley.hs b/core/lib/Cardano/Address/Style/Shelley.hs index db8efb437..1e1b5d7da 100644 --- a/core/lib/Cardano/Address/Style/Shelley.hs +++ b/core/lib/Cardano/Address/Style/Shelley.hs @@ -251,7 +251,7 @@ instance Internal.GenMasterKey Shelley where instance Internal.HardDerivation Shelley where type AccountIndexDerivationType Shelley = 'Hardened type AddressIndexDerivationType Shelley = 'Soft - type WithAccountStyle Shelley = Role + type WithRole Shelley = Role deriveAccountPrivateKey (Shelley rootXPrv) accIx = let @@ -270,10 +270,9 @@ instance Internal.HardDerivation Shelley where deriveAddressPrivateKey (Shelley accXPrv) role addrIx = let - changeCode = - toEnum @(Index 'Soft _) $ fromEnum role + roleCode = toEnum @(Index 'Soft _) $ fromEnum role changeXPrv = -- lvl4 derivation; soft derivation of change chain - deriveXPrv DerivationScheme2 accXPrv changeCode + deriveXPrv DerivationScheme2 accXPrv roleCode addrXPrv = -- lvl5 derivation; soft derivation of address index deriveXPrv DerivationScheme2 changeXPrv addrIx in @@ -282,9 +281,9 @@ instance Internal.HardDerivation Shelley where instance Internal.SoftDerivation Shelley where deriveAddressPublicKey (Shelley accXPub) role addrIx = fromMaybe errWrongIndex $ do - let changeCode = toEnum @(Index 'Soft _) $ fromEnum role + let roleCode = toEnum @(Index 'Soft _) $ fromEnum role changeXPub <- -- lvl4 derivation in bip44 is derivation of change chain - deriveXPub DerivationScheme2 accXPub changeCode + deriveXPub DerivationScheme2 accXPub roleCode addrXPub <- -- lvl5 derivation in bip44 is derivation of address chain deriveXPub DerivationScheme2 changeXPub addrIx return $ Shelley addrXPub