<p><code>Constraint.mustPayToOtherScriptWithInlineDatumInTx</code> doesn't exist on <code>main</code> branch. Use <code>Constraint.mustPayToOtherScriptWithInlineDatum</code> without other datum-related constraints to avoid conflict.</p>

CC BY-SA 4.0
2022-10-24T08:52:07.057Z
2022-10-24T08:52:07.057Z
james
<p>I am trying to create a OffChain code for submitting inline datums.</p>
<pre><code>gTest :: forall w s. GrabParams -&gt; PlutusContract.Contract w s DataText.Text ()
gTest GrabParams{..} = do
    PlutusContract.logInfo @P.String $ TextPrintf.printf &quot;------------------------------------------------------&quot;
    PlutusContract.logInfo @P.String $ TextPrintf.printf &quot;------------------- GTest endpoint -------------------&quot;
    PlutusContract.logInfo @P.String $ TextPrintf.printf &quot;------------------------------------------------------&quot;
    maybeutxo &lt;- findUtxoInValidator grabRedeem
    PlutusContract.logInfo @P.String $ TextPrintf.printf &quot;datum utxos %s&quot; (P.show maybeutxo)
    case maybeutxo of
        Nothing -&gt; PlutusContract.logInfo @P.String $ TextPrintf.printf &quot;Wrong guess %d&quot; grabRedeem
        Just (oref, o) -&gt; do
            PlutusContract.logInfo @P.String $ TextPrintf.printf &quot;Redeem utxos %s&quot; (P.show oref)
            let 
                d = OnChain.Dat
                    { 
                          ddata = grabRedeem
                        , dtype = OnChain.Test
                    }
                r = OnChain.Redeem 
                    {
                        OnChain.redeem = grabRedeem
                    }
                q = 4000000
                lookups = Constraints.unspentOutputs (Map.singleton oref o) P.&lt;&gt;
                          Constraints.plutusV2OtherScript OnChain.validator
                tx = (Constraints.mustPayToOtherScriptWithDatumInTx OnChain.validatorHash (ScriptsLedger.Datum $ PlutusTx.toBuiltinData d) (lovelaceValueOf q)) &lt;&gt;
                     (Constraints.mustIncludeDatumInTx  (ScriptsLedger.Datum $ PlutusTx.toBuiltinData d)) &lt;&gt;
                     (Constraints.mustSpendScriptOutput oref $ ScriptsLedger.Redeemer $ PlutusTx.toBuiltinData r) 
            PlutusContract.logInfo @P.String $ TextPrintf.printf &quot;[GTEST TX] %s&quot; (P.show tx)            
            submittedTx &lt;- PlutusContract.submitTxConstraintsWith @OnChain.Simple lookups tx
            Monad.void $ PlutusContract.awaitTxConfirmed $ LedgerTx.getCardanoTxId submittedTx
            PlutusContract.logInfo @P.String $ &quot;collected gifts&quot;
</code></pre>
<p>I even tried the Constraints.mustPayToOtherScriptWithInlineDatumInTx and still doesn't include the inline datum.</p>

CC BY-SA 4.0
2022-10-19T20:29:28.787Z
What plutus-apps tag/branch are you using?
Cristovao Morgado
<plutus><offchain><inline-datum>
OffChain code for inline datum
# OffChain code for inline datum

(Asked by: username_0 on 2022-10-19)

I am trying to create a OffChain code for submitting inline datums.
gTest :: forall w s. GrabParams -> PlutusContract.Contract w s DataText.Text ()
gTest GrabParams{..} = do
    PlutusContract.logInfo @P.String $ TextPrintf.printf "------------------------------------------------------"
    PlutusContract.logInfo @P.String $ TextPrintf.printf "------------------- GTest endpoint -------------------"
    PlutusContract.logInfo @P.String $ TextPrintf.printf "------------------------------------------------------"
    maybeutxo <- findUtxoInValidator grabRedeem
    PlutusContract.logInfo @P.String $ TextPrintf.printf "datum utxos %s" (P.show maybeutxo)
    case maybeutxo of
        Nothing -> PlutusContract.logInfo @P.String $ TextPrintf.printf "Wrong guess %d" grabRedeem
        Just (oref, o) -> do
            PlutusContract.logInfo @P.String $ TextPrintf.printf "Redeem utxos %s" (P.show oref)
            let 
                d = OnChain.Dat
                    { 
                          ddata = grabRedeem
                        , dtype = OnChain.Test
                    }
                r = OnChain.Redeem 
                    {
                        OnChain.redeem = grabRedeem
                    }
                q = 4000000
                lookups = Constraints.unspentOutputs (Map.singleton oref o) P.<>
                          Constraints.plutusV2OtherScript OnChain.validator
                tx = (Constraints.mustPayToOtherScriptWithDatumInTx OnChain.validatorHash (ScriptsLedger.Datum $ PlutusTx.toBuiltinData d) (lovelaceValueOf q)) <>
                     (Constraints.mustIncludeDatumInTx  (ScriptsLedger.Datum $ PlutusTx.toBuiltinData d)) <>
                     (Constraints.mustSpendScriptOutput oref $ ScriptsLedger.Redeemer $ PlutusTx.toBuiltinData r) 
            PlutusContract.logInfo @P.String $ TextPrintf.printf "[GTEST TX] %s" (P.show tx)            
            submittedTx <- PlutusContract.submitTxConstraintsWith @OnChain.Simple lookups tx
            Monad.void $ PlutusContract.awaitTxConfirmed $ LedgerTx.getCardanoTxId submittedTx
            PlutusContract.logInfo @P.String $ "collected gifts"

I even tried the Constraints.mustPayToOtherScriptWithInlineDatumInTx and still doesn't include the inline datum.

**Tags:** plutus, offchain, inline-datum
> **Comments:**
> **username_1**: What plutus-apps tag/branch are you using?  

---

## 1 answers

### Answer by username_2 on 2022-10-24. Score: 0

`Constraint.mustPayToOtherScriptWithInlineDatumInTx` doesn't exist on `main` branch. Use `Constraint.mustPayToOtherScriptWithInlineDatum` without other datum-related constraints to avoid conflict.


---

