module Cardano.CLI.Type.Error.StakeAddressNetworkIdMismatchError ( StakeAddressNetworkIdMismatchError (..) ) where import Cardano.Api import Cardano.Api.Ledger qualified as L data StakeAddressNetworkIdMismatchError = StakeAddressNetworkIdMismatchError { StakeAddressNetworkIdMismatchError -> StakeAddress stakeAddress :: !StakeAddress , StakeAddressNetworkIdMismatchError -> NetworkId cliNetworkId :: !NetworkId } deriving Int -> StakeAddressNetworkIdMismatchError -> ShowS [StakeAddressNetworkIdMismatchError] -> ShowS StakeAddressNetworkIdMismatchError -> String (Int -> StakeAddressNetworkIdMismatchError -> ShowS) -> (StakeAddressNetworkIdMismatchError -> String) -> ([StakeAddressNetworkIdMismatchError] -> ShowS) -> Show StakeAddressNetworkIdMismatchError forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> StakeAddressNetworkIdMismatchError -> ShowS showsPrec :: Int -> StakeAddressNetworkIdMismatchError -> ShowS $cshow :: StakeAddressNetworkIdMismatchError -> String show :: StakeAddressNetworkIdMismatchError -> String $cshowList :: [StakeAddressNetworkIdMismatchError] -> ShowS showList :: [StakeAddressNetworkIdMismatchError] -> ShowS Show instance Error StakeAddressNetworkIdMismatchError where prettyError :: forall ann. StakeAddressNetworkIdMismatchError -> Doc ann prettyError (StakeAddressNetworkIdMismatchError sAddr :: StakeAddress sAddr@(StakeAddress Network addrNetwork Credential Staking _) NetworkId netId) = [Doc ann] -> Doc ann forall a. Monoid a => [a] -> a mconcat [ Doc ann "The stake address " , Text -> Doc ann forall ann. Text -> Doc ann forall a ann. Pretty a => a -> Doc ann pretty (StakeAddress -> Text forall addr. SerialiseAddress addr => addr -> Text serialiseAddress StakeAddress sAddr) , Doc ann " is " , Network -> Doc ann forall ann. Network -> Doc ann renderNetwork Network addrNetwork , Doc ann ", but the command was given " , NetworkId -> Doc ann forall ann. NetworkId -> Doc ann renderNetworkId NetworkId netId , Doc ann ".\n" , Doc ann "Check the network options (--mainnet, --testnet-magic, or the " , Doc ann "CARDANO_NODE_NETWORK_ID environment variable), or use a stake address " , Doc ann "for the expected network." ] where renderNetwork :: L.Network -> Doc ann renderNetwork :: forall ann. Network -> Doc ann renderNetwork Network L.Mainnet = Doc ann "a mainnet stake address" renderNetwork Network L.Testnet = Doc ann "a testnet stake address" renderNetworkId :: NetworkId -> Doc ann renderNetworkId :: forall ann. NetworkId -> Doc ann renderNetworkId NetworkId Mainnet = Doc ann "mainnet" renderNetworkId (Testnet (NetworkMagic Word32 magic)) = Doc ann "a testnet with network magic " Doc ann -> Doc ann -> Doc ann forall a. Semigroup a => a -> a -> a <> Word32 -> Doc ann forall ann. Word32 -> Doc ann forall a ann. Pretty a => a -> Doc ann pretty Word32 magic