1
{-# LANGUAGE OverloadedStrings #-}
3
module Test.Cli.Pioneers.Exercise2
8
import Hedgehog (Property)
11
import qualified Hedgehog as H
12
import qualified Hedgehog.Extras.Test.Base as H
13
import qualified Hedgehog.Extras.Test.File as H
15
-- | 1. We generate a payment signing key
16
-- 2. We create a tx body
17
-- 3. We sign the tx body with the generated payment signing key
18
prop_createTransaction :: Property
19
prop_createTransaction = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
21
paymentVerKey <- noteTempFile tempDir "payment-verification-key-file"
22
paymentSignKey <- noteTempFile tempDir "payment-signing-key-file"
23
transactionBodyFile <- noteTempFile tempDir "transaction-body"
24
transactionFile <- noteTempFile tempDir "transaction-file"
26
-- Generate payment signing key to sign transaction
29
, "--verification-key-file", paymentVerKey
30
, "--signing-key-file", paymentSignKey
33
H.assertFilesExist [paymentVerKey, paymentSignKey]
35
-- Create transaction body
37
[ "transaction", "build-raw"
38
, "--tx-in", "91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0"
39
, "--auxiliary-script-file", "test/data/golden/shelley/multisig/scripts/all"
40
, "--tx-in", "91999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c3#0"
41
, "--auxiliary-script-file", "test/data/golden/shelley/multisig/scripts/all"
42
, "--tx-out", "addr1v9wmu83pzajplrtpsq6tsqdgwr98x888trpmah2u0ezznsge7del3+100000000"
44
, "--invalid-hereafter", "500000"
45
, "--out-file", transactionBodyFile
48
H.assertFilesExist [transactionBodyFile]
52
[ "transaction", "sign"
53
, "--tx-body-file", transactionBodyFile
54
, "--signing-key-file", paymentSignKey
56
, "--out-file", transactionFile
59
H.assertFilesExist [paymentVerKey, paymentSignKey, transactionBodyFile, transactionFile]
61
-- -----------------------------------------------------------------------------
66
$ H.Group "Pioneers Example 2"
67
[ ("prop_createTransaction", prop_createTransaction)