Copyright | (c) Rune K. Svendsen, 2016 |
---|---|
License | PublicDomain |
Maintainer | runesvend@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Types used with the interface provided by Data.Bitcoin.PaymentChannel.
- class PaymentChannel a where
- data SenderPaymentChannel = CSenderPaymentChannel {
- spcState :: PaymentChannelState
- spcSignFunc :: Hash256 -> Signature
- newtype ReceiverPaymentChannel = CReceiverPaymentChannel {}
- data Payment
- data FundingTxInfo = CFundingTxInfo {
- ftiHash :: TxHash
- ftiOutIndex :: Word32
- ftiOutValue :: BitcoinAmount
- data ChannelParameters = CChannelParameters {}
- data PayChanError
- data PaymentChannelState
- newtype SendPubKey = MkSendPubKey {
- getSenderPK :: PubKey
- newtype RecvPubKey = MkRecvPubKey {
- getReceiverPK :: PubKey
- class IsPubKey a where
- data BitcoinAmount
- data BitcoinLockTime
- fromDate :: UTCTime -> BitcoinLockTime
- usesBlockHeight :: BitcoinLockTime -> Bool
- b64Encode :: Binary a => a -> ByteString
- dUST_LIMIT :: BitcoinAmount
- mIN_CHANNEL_SIZE :: BitcoinAmount
Documentation
class PaymentChannel a where Source #
Get various information about an open payment channel.
valueToMe :: a -> BitcoinAmount Source #
Get value sent to receiver/left for sender
getChannelState :: a -> PaymentChannelState Source #
Retrieve internal state object
getChannelID :: a -> OutPoint Source #
getExpirationDate :: a -> BitcoinLockTime Source #
getNewestPayment :: a -> Payment Source #
expiresBefore :: BitcoinLockTime -> a -> Bool Source #
Return True if channel expires earlier than given expiration date
_setChannelState :: a -> PaymentChannelState -> a Source #
For internal use
channelValueLeft :: a -> BitcoinAmount Source #
channelIsExhausted :: a -> Bool Source #
data SenderPaymentChannel Source #
State object for the value sender
CSenderPaymentChannel | |
|
newtype ReceiverPaymentChannel Source #
State object for the value receiver
CReceiverPaymentChannel | |
|
data FundingTxInfo Source #
Holds information about the Bitcoin transaction used to fund the channel
CFundingTxInfo | |
|
data ChannelParameters Source #
Defines channel: sender, receiver, and expiration date
CChannelParameters | |
|
data PayChanError Source #
data PaymentChannelState Source #
Shared state object used by both value sender and value receiver.
newtype SendPubKey Source #
MkSendPubKey | |
|
newtype RecvPubKey Source #
MkRecvPubKey | |
|
data BitcoinAmount Source #
Represents a bitcoin amount as number of satoshis.
1 satoshi = 1e-8 bitcoin.
Only natural numbers (>= 0) can be represented (fromInteger
caps to a Word64
).
It is thus not possible to construct a negative BitcoinAmount which, when added to
another BitcoinAmount, subtracts from its value. So we avoid the problem of being
able to invert subtraction/addition by supplying a negative value as one of the
arguments.
data BitcoinLockTime Source #
Data type representing a Bitcoin LockTime, which specifies a point in time.
Derive a BitcoinLockTime
from a UTCTime
using fromDate
.
LockTimeBlockHeight Word32 | A value of "n" represents the point in time at which Bitcoin block number "n" appears |
LockTimeDate UTCTime | Specifies a point in time using a timestamp with 1-second accuraccy |
fromDate :: UTCTime -> BitcoinLockTime Source #
Convert a UTCTime
to a BitcoinLockTime
b64Encode :: Binary a => a -> ByteString Source #