| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Rpc.Server.Internal.UtxoRpc.Type
Description
Umbrella module for the conversions between cardano-api types and their
UTxO RPC protobuf counterparts. The conversions live in the Type.*
submodules; this module re-exports them so that existing importers keep
working unchanged.
Synopsis
- utxoRpcPParamsToProtocolParams :: Era era -> Proto PParams -> Either String (PParams (ShelleyLedgerEra era))
- utxoToUtxoRpcAnyUtxoData :: IsEra era => UTxO era -> [Proto AnyUtxoData]
- txInTxOutToAnyUtxoData :: IsEra era => TxIn -> TxOut CtxUTxO era -> Proto AnyUtxoData
- anyUtxoDataUtxoRpcToUtxo :: forall era m. (HasCallStack, MonadThrow m) => Era era -> [Proto AnyUtxoData] -> m (UTxO era)
- metadatumToUtxoRpcMetadatum :: Metadatum -> Proto Metadatum
- txOutToUtxoRpcTxOutput :: ShelleyBasedEra era -> TxOut CtxUTxO era -> Proto TxOutput
- txToUtxoRpcTx :: IsShelleyBasedEra era => Tx 'TopTx (ShelleyLedgerEra era) -> Proto Tx
- anyEraTxConstraints :: ShelleyBasedEra era -> ((IsShelleyBasedEra era, AnyEraTx (ShelleyLedgerEra era)) => a) -> a
- txoRefUtxoRpcToTxIn :: (HasCallStack, MonadThrow m) => Proto TxoRef -> m TxIn
- utxoRpcTxOutputToTxOut :: forall era m. (HasCallStack, MonadThrow m, IsEra era) => Proto TxOutput -> m (TxOut CtxUTxO era)
- protocolParamsToUtxoRpcPParams :: Era era -> PParams (LedgerEra era) -> Proto PParams
- simpleScriptToUtxoRpcNativeScript :: SimpleScript -> Proto NativeScript
- utxoRpcBigIntToInteger :: (HasCallStack, MonadThrow m) => Proto BigInt -> m Integer
- utxoRpcRationalNumberToRational :: Proto RationalNumber -> Maybe Rational
- mkChainPointMsg :: ChainPoint -> WithOrigin BlockNo -> UTCTime -> Proto ChainPoint
- utxoRpcChainPointMsgToChainPoint :: (HasCallStack, MonadThrow m) => Proto ChainPoint -> m (ChainPoint, WithOrigin BlockNo, UTCTime)
- scriptDataToUtxoRpcPlutusData :: ScriptData -> Proto PlutusData
- utxoRpcPlutusDataToScriptData :: (HasCallStack, MonadThrow m) => Proto PlutusData -> m ScriptData
- scriptWitnessIndexToRedeemerPurpose :: ScriptWitnessIndex -> (Proto RedeemerPurpose, Word32)
- scriptExecutionErrorToEvalReport :: ScriptWitnessIndex -> ScriptExecutionError -> Proto EvalReport
- mkProtoRedeemer :: (PlutusScriptPurpose, Word32) -> ExecutionUnits -> Maybe (ScriptData, ByteString) -> Proto Redeemer
- mkProtoTxEval :: Coin -> Map ScriptWitnessIndex (Either ScriptExecutionError ([Text], ExecutionUnits)) -> Map ScriptWitnessIndex (ScriptData, ByteString) -> Proto TxEval
Documentation
utxoRpcPParamsToProtocolParams :: Era era -> Proto PParams -> Either String (PParams (ShelleyLedgerEra era)) Source #
utxoToUtxoRpcAnyUtxoData :: IsEra era => UTxO era -> [Proto AnyUtxoData] Source #
txInTxOutToAnyUtxoData :: IsEra era => TxIn -> TxOut CtxUTxO era -> Proto AnyUtxoData Source #
anyUtxoDataUtxoRpcToUtxo :: forall era m. (HasCallStack, MonadThrow m) => Era era -> [Proto AnyUtxoData] -> m (UTxO era) Source #
metadatumToUtxoRpcMetadatum :: Metadatum -> Proto Metadatum Source #
Convert a ledger metadatum to the UTxO RPC Metadatum message.
The UTxO RPC encoding only supports signed 64-bit metadata integers, while
the ledger rules allow any integer with an 8-byte magnitude, i.e. within
[-(2^64 - 1), 2^64 - 1]. Values outside of the Int64 range are
therefore clamped to minBound and maxBound respectively. Consumers
which need full fidelity should decode the native_bytes CBOR of the
transaction instead.
txOutToUtxoRpcTxOutput :: ShelleyBasedEra era -> TxOut CtxUTxO era -> Proto TxOutput Source #
txToUtxoRpcTx :: IsShelleyBasedEra era => Tx 'TopTx (ShelleyLedgerEra era) -> Proto Tx Source #
Convert a ledger transaction to the UTxO RPC Tx message.
Populates hash, fee, successful, inputs, outputs, reference inputs, validity,
mint, withdrawals, collateral, certificates, witnesses, auxiliary data and
governance proposals, with spending, withdrawal and certificate redeemers
wired to their respective entries. Era-gated fields are read through the
any-era getters, whose Nothing maps to the proto default; the
ShelleyBasedEra witness is recovered from IsShelleyBasedEra and brings
the any-era reading classes into scope.
anyEraTxConstraints :: ShelleyBasedEra era -> ((IsShelleyBasedEra era, AnyEraTx (ShelleyLedgerEra era)) => a) -> a Source #
Bring the constraints of txToUtxoRpcTx into scope for a Shelley-based
era: the uniform any-era transaction reading classes of cardano-ledger-api,
whose era-gated getters return Nothing where the era predates a field,
and IsShelleyBasedEra to recover the witness. Unlike the eon constraint
bundles this dispatch is total, including Dijkstra.
txoRefUtxoRpcToTxIn :: (HasCallStack, MonadThrow m) => Proto TxoRef -> m TxIn Source #
utxoRpcTxOutputToTxOut :: forall era m. (HasCallStack, MonadThrow m, IsEra era) => Proto TxOutput -> m (TxOut CtxUTxO era) Source #
protocolParamsToUtxoRpcPParams :: Era era -> PParams (LedgerEra era) -> Proto PParams Source #
Convert full ledger protocol parameters to the UTxO RPC PParams
message. All parameters are set.
simpleScriptToUtxoRpcNativeScript :: SimpleScript -> Proto NativeScript Source #
TODO: remove together with the old-API TxOutput pipeline, https://github.com/IntersectMBO/cardano-api/issues/1264
utxoRpcBigIntToInteger :: (HasCallStack, MonadThrow m) => Proto BigInt -> m Integer Source #
utxoRpcRationalNumberToRational :: Proto RationalNumber -> Maybe Rational Source #
Convert a protobuf RationalNumber into a Rational.
Fails with Nothing when the denominator is zero, which is also the
default value of the protobuf field when it is omitted.
mkChainPointMsg :: ChainPoint -> WithOrigin BlockNo -> UTCTime -> Proto ChainPoint Source #
utxoRpcChainPointMsgToChainPoint :: (HasCallStack, MonadThrow m) => Proto ChainPoint -> m (ChainPoint, WithOrigin BlockNo, UTCTime) Source #
Inverse of mkChainPointMsg. Note: Origin and At (BlockNo 0) both
encode to height=0, so the decode always maps 0 back to Origin.
scriptDataToUtxoRpcPlutusData :: ScriptData -> Proto PlutusData Source #
utxoRpcPlutusDataToScriptData :: (HasCallStack, MonadThrow m) => Proto PlutusData -> m ScriptData Source #
scriptWitnessIndexToRedeemerPurpose :: ScriptWitnessIndex -> (Proto RedeemerPurpose, Word32) Source #
Map a ScriptWitnessIndex to the corresponding proto RedeemerPurpose
and the numeric index within that purpose.
scriptExecutionErrorToEvalReport :: ScriptWitnessIndex -> ScriptExecutionError -> Proto EvalReport Source #
Convert a ScriptExecutionError into a proto EvalReport with the
redeemer purpose and 0-based index that produced the error.
Arguments
| :: (PlutusScriptPurpose, Word32) | Redeemer purpose and index |
| -> ExecutionUnits | Execution units consumed |
| -> Maybe (ScriptData, ByteString) | Plutus data payload and its CBOR bytes |
| -> Proto Redeemer |
Assemble a proto Redeemer from evaluation results and transaction
witness data.
Arguments
| :: Coin | Computed minimum fee |
| -> Map ScriptWitnessIndex (Either ScriptExecutionError ([Text], ExecutionUnits)) | Per-redeemer evaluation results: script traces and execution units on success, or a script execution error on failure |
| -> Map ScriptWitnessIndex (ScriptData, ByteString) | Redeemer Plutus data extracted from the transaction witness set, keyed by script witness index, with decoded payload and CBOR bytes. |
| -> Proto TxEval |
Assemble a proto TxEval response from the computed fee, per-redeemer
evaluation results, and redeemer Plutus data from the transaction witness set.