Skip to content

Commit 5335613

Browse files
committed
lnd-client wip
1 parent 1bc44ba commit 5335613

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1154
-1174
lines changed

pub/lnd-client/cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
allow-newer: *
22
packages:
33
*.cabal
4+
../functora/*.cabal
45
../network-bitcoin/*.cabal
56
../proto-lens/discrimination-ieee754/*.cabal
67
../proto-lens/proto-lens/*.cabal

pub/lnd-client/lnd-client.cabal

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ cabal-version: 2.0
55
-- see: https://github.com/sol/hpack
66

77
name: lnd-client
8-
version: 0.1.0.2
8+
version: 0.1.0.3
99
synopsis: Lightning Network Daemon (LND) client library for Haskell
1010
description: You can find documentation at <https://hackage.haskell.org/package/lnd-client>
1111
category: Lightning, Bitcoin, Finance, Network, Payments
12-
homepage: https://github.com/coingaming/lnd-client#readme
13-
bug-reports: https://github.com/coingaming/lnd-client/issues
14-
author: 21it <21[email protected]>, Mikhail Prushinskiy <[email protected]>, Artem Markov <[email protected]>
15-
maintainer: 21it <21[email protected]>, Mikhail Prushinskiy <[email protected]>, Artem Markov <[email protected]>
16-
copyright: 2022 Yolo <[email protected]>
12+
homepage: https://github.com/functora.github.io/pub#readme
13+
bug-reports: https://github.com/functora.github.io/pub/issues
14+
author: functora <[email protected]>
15+
maintainer: functora <[email protected]>
16+
copyright: 2025 functora <[email protected]>
1717
license: BSD3
1818
license-file: LICENSE
1919
build-type: Simple
@@ -23,7 +23,8 @@ extra-source-files:
2323

2424
source-repository head
2525
type: git
26-
location: https://github.com/coingaming/lnd-client
26+
location: https://github.com/functora.github.io/pub
27+
subdir: lnd-client
2728

2829
flag ghcid
2930
manual: True
@@ -89,7 +90,6 @@ library
8990
LndClient.Import.External
9091
LndClient.LndTest
9192
LndClient.Log
92-
LndClient.Orphan
9393
LndClient.QRCode
9494
LndClient.RPC.Generic
9595
LndClient.RPC.Katip
@@ -149,7 +149,8 @@ library
149149
TypeOperators
150150
FlexibleContexts
151151
FlexibleInstances
152-
ghc-options: -Weverything -Werror -Wno-missing-export-lists -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures
152+
DeriveDataTypeable
153+
ghc-options: -Weverything -Werror -Wno-missing-export-lists -Wno-missing-kind-signatures -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures
153154
build-depends:
154155
JuicyPixels >=3.3.3 && <3.4
155156
, aeson >=1.4.4.0
@@ -161,9 +162,12 @@ library
161162
, chronos >=1.0.7 && <1.2
162163
, containers >=0.6.0.1 && <0.6.6
163164
, cryptohash-sha256 >=0.11.101.0 && <0.12
165+
, crypton-x509 ==1.7.5.*
166+
, crypton-x509-store
164167
, cryptonite >=0.25 && <0.31
165168
, envparse ==0.4.1.*
166169
, extra >=1.6.18 && <1.8
170+
, functora
167171
, http2 >=3.0.3
168172
, http2-client >=0.10.0.0
169173
, http2-client-grpc >=0.8.0.0
@@ -182,14 +186,10 @@ library
182186
, stm >=2.5.0.0 && <2.5.1
183187
, template-haskell >=2.14.0.0 && <2.19
184188
, text >=1.2.3.1 && <2.1
185-
, time
186189
, tls
187190
, unbounded-delays >=0.1.1.0 && <0.1.2
188191
, universum >=1.5.0 && <1.8
189192
, unliftio >=0.2.12
190-
, witch
191-
, x509 ==1.7.5.*
192-
, x509-store
193193
default-language: Haskell2010
194194
if impl(ghc >= 8.10.7)
195195
ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module -fenable-th-splice-warnings -fprint-potential-instances
@@ -218,7 +218,8 @@ library lnd-client-tkit
218218
TypeOperators
219219
FlexibleContexts
220220
FlexibleInstances
221-
ghc-options: -Weverything -Werror -Wno-missing-export-lists -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures
221+
DeriveDataTypeable
222+
ghc-options: -Weverything -Werror -Wno-missing-export-lists -Wno-missing-kind-signatures -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures
222223
build-depends:
223224
base >=4.7 && <5
224225
, http2-client-grpc
@@ -251,7 +252,8 @@ executable lnd-client-prof
251252
TypeOperators
252253
FlexibleContexts
253254
FlexibleInstances
254-
ghc-options: -Weverything -Werror -Wno-missing-export-lists -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -main-is LndClient.Main -O2 -optc-O3 -funfolding-use-threshold=16 -threaded -rtsopts "-with-rtsopts=-N -s -p -h -xt" -prof -fprof-auto -optl-fuse-ld=gold
255+
DeriveDataTypeable
256+
ghc-options: -Weverything -Werror -Wno-missing-export-lists -Wno-missing-kind-signatures -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -main-is LndClient.Main -O2 -optc-O3 -funfolding-use-threshold=16 -threaded -rtsopts "-with-rtsopts=-N -s -p -h -xt" -prof -fprof-auto -optl-fuse-ld=gold
255257
ld-options: -fuse-ld=gold
256258
build-depends:
257259
async
@@ -321,7 +323,6 @@ executable lnd-client-prof
321323
LndClient.Import.External
322324
LndClient.LndTest
323325
LndClient.Log
324-
LndClient.Orphan
325326
LndClient.QRCode
326327
LndClient.RPC.Generic
327328
LndClient.RPC.Katip
@@ -376,9 +377,12 @@ executable lnd-client-prof
376377
, chronos >=1.0.7 && <1.2
377378
, containers >=0.6.0.1 && <0.6.6
378379
, cryptohash-sha256 >=0.11.101.0 && <0.12
380+
, crypton-x509 ==1.7.5.*
381+
, crypton-x509-store
379382
, cryptonite >=0.25 && <0.31
380383
, envparse ==0.4.1.*
381384
, extra >=1.6.18 && <1.8
385+
, functora
382386
, http2 >=3.0.3
383387
, http2-client >=0.10.0.0
384388
, http2-client-grpc >=0.8.0.0
@@ -397,14 +401,10 @@ executable lnd-client-prof
397401
, stm >=2.5.0.0 && <2.5.1
398402
, template-haskell >=2.14.0.0 && <2.19
399403
, text >=1.2.3.1 && <2.1
400-
, time
401404
, tls
402405
, unbounded-delays >=0.1.1.0 && <0.1.2
403406
, universum >=1.5.0 && <1.8
404407
, unliftio >=0.2.12
405-
, witch
406-
, x509 ==1.7.5.*
407-
, x509-store
408408
else
409409
build-depends:
410410
lnd-client
@@ -437,7 +437,8 @@ test-suite lnd-client-test
437437
TypeOperators
438438
FlexibleContexts
439439
FlexibleInstances
440-
ghc-options: -Weverything -Werror -Wno-missing-export-lists -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -O2 -optc-O3 -funfolding-use-threshold=16 -threaded -rtsopts -with-rtsopts=-N -optl-fuse-ld=gold
440+
DeriveDataTypeable
441+
ghc-options: -Weverything -Werror -Wno-missing-export-lists -Wno-missing-kind-signatures -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missed-specialisations -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe -Wno-missing-local-signatures -O2 -optc-O3 -funfolding-use-threshold=16 -threaded -rtsopts -with-rtsopts=-N -optl-fuse-ld=gold
441442
ld-options: -fuse-ld=gold
442443
build-depends:
443444
async
@@ -508,7 +509,6 @@ test-suite lnd-client-test
508509
LndClient.Import.External
509510
LndClient.LndTest
510511
LndClient.Log
511-
LndClient.Orphan
512512
LndClient.QRCode
513513
LndClient.RPC.Generic
514514
LndClient.RPC.Katip
@@ -563,9 +563,12 @@ test-suite lnd-client-test
563563
, chronos >=1.0.7 && <1.2
564564
, containers >=0.6.0.1 && <0.6.6
565565
, cryptohash-sha256 >=0.11.101.0 && <0.12
566+
, crypton-x509 ==1.7.5.*
567+
, crypton-x509-store
566568
, cryptonite >=0.25 && <0.31
567569
, envparse ==0.4.1.*
568570
, extra >=1.6.18 && <1.8
571+
, functora
569572
, http2 >=3.0.3
570573
, http2-client >=0.10.0.0
571574
, http2-client-grpc >=0.8.0.0
@@ -584,14 +587,10 @@ test-suite lnd-client-test
584587
, stm >=2.5.0.0 && <2.5.1
585588
, template-haskell >=2.14.0.0 && <2.19
586589
, text >=1.2.3.1 && <2.1
587-
, time
588590
, tls
589591
, unbounded-delays >=0.1.1.0 && <0.1.2
590592
, universum >=1.5.0 && <1.8
591593
, unliftio >=0.2.12
592-
, witch
593-
, x509 ==1.7.5.*
594-
, x509-store
595594
else
596595
build-depends:
597596
lnd-client

pub/lnd-client/package.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: lnd-client
2-
version: 0.1.0.2
3-
github: "coingaming/lnd-client"
2+
version: 0.1.0.3
3+
github: "functora.github.io/pub/lnd-client"
44
license: BSD3
5-
author: "21it <[email protected]>, Mikhail Prushinskiy <[email protected]>, Artem Markov <[email protected]>"
6-
maintainer: "21it <[email protected]>, Mikhail Prushinskiy <[email protected]>, Artem Markov <[email protected]>"
7-
copyright: "2022 Yolo <[email protected]>"
5+
author: "functora <[email protected]>"
6+
maintainer: "functora <[email protected]>"
7+
copyright: "2025 functora <[email protected]>"
88
synopsis: Lightning Network Daemon (LND) client library for Haskell
99
category: Lightning, Bitcoin, Finance, Network, Payments
1010
description: You can find documentation at <https://hackage.haskell.org/package/lnd-client>
@@ -18,9 +18,8 @@ _deps: &deps
1818
# foundation
1919
- base >= 4.7 && < 5
2020
- universum >= 1.5.0 && < 1.8
21-
- witch
21+
- functora
2222
# time
23-
- time
2423
- chronos >= 1.0.7 && < 1.2
2524
- unbounded-delays >= 0.1.1.0 && < 0.1.2
2625
# storage
@@ -44,8 +43,8 @@ _deps: &deps
4443
# crypto
4544
- cryptonite >= 0.25 && < 0.31
4645
- cryptohash-sha256 >= 0.11.101.0 && < 0.12
47-
- x509 >= 1.7.5 && < 1.7.6
48-
- x509-store
46+
- crypton-x509 >= 1.7.5 && < 1.7.6
47+
- crypton-x509-store
4948
- pem >= 0.2.4 && < 0.3
5049
# bitcoin
5150
- network-bitcoin >= 1.8.3
@@ -97,12 +96,14 @@ default-extensions:
9796
- TypeOperators
9897
- FlexibleContexts
9998
- FlexibleInstances
99+
- DeriveDataTypeable
100100
ghc-options:
101101
# For details on warnings: https://downloads.haskell.org/~ghc/master/users-guide/using-warnings.html
102102
# Enable all warnings with -Weverything, then disable the ones we don’t care about
103103
- -Weverything
104104
- -Werror
105105
- -Wno-missing-export-lists
106+
- -Wno-missing-kind-signatures
106107
- -Wno-missing-exported-signatures # missing-exported-signatures turns off the more strict -Wmissing-signatures. See https://ghc.haskell.org/trac/ghc/ticket/14794#ticket
107108
- -Wno-missing-import-lists # Requires explicit imports of _every_ function (e.g. ‘$’); too strict
108109
- -Wno-missed-specialisations # When GHC can’t specialize a polymorphic function. No big deal and requires fixing underlying libraries to solve.

pub/lnd-client/script/generate-protoc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ protoc \
77
--plugin=protoc-gen-haskell=`which proto-lens-protoc` \
88
--proto_path=proto \
99
--haskell_out=./src \
10-
--haskell_opt='Opt{ imports = [], pragmas = ["DeriveGeneric"], stockInstances = ["GHC.Generics.Generic"], defaultInstances = [] }' \
10+
--haskell_opt='Opt{ imports = [], pragmas = ["DeriveDataTypeable", "DeriveGeneric"], stockInstances = ["Data.Data.Data", "GHC.Generics.Generic"], defaultInstances = [] }' \
1111
./proto/**/*.proto

