@@ -68,12 +68,12 @@ invoiceWidget ln =
68
68
. maybe " 0" B11. inspectBolt11HrpAmt
69
69
. B11. bolt11HrpAmt
70
70
$ B11. bolt11Hrp ln,
71
- pair " Timestamp "
72
- . inspect
71
+ pair " Created At "
72
+ . inspectTimestamp
73
73
$ B11. bolt11Timestamp ln
74
74
]
75
75
<> ( B11. bolt11Tags ln
76
- >>= invoiceTagWidget
76
+ >>= invoiceTagWidget ln
77
77
)
78
78
<> [ pair " Signature"
79
79
. B11. inspectHex
@@ -86,24 +86,26 @@ invoiceWidget ln =
86
86
where
87
87
sig = B11. bolt11Signature ln
88
88
89
- invoiceTagWidget :: B11. Tag -> [FieldPair DynamicField Identity ]
90
- invoiceTagWidget = \ case
89
+ invoiceTagWidget :: B11. Bolt11 -> B11. Tag -> [FieldPair DynamicField Identity ]
90
+ invoiceTagWidget ln = \ case
91
91
B11. PaymentHash x -> hex " Preimage Hash" x
92
92
B11. PaymentSecret x -> hex " Payment Secret" x
93
93
B11. Description x -> pure . pair " Description" $ inspect x
94
94
B11. AdditionalMetadata x -> w5s " Additional Metadata" x
95
95
B11. PayeePubkey x -> hex " Payee Pubkey" x
96
96
B11. DescriptionHash x -> hex " Description Hash" x
97
- B11. Expiry x -> pure . pair " Expiry" $ inspect x
98
- B11. MinFinalCltvExpiry x -> pure . pair " Min Final CLTV Expiry" $ inspect x
97
+ B11. Expiry x ->
98
+ pure . pair " Expires At" . inspectTimestamp $ x + B11. bolt11Timestamp ln
99
+ B11. MinFinalCltvExpiry x ->
100
+ pure . pair " Min Final CLTV Expiry" $ inspect x <> " Blocks"
99
101
B11. OnchainFallback x -> do
100
102
--
101
103
-- TODO : do not ignore failure?
102
104
--
103
105
txt <- either (const mempty ) pure . decodeUtf8' $ Btc. renderAddress x
104
106
pure $ pair " Onchain Fallback" $ from @ Prelude. Text @ MisoString txt
105
107
B11. ExtraRouteInfo -> mempty
106
- B11. Features x -> pure . pair " Feature Bits" $ inspect x
108
+ B11. Features x -> pure . pair " Feature Bits" $ B11. inspectFeatures x
107
109
B11. UnknownTag {} -> mempty
108
110
B11. UnparsedTag {} -> mempty
109
111
where
@@ -181,3 +183,10 @@ css :: MisoString -> [View action] -> [View action]
181
183
css x = fmap $ \ case
182
184
Node x0 x1 x2 x3 x4 -> Node x0 x1 x2 (class_ x : x3) x4
183
185
html -> html
186
+
187
+ inspectTimestamp :: Int -> MisoString
188
+ inspectTimestamp =
189
+ inspect
190
+ . posixSecondsToUTCTime
191
+ . Prelude. fromInteger
192
+ . from @ Int @ Integer
0 commit comments