Skip to content

Commit 16a3d12

Browse files
committed
rm redundant bolt11 code
1 parent eb6246f commit 16a3d12

File tree

4 files changed

+6
-158
lines changed

4 files changed

+6
-158
lines changed

pub/functora/functora.cabal

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,7 @@ library bolt11
348348
import: pkg-bolt11
349349
exposed: True
350350
visibility: public
351-
exposed-modules:
352-
Functora.Bolt11
353-
Functora.Denomination
351+
exposed-modules: Functora.Bolt11
354352

355353
executable elm2miso
356354
import: pkg-elm2miso, exe
@@ -404,7 +402,6 @@ test-suite functora-test
404402
Functora.Bolt11
405403
Functora.Cfg
406404
Functora.CfgOrphan
407-
Functora.Denomination
408405
Functora.Elm2Miso
409406
Functora.Money
410407
Functora.MoneySing

pub/functora/src/bolt11/Functora/Bolt11.hs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
module Functora.Bolt11
55
( Bolt11 (..),
6-
bolt11Msats,
76
decodeBolt11,
87
Hex (..),
98
Multiplier (..),
@@ -35,7 +34,6 @@ import Data.Text (Text)
3534
import qualified Data.Text as T
3635
import Data.Text.Encoding (decodeUtf8)
3736
import qualified Data.Text.Encoding as T
38-
import Functora.Denomination (Denomination (toMsats), MSats, btc)
3937
import GHC.Generics (Generic)
4038
import Prelude
4139

@@ -101,7 +99,11 @@ newtype Bolt11Amount = Bolt11Amount {_getBolt11Amount :: (Integer, Multiplier)}
10199
deriving stock (Data, Generic)
102100

103101
instance Show Bolt11Amount where
104-
show amt = show (bolt11Msats amt)
102+
show (Bolt11Amount (amt, mul)) =
103+
show msat <> " msats"
104+
where
105+
msat :: Integer
106+
msat = round $ (amt % 1) * multiplierRatio mul * 1000_0000_0000
105107

106108
data Bolt11HRP = Bolt11HRP
107109
{ bolt11Currency :: Network,
@@ -221,7 +223,3 @@ multiplierRatio m =
221223
Micro -> 1 % 1000000
222224
Nano -> 1 % 1000000000
223225
Pico -> 1 % 1000000000000
224-
225-
bolt11Msats :: Bolt11Amount -> MSats
226-
bolt11Msats (Bolt11Amount (amt, multi)) =
227-
toMsats (btc (multiplierRatio multi * toRational amt))

pub/functora/src/bolt11/Functora/Denomination.hs

Lines changed: 0 additions & 145 deletions
This file was deleted.

pub/functora/src/functora-ghcjs.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ library
156156
Functora.Bolt11
157157
Functora.Cfg
158158
Functora.CfgOrphan
159-
Functora.Denomination
160159
Functora.Money
161160
Functora.MoneySing
162161
Functora.Prelude
@@ -214,7 +213,6 @@ test-suite functora-ghcjs-test
214213
Functora.Bolt11
215214
Functora.Cfg
216215
Functora.CfgOrphan
217-
Functora.Denomination
218216
Functora.Elm2Miso
219217
Functora.Money
220218
Functora.MoneySing

0 commit comments

Comments
 (0)