bitcoin-payment-channel-1.2.0.0: Instant, two-party Bitcoin payments

Copyright(c) Rune K. Svendsen 2016
LicensePublicDomain
Maintainerrunesvend@gmail.com
Safe HaskellNone
LanguageHaskell2010

PaymentChannel.Types

Contents

Description

Types used with the interface provided by PaymentChannel.

Synopsis

Shared senderreceiver typesfunctions

data FundingTxInfo Source #

Holds information about the Bitcoin transaction used to fund the channel

Constructors

CFundingTxInfo 

Fields

  • ftiHash :: TxHash

    Hash of funding transaction.

  • ftiOutIndex :: Word32

    Index/"vout" of funding output (zero-based index of funding output within list of transaction outputs)

  • ftiOutValue :: NonDustyAmount

    Value of funding output (channel max value).

data ChanParams Source #

Defines channel: sender, receiver, and expiration date

Constructors

ChanParams 

Fields

Instances

Eq ChanParams Source # 
Show ChanParams Source # 
Generic ChanParams Source # 

Associated Types

type Rep ChanParams :: * -> * #

ToJSON ChanParams Source # 
FromJSON ChanParams Source # 
Serialize ChanParams Source # 
NFData ChanParams Source # 

Methods

rnf :: ChanParams -> () #

HasLockTimeDate ChanParams Source # 

Methods

getLockTimeDate :: ChanParams -> LockTimeDate

HasRecvPubKey ChanParams Source # 
HasSendPubKey ChanParams Source # 
DerivationSeed ChanParams Source # 
HasUserParams ChanParams Source # 
type Rep ChanParams Source # 
type Rep ChanParams = D1 (MetaData "ChanParams" "PaymentChannel.Internal.ChanScript" "bitcoin-payment-channel-1.2.0.0-7YwDEKAOCp2BNoMt0JxEOM" False) (C1 (MetaCons "ChanParams" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "cpSenderPubKey") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SendPubKey)) ((:*:) (S1 (MetaSel (Just Symbol "cpReceiverPubKey") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 RecvPubKey)) (S1 (MetaSel (Just Symbol "cpLockTime") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 LockTimeDate)))))

class HasSignedPayChanState a => PaymentChannel a where Source #

Get various information about an open payment channel.

Minimal complete definition

valueToMe, channelValueLeft, getStatePayment

Methods

valueToMe :: a -> BtcAmount Source #

Get amount received by receiver/left for sender

channelValueLeft :: a -> BtcAmount Source #

Remaining channel value

getStatePayment :: a -> SignedPayment Source #

For internal use

Instances

PaymentChannel ClientPayChan Source # 

Methods

valueToMe :: ClientPayChan -> BtcAmount Source #

channelValueLeft :: ClientPayChan -> BtcAmount Source #

getStatePayment :: ClientPayChan -> SignedPayment Source #

PaymentChannel (ServerPayChanI s) Source # 

Methods

valueToMe :: ServerPayChanI s -> BtcAmount Source #

channelValueLeft :: ServerPayChanI s -> BtcAmount Source #

getStatePayment :: ServerPayChanI s -> SignedPayment Source #

class PaymentChannel a => PayChan a Source #

Short-hand

class PaymentChannel a => PaymentChannelRecv a where Source #

Payment channel state objects with metadata information

Minimal complete definition

clientTotalValueSent

Methods

clientTotalValueSent :: a -> BtcAmount Source #

Get total amount (both settled and unsettled) sent by client

Instances

PaymentChannelRecv (ServerPayChanI (MetadataI a)) Source # 

Methods

clientTotalValueSent :: ServerPayChanI (MetadataI a) -> BtcAmount Source #

data SharedSecret :: * #

Instances

Eq SharedSecret 
Show SharedSecret 
Generic SharedSecret 

Associated Types

type Rep SharedSecret :: * -> * #

ToJSON SharedSecret 
FromJSON SharedSecret 
Serialize SharedSecret 
NFData SharedSecret 

Methods

rnf :: SharedSecret -> () #

ToHttpApiData SharedSecret 
FromHttpApiData SharedSecret 
type Rep SharedSecret 
type Rep SharedSecret = D1 (MetaData "SharedSecret" "RBPCP.Types" "rbpcp-api-0.2.0.0-HjG8OZksaPrKuqAft2d0fv" True) (C1 (MetaCons "SharedSecret" PrefixI True) (S1 (MetaSel (Just Symbol "ssHash") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Hash256)))

