hydra-tui
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.TUI.Forms

Synopsis

Documentation

renderUTxOAsAda :: (TxIn, TxOut CtxUTxO) -> Text Source #

Render a UTxO entry as "txin#ix ↦ ₳ X.XXXXXX" for form labels. The TxIn is shortened to the last 10 characters of the hash plus its '#index' suffix.

utxoRadioField :: forall s e n. (s ~ (TxIn, TxOut CtxUTxO), n ~ Text) => Map TxIn (TxOut CtxUTxO) -> Maybe (Form s e n) Source #

utxoCheckboxField :: forall e n. n ~ Text => Map TxIn (TxOut CtxUTxO) -> Maybe (Form (Map TxIn (TxOut CtxUTxO, Bool)) e n) Source #

Build a multi-select (checkbox) form over a UTxO set: each entry can be toggled with Space, and the form state records which are selected. Used for selective partial fanout, where the user picks one or more UTxOs to fan out in a single PartialFanout. Returns Nothing for an empty UTxO set.

utxoCheckboxFieldWith :: forall e n. n ~ Text => Maybe (Map TxIn (TxOut CtxUTxO, Bool)) -> Map TxIn (TxOut CtxUTxO) -> Maybe (Form (Map TxIn (TxOut CtxUTxO, Bool)) e n) Source #

Like utxoCheckboxField but carries over a previous selection: any TxIn still present keeps its ticked state, new entries default to unticked, and entries no longer in the set are dropped. Used to rebuild the open fanout modal when a HeadPartiallyFannedOut step shrinks the remaining UTxO.

depositIdRadioField :: forall s e n. (s ~ TxId, n ~ Text) => [(TxId, UTxO)] -> Maybe (Form s e n) Source #

Build a radio form for selecting one pending deposit (by TxId) to recover. The form yields just the TxId — the full UTxO breakdown is rendered separately in the recover detail panel (see drawRecoverDetail).

depositIdRadioFieldWith :: forall s e n. (s ~ TxId, n ~ Text) => Maybe TxId -> [(TxId, UTxO)] -> Maybe (Form s e n) Source #

Like depositIdRadioField, but use desired as the initial selection if it is still present in the list (otherwise fall back to the first entry). Used when rebuilding the recovery form after the underlying pendingIncrements has changed.

renderDepositSummary :: TxId -> UTxO -> Text Source #

One-line summary of a pending deposit: shortened TxId plus the total lovelace across all its outputs.

confirmRadioField :: forall s e n. (s ~ Bool, n ~ Text) => Form s e n Source #

type FormFieldRenderHelper a n = a -> Text -> Bool -> Widget n -> Widget n Source #

customRadioField Source #

Arguments

:: (Ord n, Eq a) 
=> LeftBracketChar 
-> CheckmarkChar 
-> RightBracketChar 
-> Lens' s a

The state lens for this value.

-> [(a, n, Text)]

The available choices, in order. Each choice has a value of type a, a resource name, and a text label.

-> FormFieldRenderHelper a n

Render widget helper.

-> s

The initial form state.

-> FormFieldState s e n