@@ -16,6 +16,9 @@ import Cardano.Wallet.Api.Http.Server.Handlers.NetworkInformation
16
16
import Cardano.Wallet.Api.Types
17
17
( ApiWalletMode (.. )
18
18
)
19
+ import Cardano.Wallet.Deposit.REST
20
+ ( WalletResource
21
+ )
19
22
import Cardano.Wallet.Network
20
23
( NetworkLayer
21
24
)
@@ -36,6 +39,9 @@ import Cardano.Wallet.UI.Common.Handlers.SSE
36
39
import Cardano.Wallet.UI.Common.Handlers.State
37
40
( getState
38
41
)
42
+ import Cardano.Wallet.UI.Common.Handlers.Wallet
43
+ ( pickMnemonic
44
+ )
39
45
import Cardano.Wallet.UI.Common.Html.Html
40
46
( RawHtml (.. )
41
47
, renderHtml
@@ -53,6 +59,9 @@ import Cardano.Wallet.UI.Common.Html.Pages.Settings
53
59
import Cardano.Wallet.UI.Common.Html.Pages.Template.Head
54
60
( PageConfig
55
61
)
62
+ import Cardano.Wallet.UI.Common.Html.Pages.Wallet
63
+ ( mnemonicH
64
+ )
56
65
import Cardano.Wallet.UI.Common.Layer
57
66
( SessionLayer (.. )
58
67
, UILayer (.. )
@@ -68,10 +77,16 @@ import Cardano.Wallet.UI.Deposit.API
68
77
( UI
69
78
, settingsSseToggleLink
70
79
)
80
+ import Cardano.Wallet.UI.Deposit.Handlers.Wallet
81
+ ( getWallet
82
+ )
71
83
import Cardano.Wallet.UI.Deposit.Html.Pages.Page
72
84
( Page (.. )
73
85
, page
74
86
)
87
+ import Cardano.Wallet.UI.Deposit.Html.Pages.Wallet
88
+ ( walletElementH
89
+ )
75
90
import Control.Monad.Trans
76
91
( MonadIO (.. )
77
92
)
@@ -99,7 +114,7 @@ import qualified Cardano.Read.Ledger.Block.Block as Read
99
114
import qualified Data.ByteString.Lazy as BL
100
115
101
116
pageHandler
102
- :: UILayer ()
117
+ :: UILayer a
103
118
-> PageConfig
104
119
-> Page
105
120
-> Maybe RequestCookies
@@ -114,37 +129,47 @@ showTime = formatTime defaultTimeLocale "%Y-%m-%d %H:%M:%S"
114
129
serveUI
115
130
:: forall n
116
131
. HasSNetworkId n
117
- => UILayer ()
132
+ => UILayer WalletResource
118
133
-> PageConfig
119
134
-> SNetworkId n
120
135
-> NetworkLayer IO Read. ConsensusBlock
121
136
-> BlockchainSource
122
137
-> Server UI
123
- serveUI ul config _ nl bs =
138
+ serveUI ul config _ nl bs =
124
139
ph About
125
140
:<|> ph About
126
141
:<|> ph Network
127
142
:<|> ph Settings
143
+ :<|> ph Wallet
128
144
:<|> sessioning (renderHtml . networkInfoH showTime <$> getNetworkInformation nid nl mode)
129
145
:<|> wsl (\ l -> getState l (renderHtml . settingsStateH settingsSseToggleLink))
130
146
:<|> wsl (\ l -> toggleSSE l $> RawHtml " " )
131
147
:<|> withSessionLayerRead (sse . sseConfig)
132
148
:<|> serveFavicon
149
+ :<|> (\ c -> sessioning $ renderHtml . mnemonicH <$> liftIO (pickMnemonic 15 c))
150
+ :<|> wsl (\ l -> getWallet l alert (renderHtml . walletElementH))
133
151
where
134
152
ph = pageHandler ul config
135
153
_ok _ = renderHtml . rogerH @ Text $ " ok"
136
- _alert = renderHtml . alertH
154
+ alert = renderHtml . alertH
137
155
nid = networkIdVal (sNetworkId @ n )
138
156
mode = case bs of
139
157
NodeSource {} -> Node
140
158
_ = networkInfoH
141
159
wsl = withSessionLayer ul
142
- withSessionLayerRead :: (SessionLayer () -> Handler a ) -> Maybe RequestCookies -> Handler a
160
+ withSessionLayerRead
161
+ :: (SessionLayer WalletResource -> Handler a )
162
+ -> Maybe RequestCookies
163
+ -> Handler a
143
164
withSessionLayerRead f = withSessionRead $ \ k -> do
144
165
s <- liftIO $ sessions ul k
145
166
f s
146
167
147
- withSessionLayer :: UILayer () -> (SessionLayer () -> Handler a ) -> Maybe RequestCookies -> Handler (CookieResponse a )
168
+ withSessionLayer
169
+ :: UILayer s
170
+ -> (SessionLayer s -> Handler a )
171
+ -> Maybe RequestCookies
172
+ -> Handler (CookieResponse a )
148
173
withSessionLayer ulayer f = withSession $ \ k -> do
149
174
s <- liftIO $ sessions ulayer k
150
175
f s
0 commit comments