Compare commits
No commits in common. "b6b586f9bfe82abc1f5e8b37116a378eaa6a6c1d" and "0d5161cdb284d9a12593c57e7e4764d9575d363d" have entirely different histories.
b6b586f9bf
...
0d5161cdb2
8 changed files with 65 additions and 313 deletions
22
CHANGELOG.md
22
CHANGELOG.md
|
@ -10,17 +10,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Added
|
||||
|
||||
- RPC module
|
||||
- OpenRPC specification
|
||||
- `listwallets` RPC method
|
||||
- `listaccounts` RPC method
|
||||
- `listaddresses` RPC method
|
||||
- `listreceived` RPC method
|
||||
- `getbalance` RPC method
|
||||
- `getnewwallet` RPC method
|
||||
- `getnewaccount` RPC method
|
||||
- `getnewaddress` RPC method
|
||||
- `getoperationstatus` RPC method
|
||||
- Function `prepareTxV2` implementing `PrivacyPolicy`
|
||||
- OpenRPC specification
|
||||
- `listwallets` RPC method
|
||||
- `listaccounts` RPC method
|
||||
- `listaddresses` RPC method
|
||||
- `listreceived` RPC method
|
||||
- `getbalance` RPC method
|
||||
- `getnewwallet` RPC method
|
||||
- `getnewaccount` RPC method
|
||||
- `getnewaddress` RPC method
|
||||
- `getoperationstatus` RPC method
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -28,7 +27,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Block tracking for chain re-org detection
|
||||
- Refactored `ZcashPool`
|
||||
|
||||
|
||||
## [0.6.0.0-beta]
|
||||
|
||||
### Added
|
||||
|
|
|
@ -10,7 +10,7 @@ import qualified Brick.BChan as BC
|
|||
import qualified Brick.Focus as F
|
||||
import Brick.Forms
|
||||
( Form(..)
|
||||
, (@@=)
|
||||
, radioField
|
||||
, allFieldsValid
|
||||
, editShowableFieldWithValidate
|
||||
, editTextField
|
||||
|
@ -18,10 +18,10 @@ import Brick.Forms
|
|||
, handleFormEvent
|
||||
, invalidFormInputAttr
|
||||
, newForm
|
||||
, radioField
|
||||
, renderForm
|
||||
, setFieldValid
|
||||
, updateFormState
|
||||
, (@@=)
|
||||
)
|
||||
import qualified Brick.Main as M
|
||||
import qualified Brick.Types as BT
|
||||
|
@ -99,9 +99,9 @@ import Zenith.Types
|
|||
( Config(..)
|
||||
, HexStringDB(..)
|
||||
, PhraseDB(..)
|
||||
, PrivacyPolicy(..)
|
||||
, UnifiedAddressDB(..)
|
||||
, ZcashNetDB(..)
|
||||
, PrivacyPolicy(..)
|
||||
)
|
||||
import Zenith.Utils
|
||||
( displayTaz
|
||||
|
@ -184,8 +184,7 @@ data Tick
|
|||
| TickMsg !String
|
||||
| TickTx !HexString
|
||||
|
||||
data DropDownItem =
|
||||
DropdownItem String
|
||||
data DropDownItem = DropdownItem String
|
||||
|
||||
data State = State
|
||||
{ _network :: !ZcashNet
|
||||
|
@ -620,9 +619,7 @@ mkSendForm :: Integer -> SendInput -> Form SendInput e Name
|
|||
mkSendForm bal =
|
||||
newForm
|
||||
[ label "Privacy Level :" @@=
|
||||
radioField
|
||||
policyField
|
||||
[ (Full, PrivacyFullField, "Full")
|
||||
radioField policyField [ (Full, PrivacyFullField, "Full")
|
||||
, (Medium, PrivacyMediumField, "Medium")
|
||||
, (Low, PrivacyLowField, "Low")
|
||||
, (None, PrivacyNoneField, "None")
|
||||
|
@ -755,11 +752,7 @@ scanZebra dbP zHost zPort b eChan znet = do
|
|||
logDebugN $
|
||||
"dbBlock: " <>
|
||||
T.pack (show dbBlock) <> " chkBlock: " <> T.pack (show chkBlock)
|
||||
when (chkBlock /= dbBlock) $ liftIO $ rewindWalletData pool chkBlock
|
||||
let sb =
|
||||
if chkBlock == dbBlock
|
||||
then max dbBlock b
|
||||
else max chkBlock b
|
||||
let sb = max dbBlock b
|
||||
if sb > zgb_blocks bStatus || sb < 1
|
||||
then do
|
||||
liftIO $ BC.writeBChan eChan $ TickMsg "Invalid starting block for scan"
|
||||
|
@ -1406,7 +1399,6 @@ runZenithTUI config = do
|
|||
Left e1 -> throwIO e1
|
||||
Right chainInfo -> do
|
||||
x <- initDb dbFilePath
|
||||
_ <- upgradeQrTable pool
|
||||
case x of
|
||||
Left e2 -> throwIO $ userError e2
|
||||
Right x' -> do
|
||||
|
|
|
@ -44,7 +44,6 @@ import ZcashHaskell.Orchard
|
|||
, encodeUnifiedAddress
|
||||
, genOrchardReceiver
|
||||
, genOrchardSpendingKey
|
||||
, getOrchardFrontier
|
||||
, getOrchardNotePosition
|
||||
, getOrchardWitness
|
||||
, isValidUnifiedAddress
|
||||
|
@ -373,16 +372,13 @@ findOrchardActions config b znet za = do
|
|||
pool <- runNoLoggingT $ initPool dbPath
|
||||
tList <- getOrchardActions pool b znet
|
||||
trees <- getCommitmentTrees zebraHost zebraPort (b - 1)
|
||||
let sT = getOrchardFrontier $ OrchardCommitmentTree $ ztiOrchard trees
|
||||
case sT of
|
||||
Nothing -> throwIO $ userError "Failed to read Orchard commitment tree"
|
||||
Just sT' -> do
|
||||
decryptNotes sT' zn pool tList
|
||||
let sT = OrchardCommitmentTree $ ztiOrchard trees
|
||||
decryptNotes sT zn pool tList
|
||||
orchNotes <- getWalletOrchNotes pool (entityKey za)
|
||||
findOrchSpends pool (entityKey za) orchNotes
|
||||
where
|
||||
decryptNotes ::
|
||||
OrchardFrontier
|
||||
OrchardCommitmentTree
|
||||
-> ZcashNet
|
||||
-> ConnectionPool
|
||||
-> [(Entity ZcashTransaction, Entity OrchAction)]
|
||||
|
@ -905,7 +901,7 @@ prepareTxV2 pool zebraHost zebraPort zn za bh amt va memo policy = do
|
|||
None ->
|
||||
return $
|
||||
Left $
|
||||
PrivacyPolicyError "Receiver not compatible with privacy policy"
|
||||
PrivacyPolicyError "Recipient not allowed by privacy policy"
|
||||
_anyOther -> do
|
||||
let chgRcvr =
|
||||
fromJust $
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
module Zenith.DB where
|
||||
|
||||
import Control.Exception (SomeException(..), throw, throwIO, try)
|
||||
import Control.Monad (unless, when)
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.IO.Class (MonadIO, liftIO)
|
||||
import Control.Monad.Logger (NoLoggingT, runNoLoggingT)
|
||||
import qualified Data.ByteString as BS
|
||||
|
@ -448,10 +448,8 @@ initDb dbName = do
|
|||
(Either SomeException [T.Text])
|
||||
case m of
|
||||
Left e2 -> return $ Left $ "Failed to migrate data tables" ++ show e2
|
||||
Right _ -> do
|
||||
return $ Right True
|
||||
Right _ -> do
|
||||
return $ Right False
|
||||
Right _ -> return $ Right True
|
||||
Right _ -> return $ Right False
|
||||
|
||||
initPool :: T.Text -> NoLoggingT IO ConnectionPool
|
||||
initPool dbPath = do
|
||||
|
@ -841,32 +839,6 @@ getQrCode pool zp wId = do
|
|||
return qrs
|
||||
return $ entityVal <$> r
|
||||
|
||||
upgradeQrTable :: ConnectionPool -> IO ()
|
||||
upgradeQrTable pool = do
|
||||
r <-
|
||||
runNoLoggingT $
|
||||
PS.retryOnBusy $
|
||||
flip PS.runSqlPool pool $
|
||||
selectOne $ do
|
||||
qrs <- from $ table @QrCode
|
||||
where_ $ qrs ^. QrCodeVersion ==. val OrchardPool
|
||||
return countRows
|
||||
unless (maybe 0 (\(Value x) -> x) r > (0 :: Int)) $ do
|
||||
_ <-
|
||||
runNoLoggingT $
|
||||
PS.retryOnBusy $
|
||||
flip PS.runSqlPool pool $ do
|
||||
rawExecute
|
||||
"update qr_code set version = ? where version = ?"
|
||||
[PersistText "OrchardPool", PersistText "Orchard"]
|
||||
rawExecute
|
||||
"update qr_code set version = ? where version = ?"
|
||||
[PersistText "SaplingPool", PersistText "Sapling"]
|
||||
rawExecute
|
||||
"update qr_code set version = ? where version = ?"
|
||||
[PersistText "TransparentPool", PersistText "Transparent"]
|
||||
return ()
|
||||
|
||||
-- * Wallet
|
||||
-- | Get the block of the last transaction known to the wallet
|
||||
getMaxWalletBlock ::
|
||||
|
|
|
@ -32,11 +32,7 @@ import Text.Printf
|
|||
import Text.Wrap (FillScope(..), FillStrategy(..), WrapSettings(..), wrapText)
|
||||
import TextShow hiding (toText)
|
||||
import ZcashHaskell.Keys (generateWalletSeedPhrase)
|
||||
import ZcashHaskell.Orchard
|
||||
( getSaplingFromUA
|
||||
, isValidUnifiedAddress
|
||||
, parseAddress
|
||||
)
|
||||
import ZcashHaskell.Orchard (getSaplingFromUA, isValidUnifiedAddress)
|
||||
import ZcashHaskell.Transparent (encodeTransparentReceiver)
|
||||
import ZcashHaskell.Types
|
||||
( BlockResponse(..)
|
||||
|
@ -55,11 +51,13 @@ import Zenith.Scanner (checkIntegrity, processTx, rescanZebra, updateConfs)
|
|||
import Zenith.Types hiding (ZcashAddress(..))
|
||||
import Zenith.Utils
|
||||
( displayAmount
|
||||
, isRecipientValid
|
||||
, isRecipientValidGUI
|
||||
, isValidString
|
||||
, isZecAddressValid
|
||||
, isValidString
|
||||
, jsonNumber
|
||||
, padWithZero
|
||||
, parseAddressUA
|
||||
, showAddress
|
||||
, validBarValue
|
||||
)
|
||||
|
@ -607,8 +605,8 @@ buildUI wenv model = widgetTree
|
|||
, separatorLine `styleBasic` [fgColor btnColor]
|
||||
, spacer
|
||||
, hstack
|
||||
[ label "Privacy Level:" `styleBasic`
|
||||
[width 70, textFont "Bold"]
|
||||
[
|
||||
label "Privacy Level:" `styleBasic` [width 70, textFont "Bold"]
|
||||
, spacer
|
||||
, label "Full " `styleBasic` [width 40]
|
||||
, radio Full privacyChoice
|
||||
|
@ -617,8 +615,8 @@ buildUI wenv model = widgetTree
|
|||
, radio Medium privacyChoice
|
||||
]
|
||||
, hstack
|
||||
[ label " " `styleBasic`
|
||||
[width 70, textFont "Bold"]
|
||||
[
|
||||
label " " `styleBasic` [width 70, textFont "Bold"]
|
||||
, spacer
|
||||
, label "Low " `styleBasic` [width 40]
|
||||
, radio Low privacyChoice
|
||||
|
@ -638,8 +636,7 @@ buildUI wenv model = widgetTree
|
|||
]
|
||||
]
|
||||
, hstack
|
||||
[ label "Amount:" `styleBasic`
|
||||
[width 50, textFont "Bold"]
|
||||
[ label "Amount:" `styleBasic` [width 50, textFont "Bold"]
|
||||
, spacer
|
||||
, numericField_
|
||||
sendAmount
|
||||
|
@ -657,8 +654,7 @@ buildUI wenv model = widgetTree
|
|||
]
|
||||
]
|
||||
, hstack
|
||||
[ label "Memo:" `styleBasic`
|
||||
[width 50, textFont "Bold"]
|
||||
[ label "Memo:" `styleBasic` [width 50, textFont "Bold"]
|
||||
, spacer
|
||||
, textArea sendMemo `styleBasic`
|
||||
[width 150, height 40]
|
||||
|
@ -1083,11 +1079,7 @@ handleEvent wenv node model evt =
|
|||
]
|
||||
ConfirmCancel -> [Model $ model & confirmTitle .~ Nothing & mainInput .~ ""]
|
||||
ShowSeed -> [Model $ model & showSeed .~ True & menuPopup .~ False]
|
||||
ShowSend ->
|
||||
[ Model $
|
||||
model & openSend .~ True & privacyChoice .~ Full & recipientValid .~
|
||||
False
|
||||
]
|
||||
ShowSend -> [Model $ model & openSend .~ True & privacyChoice .~ Full & recipientValid .~ False]
|
||||
SendTx ->
|
||||
case currentAccount of
|
||||
Nothing -> [Event $ ShowError "No account available", Event CancelSend]
|
||||
|
@ -1105,7 +1097,6 @@ handleEvent wenv node model evt =
|
|||
(model ^. sendAmount)
|
||||
(model ^. sendRecipient)
|
||||
(model ^. sendMemo)
|
||||
(model ^. privacyChoice)
|
||||
, Event CancelSend
|
||||
]
|
||||
CancelSend ->
|
||||
|
@ -1272,10 +1263,9 @@ handleEvent wenv node model evt =
|
|||
T.pack (printf "%.2f%%" (model ^. barValue * 100)))
|
||||
]
|
||||
ResetRecipientValid -> [Model $ model & recipientValid .~ False]
|
||||
CheckRecipient a ->
|
||||
[ Model $
|
||||
model & recipientValid .~ isRecipientValidGUI (model ^. privacyChoice) a
|
||||
]
|
||||
CheckRecipient a -> [Model $
|
||||
model & recipientValid .~ isRecipientValidGUI (model ^.privacyChoice) a ]
|
||||
-- model & recipientValid .~ ((model ^. privacyChoice) == Low) ]
|
||||
CheckAmount i ->
|
||||
[ Model $
|
||||
model & amountValid .~
|
||||
|
@ -1475,7 +1465,6 @@ handleEvent wenv node model evt =
|
|||
res <- liftIO $ updateAdrsInAdrBook pool d a a
|
||||
return $ ShowMessage "Address Book entry updated!!"
|
||||
|
||||
-- model & recipientValid .~ ((model ^. privacyChoice) == Low) ]
|
||||
scanZebra :: T.Text -> T.Text -> Int -> ZcashNet -> (AppEvent -> IO ()) -> IO ()
|
||||
scanZebra dbPath zHost zPort net sendMsg = do
|
||||
bStatus <- liftIO $ checkBlockChain zHost zPort
|
||||
|
@ -1544,21 +1533,20 @@ sendTransaction ::
|
|||
-> Float
|
||||
-> T.Text
|
||||
-> T.Text
|
||||
-> PrivacyPolicy
|
||||
-> (AppEvent -> IO ())
|
||||
-> IO ()
|
||||
sendTransaction config znet accId bl amt ua memo policy sendMsg = do
|
||||
sendTransaction config znet accId bl amt ua memo sendMsg = do
|
||||
sendMsg $ ShowModal "Preparing transaction..."
|
||||
case parseAddress (E.encodeUtf8 ua) of
|
||||
case parseAddressUA ua znet of
|
||||
Nothing -> sendMsg $ ShowError "Incorrect address"
|
||||
Just addr -> do
|
||||
Just outUA -> do
|
||||
let dbPath = c_dbPath config
|
||||
let zHost = c_zebraHost config
|
||||
let zPort = c_zebraPort config
|
||||
pool <- runNoLoggingT $ initPool dbPath
|
||||
res <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2 pool zHost zPort znet accId bl amt addr memo policy
|
||||
prepareTx pool zHost zPort znet accId bl amt outUA memo
|
||||
case res of
|
||||
Left e -> sendMsg $ ShowError $ T.pack $ show e
|
||||
Right rawTx -> do
|
||||
|
@ -1605,7 +1593,6 @@ runZenithGUI config = do
|
|||
Left e1 -> throwIO e1
|
||||
Right chainInfo -> do
|
||||
x <- initDb dbFilePath
|
||||
_ <- upgradeQrTable pool
|
||||
case x of
|
||||
Left e2 -> throwIO $ userError e2
|
||||
Right x' -> do
|
||||
|
|
|
@ -48,7 +48,6 @@ import Zenith.DB
|
|||
, saveConfs
|
||||
, saveTransaction
|
||||
, updateWalletSync
|
||||
, upgradeQrTable
|
||||
)
|
||||
import Zenith.Types (Config(..), HexStringDB(..), ZcashNetDB(..))
|
||||
import Zenith.Utils (jsonNumber)
|
||||
|
@ -70,8 +69,6 @@ rescanZebra host port dbFilePath = do
|
|||
pool1 <- runNoLoggingT $ initPool dbFilePath
|
||||
{-pool2 <- runNoLoggingT $ initPool dbFilePath-}
|
||||
{-pool3 <- runNoLoggingT $ initPool dbFilePath-}
|
||||
_ <- initDb dbFilePath
|
||||
upgradeQrTable pool1
|
||||
clearWalletTransactions pool1
|
||||
clearWalletData pool1
|
||||
dbBlock <- getMaxBlock pool1 znet
|
||||
|
@ -214,7 +211,6 @@ clearSync config = do
|
|||
Left e1 -> throwIO e1
|
||||
Right chainInfo -> do
|
||||
x <- initDb dbPath
|
||||
_ <- upgradeQrTable pool
|
||||
case x of
|
||||
Left e2 -> throwIO $ userError e2
|
||||
Right x' -> do
|
||||
|
|
207
test/Spec.hs
207
test/Spec.hs
|
@ -32,7 +32,6 @@ import ZcashHaskell.Types
|
|||
, SaplingSpendingKey(..)
|
||||
, Scope(..)
|
||||
, ShieldedOutput(..)
|
||||
, TxError(..)
|
||||
, ZcashNet(..)
|
||||
)
|
||||
import Zenith.Core
|
||||
|
@ -236,15 +235,15 @@ main = do
|
|||
Just
|
||||
"ztestsapling1tgjr4zppwk4ne8xy6gdq4z2gwq7dmf5jq8z2ctpn8nlmtse0a74fa5z0m8z383gmpgqz6q6duu4"
|
||||
describe "Notes" $ do
|
||||
xit "Check Orchard notes" $ do
|
||||
it "Check Orchard notes" $ do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
oNotes <- getWalletUnspentOrchNotes pool (toSqlKey 1)
|
||||
oNotes `shouldBe` []
|
||||
xit "Check Sapling notes" $ do
|
||||
it "Check Sapling notes" $ do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
oNotes <- getWalletUnspentSapNotes pool (toSqlKey 4)
|
||||
oNotes `shouldBe` []
|
||||
xit "Check transparent notes" $ do
|
||||
it "Check transparent notes" $ do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
oNotes <- getWalletUnspentTrNotes pool (toSqlKey 1)
|
||||
oNotes `shouldBe` []
|
||||
|
@ -266,7 +265,7 @@ main = do
|
|||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001331
|
||||
3001230
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
"Sending memo to orchard"
|
||||
|
@ -290,7 +289,7 @@ main = do
|
|||
18232
|
||||
TestNet
|
||||
(toSqlKey 4)
|
||||
3001331
|
||||
3001230
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
"Sending memo to sapling"
|
||||
|
@ -298,30 +297,8 @@ main = do
|
|||
case tx of
|
||||
Left e -> assertFailure $ show e
|
||||
Right h -> h `shouldNotBe` (hexString "deadbeef")
|
||||
it "To Transparent" $ do
|
||||
let uaRead = parseAddress "tmAmSa4AauSFuJieeanRBjkfnah45ysGtgZ"
|
||||
case uaRead of
|
||||
Nothing -> assertFailure "wrong address"
|
||||
Just ua -> do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
tx <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2
|
||||
pool
|
||||
"localhost"
|
||||
18232
|
||||
TestNet
|
||||
(toSqlKey 4)
|
||||
3001331
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
""
|
||||
Full
|
||||
tx `shouldBe`
|
||||
Left
|
||||
(PrivacyPolicyError "Receiver not capable of Full privacy")
|
||||
describe "Medium" $ do
|
||||
it "To Orchard" $ do
|
||||
xit "To Orchard" $ do
|
||||
let uaRead =
|
||||
parseAddress
|
||||
"utest1dl54utt6prjj5e0dnlknwumnxq9hycdjpkfr0sy6e6h522remqee8axe9zax0wsjrwpj76v555pdhvj9rnargpfyycs0vpkapq98xcdhem99gc4wchzn0ggepq3y6nz3a9sscwgqxgsh9vzhcad402y3x9szfregck5gslkya3c79d86xx0l33tpk8gnn7ew9vw37w43zh22u8dgdax"
|
||||
|
@ -337,7 +314,7 @@ main = do
|
|||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001372
|
||||
3000789
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
"Sending memo to orchard"
|
||||
|
@ -345,7 +322,7 @@ main = do
|
|||
case tx of
|
||||
Left e -> assertFailure $ show e
|
||||
Right h -> h `shouldNotBe` (hexString "deadbeef")
|
||||
it "To Sapling" $ do
|
||||
xit "To Sapling" $ do
|
||||
let uaRead =
|
||||
parseAddress
|
||||
"ztestsapling136jp8z89v2jh6kqd5rs4dtvlxym90m43svzdwzxaplyvc5ttzppytpvx80ncllcsqzpmukxjl3y"
|
||||
|
@ -361,7 +338,7 @@ main = do
|
|||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001372
|
||||
3000789
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
"Sending memo to orchard"
|
||||
|
@ -369,169 +346,3 @@ main = do
|
|||
case tx of
|
||||
Left e -> assertFailure $ show e
|
||||
Right h -> h `shouldNotBe` (hexString "deadbeef")
|
||||
it "To Transparent" $ do
|
||||
let uaRead = parseAddress "tmAmSa4AauSFuJieeanRBjkfnah45ysGtgZ"
|
||||
case uaRead of
|
||||
Nothing -> assertFailure "wrong address"
|
||||
Just ua -> do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
tx <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2
|
||||
pool
|
||||
"localhost"
|
||||
18232
|
||||
TestNet
|
||||
(toSqlKey 4)
|
||||
3001331
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
""
|
||||
Medium
|
||||
tx `shouldBe`
|
||||
Left
|
||||
(PrivacyPolicyError "Receiver not capable of Medium privacy")
|
||||
describe "Low" $ do
|
||||
it "To Orchard" $ do
|
||||
let uaRead =
|
||||
parseAddress
|
||||
"utest1dl54utt6prjj5e0dnlknwumnxq9hycdjpkfr0sy6e6h522remqee8axe9zax0wsjrwpj76v555pdhvj9rnargpfyycs0vpkapq98xcdhem99gc4wchzn0ggepq3y6nz3a9sscwgqxgsh9vzhcad402y3x9szfregck5gslkya3c79d86xx0l33tpk8gnn7ew9vw37w43zh22u8dgdax"
|
||||
case uaRead of
|
||||
Nothing -> assertFailure "wrong address"
|
||||
Just ua -> do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
tx <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2
|
||||
pool
|
||||
"localhost"
|
||||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001372
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
"Sending memo to orchard"
|
||||
Low
|
||||
case tx of
|
||||
Left e -> assertFailure $ show e
|
||||
Right h -> h `shouldNotBe` (hexString "deadbeef")
|
||||
it "To Sapling" $ do
|
||||
let uaRead =
|
||||
parseAddress
|
||||
"ztestsapling136jp8z89v2jh6kqd5rs4dtvlxym90m43svzdwzxaplyvc5ttzppytpvx80ncllcsqzpmukxjl3y"
|
||||
case uaRead of
|
||||
Nothing -> assertFailure "wrong address"
|
||||
Just ua -> do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
tx <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2
|
||||
pool
|
||||
"localhost"
|
||||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001372
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
"Sending memo to orchard"
|
||||
Low
|
||||
case tx of
|
||||
Left e -> assertFailure $ show e
|
||||
Right h -> h `shouldNotBe` (hexString "deadbeef")
|
||||
it "To Transparent" $ do
|
||||
let uaRead = parseAddress "tmAmSa4AauSFuJieeanRBjkfnah45ysGtgZ"
|
||||
case uaRead of
|
||||
Nothing -> assertFailure "wrong address"
|
||||
Just ua -> do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
tx <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2
|
||||
pool
|
||||
"localhost"
|
||||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001372
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
""
|
||||
Low
|
||||
case tx of
|
||||
Left e -> assertFailure $ show e
|
||||
Right h -> h `shouldNotBe` (hexString "deadbeef")
|
||||
describe "None" $ do
|
||||
it "To Orchard" $ do
|
||||
let uaRead =
|
||||
parseAddress
|
||||
"utest1dl54utt6prjj5e0dnlknwumnxq9hycdjpkfr0sy6e6h522remqee8axe9zax0wsjrwpj76v555pdhvj9rnargpfyycs0vpkapq98xcdhem99gc4wchzn0ggepq3y6nz3a9sscwgqxgsh9vzhcad402y3x9szfregck5gslkya3c79d86xx0l33tpk8gnn7ew9vw37w43zh22u8dgdax"
|
||||
case uaRead of
|
||||
Nothing -> assertFailure "wrong address"
|
||||
Just ua -> do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
tx <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2
|
||||
pool
|
||||
"localhost"
|
||||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001372
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
"Sending memo to orchard"
|
||||
None
|
||||
tx `shouldBe`
|
||||
Left
|
||||
(PrivacyPolicyError
|
||||
"Receiver not compatible with privacy policy")
|
||||
it "To Sapling" $ do
|
||||
let uaRead =
|
||||
parseAddress
|
||||
"ztestsapling136jp8z89v2jh6kqd5rs4dtvlxym90m43svzdwzxaplyvc5ttzppytpvx80ncllcsqzpmukxjl3y"
|
||||
case uaRead of
|
||||
Nothing -> assertFailure "wrong address"
|
||||
Just ua -> do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
tx <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2
|
||||
pool
|
||||
"localhost"
|
||||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001372
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
"Sending memo to orchard"
|
||||
None
|
||||
tx `shouldBe`
|
||||
Left
|
||||
(PrivacyPolicyError
|
||||
"Receiver not compatible with privacy policy")
|
||||
it "To Transparent" $ do
|
||||
let uaRead = parseAddress "tmAmSa4AauSFuJieeanRBjkfnah45ysGtgZ"
|
||||
case uaRead of
|
||||
Nothing -> assertFailure "wrong address"
|
||||
Just ua -> do
|
||||
pool <- runNoLoggingT $ initPool "/home/rav/Zenith/zenith.db"
|
||||
tx <-
|
||||
runFileLoggingT "zenith.log" $
|
||||
prepareTxV2
|
||||
pool
|
||||
"localhost"
|
||||
18232
|
||||
TestNet
|
||||
(toSqlKey 1)
|
||||
3001372
|
||||
0.005
|
||||
(fromJust uaRead)
|
||||
""
|
||||
None
|
||||
case tx of
|
||||
Left e -> assertFailure $ show e
|
||||
Right h -> h `shouldNotBe` (hexString "deadbeef")
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 003293cc3f978c146824d0695c5c458cf2cc9bb5
|
||||
Subproject commit 12296026a0ebb9a5afe0904b251c5d31080eab18
|
Loading…
Reference in a new issue