{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE DeriveGeneric #-}
module Lightning.Protocol.BOLT2.Types (
HtlcId(..)
, SerialId(..)
, ScriptPubKey
, script_pubkey
, un_script_pubkey
, Witness
, witness
, un_witness
, OnionRoutingPacket
, onion_routing_packet
, un_onion_routing_packet
, OnionHash
, onion_hash
, un_onion_hash
, AttributionData
, attribution_data
, un_attribution_data
, FeeRange(..)
, NextFunding(..)
) where
import Bitcoin.Prim.Tx (TxId)
import Control.DeepSeq (NFData)
import qualified Data.ByteString as BS
import Data.Word (Word8, Word64)
import GHC.Generics (Generic)
import Lightning.Protocol.BOLT1 (Satoshi)
newtype HtlcId = HtlcId Word64
deriving (HtlcId -> HtlcId -> Bool
(HtlcId -> HtlcId -> Bool)
-> (HtlcId -> HtlcId -> Bool) -> Eq HtlcId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HtlcId -> HtlcId -> Bool
== :: HtlcId -> HtlcId -> Bool
$c/= :: HtlcId -> HtlcId -> Bool
/= :: HtlcId -> HtlcId -> Bool
Eq, Eq HtlcId
Eq HtlcId =>
(HtlcId -> HtlcId -> Ordering)
-> (HtlcId -> HtlcId -> Bool)
-> (HtlcId -> HtlcId -> Bool)
-> (HtlcId -> HtlcId -> Bool)
-> (HtlcId -> HtlcId -> Bool)
-> (HtlcId -> HtlcId -> HtlcId)
-> (HtlcId -> HtlcId -> HtlcId)
-> Ord HtlcId
HtlcId -> HtlcId -> Bool
HtlcId -> HtlcId -> Ordering
HtlcId -> HtlcId -> HtlcId
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: HtlcId -> HtlcId -> Ordering
compare :: HtlcId -> HtlcId -> Ordering
$c< :: HtlcId -> HtlcId -> Bool
< :: HtlcId -> HtlcId -> Bool
$c<= :: HtlcId -> HtlcId -> Bool
<= :: HtlcId -> HtlcId -> Bool
$c> :: HtlcId -> HtlcId -> Bool
> :: HtlcId -> HtlcId -> Bool
$c>= :: HtlcId -> HtlcId -> Bool
>= :: HtlcId -> HtlcId -> Bool
$cmax :: HtlcId -> HtlcId -> HtlcId
max :: HtlcId -> HtlcId -> HtlcId
$cmin :: HtlcId -> HtlcId -> HtlcId
min :: HtlcId -> HtlcId -> HtlcId
Ord, Int -> HtlcId -> ShowS
[HtlcId] -> ShowS
HtlcId -> String
(Int -> HtlcId -> ShowS)
-> (HtlcId -> String) -> ([HtlcId] -> ShowS) -> Show HtlcId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HtlcId -> ShowS
showsPrec :: Int -> HtlcId -> ShowS
$cshow :: HtlcId -> String
show :: HtlcId -> String
$cshowList :: [HtlcId] -> ShowS
showList :: [HtlcId] -> ShowS
Show, (forall x. HtlcId -> Rep HtlcId x)
-> (forall x. Rep HtlcId x -> HtlcId) -> Generic HtlcId
forall x. Rep HtlcId x -> HtlcId
forall x. HtlcId -> Rep HtlcId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HtlcId -> Rep HtlcId x
from :: forall x. HtlcId -> Rep HtlcId x
$cto :: forall x. Rep HtlcId x -> HtlcId
to :: forall x. Rep HtlcId x -> HtlcId
Generic)
instance NFData HtlcId
newtype SerialId = SerialId Word64
deriving (SerialId -> SerialId -> Bool
(SerialId -> SerialId -> Bool)
-> (SerialId -> SerialId -> Bool) -> Eq SerialId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SerialId -> SerialId -> Bool
== :: SerialId -> SerialId -> Bool
$c/= :: SerialId -> SerialId -> Bool
/= :: SerialId -> SerialId -> Bool
Eq, Eq SerialId
Eq SerialId =>
(SerialId -> SerialId -> Ordering)
-> (SerialId -> SerialId -> Bool)
-> (SerialId -> SerialId -> Bool)
-> (SerialId -> SerialId -> Bool)
-> (SerialId -> SerialId -> Bool)
-> (SerialId -> SerialId -> SerialId)
-> (SerialId -> SerialId -> SerialId)
-> Ord SerialId
SerialId -> SerialId -> Bool
SerialId -> SerialId -> Ordering
SerialId -> SerialId -> SerialId
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SerialId -> SerialId -> Ordering
compare :: SerialId -> SerialId -> Ordering
$c< :: SerialId -> SerialId -> Bool
< :: SerialId -> SerialId -> Bool
$c<= :: SerialId -> SerialId -> Bool
<= :: SerialId -> SerialId -> Bool
$c> :: SerialId -> SerialId -> Bool
> :: SerialId -> SerialId -> Bool
$c>= :: SerialId -> SerialId -> Bool
>= :: SerialId -> SerialId -> Bool
$cmax :: SerialId -> SerialId -> SerialId
max :: SerialId -> SerialId -> SerialId
$cmin :: SerialId -> SerialId -> SerialId
min :: SerialId -> SerialId -> SerialId
Ord, Int -> SerialId -> ShowS
[SerialId] -> ShowS
SerialId -> String
(Int -> SerialId -> ShowS)
-> (SerialId -> String) -> ([SerialId] -> ShowS) -> Show SerialId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SerialId -> ShowS
showsPrec :: Int -> SerialId -> ShowS
$cshow :: SerialId -> String
show :: SerialId -> String
$cshowList :: [SerialId] -> ShowS
showList :: [SerialId] -> ShowS
Show, (forall x. SerialId -> Rep SerialId x)
-> (forall x. Rep SerialId x -> SerialId) -> Generic SerialId
forall x. Rep SerialId x -> SerialId
forall x. SerialId -> Rep SerialId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SerialId -> Rep SerialId x
from :: forall x. SerialId -> Rep SerialId x
$cto :: forall x. Rep SerialId x -> SerialId
to :: forall x. Rep SerialId x -> SerialId
Generic)
instance NFData SerialId
newtype ScriptPubKey = ScriptPubKey BS.ByteString
deriving (ScriptPubKey -> ScriptPubKey -> Bool
(ScriptPubKey -> ScriptPubKey -> Bool)
-> (ScriptPubKey -> ScriptPubKey -> Bool) -> Eq ScriptPubKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ScriptPubKey -> ScriptPubKey -> Bool
== :: ScriptPubKey -> ScriptPubKey -> Bool
$c/= :: ScriptPubKey -> ScriptPubKey -> Bool
/= :: ScriptPubKey -> ScriptPubKey -> Bool
Eq, Eq ScriptPubKey
Eq ScriptPubKey =>
(ScriptPubKey -> ScriptPubKey -> Ordering)
-> (ScriptPubKey -> ScriptPubKey -> Bool)
-> (ScriptPubKey -> ScriptPubKey -> Bool)
-> (ScriptPubKey -> ScriptPubKey -> Bool)
-> (ScriptPubKey -> ScriptPubKey -> Bool)
-> (ScriptPubKey -> ScriptPubKey -> ScriptPubKey)
-> (ScriptPubKey -> ScriptPubKey -> ScriptPubKey)
-> Ord ScriptPubKey
ScriptPubKey -> ScriptPubKey -> Bool
ScriptPubKey -> ScriptPubKey -> Ordering
ScriptPubKey -> ScriptPubKey -> ScriptPubKey
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ScriptPubKey -> ScriptPubKey -> Ordering
compare :: ScriptPubKey -> ScriptPubKey -> Ordering
$c< :: ScriptPubKey -> ScriptPubKey -> Bool
< :: ScriptPubKey -> ScriptPubKey -> Bool
$c<= :: ScriptPubKey -> ScriptPubKey -> Bool
<= :: ScriptPubKey -> ScriptPubKey -> Bool
$c> :: ScriptPubKey -> ScriptPubKey -> Bool
> :: ScriptPubKey -> ScriptPubKey -> Bool
$c>= :: ScriptPubKey -> ScriptPubKey -> Bool
>= :: ScriptPubKey -> ScriptPubKey -> Bool
$cmax :: ScriptPubKey -> ScriptPubKey -> ScriptPubKey
max :: ScriptPubKey -> ScriptPubKey -> ScriptPubKey
$cmin :: ScriptPubKey -> ScriptPubKey -> ScriptPubKey
min :: ScriptPubKey -> ScriptPubKey -> ScriptPubKey
Ord, Int -> ScriptPubKey -> ShowS
[ScriptPubKey] -> ShowS
ScriptPubKey -> String
(Int -> ScriptPubKey -> ShowS)
-> (ScriptPubKey -> String)
-> ([ScriptPubKey] -> ShowS)
-> Show ScriptPubKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ScriptPubKey -> ShowS
showsPrec :: Int -> ScriptPubKey -> ShowS
$cshow :: ScriptPubKey -> String
show :: ScriptPubKey -> String
$cshowList :: [ScriptPubKey] -> ShowS
showList :: [ScriptPubKey] -> ShowS
Show, (forall x. ScriptPubKey -> Rep ScriptPubKey x)
-> (forall x. Rep ScriptPubKey x -> ScriptPubKey)
-> Generic ScriptPubKey
forall x. Rep ScriptPubKey x -> ScriptPubKey
forall x. ScriptPubKey -> Rep ScriptPubKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ScriptPubKey -> Rep ScriptPubKey x
from :: forall x. ScriptPubKey -> Rep ScriptPubKey x
$cto :: forall x. Rep ScriptPubKey x -> ScriptPubKey
to :: forall x. Rep ScriptPubKey x -> ScriptPubKey
Generic)
instance NFData ScriptPubKey
script_pubkey :: BS.ByteString -> Maybe ScriptPubKey
script_pubkey :: ByteString -> Maybe ScriptPubKey
script_pubkey ByteString
bs
| ByteString -> Int
BS.length ByteString
bs Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
65535 = ScriptPubKey -> Maybe ScriptPubKey
forall a. a -> Maybe a
Just (ByteString -> ScriptPubKey
ScriptPubKey ByteString
bs)
| Bool
otherwise = Maybe ScriptPubKey
forall a. Maybe a
Nothing
{-# INLINE script_pubkey #-}
un_script_pubkey :: ScriptPubKey -> BS.ByteString
un_script_pubkey :: ScriptPubKey -> ByteString
un_script_pubkey (ScriptPubKey ByteString
bs) = ByteString
bs
{-# INLINE un_script_pubkey #-}
newtype Witness = Witness BS.ByteString
deriving (Witness -> Witness -> Bool
(Witness -> Witness -> Bool)
-> (Witness -> Witness -> Bool) -> Eq Witness
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Witness -> Witness -> Bool
== :: Witness -> Witness -> Bool
$c/= :: Witness -> Witness -> Bool
/= :: Witness -> Witness -> Bool
Eq, Eq Witness
Eq Witness =>
(Witness -> Witness -> Ordering)
-> (Witness -> Witness -> Bool)
-> (Witness -> Witness -> Bool)
-> (Witness -> Witness -> Bool)
-> (Witness -> Witness -> Bool)
-> (Witness -> Witness -> Witness)
-> (Witness -> Witness -> Witness)
-> Ord Witness
Witness -> Witness -> Bool
Witness -> Witness -> Ordering
Witness -> Witness -> Witness
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Witness -> Witness -> Ordering
compare :: Witness -> Witness -> Ordering
$c< :: Witness -> Witness -> Bool
< :: Witness -> Witness -> Bool
$c<= :: Witness -> Witness -> Bool
<= :: Witness -> Witness -> Bool
$c> :: Witness -> Witness -> Bool
> :: Witness -> Witness -> Bool
$c>= :: Witness -> Witness -> Bool
>= :: Witness -> Witness -> Bool
$cmax :: Witness -> Witness -> Witness
max :: Witness -> Witness -> Witness
$cmin :: Witness -> Witness -> Witness
min :: Witness -> Witness -> Witness
Ord, Int -> Witness -> ShowS
[Witness] -> ShowS
Witness -> String
(Int -> Witness -> ShowS)
-> (Witness -> String) -> ([Witness] -> ShowS) -> Show Witness
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Witness -> ShowS
showsPrec :: Int -> Witness -> ShowS
$cshow :: Witness -> String
show :: Witness -> String
$cshowList :: [Witness] -> ShowS
showList :: [Witness] -> ShowS
Show, (forall x. Witness -> Rep Witness x)
-> (forall x. Rep Witness x -> Witness) -> Generic Witness
forall x. Rep Witness x -> Witness
forall x. Witness -> Rep Witness x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Witness -> Rep Witness x
from :: forall x. Witness -> Rep Witness x
$cto :: forall x. Rep Witness x -> Witness
to :: forall x. Rep Witness x -> Witness
Generic)
instance NFData Witness
witness :: BS.ByteString -> Maybe Witness
witness :: ByteString -> Maybe Witness
witness ByteString
bs
| ByteString -> Int
BS.length ByteString
bs Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
65535 = Witness -> Maybe Witness
forall a. a -> Maybe a
Just (ByteString -> Witness
Witness ByteString
bs)
| Bool
otherwise = Maybe Witness
forall a. Maybe a
Nothing
{-# INLINE witness #-}
un_witness :: Witness -> BS.ByteString
un_witness :: Witness -> ByteString
un_witness (Witness ByteString
bs) = ByteString
bs
{-# INLINE un_witness #-}
newtype OnionRoutingPacket = OnionRoutingPacket BS.ByteString
deriving (OnionRoutingPacket -> OnionRoutingPacket -> Bool
(OnionRoutingPacket -> OnionRoutingPacket -> Bool)
-> (OnionRoutingPacket -> OnionRoutingPacket -> Bool)
-> Eq OnionRoutingPacket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
== :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
$c/= :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
/= :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
Eq, Eq OnionRoutingPacket
Eq OnionRoutingPacket =>
(OnionRoutingPacket -> OnionRoutingPacket -> Ordering)
-> (OnionRoutingPacket -> OnionRoutingPacket -> Bool)
-> (OnionRoutingPacket -> OnionRoutingPacket -> Bool)
-> (OnionRoutingPacket -> OnionRoutingPacket -> Bool)
-> (OnionRoutingPacket -> OnionRoutingPacket -> Bool)
-> (OnionRoutingPacket -> OnionRoutingPacket -> OnionRoutingPacket)
-> (OnionRoutingPacket -> OnionRoutingPacket -> OnionRoutingPacket)
-> Ord OnionRoutingPacket
OnionRoutingPacket -> OnionRoutingPacket -> Bool
OnionRoutingPacket -> OnionRoutingPacket -> Ordering
OnionRoutingPacket -> OnionRoutingPacket -> OnionRoutingPacket
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: OnionRoutingPacket -> OnionRoutingPacket -> Ordering
compare :: OnionRoutingPacket -> OnionRoutingPacket -> Ordering
$c< :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
< :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
$c<= :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
<= :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
$c> :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
> :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
$c>= :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
>= :: OnionRoutingPacket -> OnionRoutingPacket -> Bool
$cmax :: OnionRoutingPacket -> OnionRoutingPacket -> OnionRoutingPacket
max :: OnionRoutingPacket -> OnionRoutingPacket -> OnionRoutingPacket
$cmin :: OnionRoutingPacket -> OnionRoutingPacket -> OnionRoutingPacket
min :: OnionRoutingPacket -> OnionRoutingPacket -> OnionRoutingPacket
Ord, Int -> OnionRoutingPacket -> ShowS
[OnionRoutingPacket] -> ShowS
OnionRoutingPacket -> String
(Int -> OnionRoutingPacket -> ShowS)
-> (OnionRoutingPacket -> String)
-> ([OnionRoutingPacket] -> ShowS)
-> Show OnionRoutingPacket
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OnionRoutingPacket -> ShowS
showsPrec :: Int -> OnionRoutingPacket -> ShowS
$cshow :: OnionRoutingPacket -> String
show :: OnionRoutingPacket -> String
$cshowList :: [OnionRoutingPacket] -> ShowS
showList :: [OnionRoutingPacket] -> ShowS
Show, (forall x. OnionRoutingPacket -> Rep OnionRoutingPacket x)
-> (forall x. Rep OnionRoutingPacket x -> OnionRoutingPacket)
-> Generic OnionRoutingPacket
forall x. Rep OnionRoutingPacket x -> OnionRoutingPacket
forall x. OnionRoutingPacket -> Rep OnionRoutingPacket x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OnionRoutingPacket -> Rep OnionRoutingPacket x
from :: forall x. OnionRoutingPacket -> Rep OnionRoutingPacket x
$cto :: forall x. Rep OnionRoutingPacket x -> OnionRoutingPacket
to :: forall x. Rep OnionRoutingPacket x -> OnionRoutingPacket
Generic)
instance NFData OnionRoutingPacket
onion_routing_packet :: BS.ByteString -> Maybe OnionRoutingPacket
onion_routing_packet :: ByteString -> Maybe OnionRoutingPacket
onion_routing_packet ByteString
bs
| ByteString -> Int
BS.length ByteString
bs Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
1366 = OnionRoutingPacket -> Maybe OnionRoutingPacket
forall a. a -> Maybe a
Just (ByteString -> OnionRoutingPacket
OnionRoutingPacket ByteString
bs)
| Bool
otherwise = Maybe OnionRoutingPacket
forall a. Maybe a
Nothing
{-# INLINE onion_routing_packet #-}
un_onion_routing_packet :: OnionRoutingPacket -> BS.ByteString
un_onion_routing_packet :: OnionRoutingPacket -> ByteString
un_onion_routing_packet (OnionRoutingPacket ByteString
bs) = ByteString
bs
{-# INLINE un_onion_routing_packet #-}
newtype OnionHash = OnionHash BS.ByteString
deriving (OnionHash -> OnionHash -> Bool
(OnionHash -> OnionHash -> Bool)
-> (OnionHash -> OnionHash -> Bool) -> Eq OnionHash
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OnionHash -> OnionHash -> Bool
== :: OnionHash -> OnionHash -> Bool
$c/= :: OnionHash -> OnionHash -> Bool
/= :: OnionHash -> OnionHash -> Bool
Eq, Eq OnionHash
Eq OnionHash =>
(OnionHash -> OnionHash -> Ordering)
-> (OnionHash -> OnionHash -> Bool)
-> (OnionHash -> OnionHash -> Bool)
-> (OnionHash -> OnionHash -> Bool)
-> (OnionHash -> OnionHash -> Bool)
-> (OnionHash -> OnionHash -> OnionHash)
-> (OnionHash -> OnionHash -> OnionHash)
-> Ord OnionHash
OnionHash -> OnionHash -> Bool
OnionHash -> OnionHash -> Ordering
OnionHash -> OnionHash -> OnionHash
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: OnionHash -> OnionHash -> Ordering
compare :: OnionHash -> OnionHash -> Ordering
$c< :: OnionHash -> OnionHash -> Bool
< :: OnionHash -> OnionHash -> Bool
$c<= :: OnionHash -> OnionHash -> Bool
<= :: OnionHash -> OnionHash -> Bool
$c> :: OnionHash -> OnionHash -> Bool
> :: OnionHash -> OnionHash -> Bool
$c>= :: OnionHash -> OnionHash -> Bool
>= :: OnionHash -> OnionHash -> Bool
$cmax :: OnionHash -> OnionHash -> OnionHash
max :: OnionHash -> OnionHash -> OnionHash
$cmin :: OnionHash -> OnionHash -> OnionHash
min :: OnionHash -> OnionHash -> OnionHash
Ord, Int -> OnionHash -> ShowS
[OnionHash] -> ShowS
OnionHash -> String
(Int -> OnionHash -> ShowS)
-> (OnionHash -> String)
-> ([OnionHash] -> ShowS)
-> Show OnionHash
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OnionHash -> ShowS
showsPrec :: Int -> OnionHash -> ShowS
$cshow :: OnionHash -> String
show :: OnionHash -> String
$cshowList :: [OnionHash] -> ShowS
showList :: [OnionHash] -> ShowS
Show, (forall x. OnionHash -> Rep OnionHash x)
-> (forall x. Rep OnionHash x -> OnionHash) -> Generic OnionHash
forall x. Rep OnionHash x -> OnionHash
forall x. OnionHash -> Rep OnionHash x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OnionHash -> Rep OnionHash x
from :: forall x. OnionHash -> Rep OnionHash x
$cto :: forall x. Rep OnionHash x -> OnionHash
to :: forall x. Rep OnionHash x -> OnionHash
Generic)
instance NFData OnionHash
onion_hash :: BS.ByteString -> Maybe OnionHash
onion_hash :: ByteString -> Maybe OnionHash
onion_hash ByteString
bs
| ByteString -> Int
BS.length ByteString
bs Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
32 = OnionHash -> Maybe OnionHash
forall a. a -> Maybe a
Just (ByteString -> OnionHash
OnionHash ByteString
bs)
| Bool
otherwise = Maybe OnionHash
forall a. Maybe a
Nothing
{-# INLINE onion_hash #-}
un_onion_hash :: OnionHash -> BS.ByteString
un_onion_hash :: OnionHash -> ByteString
un_onion_hash (OnionHash ByteString
bs) = ByteString
bs
{-# INLINE un_onion_hash #-}
newtype AttributionData = AttributionData BS.ByteString
deriving (AttributionData -> AttributionData -> Bool
(AttributionData -> AttributionData -> Bool)
-> (AttributionData -> AttributionData -> Bool)
-> Eq AttributionData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AttributionData -> AttributionData -> Bool
== :: AttributionData -> AttributionData -> Bool
$c/= :: AttributionData -> AttributionData -> Bool
/= :: AttributionData -> AttributionData -> Bool
Eq, Eq AttributionData
Eq AttributionData =>
(AttributionData -> AttributionData -> Ordering)
-> (AttributionData -> AttributionData -> Bool)
-> (AttributionData -> AttributionData -> Bool)
-> (AttributionData -> AttributionData -> Bool)
-> (AttributionData -> AttributionData -> Bool)
-> (AttributionData -> AttributionData -> AttributionData)
-> (AttributionData -> AttributionData -> AttributionData)
-> Ord AttributionData
AttributionData -> AttributionData -> Bool
AttributionData -> AttributionData -> Ordering
AttributionData -> AttributionData -> AttributionData
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: AttributionData -> AttributionData -> Ordering
compare :: AttributionData -> AttributionData -> Ordering
$c< :: AttributionData -> AttributionData -> Bool
< :: AttributionData -> AttributionData -> Bool
$c<= :: AttributionData -> AttributionData -> Bool
<= :: AttributionData -> AttributionData -> Bool
$c> :: AttributionData -> AttributionData -> Bool
> :: AttributionData -> AttributionData -> Bool
$c>= :: AttributionData -> AttributionData -> Bool
>= :: AttributionData -> AttributionData -> Bool
$cmax :: AttributionData -> AttributionData -> AttributionData
max :: AttributionData -> AttributionData -> AttributionData
$cmin :: AttributionData -> AttributionData -> AttributionData
min :: AttributionData -> AttributionData -> AttributionData
Ord, Int -> AttributionData -> ShowS
[AttributionData] -> ShowS
AttributionData -> String
(Int -> AttributionData -> ShowS)
-> (AttributionData -> String)
-> ([AttributionData] -> ShowS)
-> Show AttributionData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AttributionData -> ShowS
showsPrec :: Int -> AttributionData -> ShowS
$cshow :: AttributionData -> String
show :: AttributionData -> String
$cshowList :: [AttributionData] -> ShowS
showList :: [AttributionData] -> ShowS
Show, (forall x. AttributionData -> Rep AttributionData x)
-> (forall x. Rep AttributionData x -> AttributionData)
-> Generic AttributionData
forall x. Rep AttributionData x -> AttributionData
forall x. AttributionData -> Rep AttributionData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AttributionData -> Rep AttributionData x
from :: forall x. AttributionData -> Rep AttributionData x
$cto :: forall x. Rep AttributionData x -> AttributionData
to :: forall x. Rep AttributionData x -> AttributionData
Generic)
instance NFData AttributionData
attribution_data :: BS.ByteString -> Maybe AttributionData
attribution_data :: ByteString -> Maybe AttributionData
attribution_data ByteString
bs
| ByteString -> Int
BS.length ByteString
bs Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
920 = AttributionData -> Maybe AttributionData
forall a. a -> Maybe a
Just (ByteString -> AttributionData
AttributionData ByteString
bs)
| Bool
otherwise = Maybe AttributionData
forall a. Maybe a
Nothing
{-# INLINE attribution_data #-}
un_attribution_data :: AttributionData -> BS.ByteString
un_attribution_data :: AttributionData -> ByteString
un_attribution_data (AttributionData ByteString
bs) = ByteString
bs
{-# INLINE un_attribution_data #-}
data FeeRange = FeeRange
{ FeeRange -> Satoshi
fee_range_min_fee_satoshis :: {-# UNPACK #-} !Satoshi
, FeeRange -> Satoshi
fee_range_max_fee_satoshis :: {-# UNPACK #-} !Satoshi
} deriving (FeeRange -> FeeRange -> Bool
(FeeRange -> FeeRange -> Bool)
-> (FeeRange -> FeeRange -> Bool) -> Eq FeeRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FeeRange -> FeeRange -> Bool
== :: FeeRange -> FeeRange -> Bool
$c/= :: FeeRange -> FeeRange -> Bool
/= :: FeeRange -> FeeRange -> Bool
Eq, Int -> FeeRange -> ShowS
[FeeRange] -> ShowS
FeeRange -> String
(Int -> FeeRange -> ShowS)
-> (FeeRange -> String) -> ([FeeRange] -> ShowS) -> Show FeeRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FeeRange -> ShowS
showsPrec :: Int -> FeeRange -> ShowS
$cshow :: FeeRange -> String
show :: FeeRange -> String
$cshowList :: [FeeRange] -> ShowS
showList :: [FeeRange] -> ShowS
Show, (forall x. FeeRange -> Rep FeeRange x)
-> (forall x. Rep FeeRange x -> FeeRange) -> Generic FeeRange
forall x. Rep FeeRange x -> FeeRange
forall x. FeeRange -> Rep FeeRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FeeRange -> Rep FeeRange x
from :: forall x. FeeRange -> Rep FeeRange x
$cto :: forall x. Rep FeeRange x -> FeeRange
to :: forall x. Rep FeeRange x -> FeeRange
Generic)
instance NFData FeeRange
data NextFunding = NextFunding
{ NextFunding -> TxId
next_funding_txid :: !TxId
, NextFunding -> Word8
next_funding_retransmit_flags :: {-# UNPACK #-} !Word8
} deriving (NextFunding -> NextFunding -> Bool
(NextFunding -> NextFunding -> Bool)
-> (NextFunding -> NextFunding -> Bool) -> Eq NextFunding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NextFunding -> NextFunding -> Bool
== :: NextFunding -> NextFunding -> Bool
$c/= :: NextFunding -> NextFunding -> Bool
/= :: NextFunding -> NextFunding -> Bool
Eq, Int -> NextFunding -> ShowS
[NextFunding] -> ShowS
NextFunding -> String
(Int -> NextFunding -> ShowS)
-> (NextFunding -> String)
-> ([NextFunding] -> ShowS)
-> Show NextFunding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NextFunding -> ShowS
showsPrec :: Int -> NextFunding -> ShowS
$cshow :: NextFunding -> String
show :: NextFunding -> String
$cshowList :: [NextFunding] -> ShowS
showList :: [NextFunding] -> ShowS
Show, (forall x. NextFunding -> Rep NextFunding x)
-> (forall x. Rep NextFunding x -> NextFunding)
-> Generic NextFunding
forall x. Rep NextFunding x -> NextFunding
forall x. NextFunding -> Rep NextFunding x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. NextFunding -> Rep NextFunding x
from :: forall x. NextFunding -> Rep NextFunding x
$cto :: forall x. Rep NextFunding x -> NextFunding
to :: forall x. Rep NextFunding x -> NextFunding
Generic)
instance NFData NextFunding