| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cometa.SubTransaction.Plan
Description
Compose a sub-transaction intent with explicit resolved inputs. Building preserves the specified inputs and outputs; it adds no fee, collateral or change. Sign and attach the resulting sub-transaction separately.
import qualified Cometa.SubTransaction.Plan as Plan payment input output = Plan.spend input <> Plan.payTo output
Synopsis
- data Plan
- type DeferredRedeemer = Transaction -> [Utxo] -> Either Error EncodedPlutusData
- payTo :: Output -> Plan
- spend :: Utxo -> Plan
- spendWith :: Utxo -> Maybe EncodedPlutusData -> Maybe EncodedPlutusData -> Plan
- spendWithDeferredRedeemer :: Utxo -> DeferredRedeemer -> Maybe EncodedPlutusData -> Plan
- referenceInput :: Utxo -> Plan
- attachScript :: Script -> Plan
- mint :: AssetId -> Int64 -> Plan
- mintWithRedeemer :: AssetId -> Int64 -> EncodedPlutusData -> Plan
- mintWithDeferredRedeemer :: PolicyId -> [(AssetName, Int64)] -> DeferredRedeemer -> Plan
- metadata :: Word64 -> Metadatum -> Plan
- attachDatum :: EncodedPlutusData -> Plan
- certificate :: Certificate -> Plan
- certificateWithRedeemer :: Certificate -> EncodedPlutusData -> Plan
- certificateWithDeferredRedeemer :: Certificate -> DeferredRedeemer -> Plan
- withdraw :: RewardAddress -> Word64 -> Plan
- withdrawWithRedeemer :: RewardAddress -> Word64 -> EncodedPlutusData -> Plan
- withdrawWithDeferredRedeemer :: RewardAddress -> Word64 -> DeferredRedeemer -> Plan
- requireSigner :: KeyHash Payment -> Plan
- validFrom :: Word64 -> Plan
- validUntil :: Word64 -> Plan
- requireTopLevelGuard :: Credential Guard -> Maybe EncodedPlutusData -> Plan
- requireGuard :: Credential Guard -> Plan
- guardWithRedeemer :: ScriptHash -> EncodedPlutusData -> Plan
- directDeposit :: RewardAddress -> Word64 -> Plan
- accountBalance :: RewardAddress -> BalanceInterval -> Plan
- donate :: Word64 -> Plan
- propose :: RewardAddress -> Action -> Anchor -> Plan
- proposeWithRedeemer :: RewardAddress -> Action -> Anchor -> EncodedPlutusData -> Plan
- proposeWithDeferredRedeemer :: RewardAddress -> Action -> Anchor -> DeferredRedeemer -> Plan
- vote :: Voter -> ActionId -> VotingProcedure -> Plan
- voteWithRedeemer :: Voter -> [(ActionId, VotingProcedure)] -> EncodedPlutusData -> Plan
- voteWithDeferredRedeemer :: Voter -> [(ActionId, VotingProcedure)] -> DeferredRedeemer -> Plan
- resolvedInputs :: Plan -> [Utxo]
Documentation
Ordered intent instructions. Composition combines mint quantities and validity requirements, preserving outputs and certificate order. Conflicting arguments or snapshots fail when building. Plans contain functions, so their monoid laws concern behavior rather than structural equality.
type DeferredRedeemer = Transaction -> [Utxo] -> Either Error EncodedPlutusData Source #
Compute an argument once from the local draft: its fee is zero, inputs and redeemer indices are local to the sub-transaction, and resolved spending inputs are in canonical order. Reference inputs are available in the draft body but absent from the supplied spending snapshot. Return an error to abort. The callback must be pure and deterministic. Snapshots are ordinary owned values; no pointer or resource scope escapes the build.
payTo :: Output -> Plan Source #
Append an output in creation order. Building preserves its exact value.
spendWith :: Utxo -> Maybe EncodedPlutusData -> Maybe EncodedPlutusData -> Plan Source #
Spend a script output with optional argument and datum witness.
spendWithDeferredRedeemer :: Utxo -> DeferredRedeemer -> Maybe EncodedPlutusData -> Plan Source #
Spend a script output with a local deferred argument and optional datum witness. Register each input once.
referenceInput :: Utxo -> Plan Source #
Make a resolved reference output available without spending it.
attachScript :: Script -> Plan Source #
Attach a native or compiled Plutus script. Executed sub-level scripts require V4. Repeated attachments with the same language and script bytes contribute one witness, ordered by the first attachment.
mint :: AssetId -> Int64 -> Plan Source #
Mint or burn a native asset. Ada and combined quantity overflow fail at build.
mintWithRedeemer :: AssetId -> Int64 -> EncodedPlutusData -> Plan Source #
Mint or burn a Plutus-policy asset with an immediate argument.
mintWithDeferredRedeemer :: PolicyId -> [(AssetName, Int64)] -> DeferredRedeemer -> Plan Source #
Mint or burn a group of names under one policy with one local deferred argument. Repeated names combine and zero totals disappear. Register each policy once.
metadata :: Word64 -> Metadatum -> Plan Source #
Attach a metadata label; conflicting values fail at build.
attachDatum :: EncodedPlutusData -> Plan Source #
Attach an exact datum witness. Repeated exact CBOR encodings contribute one witness, including data supplied to spending inputs, in first occurrence order. Different encodings remain distinct because their hashes differ.
certificate :: Certificate -> Plan Source #
Append a typed certificate without a script argument.
certificateWithRedeemer :: Certificate -> EncodedPlutusData -> Plan Source #
Append a typed certificate authorized by an immediate argument.
certificateWithDeferredRedeemer :: Certificate -> DeferredRedeemer -> Plan Source #
Append a typed certificate authorized by a local deferred argument.
withdraw :: RewardAddress -> Word64 -> Plan Source #
Withdraw rewards from a key-controlled account. Amounts must fit signed 64-bit.
withdrawWithRedeemer :: RewardAddress -> Word64 -> EncodedPlutusData -> Plan Source #
Withdraw rewards with an immediate Plutus argument.
withdrawWithDeferredRedeemer :: RewardAddress -> Word64 -> DeferredRedeemer -> Plan Source #
Withdraw rewards with a local deferred argument. Register each account once.
validFrom :: Word64 -> Plan Source #
Inclusive lower validity slot; composition takes the greatest lower bound.
validUntil :: Word64 -> Plan Source #
Exclusive upper validity slot; composition takes the least upper bound.
requireTopLevelGuard :: Credential Guard -> Maybe EncodedPlutusData -> Plan Source #
Require an outer guard and optional datum for this intent. This records a requirement; the enclosing transaction must satisfy it when assembled.
requireGuard :: Credential Guard -> Plan Source #
Require a key or native-script guard. Use guardWithRedeemer for Plutus guards.
guardWithRedeemer :: ScriptHash -> EncodedPlutusData -> Plan Source #
Require a local Plutus guard with its immediate argument.
directDeposit :: RewardAddress -> Word64 -> Plan Source #
Deposit lovelace directly into a reward account. Repeated amounts combine.
accountBalance :: RewardAddress -> BalanceInterval -> Plan Source #
Require a reward-account balance interval for this intent.
propose :: RewardAddress -> Action -> Anchor -> Plan Source #
Append a governance proposal, using the configured governance deposit.
Parameter changes and treasury withdrawals naming a guardrails policy use
the unit argument Constr 0 [] and require a supplied Plutus V4 script.
Actions without a policy do not create a proposing redeemer.
proposeWithRedeemer :: RewardAddress -> Action -> Anchor -> EncodedPlutusData -> Plan Source #
Append a proposal with a guardrails argument. The action must name a policy; the configured protocol snapshot supplies its deposit. Attach the script or resolve its reference input separately. Duplicate proposals fail at build.
proposeWithDeferredRedeemer :: RewardAddress -> Action -> Anchor -> DeferredRedeemer -> Plan Source #
Compute a proposal's guardrails argument from the local draft. Proposal indices and resolved inputs belong to this subtransaction. The action must name a policy; duplicate proposals fail at build.
voteWithRedeemer :: Voter -> [(ActionId, VotingProcedure)] -> EncodedPlutusData -> Plan Source #
Cast several votes under one voter with one immediate argument.
voteWithDeferredRedeemer :: Voter -> [(ActionId, VotingProcedure)] -> DeferredRedeemer -> Plan Source #
Cast several votes under one voter with one local deferred argument. Register each voter once; empty groups do not invoke the callback.
resolvedInputs :: Plan -> [Utxo] Source #
Unique spending and reference snapshots in ascending input-reference order. Conflicting original snapshots are rejected when building. Supply this result alongside a successfully built intent when attaching it to an outer plan.