class HasSharedSecret a where Source #

Minimal complete definition

getSecret

Instances

HasSharedSecret ClientPayChan Source # 

Methods

getSecret :: ClientPayChan -> SharedSecret Source #

HasSharedSecret (PayChanState a) Source # 

Methods

getSecret :: PayChanState a -> SharedSecret Source #

HasSharedSecret (ServerPayChanG sd s) Source # 

fundingAddress :: HasPayChanState a => a -> Address Source #

clientChangeAddress :: HasPayChanState a => a -> Address Source #

getFundingAmount :: HasPayChanState a => a -> BtcAmount Source #

Sender

data ClientPayChanI sigData Source #

State object for the value sender

Constructors

MkClientPayChan 

Fields

Instances

Show ClientPayChan Source # 

Methods

showsPrec :: Int -> ClientPayChan -> ShowS #

show :: ClientPayChan -> String #

showList :: [ClientPayChan] -> ShowS #

HasSigData ClientPayChanI Source # 

Methods

mapSigData :: (a -> b) -> ClientPayChanI a -> ClientPayChanI b

SetClientChangeAddr ClientPayChanI Source # 
HasSharedSecret ClientPayChan Source # 

Methods

getSecret :: ClientPayChan -> SharedSecret Source #

PaymentChannel ClientPayChan Source # 

Methods

valueToMe :: ClientPayChan -> BtcAmount Source #

channelValueLeft :: ClientPayChan -> BtcAmount Source #

getStatePayment :: ClientPayChan -> SignedPayment Source #

Eq sigData => Eq (ClientPayChanI sigData) Source # 

Methods

(==) :: ClientPayChanI sigData -> ClientPayChanI sigData -> Bool #

(/=) :: ClientPayChanI sigData -> ClientPayChanI sigData -> Bool #

Generic (ClientPayChanI sigData) Source # 

Associated Types

type Rep (ClientPayChanI sigData) :: * -> * #

Methods

from :: ClientPayChanI sigData -> Rep (ClientPayChanI sigData) x #

to :: Rep (ClientPayChanI sigData) x -> ClientPayChanI sigData #

NFData sigData => NFData (ClientPayChanI sigData) Source # 

Methods

rnf :: ClientPayChanI sigData -> () #

HasRecvPubKey (ClientPayChanI a) Source # 
HasSendPubKey (ClientPayChanI a) Source # 
type Rep (ClientPayChanI sigData) Source # 
type Rep (ClientPayChanI sigData) = D1 (MetaData "ClientPayChanI" "PaymentChannel.Internal.Types" "bitcoin-payment-channel-1.2.0.0-7YwDEKAOCp2BNoMt0JxEOM" False) (C1 (MetaCons "MkClientPayChan" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "spcState") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (PayChanState sigData))) (S1 (MetaSel (Just Symbol "spcPrvKey") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PrvKeyC))))

Receiver

type ServerPayChan = ServerPayChanI () Source #

ServerPayChan without receiver key metadata

data ServerPayChanG kd sd Source #

State object for the value receiver. "kd" is used to store information about the receiver key(s) used for this state object.

Instances

ToJSON d => ToJSON (ServerPayChanI d) Source # 

Methods

toJSON :: ServerPayChanI d -> Value #

toEncoding :: ServerPayChanI d -> Encoding #

toJSONList :: [ServerPayChanI d] -> Value #

toEncodingList :: [ServerPayChanI d] -> Encoding #

FromJSON d => FromJSON (ServerPayChanI d) Source # 

Methods

parseJSON :: Value -> Parser (ServerPayChanI d) #

parseJSONList :: Value -> Parser [ServerPayChanI d] #

HasSigData (ServerPayChanG kd) Source # 

Methods

mapSigData :: (a -> b) -> ServerPayChanG kd a -> ServerPayChanG kd b

SetClientChangeAddr (ServerPayChanG kd) Source # 
PaymentChannelRecv (ServerPayChanI (MetadataI a)) Source # 

Methods

clientTotalValueSent :: ServerPayChanI (MetadataI a) -> BtcAmount Source #

PaymentChannel (ServerPayChanI s) Source # 

Methods

valueToMe :: ServerPayChanI s -> BtcAmount Source #

channelValueLeft :: ServerPayChanI s -> BtcAmount Source #

getStatePayment :: ServerPayChanI s -> SignedPayment Source #

(Eq kd, Eq sd) => Eq (ServerPayChanG kd sd) Source # 

Methods

