Relaycode

Overview

Substrate-aware input components for the Polkadot ecosystem

Component Overview

Relaycode ships a library of 22 input components and 10 contextual selectors that map directly to Substrate runtime types. Each component understands the SCALE type it represents, validates input accordingly, and emits values ready for SCALE encoding.

Components are resolved automatically through a priority-based type resolution system.

Available Components

ComponentSubstrate TypesDescription
AccountInputAccountId, MultiAddress, AddressAddress input with wallet integration and SS58 validation
BalanceInputBalance, BalanceOf, Compact<Balance>Token amount with denomination selector and balance display
AmountInputu8-u128, i8-i128, Compact<uN>Numeric integer input for unsigned and signed integers
BoolInputboolToggle switch for boolean parameters
HashInputH160, H256, H512, HashFixed-length hex hash input with length validation
BytesInputBytes, Vec<u8>Raw bytes hex input with multiple input modes
CallInputCall, RuntimeCallNested extrinsic builder for composing calls
EnumInputEnum types from metadataVariant selector with dynamic inner value resolution
OptionInputOption<T>Optional value toggle wrapping any inner type
StructInputStruct types from metadataNamed field grouping with recursive sub-inputs
TextInputString, TextBasic string input and fallback for unknown types
TupleInput(T1, T2, ...)Positional element inputs for tuple types
VectorInputVec<T>, BoundedVec<T>, BTreeSet<T>Dynamic-length array with add/remove controls (supports unique mode for sets)
VectorFixedInput[T; N]Fixed-length array with N input slots
BTreeMapInputBTreeMap<K, V>Key-value pair entries
MomentInputMomentTimestamp input with date picker and presets
VoteInputAccountVoteVoting preference input (Standard/Split)
VoteThresholdInputVoteThresholdThreshold selector (SuperMajorityApprove/Against/SimpleMajority)
KeyValueInputKeyValueSingle key-value pair input

For the full priority ordering and pattern matching details, see the Input Map API reference.

Shared Props

Every input component implements the ParamInputProps interface:

interface ParamInputProps {
  name: string;
  label?: string;
  description?: string;
  typeName?: string;
  isDisabled?: boolean;
  isRequired?: boolean;
  error?: string;
  client: DedotClient<PolkadotApi>;
  typeId?: number;
  value?: any;
  onChange?: (value: unknown) => void;
  palletContext?: PalletContextData | null;
  isContextLoading?: boolean;
}

See individual component pages for type-specific props and behavior details.

Contextual Selectors

When the extrinsic builder detects specific pallet and method combinations, it replaces generic inputs with contextual selectors that display live chain data. These are resolved via findComponentWithContext before falling back to the standard registry.

SelectorPalletsDescription
ValidatorSelectorStaking, NominationPoolsSearchable combobox for validators (single-select and multi-select modes)
PoolSelectorNominationPoolsSearchable dropdown for nomination pool selection
ReferendumSelectorConvictionVoting, ReferendaDropdown for selecting active referenda
BountySelectorBountiesSelector for on-chain bounty IDs
TrackSelectorConvictionVotingDropdown for OpenGov track selection
EraSelectorStakingEra index input with current era context
ContextHintVariousInformational display for contextual data
SelectorFallbackVariousLoading/error state wrapper for selectors