| License | Apache-2.0 |
|---|---|
| Safe Haskell | None |
| Language | GHC2021 |
Singular.Registry.TxBuilder.Update.Context
Description
Everything a fold must know or prepare before it can decide anything: the registry context a caller hands in (and its empty value), the staterequestfee queries that find the fold's inputs, the ordered speculative proofs through the trie, the state continuation output and its script, the validity upper slot, and the completion of a partly empty context from the provider.
This module owns no duty decisions and no transaction assembly; see Singular.Registry.TxBuilder.Update.Duties and Singular.Registry.TxBuilder.Update.Build. The public surface stays Singular.Registry.TxBuilder.Update, which re-exports the context types unchanged (#267).
Synopsis
- data RegistryContext = RegistryContext {
- rcWitnessScripts :: Map Integer (Script ConwayEra)
- rcCageScript :: Maybe (Script ConwayEra)
- rcCageUtxos :: [(TxIn, TxOut ConwayEra)]
- rcAllowInadmissible :: Bool
- rcHolderUtxos :: [(TxIn, TxOut ConwayEra)]
- rcHolderReleases :: Map TxIn HolderRelease
- rcRefUtxos :: [(TxIn, TxOut ConwayEra)]
- data HolderRelease = HolderRelease {
- hrRedeemer :: Data
- hrScript :: Script ConwayEra
- hrRecipient :: ByteString
- hrReleased :: Integer
- emptyRegistryContext :: RegistryContext
- completeContext :: CageConfig -> Session NoWitness IO -> Addr -> Script ConwayEra -> RegistryContext -> IO RegistryContext
- queryContext :: Maybe (NonEmpty TxIn) -> CageConfig -> Session NoWitness IO -> TokenId -> Addr -> IO ((TxIn, TxOut ConwayEra), [(TxIn, TxOut ConwayEra)], (TxIn, TxOut ConwayEra), PParams ConwayEra)
- computeProofs :: TrieManager IO -> TokenId -> [(TxIn, TxOut ConwayEra)] -> IO ([[ProofStep]], Root)
- prepareState :: CageConfig -> TxOut ConwayEra -> Root -> (OnChainTokenState, TxOut ConwayEra, Script ConwayEra)
- computeUpperSlot :: Session NoWitness IO -> OnChainTokenState -> [(TxIn, TxOut ConwayEra)] -> IO SlotNo
Documentation
data RegistryContext Source #
What a fold needs in hand to discharge the obligations: the three token policies' scripts by kind, the cage script (custody spends run it), and the UTxOs sitting at the cage address (custody lives among them). A delivered output's datum is the one its request carries (#419), so nothing beyond the chain is in hand.
Constructors
| RegistryContext | |
Fields
| |
data HolderRelease Source #
How an application-held burn source is spent, and what its spend releases (#299): the redeemer and script that witness the spend, and the lovelace owed to the recipient's key because the holder is released.
Constructors
| HolderRelease | |
Fields
| |
Instances
| Show HolderRelease Source # | |
Defined in Singular.Registry.TxBuilder.Update.Context Methods showsPrec :: Int -> HolderRelease -> ShowS Source # show :: HolderRelease -> String Source # showList :: [HolderRelease] -> ShowS Source # | |
| Eq HolderRelease Source # | |
Defined in Singular.Registry.TxBuilder.Update.Context Methods (==) :: HolderRelease -> HolderRelease -> Bool Source # (/=) :: HolderRelease -> HolderRelease -> Bool Source # | |
emptyRegistryContext :: RegistryContext Source #
The context a fold of tree edges needs beyond the registry's own configuration: the three token policies' scripts and the cage script that custody spends run. A delivered output's datum is the one its request carries.
emptyRegistryContext carries none of it, which is right for a caller
that folds only rejections — and refuses loudly, naming the missing
script, for one that folds an edge without it.
completeContext :: CageConfig -> Session NoWitness IO -> Addr -> Script ConwayEra -> RegistryContext -> IO RegistryContext Source #
Complete a context the caller left partly empty: the cage's own UTxOs and the fold's holder inventory are queried from the provider when the caller did not supply them, and the cage script defaults to the one this build's own state continuation runs. The caller-supplied value always wins; only an omission triggers a query (#267: moved verbatim from the facade's inline completion).
queryContext :: Maybe (NonEmpty TxIn) -> CageConfig -> Session NoWitness IO -> TokenId -> Addr -> IO ((TxIn, TxOut ConwayEra), [(TxIn, TxOut ConwayEra)], (TxIn, TxOut ConwayEra), PParams ConwayEra) Source #
Query cage UTxOs, find the state and request UTxOs, pick a fee-paying wallet UTxO.
The pending-request query takes the chosen set: folding every pending request (absent selection) still refuses an empty pending set with the long-standing generic error, while folding a chosen set returns whatever is pending (possibly none) so the caller can name every chosen reference that is not among them, at every live pending-set size including zero.
computeProofs :: TrieManager IO -> TokenId -> [(TxIn, TxOut ConwayEra)] -> IO ([[ProofStep]], Root) Source #
Run speculative trie operations to compute proofs and the new root hash.
prepareState :: CageConfig -> TxOut ConwayEra -> Root -> (OnChainTokenState, TxOut ConwayEra, Script ConwayEra) Source #
Extract old state, build new state output, cage script, and owner key hash.
computeUpperSlot :: Session NoWitness IO -> OnChainTokenState -> [(TxIn, TxOut ConwayEra)] -> IO SlotNo Source #
Compute the validity upper slot.