(==) :: ServerPayChanG kd sd -> ServerPayChanG kd sd -> Bool #

(/=) :: ServerPayChanG kd sd -> ServerPayChanG kd sd -> Bool #

(Show kd, Show sd) => Show (ServerPayChanG kd sd) Source # 

Methods

showsPrec :: Int -> ServerPayChanG kd sd -> ShowS #

show :: ServerPayChanG kd sd -> String #

showList :: [ServerPayChanG kd sd] -> ShowS #

Generic (ServerPayChanG kd sd) Source # 

Associated Types

type Rep (ServerPayChanG kd sd) :: * -> * #

Methods

from :: ServerPayChanG kd sd -> Rep (ServerPayChanG kd sd) x #

to :: Rep (ServerPayChanG kd sd) x -> ServerPayChanG kd sd #

(Serialize kd, Serialize sd) => Serialize (ServerPayChanG kd sd) Source # 

Methods

put :: Putter (ServerPayChanG kd sd) #

get :: Get (ServerPayChanG kd sd) #

(NFData kd, NFData sd) => NFData (ServerPayChanG kd sd) Source # 

Methods

rnf :: ServerPayChanG kd sd -> () #

HasLockTimeDate (ServerPayChanG kd sd) Source # 

Methods

getLockTimeDate :: ServerPayChanG kd sd -> LockTimeDate

HasRecvPubKey (ServerPayChanG kd sd) Source # 
HasSendPubKey (ServerPayChanG kd sd) Source # 
HasSharedSecret (ServerPayChanG sd s) Source # 
type Rep (ServerPayChanG kd sd) Source # 
type Rep (ServerPayChanG kd sd) = D1 (MetaData "ServerPayChanG" "PaymentChannel.Internal.Receiver.Types" "bitcoin-payment-channel-1.2.0.0-7YwDEKAOCp2BNoMt0JxEOM" False) (C1 (MetaCons "MkServerPayChan" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "rpcState") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (PayChanState sd))) (S1 (MetaSel (Just Symbol "rpcMetadata") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (MetadataI kd)))))

data PayChanStatus Source #

data MetadataI kd Source #

Constructors

Metadata 

Fields

Instances

Eq kd => Eq (MetadataI kd) Source # 

Methods

(==) :: MetadataI kd -> MetadataI kd -> Bool #

(/=) :: MetadataI kd -> MetadataI kd -> Bool #

Show kd => Show (MetadataI kd) Source # 

Methods

showsPrec :: Int -> MetadataI kd -> ShowS #

show :: MetadataI kd -> String #

showList :: [MetadataI kd] -> ShowS #

Generic (MetadataI kd) Source # 

Associated Types

type Rep (MetadataI kd) :: * -> * #

Methods

from :: MetadataI kd -> Rep (MetadataI kd) x #

to :: Rep (MetadataI kd) x -> MetadataI kd #

ToJSON a => ToJSON (MetadataI a) Source # 
FromJSON a => FromJSON (MetadataI a) Source # 
Serialize a => Serialize (MetadataI a) Source # 

Methods

put :: Putter (MetadataI a) #

get :: Get (MetadataI a) #

NFData kd => NFData (MetadataI kd) Source # 

Methods

rnf :: MetadataI kd -> () #

PaymentChannelRecv (ServerPayChanI (MetadataI a)) Source # 

Methods

clientTotalValueSent :: ServerPayChanI (MetadataI a) -> BtcAmount Source #

type Rep (MetadataI kd) Source # 
type Rep (MetadataI kd)

data OpenError Source #

Instances

Eq OpenError Source # 
Show OpenError Source # 
Generic OpenError Source # 

Associated Types

type Rep OpenError :: * -> * #

ToJSON OpenError Source # 
FromJSON OpenError Source # 
Serialize OpenError Source # 
NFData OpenError Source # 

Methods

rnf :: OpenError -> () #

IsPayChanError OpenError Source # 
type Rep OpenError Source # 

data ServerSettings Source #

Various server-defined settings

Constructors

ServerSettings 

Fields

Instances

Eq ServerSettings Source # 
Show ServerSettings Source # 
Generic ServerSettings Source # 

Associated Types

type Rep ServerSettings :: * -> * #

ToJSON ServerSettings Source # 
FromJSON ServerSettings Source # 
Serialize ServerSettings Source # 
NFData ServerSettings Source # 

Methods

rnf :: ServerSettings -> () #

MonadReader ServerSettings MonadConf # 

Methods

ask :: MonadConf ServerSettings #

