buildAddrTx :: [OutPoint] -> [(ByteString, Word64)] -> Either String Tx
buildAddrTx xs ys =
    buildTx xs =<< mapM f ys
  where
    f (s, v) = case base58ToAddr s of
        Just a@(PubKeyAddress _) -> return (PayPKHash a,v)
        Just a@(ScriptAddress _) -> return (PayScriptHash a,v)
        _ -> Left $ "buildAddrTx: Invalid address " ++ cs s

-- | Build a transaction by providing a list of outpoints as inputs
-- and a list of 'ScriptOutput' and amounts as outputs.
buildAddrTx :: [OutPoint] -> [(ByteString, Word64)] -> Either String Tx
buildAddrTx xs ys =
    buildTx xs =<< mapM f ys
  where
    f (s, v) = case base58ToAddr s of
        Just a@(PubKeyAddress _) -> return (PayPKHash a,v)
        Just a@(ScriptAddress _) -> return (PayScriptHash a,v)
        _ -> Left $ "buildAddrTx: Invalid address " ++ cs s

-- | Build a transaction by providing a list of outpoints as inputs
-- and a list of 'ScriptOutput' and amounts as outputs.
buildAddrTx xs ys =
    buildTx xs =<< mapM f ys
  where
    f (s, v) = case base58ToAddr s of
        Just a@(PubKeyAddress _) -> return (PayPKHash a,v)
        Just a@(ScriptAddress _) -> return (PayScriptHash a,v)
        _ -> Left $ "buildAddrTx: Invalid address " ++ cs s

-- | Build a transaction by providing a list of outpoints as inputs
-- and a list of 'ScriptOutput' and amounts as outputs.