pub/lnd-client/src/LndClient/Data/AddHodlInvoice.hs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ data AddHodlInvoiceRequest = AddHodlInvoiceRequest
1616
valueMsat :: Msat,
1717
expiry :: Maybe Seconds
1818
}
19-
deriving stock (Eq, Show, Generic)
20-
21-
instance Out AddHodlInvoiceRequest
19+
deriving stock (Eq, Ord, Show, Read, Data, Generic)
2220

2321
instance ToGrpc AddHodlInvoiceRequest LnGRPC.AddHoldInvoiceRequest where
2422
toGrpc x =
@@ -30,7 +28,11 @@ instance ToGrpc AddHodlInvoiceRequest LnGRPC.AddHoldInvoiceRequest where
3028
where
3129
msg gMemo gHash gValue gExp =
3230
defMessage
33-
& LnGRPC.memo .~ gMemo
34-
& LnGRPC.hash .~ gHash
35-
& LnGRPC.valueMsat .~ gValue
36-
& LnGRPC.expiry .~ gExp
31+
& LnGRPC.memo
32+
.~ gMemo
33+
& LnGRPC.hash
34+
.~ gHash
35+
& LnGRPC.valueMsat
36+
.~ gValue
37+
& LnGRPC.expiry
38+
.~ gExp

