module Morley.Client.Env
( MorleyClientEnv' (..)
, mceTezosClientL
, mceLogActionL
, mceSecretKeyL
, mceClientEnvL
) where
import Control.Lens (lens)
import Morley.Util.Lens (makeLensesWith, postfixLFields)
import Servant.Client (ClientEnv)
import Morley.Tezos.Crypto.Ed25519 qualified as Ed25519
import Morley.Client.Logging (ClientLogAction)
import Morley.Client.TezosClient.Types
data MorleyClientEnv' m = MorleyClientEnv
{ forall (m :: * -> *). MorleyClientEnv' m -> TezosClientEnv
mceTezosClient :: TezosClientEnv
, forall (m :: * -> *). MorleyClientEnv' m -> ClientLogAction m
mceLogAction :: ClientLogAction m
, forall (m :: * -> *). MorleyClientEnv' m -> Maybe SecretKey
mceSecretKey :: Maybe Ed25519.SecretKey
, forall (m :: * -> *). MorleyClientEnv' m -> ClientEnv
mceClientEnv :: ClientEnv
}
makeLensesWith postfixLFields ''MorleyClientEnv'
instance HasTezosClientEnv (MorleyClientEnv' m) where
tezosClientEnvL :: Lens' (MorleyClientEnv' m) TezosClientEnv
tezosClientEnvL =
(MorleyClientEnv' m -> TezosClientEnv)
-> (MorleyClientEnv' m -> TezosClientEnv -> MorleyClientEnv' m)
-> Lens' (MorleyClientEnv' m) TezosClientEnv
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens MorleyClientEnv' m -> TezosClientEnv
forall (m :: * -> *). MorleyClientEnv' m -> TezosClientEnv
mceTezosClient (\MorleyClientEnv' m
mce TezosClientEnv
tce -> MorleyClientEnv' m
mce { mceTezosClient :: TezosClientEnv
mceTezosClient = TezosClientEnv
tce })