Skip to main content

Crate pallas_utxorpc

Crate pallas_utxorpc 

Source
Expand description

Map Pallas ledger types onto the UTxORPC Cardano protobuf schema.

Both spec versions are always compiled in side by side, so a caller can choose v1alpha or v1beta per call site without juggling features.

§Usage

use pallas_utxorpc::Mapper;          // default features: alias for v1alpha::Mapper
use pallas_utxorpc::v1alpha::Mapper as V1Alpha;
use pallas_utxorpc::v1beta::Mapper as V1Beta;

For back-compat with pre-v1beta releases, the default u5c-v1alpha-compat feature re-exports v1alpha at the crate root, so pallas_utxorpc::Mapper and pallas_utxorpc::spec keep resolving to v1alpha. Disable the compat shim to force callers onto explicit version paths:

pallas-utxorpc = { version = "...", default-features = false }

§Overview

  • v1alphaMapper returning utxorpc_spec::utxorpc::v1alpha::cardano::*.
  • v1betaMapper returning utxorpc_spec::utxorpc::v1beta::cardano::*, including the v1beta-only types (BootstrapWitness, VoterVotes, VotingProcedure, Vote).
  • Crate-root infrastructure (LedgerContext, TxHash, TxoIndex, TxoRef, Cbor, EraCbor, UtxoMap, DatumMap) is shared across versions and unaffected by the feature flag.

§Feature flags

§Testing

Each version has a snapshot test that decodes a fixed Babbage block and compares the mapper output against a JSON file under test_data/ (u5c_v1alpha.json, u5c_v1beta.json). To overwrite both snapshots with the current mapper output:

REGENERATE_SNAPSHOTS=1 cargo test -p pallas-utxorpc

When the variable is unset (the normal case), the tests assert against the checked-in JSON files.

§Usage as part of pallas

When depending on the umbrella pallas crate, this crate is re-exported as pallas::interop::utxorpc.

Re-exports§

pub use v1alpha::Mapper;

Modules§

spec
v1alpha
Mappers and types for the v1alpha UTxO RPC schema.
v1beta
Mappers and types for the v1beta UTxO RPC schema.

Traits§

LedgerContext
Side-channel a UTxO RPC mapper uses to resolve information that is not inlined in the transaction or block being mapped (referenced UTxOs, slot timestamps, etc.).

Type Aliases§

Cbor
Raw CBOR bytes for an on-chain artifact.
DatumMap
Plutus datums keyed by their 32-byte hash.
EraCbor
CBOR bytes tagged with the era they were produced in.
TxHash
32-byte transaction hash.
TxoIndex
Index of an output within a transaction.
TxoRef
Reference to a single transaction output: (tx_hash, output_index).
UtxoMap
Resolved UTxO set keyed by output reference.