pub/lnd-client/src/LndClient/Data/AddInvoice.hs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,14 @@ data AddInvoiceRequest = AddInvoiceRequest
1616
memo :: Maybe Text,
1717
expiry :: Maybe Seconds
1818
}
19-
deriving stock (Eq, Show, Generic)
20-
21-
instance Out AddInvoiceRequest
19+
deriving stock (Eq, Ord, Show, Read, Data, Generic)
2220

2321
data AddInvoiceResponse = AddInvoiceResponse
2422
{ rHash :: RHash,
2523
paymentRequest :: PaymentRequest,
2624
addIndex :: AddIndex
2725
}
28-
deriving stock (Eq, Show, Generic)
29-
30-
instance Out AddInvoiceResponse
26+
deriving stock (Eq, Ord, Show, Read, Data, Generic)
3127

3228
instance ToGrpc AddInvoiceRequest LnGRPC.Invoice where
3329
toGrpc x =
@@ -38,9 +34,12 @@ instance ToGrpc AddInvoiceRequest LnGRPC.Invoice where
3834
where
3935
msg gMemo gValue gExp =
4036
defMessage
41-
& LnGRPC.memo .~ gMemo
42-
& LnGRPC.valueMsat .~ gValue
43-
& LnGRPC.expiry .~ gExp
37+
& LnGRPC.memo
38+
.~ gMemo
39+
& LnGRPC.valueMsat
40+
.~ gValue
41+
& LnGRPC.expiry
42+
.~ gExp
4443

4544
instance FromGrpc AddInvoiceResponse LnGRPC.AddInvoiceResponse where
4645
fromGrpc x =

pub/lnd-client/src/LndClient/Data/Channel.hs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,13 @@ data Channel = Channel
3131
numUpdates :: Word64,
3232
prv :: Bool
3333
}
34-
deriving stock (Eq, Ord, Show, Generic)
35-
36-
instance Out Channel
34+
deriving stock (Eq, Ord, Show, Read, Data, Generic)
3735

3836
data PendingUpdate (a :: TxKind) = PendingUpdate
3937
{ txid :: TxId a,
4038
outputIndex :: Vout a
4139
}
42-
deriving stock (Eq, Ord, Show, Generic)
43-
44-
instance Out (PendingUpdate a)
40+
deriving stock (Eq, Ord, Show, Read, Data, Generic)
4541

4642
instance FromGrpc Channel LnGRPC.Channel where
4743
fromGrpc x =

0 commit comments

Comments
 (0)