| License | Apache-2.0 |
|---|---|
| Safe Haskell | None |
| Language | GHC2021 |
Singular.Registry.TxBuilder.Internal.Identity
Description
One owner for what a builder calls a thing: script construction and
hashing from config bytes, the cage and request identities derived
from a CageConfig, request datum encoding, and the conversions
between ledger and on-chain reference types.
This is the identity-and-conversion owner extracted from
Singular.Registry.TxBuilder.Internal; the public module re-exports
it and is its only intended consumer surface.
Synopsis
- mkCageScript :: CageConfig -> Script ConwayEra
- mkRequestScript :: CageConfig -> TokenId -> Script ConwayEra
- scriptFromBytes :: String -> ShortByteString -> Script ConwayEra
- scriptHashBytes :: ScriptHash -> ByteString
- computeScriptHash :: ShortByteString -> ScriptHash
- cagePolicyIdFromCfg :: CageConfig -> PolicyID
- cageAddrFromCfg :: CageConfig -> Network -> Addr
- requestAddrFromCfg :: CageConfig -> TokenId -> Network -> Addr
- onChainTokenId :: TokenId -> OnChainTokenId
- mkRequestDatum :: TokenId -> Addr -> ByteString -> Edge -> Integer -> Integer -> Data
- mkRequestDatumWith :: TokenId -> Addr -> ByteString -> Edge -> Integer -> Integer -> (ByteString, Maybe Data) -> Data
- toPlcData :: ToData a => a -> Data
- toLedgerData :: ToData a => a -> Data ConwayEra
- mkInlineDatum :: Data -> Datum ConwayEra
- extractCageDatum :: TxOut ConwayEra -> Maybe CageDatum
- txInToRef :: TxIn -> OnChainTxOutRef
- addrKeyHashBytes :: Addr -> ByteString
- addrFromKeyHashBytes :: Network -> ByteString -> Addr
- addrWitnessKeyHash :: ByteString -> KeyHash 'Guard
- extractOwnerBytes :: TxOut ConwayEra -> ByteString
- emptyRoot :: ByteString
- policyIdFromPin :: ShortByteString -> PolicyID
- addrFromBytes :: ByteString -> Maybe Addr
Script construction
mkCageScript :: CageConfig -> Script ConwayEra Source #
Build the cage Script from config bytes.
mkRequestScript :: CageConfig -> TokenId -> Script ConwayEra Source #
Build the per-cage request Script from config bytes.
scriptFromBytes :: String -> ShortByteString -> Script ConwayEra Source #
scriptHashBytes :: ScriptHash -> ByteString Source #
computeScriptHash :: ShortByteString -> ScriptHash Source #
Compute the ScriptHash from raw script bytes.
Derived identity
cagePolicyIdFromCfg :: CageConfig -> PolicyID Source #
Compute the cage minting policy ID from config.
cageAddrFromCfg :: CageConfig -> Network -> Addr Source #
Compute the cage script address from config.
requestAddrFromCfg :: CageConfig -> TokenId -> Network -> Addr Source #
Compute the request script address for a token.
onChainTokenId :: TokenId -> OnChainTokenId Source #
Convert a ledger token id to its on-chain token id.
Datum helpers
Arguments
| :: TokenId | |
| -> Addr | |
| -> ByteString | |
| -> Edge | The seven-admitted-edges row index the request names |
| -> Integer | The deposit the request rides with, over and above the tip |
| -> Integer | |
| -> Data |
Build a CageDatum for a request at one seven-admitted-edges edge (#183).
Arguments
| :: TokenId | |
| -> Addr | |
| -> ByteString | |
| -> Edge | The seven-admitted-edges row index the request names |
| -> Integer | The deposit the request rides with, over and above the tip |
| -> Integer | |
| -> (ByteString, Maybe Data) | |
| -> Data |
A request datum naming where the edge it books delivers (#157 request-destination-binding) and carrying the datum the delivered output must hold (#419). The cage reads the destination for every edge that mints an active or terminal token, and the approval that certifies the edge binds the address and the hash of that datum, so the booking and the fold cannot disagree about where the token goes or what it carries.
toLedgerData :: ToData a => a -> Data ConwayEra Source #
Convert a ToData value to a ledger Data.
mkInlineDatum :: Data -> Datum ConwayEra Source #
Wrap Data as an inline
Datum.
extractCageDatum :: TxOut ConwayEra -> Maybe CageDatum Source #
Extract a CageDatum from an inline datum
in a TxOut.
Reference conversion
txInToRef :: TxIn -> OnChainTxOutRef Source #
Convert a ledger TxIn to an on-chain
OnChainTxOutRef.
addrKeyHashBytes :: Addr -> ByteString Source #
Extract the payment key hash raw bytes from
an Addr.
addrFromKeyHashBytes :: Network -> ByteString -> Addr Source #
Reconstruct an Addr from raw payment key
hash bytes.
addrWitnessKeyHash :: ByteString -> KeyHash 'Guard Source #
Extract a KeyHash 'Witness from raw
payment key hash bytes.
Request helpers
extractOwnerBytes :: TxOut ConwayEra -> ByteString Source #
Extract the owner key hash bytes from a
request TxOut.
Constants
Reference identity from pins
policyIdFromPin :: ShortByteString -> PolicyID Source #
The policy id a 28-byte pin names. The four pins the state datum carries are raw script hashes; this is the one place that turns one back into the ledger's own type.
addrFromBytes :: ByteString -> Maybe Addr Source #
The address a request's binary destination names (#157 request-destination-binding). The bytes are a full Cardano address, network byte and all, so nothing here supplies a network of its own.