BOLT1.hs (1759B)
1 {-# OPTIONS_HADDOCK prune #-} 2 3 -- | 4 -- Module: Lightning.Protocol.BOLT1 5 -- Copyright: (c) 2025 Jared Tobin 6 -- License: MIT 7 -- Maintainer: Jared Tobin <jared@ppad.tech> 8 -- 9 -- Base protocol for the Lightning Network, per 10 -- [BOLT #1](https://github.com/lightning/bolts/blob/master/01-messaging.md). 11 12 module Lightning.Protocol.BOLT1 ( 13 -- * Message types 14 Message(..) 15 , MsgType(..) 16 , msgTypeWord 17 18 -- * Channel identifiers 19 , ChannelId 20 , channelId 21 , allChannels 22 23 -- ** Setup messages 24 , Init(..) 25 , Error(..) 26 , Warning(..) 27 28 -- ** Control messages 29 , Ping(..) 30 , Pong(..) 31 32 -- ** Peer storage 33 , PeerStorage(..) 34 , PeerStorageRetrieval(..) 35 36 -- * TLV 37 , TlvRecord(..) 38 , TlvStream 39 , unTlvStream 40 , tlvStream 41 , unsafeTlvStream 42 , TlvError(..) 43 , encodeTlvStream 44 , decodeTlvStream 45 , decodeTlvStreamWith 46 , decodeTlvStreamRaw 47 48 -- ** Init TLVs 49 , InitTlv(..) 50 , ChainHash 51 , chainHash 52 , unChainHash 53 54 -- * Message envelope 55 , Envelope(..) 56 57 -- * Encoding 58 , EncodeError(..) 59 , encodeMessage 60 , encodeEnvelope 61 62 -- * Decoding 63 , DecodeError(..) 64 , decodeMessage 65 , decodeEnvelope 66 , decodeEnvelopeWith 67 68 -- * Primitive encoding 69 , encodeU16 70 , encodeU32 71 , encodeU64 72 , encodeS8 73 , encodeS16 74 , encodeS32 75 , encodeS64 76 , encodeTu16 77 , encodeTu32 78 , encodeTu64 79 , encodeMinSigned 80 , encodeBigSize 81 82 -- * Primitive decoding 83 , decodeU16 84 , decodeU32 85 , decodeU64 86 , decodeS8 87 , decodeS16 88 , decodeS32 89 , decodeS64 90 , decodeTu16 91 , decodeTu32 92 , decodeTu64 93 , decodeMinSigned 94 , decodeBigSize 95 ) where 96 97 -- Re-export from sub-modules 98 import Lightning.Protocol.BOLT1.Prim 99 import Lightning.Protocol.BOLT1.TLV 100 import Lightning.Protocol.BOLT1.Message 101 import Lightning.Protocol.BOLT1.Codec