Plutonomicon / cardano-transaction-lib

A Purescript library for building smart contract transactions on Cardano
https://plutonomicon.github.io/cardano-transaction-lib/
MIT License
93 stars 50 forks source link

Calculate various `Redeemer` fields #156

Closed ngua closed 2 years ago

ngua commented 2 years ago

We need to figure out how to calculate the various fields of the CSL-style Redeemer type which is much different from the Plutus-style redeemer an end user will encounter.

Our definition is:

newtype Redeemer = Redeemer
  { tag :: RedeemerTag
  , index :: BigInt
  , data :: PlutusData
  , ex_units :: ExUnits
  }

index might correspond to the index of the input which is being spent with the redeemer. ex_units might be significantly harder to figure out

More context/discussion: https://github.com/Emurgo/cardano-serialization-lib/issues/241

ngua commented 2 years ago

OK, looks like we might need to use evaluateTransactionExecutionUnits from Cardano.Api for this

ngua commented 2 years ago

It turns out this will be horribly complex to do from the server. Instead we can use Ogmios v5.2.0 (after upgrading) and use it EvaluateTx protocol:

https://ogmios.dev/mini-protocols/local-tx-submission/#evaluatetx

ngua commented 2 years ago

I'm going to close this in favor of #167 where calling the Ogmios protocol will be implemented