local :: (ServerSettings -> ServerSettings) -> MonadConf a -> MonadConf a #

reader :: (ServerSettings -> a) -> MonadConf a #

type Rep ServerSettings Source # 
type Rep ServerSettings = D1 (MetaData "ServerSettings" "PaymentChannel.Internal.Config" "bitcoin-payment-channel-1.2.0.0-7YwDEKAOCp2BNoMt0JxEOM" False) (C1 (MetaCons "ServerSettings" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "serverConfDustLimit") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 BtcAmount)) (S1 (MetaSel (Just Symbol "serverConfSettlePeriod") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Hour))) ((:*:) (S1 (MetaSel (Just Symbol "serverConfMinDuration") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Hour)) (S1 (MetaSel (Just Symbol "serverConfOpenPrice") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 BtcAmount)))))

newtype Hour Source #

Constructors

MkHour 

Fields

Instances

Enum Hour Source # 

Methods

succ :: Hour -> Hour #

pred :: Hour -> Hour #

toEnum :: Int -> Hour #

fromEnum :: Hour -> Int #

enumFrom :: Hour -> [Hour] #

enumFromThen :: Hour -> Hour -> [Hour] #

enumFromTo :: Hour -> Hour -> [Hour] #

enumFromThenTo :: Hour -> Hour -> Hour -> [Hour] #

Eq Hour Source # 

Methods

(==) :: Hour -> Hour -> Bool #

(/=) :: Hour -> Hour -> Bool #

Integral Hour Source # 

Methods

quot :: Hour -> Hour -> Hour #

rem :: Hour -> Hour -> Hour #

div :: Hour -> Hour -> Hour #

mod :: Hour -> Hour -> Hour #

quotRem :: Hour -> Hour -> (Hour, Hour) #

divMod :: Hour -> Hour -> (Hour, Hour) #

toInteger :: Hour -> Integer #

Num Hour Source # 

Methods

(+) :: Hour -> Hour -> Hour #

(-) :: Hour -> Hour -> Hour #

(*) :: Hour -> Hour -> Hour #

negate :: Hour -> Hour #

abs :: Hour -> Hour #

signum :: Hour -> Hour #

fromInteger :: Integer -> Hour #

Ord Hour Source # 

Methods

compare :: Hour -> Hour -> Ordering #

(<) :: Hour -> Hour -> Bool #

(<=) :: Hour -> Hour -> Bool #

(>) :: Hour -> Hour -> Bool #

(>=) :: Hour -> Hour -> Bool #

max :: Hour -> Hour -> Hour #

min :: Hour -> Hour -> Hour #

Real Hour Source # 

Methods

toRational :: Hour -> Rational #

Show Hour Source # 

Methods

showsPrec :: Int -> Hour -> ShowS #

show :: Hour -> String #

showList :: [Hour] -> ShowS #

Generic Hour Source # 

Associated Types

type Rep Hour :: * -> * #

Methods

from :: Hour -> Rep Hour x #

to :: Rep Hour x -> Hour #

ToJSON Hour Source # 
FromJSON Hour Source # 
Serialize Hour Source # 

Methods

put :: Putter Hour #

get :: Get Hour #

NFData Hour Source # 

Methods

rnf :: Hour -> () #

type Rep Hour Source # 
type Rep Hour = D1 (MetaData "Hour" "PaymentChannel.Internal.Types.Hour" "bitcoin-payment-channel-1.2.0.0-7YwDEKAOCp2BNoMt0JxEOM" True) (C1 (MetaCons "MkHour" PrefixI True) (S1 (MetaSel (Just Symbol "numHours") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word32)))

Receiver state (with pubkey metadata)

type ServerPayChanX = ServerPayChanI ExtPub Source #

ServerPayChan with BIP32, "extended key" index as metadata

mkExtendedDerivRpc :: RootPub -> ServerPayChanI kd -> Maybe ServerPayChanX Source #

Add an ExtPub to a ServerPayChan that has been created with a server pubkey derived using deriveRecvPub

data UserParams Source #

Constructors

UserParams 

Fields

deriveRecvPub :: HasUserParams up => RootPub -> up -> (ChanParams, External ChildPub) Source #

Deterministically derive a server public key from client pubkey+expiration date

Payment

type SignedPayment = Payment BtcSig Source #

Receiver settlement

data ClosedServerChanI kd Source #

Instances

Eq kd => Eq (ClosedServerChanI kd) Source # 
Show kd => Show (ClosedServerChanI kd) Source # 
Generic (ClosedServerChanI kd) Source # 

