@@ -7,8 +7,22 @@ import Prelude
77import Cardano.AsCbor (decodeCbor )
88import Cardano.Data.Lite (fromBytes )
99import Cardano.Plutus.ApplyArgs (applyArgs )
10- import Cardano.Transaction.Builder (DatumWitness (DatumValue), OutputWitness (PlutusScriptOutput), ScriptWitness (ScriptValue), TransactionBuilderStep (Pay, SpendOutput))
11- import Cardano.Types (Address (EnterpriseAddress), Credential (PubKeyHashCredential, ScriptHashCredential), GeneralTransactionMetadata , PaymentCredential (PaymentCredential), StakeCredential (StakeCredential), TransactionUnspentOutput (TransactionUnspentOutput), _input , _output )
10+ import Cardano.Transaction.Builder
11+ ( DatumWitness (DatumValue)
12+ , OutputWitness (PlutusScriptOutput)
13+ , ScriptWitness (ScriptValue)
14+ , TransactionBuilderStep (Pay, SpendOutput)
15+ )
16+ import Cardano.Types
17+ ( Address (EnterpriseAddress)
18+ , Credential (PubKeyHashCredential, ScriptHashCredential)
19+ , GeneralTransactionMetadata
20+ , PaymentCredential (PaymentCredential)
21+ , StakeCredential (StakeCredential)
22+ , TransactionUnspentOutput (TransactionUnspentOutput)
23+ , _input
24+ , _output
25+ )
1226import Cardano.Types.AssetName as AssetName
1327import Cardano.Types.Coin as Coin
1428import Cardano.Types.Int as Int
@@ -20,10 +34,22 @@ import Cardano.Types.PublicKey (hash) as PublicKey
2034import Cardano.Types.RedeemerDatum as RedeemerDatum
2135import Cardano.Types.TransactionUnspentOutput (toUtxoMap )
2236import Cardano.Types.Value (lovelaceValueOf )
23- import Contract.Address (PaymentPubKeyHash (PaymentPubKeyHash), StakePubKeyHash , getNetworkId , mkAddress )
37+ import Contract.Address
38+ ( PaymentPubKeyHash (PaymentPubKeyHash)
39+ , StakePubKeyHash
40+ , getNetworkId
41+ , mkAddress
42+ )
2443import Contract.AuxiliaryData (setGeneralTxMetadata )
25- import Contract.BalanceTxConstraints (BalanceTxConstraintsBuilder , mustUseAdditionalUtxos ) as BalanceTxConstraints
26- import Contract.BalanceTxConstraints (mustNotSpendUtxosWhere , mustNotSpendUtxosWithOutRefs , mustUseCollateralUtxos )
44+ import Contract.BalanceTxConstraints
45+ ( BalanceTxConstraintsBuilder
46+ , mustUseAdditionalUtxos
47+ ) as BalanceTxConstraints
48+ import Contract.BalanceTxConstraints
49+ ( mustNotSpendUtxosWhere
50+ , mustNotSpendUtxosWithOutRefs
51+ , mustUseCollateralUtxos
52+ )
2753import Contract.Chain (currentTime , waitUntilSlot )
2854import Contract.Config (KnownWallet (Eternl, Gero, Lode, NuFi), walletName )
2955import Contract.Hashing (datumHash , nativeScriptHash )
@@ -32,23 +58,82 @@ import Contract.Log (logInfo')
3258import Contract.Metadata as Metadatum
3359import Contract.Monad (Contract , liftContractE , liftContractM , liftedM )
3460import Contract.Numeric.BigNum as BigNum
35- import Contract.PlutusData (PlutusData (Bytes, Integer, List), getDatumByHash , getDatumsByHashes , getDatumsByHashesWithErrors , unitRedeemer )
61+ import Contract.PlutusData
62+ ( PlutusData (Bytes, Integer, List)
63+ , getDatumByHash
64+ , getDatumsByHashes
65+ , getDatumsByHashesWithErrors
66+ , unitRedeemer
67+ )
3668import Contract.Prelude (liftM , mconcat )
37- import Contract.Prim.ByteArray (byteArrayFromAscii , hexToByteArray , hexToByteArrayUnsafe , hexToRawBytes )
69+ import Contract.Prim.ByteArray
70+ ( byteArrayFromAscii
71+ , hexToByteArray
72+ , hexToByteArrayUnsafe
73+ , hexToRawBytes
74+ )
3875import Contract.ScriptLookups as Lookups
39- import Contract.Scripts (ValidatorHash , getScriptByHash , getScriptsByHashes , validatorHash )
76+ import Contract.Scripts
77+ ( ValidatorHash
78+ , getScriptByHash
79+ , getScriptsByHashes
80+ , validatorHash
81+ )
4082import Contract.Test (ContractTest )
4183import Contract.Test.Assert (runChecks )
42- import Contract.Test.Testnet (InitialUTxOs , InitialUTxOsWithStakeKey , withStakeKey , withWallets )
84+ import Contract.Test.Testnet
85+ ( InitialUTxOs
86+ , InitialUTxOsWithStakeKey
87+ , withStakeKey
88+ , withWallets
89+ )
4390import Contract.Time (Slot (Slot), getEraSummaries )
44- import Contract.Transaction (BalanceTxError (BalanceInsufficientError, InsufficientCollateralUtxos), DataHash , NativeScript (ScriptPubkey, ScriptNOfK, ScriptAll), OutputDatum (OutputDatum, OutputDatumHash), ScriptRef (PlutusScriptRef, NativeScriptRef), TransactionHash (TransactionHash), TransactionInput (TransactionInput), TransactionOutput (TransactionOutput), awaitTxConfirmed , balanceTx , balanceTxE , buildTx , createAdditionalUtxos , defaultBalancer , emptyBalancerCtx , getTxAuxiliaryData , lookupTxHash , signTransaction , submit , submitTxFromBlueprint , submitTxFromConstraints , withBalancedTx , withBalancedTxs )
91+ import Contract.Transaction
92+ ( BalanceTxError (BalanceInsufficientError, InsufficientCollateralUtxos)
93+ , DataHash
94+ , NativeScript (ScriptPubkey, ScriptNOfK, ScriptAll)
95+ , OutputDatum (OutputDatum, OutputDatumHash)
96+ , ScriptRef (PlutusScriptRef, NativeScriptRef)
97+ , TransactionHash (TransactionHash)
98+ , TransactionInput (TransactionInput)
99+ , TransactionOutput (TransactionOutput)
100+ , awaitTxConfirmed
101+ , balanceTx
102+ , balanceTxE
103+ , buildTx
104+ , createAdditionalUtxos
105+ , defaultBalancer
106+ , emptyBalancerCtx
107+ , getTxAuxiliaryData
108+ , lookupTxHash
109+ , signTransaction
110+ , submit
111+ , submitTxFromBlueprint
112+ , submitTxFromConstraints
113+ , withBalancedTx
114+ , withBalancedTxs
115+ )
45116import Contract.TxConstraints (TxConstraints )
46117import Contract.TxConstraints as Constraints
47118import Contract.UnbalancedTx (mkUnbalancedTx , mkUnbalancedTxE )
48119import Contract.Utxos (UtxoMap , getUtxo , utxosAt )
49120import Contract.Value (Coin (Coin), Value , coinToValue )
50121import Contract.Value as Value
51- import Contract.Wallet (getWalletAddresses , getWalletBalance , getWalletCollateral , getWalletUtxos , isWalletAvailable , ownDrepPubKey , ownDrepPubKeyHash , ownPaymentPubKeyHashes , ownRegisteredPubStakeKeys , ownStakePubKeyHashes , ownUnregisteredPubStakeKeys , signData , withKeyWallet )
122+ import Contract.Wallet
123+ ( getWalletAddresses
124+ , getWalletBalance
125+ , getWalletCollateral
126+ , getWalletUtxos
127+ , isWalletAvailable
128+ , ownDrepPubKey
129+ , ownDrepPubKeyHash
130+ , ownPaymentPubKeyHashes
131+ , ownRegisteredPubStakeKeys
132+ , ownStakePubKeyHashes
133+ , ownUnregisteredPubStakeKeys
134+ , signData
135+ , withKeyWallet
136+ )
52137import Control.Monad.Error.Class (liftEither , try )
53138import Control.Monad.Trans.Class (lift )
54139import Control.Parallel (parallel , sequential )
@@ -98,11 +183,30 @@ import Mote (group, skip, test)
98183import Mote.TestPlanM (TestPlanM )
99184import Partial.Unsafe (unsafePartial )
100185import Safe.Coerce (coerce )
101- import Test.Ctl.Fixtures (fullyAppliedScriptFixture , nativeScriptFixture1 , nativeScriptFixture2 , nativeScriptFixture3 , nativeScriptFixture4 , nativeScriptFixture5 , nativeScriptFixture6 , nativeScriptFixture7 , partiallyAppliedScriptFixture , unappliedScriptFixture )
186+ import Test.Ctl.Fixtures
187+ ( fullyAppliedScriptFixture
188+ , nativeScriptFixture1
189+ , nativeScriptFixture2
190+ , nativeScriptFixture3
191+ , nativeScriptFixture4
192+ , nativeScriptFixture5
193+ , nativeScriptFixture6
194+ , nativeScriptFixture7
195+ , partiallyAppliedScriptFixture
196+ , unappliedScriptFixture
197+ )
102198import Test.Ctl.Testnet.Common (privateDrepKey , privateStakeKey )
103199import Test.Ctl.Testnet.Utils (getLockedInputs , submitAndLog )
104200import Test.Ctl.Testnet.UtxoDistribution (checkUtxoDistribution )
105- import Test.Spec.Assertions (expectError , fail , shouldEqual , shouldNotEqual , shouldReturn , shouldSatisfy )
201+ import Test.Spec.Assertions
202+ ( expectError
203+ , fail
204+ , shouldEqual
205+ , shouldNotEqual
206+ , shouldReturn
207+ , shouldSatisfy
208+ )
209+
106210suite :: TestPlanM ContractTest Unit
107211suite = do
108212 group " WaitUntilSlot" do
@@ -207,7 +311,7 @@ suite = do
207311 }
208312 balancedSignedTx <- signTransaction balancedTx
209313 submitAndLog balancedSignedTx
210-
314+
211315 test " #1480 - test that does nothing but fails" do
212316 let
213317 someUtxos =
0 commit comments