| Copyright | (c) Rune K. Svendsen, 2016 |
|---|---|
| License | PublicDomain |
| Maintainer | runesvend@gmail.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Bitcoin.PaymentChannel.Types
Description
Types used with the interface provided by Data.Bitcoin.PaymentChannel.
- class PaymentChannel a where
- data SenderPaymentChannel = CSenderPaymentChannel {}
- newtype ReceiverPaymentChannel = CReceiverPaymentChannel {}
- data Payment
- data FundingTxInfo = CFundingTxInfo {}
- data ChannelParameters = CChannelParameters {}
- data PayChanError
- data PaymentChannelState
- data BitcoinAmount
- toWord64 :: BitcoinAmount -> Word64
- data BitcoinLockTime
- fromDate :: UTCTime -> BitcoinLockTime
- 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.
Minimal complete definition
Methods
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 #
_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
Constructors
| CSenderPaymentChannel | |
Fields
| |
newtype ReceiverPaymentChannel Source #
State object for the value receiver
Constructors
| CReceiverPaymentChannel | |
Fields
| |
data FundingTxInfo Source #
Holds information about the Bitcoin transaction used to fund the channel
Constructors
| CFundingTxInfo | |
Fields
| |
Instances
data ChannelParameters Source #
Defines sender, receiver, and expiration date of the channel
Constructors
| CChannelParameters | |
Fields
| |
Instances
data PayChanError Source #
Instances
data PaymentChannelState Source #
Shared state object used by both value sender and value receiver.
Instances
data BitcoinAmount Source #
Represents a bitcoin amount as number of satoshis.
1 satoshi = 1e-8 bitcoins.
Integer operations will never over- or underflow with this type.
Convert to a Word64 using toWord64, which caps the final amount.
toWord64 :: BitcoinAmount -> Word64 Source #
Convert to Word64, with zero as floor, UINT64_MAX as ceiling
data BitcoinLockTime Source #
Data type representing a Bitcoin LockTime, which specifies a point in time.
Derive a BitcoinLockTime from a UTCTime using fromDate.
Constructors
| LockTimeBlockHeight Word32 | |
| LockTimeDate UTCTime |
Instances
fromDate :: UTCTime -> BitcoinLockTime Source #
Convert a UTCTime to a BitcoinLockTime
b64Encode :: Binary a => a -> ByteString Source #