8

Is there a way to append metadata to transactions that are send from plutus code?

Right now we send transactions from the contracts like follows (or something alike):

ledgerTx <- submitTxConstraintsWith @Cube constraints tx
void $ awaitTxConfirmed $ txId ledgerTx

I know Alonzo is still in development/testing phase, but I was wondering if there is already something in the API do this or there will be (I cant find anything in the code base as of right now).

2
  • AngelCastillo - just wondering if you ever got anywhere with this? I'm currently looking into the same requirement.
    – William
    Jul 29 at 13:25
  • Not yet, haven't found any info regarding this. I hope by the time we can access the test net to test our dapps, there is some information. Jul 30 at 4:39
0

I'm not sure in what context you need to append metadata to a transaction, but you may want to check this documentation for any of these helper functions used for creating TxContraints:

  • mustIncludeDatum :: forall i o. Datum -> TxConstraints i o
  • mustPayToOtherScript :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o
  • mustPayToTheScript :: forall i o. IsData o => o -> Value -> TxConstraints i o

The first two require a Datum while the last one could be any arbitrary data type converted to a Data using PlutusTx.unstableMakeIsData or its equivalents.

EDIT:

You might want to look into StateMachines. Especially the transition function (which also requires TxConstraints). You may start with this documentation,

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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