Associated Types

type Rep (ClosedServerChanI kd) :: * -> * #

Serialize kd => Serialize (ClosedServerChanI kd) Source # 
NFData kd => NFData (ClosedServerChanI kd) Source # 

Methods

rnf :: ClosedServerChanI kd -> () #

type Rep (ClosedServerChanI kd) Source # 
type Rep (ClosedServerChanI kd) = D1 (MetaData "ClosedServerChanI" "PaymentChannel.Internal.Receiver.Types" "bitcoin-payment-channel-1.2.0.0-7YwDEKAOCp2BNoMt0JxEOM" False) (C1 (MetaCons "MkClosedServerChan" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "cscState") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ServerPayChanG kd BtcSig))) (S1 (MetaSel (Just Symbol "cscClosingPayment") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SignedPayment))))

getClosedState :: ClosedServerChanI kd -> ServerPayChanI kd Source #

type SettleTx = BtcTx P2SH ChanParams PaymentScriptSig Source #

Error

data PayChanError Source #

Constructors

SigVerifyFailed

Signature verification failed

LockTimeParseError LockTimeParseError 
BadSigHashFlag SigHash SigHash

Unexpected SigHash flag. Expected: SIGHASH_SINGLE|ANYONECANPAY.

BadPaymentValue BtcAmount

Payment assigns less value to server than previous payment. Client change value is greater by the specified BtcAmount.

PaymentError (TxMismatch ChanParams) 
ChannelExpired

Channel has expired or is too close to expiration date

StatusError HTTPError

Channel not ready for payment. 409=try again; 410=channel gone.

RBPCPError ParseError

Failed to parse RBPCP payment

OpenError OpenError

Channel-open error

class IsPayChanError e where Source #

Minimal complete definition

mkChanErr

Bitcoin

class HasFee a where Source #

Objects from which a Bitcoin fee can be calculated, given a transaction

Minimal complete definition

absoluteFee

Methods

absoluteFee :: BtcAmount -> TxByteSize -> a -> BtcAmount Source #

Instances

HasFee BtcAmount Source #

Constant fee

Methods

absoluteFee :: BtcAmount -> TxByteSize -> BtcAmount -> BtcAmount Source #

HasFee SatoshisPerByte Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> SatoshisPerByte -> BtcAmount Source #

HasFee Constant Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> Constant -> BtcAmount Source #

HasFee fee => HasFee (Capped fee) Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> Capped fee -> BtcAmount Source #

(HasFee a, HasFee b) => HasFee (MaxFee a b) Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> MaxFee a b -> BtcAmount Source #

newtype Constant Source #

Constructors

Constant BtcAmount 

Instances

Eq Constant Source # 
Generic Constant Source # 

Associated Types

type Rep Constant :: * -> * #

Methods

from :: Constant -> Rep Constant x #

to :: Rep Constant x -> Constant #

NFData Constant Source # 

Methods

rnf :: Constant -> () #

HasFee Constant Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> Constant -> BtcAmount Source #

type Rep Constant Source # 
type Rep Constant = D1 (MetaData "Constant" "Bitcoin.Fee" "bitcoin-payment-channel-1.2.0.0-7YwDEKAOCp2BNoMt0JxEOM" True) (C1 (MetaCons "Constant" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 BtcAmount)))

newtype SatoshisPerByte Source #

Specify a fee as satoshis per byte

Constructors

SatoshisPerByte BtcAmount

Fee in satoshis per byte

Instances

Enum SatoshisPerByte Source # 
Eq SatoshisPerByte Source # 
Integral SatoshisPerByte Source # 
Num SatoshisPerByte Source # 
Ord SatoshisPerByte Source # 
Real SatoshisPerByte Source # 
Show SatoshisPerByte Source # 
ToJSON SatoshisPerByte Source # 
FromJSON SatoshisPerByte Source # 
Serialize SatoshisPerByte Source # 
NFData SatoshisPerByte Source # 

Methods

rnf :: SatoshisPerByte -> () #

HasFee SatoshisPerByte Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> SatoshisPerByte -> BtcAmount Source #

ToChangeOutFee SatoshisPerByte Source # 

Methods

mkChangeFee :: SatoshisPerByte -> TxFee Source #

newtype MaxFee a b Source #

A maximum fee of two fees. Whichever fee results in the largest absolute fee is chosen.

Constructors

MaxFee (a, b) 

Instances

