module Data.Bitcoin.PaymentChannel.Util
(
getFundingAddress,
setSenderChangeAddress,
serialize, serialize',
BitcoinLockTime, parseBitcoinLocktime, toWord32, fromDate, deserEither,
parseJSONInt,
unsafeUpdateRecvState
)
where
import Data.Bitcoin.PaymentChannel.Internal.Types
(PaymentChannelState(..), PaymentTxConfig(..),
Payment(..))
import Data.Bitcoin.PaymentChannel.Internal.Script
(getP2SHFundingAddress)
import Data.Bitcoin.PaymentChannel.Internal.Util
(BitcoinLockTime, parseBitcoinLocktime, toWord32, fromDate, deserEither,
serialize, serialize')
import Data.Bitcoin.PaymentChannel.Internal.State
(setClientChangeAddress)
import Data.Bitcoin.PaymentChannel.Internal.Serialization
(parseJSONInt)
import Data.Bitcoin.PaymentChannel.Types
import qualified Network.Haskoin.Crypto as HC
getFundingAddress = getP2SHFundingAddress
setSenderChangeAddress :: PaymentChannel a => a -> HC.Address -> a
setSenderChangeAddress pch addr =
_setChannelState pch (setClientChangeAddress (getChannelState pch) addr)
unsafeUpdateRecvState :: ReceiverPaymentChannel -> Payment -> ReceiverPaymentChannel
unsafeUpdateRecvState (CReceiverPaymentChannel s) (CPayment val sig) =
CReceiverPaymentChannel $ s { pcsValueLeft = val, pcsPaymentSignature = Just sig}