Skip to content

Commit

Permalink
Merge pull request #6003 from IntersectMBO/smelc/test-cli-transaction…
Browse files Browse the repository at this point in the history
…-submit-new-output

cardano-testnet: use new output of "transaction submit"
  • Loading branch information
smelc authored Feb 18, 2025
2 parents c2179ff + 8fd765e commit 97cd975
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import Cardano.Api
import qualified Cardano.Api.Ledger as L
import Cardano.Api.Shelley

import Cardano.CLI.Types.Common
import Cardano.Crypto.Hash.Class (hashToStringAsHex)
import qualified Cardano.Ledger.Core as L

import Cardano.Testnet

import Prelude
Expand All @@ -28,7 +31,7 @@ import qualified System.Info as SYS
import Testnet.Components.Configuration
import Testnet.Components.Query (findLargestUtxoWithAddress, findUtxosWithAddress,
getEpochStateView, waitForBlocks)
import Testnet.Process.Run (execCli', mkExecConfig)
import Testnet.Process.Run
import Testnet.Property.Util (integrationRetryWorkspace)
import Testnet.Types

Expand Down Expand Up @@ -108,10 +111,11 @@ hprop_transaction = integrationRetryWorkspace 2 "simple transaction build" $ \te
, "--out-file", txbodySignedFp
]

void $ execCli' execConfig
txSubmissionResult :: TxSubmissionResult <- execCliStdoutToJson execConfig
[ anyEraToString cEra, "transaction", "submit"
, "--tx-file", txbodySignedFp
]
let TxId txHash = txhash txSubmissionResult

H.noteShowM_ $ waitForBlocks epochStateView 1

Expand All @@ -121,6 +125,12 @@ hprop_transaction = integrationRetryWorkspace 2 "simple transaction build" $ \te
H.assertWith txouts2 $ \txouts2' ->
[transferAmount, initialAmount - transferAmount - txFee] == txouts2'

-- Check that the transaction output exists, when querying by id:
void $ execCli' execConfig
[ anyEraToString cEra, "query", "utxo"
, "--tx-in", hashToStringAsHex txHash <> "#0"
]

txOutValue :: TxOut ctx era -> TxOutValue era
txOutValue (TxOut _ v _ _) = v

Expand Down

0 comments on commit 97cd975

Please sign in to comment.