(Eq b, Eq a) => Eq (MaxFee a b) Source # 

Methods

(==) :: MaxFee a b -> MaxFee a b -> Bool #

(/=) :: MaxFee a b -> MaxFee a b -> Bool #

(Ord b, Ord a) => Ord (MaxFee a b) Source # 

Methods

compare :: MaxFee a b -> MaxFee a b -> Ordering #

(<) :: MaxFee a b -> MaxFee a b -> Bool #

(<=) :: MaxFee a b -> MaxFee a b -> Bool #

(>) :: MaxFee a b -> MaxFee a b -> Bool #

(>=) :: MaxFee a b -> MaxFee a b -> Bool #

max :: MaxFee a b -> MaxFee a b -> MaxFee a b #

min :: MaxFee a b -> MaxFee a b -> MaxFee a b #

(Show b, Show a) => Show (MaxFee a b) Source # 

Methods

showsPrec :: Int -> MaxFee a b -> ShowS #

show :: MaxFee a b -> String #

showList :: [MaxFee a b] -> ShowS #

(ToJSON b, ToJSON a) => ToJSON (MaxFee a b) Source # 

Methods

toJSON :: MaxFee a b -> Value #

toEncoding :: MaxFee a b -> Encoding #

toJSONList :: [MaxFee a b] -> Value #

toEncodingList :: [MaxFee a b] -> Encoding #

(FromJSON b, FromJSON a) => FromJSON (MaxFee a b) Source # 

Methods

parseJSON :: Value -> Parser (MaxFee a b) #

parseJSONList :: Value -> Parser [MaxFee a b] #

(Serialize b, Serialize a) => Serialize (MaxFee a b) Source # 

Methods

put :: Putter (MaxFee a b) #

get :: Get (MaxFee a b) #

(NFData b, NFData a) => NFData (MaxFee a b) Source # 

Methods

rnf :: MaxFee a b -> () #

(HasFee a, HasFee b) => HasFee (MaxFee a b) Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> MaxFee a b -> BtcAmount Source #

newtype Capped val Source #

At most the specified fee. Will not fail if the specified amount is more than is available.

Constructors

Capped val 

Instances

HasFee fee => HasFee (Capped fee) Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> Capped fee -> BtcAmount Source #

PaymentValueSpec (Capped BtcAmount) Source # 

Methods

paymentValue :: BtcAmount -> ServerSettings -> Capped BtcAmount -> BtcAmount Source #

class PaymentValueSpec val where Source #

Capped/non-capped amount-specifications (get value)

Minimal complete definition

paymentValue

Methods

paymentValue :: BtcAmount -> ServerSettings -> val -> BtcAmount Source #

Instances

PaymentValueSpec BtcAmount Source # 

Methods

paymentValue :: BtcAmount -> ServerSettings -> BtcAmount -> BtcAmount Source #

PaymentValueSpec (Capped BtcAmount) Source # 

Methods

paymentValue :: BtcAmount -> ServerSettings -> Capped BtcAmount -> BtcAmount Source #

newtype Capped val Source #

At most the specified fee. Will not fail if the specified amount is more than is available.

Constructors

Capped val 

Instances

HasFee fee => HasFee (Capped fee) Source # 

Methods

absoluteFee :: BtcAmount -> TxByteSize -> Capped fee -> BtcAmount Source #

PaymentValueSpec (Capped BtcAmount) Source # 

Methods

paymentValue :: BtcAmount -> ServerSettings -> Capped BtcAmount -> BtcAmount Source #

Crypto

newtype SendPubKey Source #

Wrapper for value sender's public key

Constructors

MkSendPubKey 

Fields

newtype RecvPubKey Source #

Wrapper for value receiver's public key

Constructors

MkRecvPubKey 

class Serialize a => IsPubKey a where Source #

Types which contain a pubkey

Minimal complete definition

getPubKey

Methods

getPubKey :: a -> PubKeyC Source #

class HasSendPubKey a where Source #

Types which contain a SendPubKey

Minimal complete definition

getSendPubKey

Util

fromDate :: UTCTime -> Maybe LockTimeDate Source #

Convert a UTCTime to a LockTimeDate. Returns Nothing if the date is later than 2106-02-07 (or earlier than 1985-11-05).

getChanState :: HasSignedPayChanState a => a -> PayChanState BtcSig Source #

clientChangeVal :: SigSinglePair t r a -> BtcAmount Source #

toHaskoinTx :: SignatureScript r ss t => BtcTx t r ss -> Tx Source #