0

I'm getting the following error during the ledgerTx line of code "ConstraintResolutionError (TxOutRefNotFound (TxOutRef {txOutRefId = 70d473b55eaac244c821a001fe153813249c22395cb55631f34eb149937d340a, txOutRefIdx = 1}))"

utxos <- utxosAt $ scriptAddress payValidator
let orefs = fst <$> Map.toList utxos
     change = _ciTxOutValue (snd (L.head (Map.toList utxos))) - (Ada.lovelaceValueOf bet)
     lookups = Constraints.typedValidatorLookups typedPayToScriptValidator
     tx = Constraints.mustSpendScriptOutput (last orefs) unitRedeemer <> Constraints.mustPayToTheScript bet change
ledgerTx <- submitTxConstraintsWith lookups tx
void $ awaitTxConfirmed $ getCardanoTxId ledgerTx

1 Answer 1

1

The issue was caused by the lookups. The combination of Constraints that resolved the issue is let lookups = Constraints.unspentOutputs utxos <> Constraints.typedValidatorLookups typedPayToScriptValidator <> Constraints.otherScript (Scripts.validatorScript typedPayToScriptValidator) I'm not sure exactly what these lookup constraints do and why they are necessary, but they fixed the ConstraintResolutionError

1
  • smacks self on forehead - I've been stuck on the exact same error. I couldn't figure out why it couldn't find a TxOutRef that I had just found a few lines earlier using utxosTxOutTxAt, but it's the lookups! thanks!
    – marcel_g
    Jul 7, 2022 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.