IntersectMBO / cardano-api

Cardano API
Apache License 2.0
26 stars 23 forks source link

[FR] - Support Plutus script evaluation events in Conway. #646

Closed Unisay closed 1 month ago

Unisay commented 1 month ago

Internal

Area Plutus Related to Plutus Scripts (Alonzo).

Describe the feature you'd like Support Plutus script evaluation events in Conway.

Describe alternatives you've considered Not using cardano-api's applyBlock function, using ledger directly.

Additional context / screenshots

toLedgerEventConway
  :: WrapLedgerEvent (ShelleyBlock protocol (ConwayEra StandardCrypto))
  -> Maybe LedgerEvent
toLedgerEventConway evt =
  case unwrapLedgerEvent evt of
    ShelleyLedgerEventTICK (TickNewEpochEvent newEpochEvent) -> handleConwayNEWEPOCHEvents newEpochEvent
    ShelleyLedgerEventTICK (TickRupdEvent rewardUpdate) -> handleLedgerRUPDEvents rewardUpdate
    ShelleyLedgerEventBBODY
      (ShelleyInAlonzoEvent (LedgersEvent (Shelley.LedgerEvent conwayLedgerEvent))) ->
        case conwayLedgerEvent of
          Conway.UtxowEvent{} -> Nothing -- <-- Ignored 
          Conway.CertsEvent{} -> Nothing
          Conway.GovEvent govEvent ->
            case govEvent of
              Conway.GovNewProposals txid props ->
                Just $ NewGovernanceProposals txid (AnyProposals