MDK Logo

Types

TypeScript types exported by @tetherto/mdk-react-devkit/core (UI primitives) and @tetherto/mdk-react-devkit/foundation (mining domain models)

This page documents the TypeScript types exported by the MDK packages. The two packages cover different territory:

  • Core types ships UI primitive types: sizes, variants, colors, status, common API and chart shapes. These are the building blocks consumed by core components and re-used in your own component prop types.
  • Foundation types ships mining-domain models: Device, Container, Alert, MinerStats, settings shapes. These describe the data flowing through foundation components and the API responses they consume.

Core types

UI primitive types exported by @tetherto/mdk-react-devkit/core — sizes, variants, colors, status, and common API and chart shapes. These are the building blocks consumed by core components and re-used in your own component prop types.

Prerequisites

Import

@tetherto/mdk-react-devkit/core
import type {
  ComponentSize,
  ButtonVariant,
  ColorVariant,
  Status,
  ApiResponse,
} from '@tetherto/mdk-react-devkit/core'

Common types

ComponentSize

@tetherto/mdk-react-devkit/core

Standard size variants used across multiple components.

type ComponentSize = 'sm' | 'md' | 'lg'

Used by: Button, Badge, Checkbox, Switch, Radio, Spinner, Indicator, EmptyState, Pagination.

ButtonSize

@tetherto/mdk-react-devkit/core

Extends ComponentSize with an icon-only variant.

type ButtonSize = ComponentSize | 'icon'

BorderRadius

@tetherto/mdk-react-devkit/core

Border radius variants for form components.

type BorderRadius = 'none' | 'small' | 'medium' | 'large' | 'full'

Used by: Checkbox, Switch, Radio.

ColorVariant

@tetherto/mdk-react-devkit/core

Comprehensive color variants for components.

type ColorVariant =
  | 'default'
  | 'primary'
  | 'secondary'
  | 'success'
  | 'warning'
  | 'error'
  | 'info'

StatusVariant

@tetherto/mdk-react-devkit/core

Status variants for state indication.

type StatusVariant = 'success' | 'processing' | 'error' | 'warning' | 'default' | 'idle'

Used by: badges, notifications, status indicators.

ComponentColor

@tetherto/mdk-react-devkit/core

Color options for form components.

type ComponentColor = 'default' | 'primary' | 'success' | 'warning' | 'error'

Used by: Checkbox, Switch, Radio, Typography.

Position

@tetherto/mdk-react-devkit/core

Position/side options for UI elements.

type Position = 'top' | 'right' | 'bottom' | 'left'

Used by: Tooltip, Popover, chart legends.

TextAlign

@tetherto/mdk-react-devkit/core

Text alignment options.

type TextAlign = 'left' | 'center' | 'right' | 'justify'

FlexAlign

@tetherto/mdk-react-devkit/core

Flex/grid alignment options.

type FlexAlign = 'start' | 'center' | 'end'

Component types

ButtonVariant

@tetherto/mdk-react-devkit/core

Button visual variants.

type ButtonVariant =
  | 'primary'
  | 'secondary'
  | 'danger'
  | 'tertiary'
  | 'link'
  | 'icon'
  | 'outline'
  | 'ghost'

ButtonIconPosition

@tetherto/mdk-react-devkit/core

Where icons appear in buttons.

type ButtonIconPosition = 'left' | 'right'

NotificationVariant

@tetherto/mdk-react-devkit/core

Toast/notification variants.

type NotificationVariant = 'success' | 'error' | 'warning' | 'info'

BadgeStatus

@tetherto/mdk-react-devkit/core

Badge status options.

type BadgeStatus = 'success' | 'processing' | 'error' | 'warning' | 'default'

TypographyColor

@tetherto/mdk-react-devkit/core

Typography color options including muted.

type TypographyColor = 'default' | 'primary' | 'success' | 'warning' | 'error' | 'muted'

Utility types

UnknownRecord

@tetherto/mdk-react-devkit/core

Generic type for objects with unknown structure.

type UnknownRecord = Record<string, unknown>

Nullable / Optional / Maybe

@tetherto/mdk-react-devkit/core

Null/undefined wrapper types.

type Nullable<T> = T | null
type Optional<T> = T | undefined
type Maybe<T> = T | null | undefined

Status

@tetherto/mdk-react-devkit/core

Async operation status.

type Status = 'idle' | 'loading' | 'success' | 'error'

API types

PaginationParams

@tetherto/mdk-react-devkit/core

Pagination request parameters.

type PaginationParams = {
  limit?: number
  offset?: number
  page?: number
}

PaginatedResponse

@tetherto/mdk-react-devkit/core

Paginated response wrapper.

type PaginatedResponse<T> = {
  data: T[]
  page: number
  total: number
  totalPages: number
}

ApiResponse

@tetherto/mdk-react-devkit/core

API response wrapper.

type ApiResponse<T> = {
  data: T
  message?: string
  status: number
}

ApiError

@tetherto/mdk-react-devkit/core

API error response structure.

type ApiError = {
  error: string
  message: string
  status: number
  data?: {
    message?: string
  }
}

Data table types

@tetherto/mdk-react-devkit/core

Re-exported from TanStack Table for convenience.

import type {
  DataTableColumnDef,
  DataTableExpandedState,
  DataTablePaginationState,
  DataTableRow,
  DataTableRowSelectionState,
  DataTableSortingState,
} from '@tetherto/mdk-react-devkit/core'

Value types

ValueUnit

@tetherto/mdk-react-devkit/core

A value paired with a unit, used for display formatting.

type ValueUnit = {
  value: number | string | null
  unit: string
  realValue: number
}

HashrateUnit / CurrencyUnit

@tetherto/mdk-react-devkit/core

Specialized value-unit aliases.

type HashrateUnit = ValueUnit
type CurrencyUnit = ValueUnit

UnitLabel

@tetherto/mdk-react-devkit/core

SI-prefix unit labels.

type UnitLabel = 'decimal' | 'k' | 'M' | 'G' | 'T' | 'P'

Time types

TimeRangeFormatted

@tetherto/mdk-react-devkit/core

A formatted time range.

type TimeRangeFormatted = {
  start: string
  end: string
  formatted: string
}

TimeInterval

@tetherto/mdk-react-devkit/core

A time interval with start/end timestamps.

type TimeInterval = {
  start: number
  end: number
}

Chart types

ChartLegendPosition

@tetherto/mdk-react-devkit/core

Chart legend position options.

type ChartLegendPosition = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'chartArea'

WeightedAverageResult

@tetherto/mdk-react-devkit/core

Result from weighted average calculation.

type WeightedAverageResult = {
  avg: number
  totalWeight: number
  weightedValue: number
}

ErrorWithTimestamp

@tetherto/mdk-react-devkit/core

An error with optional timestamp.

type ErrorWithTimestamp = {
  msg?: string
  message?: string
  timestamp?: number | string
}

Foundation types

Foundation types describe the shape of devices, containers, alerts, site configuration, and settings data flowing through @tetherto/mdk-react-devkit/foundation components and API responses. They are organized into barrels including alerts, config, device, and settings.types.

Prerequisites

Import

@tetherto/mdk-react-devkit/foundation
import type {
  Alert,
  Device,
  DeviceLast,
  DeviceInfo,
  ContainerSnap,
  ContainerStats,
  MinerStats,
  MinerConfig,
  SettingsUser,
  PermLevel,
  GlobalConfig,
  TimelineChartDataPoint,
  TimelineChartDataset,
  TimelineChartData,
  ChartRange,
  AxisTitleText,
  MetricsEfficiencyLogEntry,
} from '@tetherto/mdk-react-devkit/foundation'

Alert types

Alert

@tetherto/mdk-react-devkit/foundation

Raw alert record as it appears on a device's alerts array.

type Alert = {
  id?: string
  severity: string
  createdAt: number | string
  name: string
  description: string
  message?: string
  uuid?: string
  code?: string | number
  [key: string]: unknown
}

The severity field uses string values like critical, high, medium, low. The open [key: string]: unknown index signature allows vendor-specific fields without breaking the type contract.

LogFormattedAlertData

@tetherto/mdk-react-devkit/foundation

Alert reshaped for log display components (e.g., AlertsLog).

type LogFormattedAlertData = {
  title: string
  subtitle: string
  status: string
  severityLevel: number
  creationDate: number | string
  body: string
  id: string
  uuid?: string
  [key: string]: unknown
}

Device types

The Device family models everything that appears on the device explorer: miners, containers, power meters, temperature sensors, and cabinets. The shape is intentionally permissive (open index signatures, optional fields) because devices come from a live API that adds vendor-specific fields over time.

Device

@tetherto/mdk-react-devkit/foundation

The root device record. Used pervasively in the operations centre components.

type Device = {
  id: string
  type: string
  tags?: string[]
  rack?: string
  last?: DeviceLast
  username?: string
  info?: DeviceInfo
  containerId?: string
  address?: string | null
  code?: string
  alerts?: Alert[] | null
  powerMeters?: Device[]
  tempSensors?: Device[]
  transformerTempSensor?: Device
  rootTempSensor?: Device
  [key: string]: unknown
}

The type string discriminates devices by category (such as miner or container) and by vendor. The last field carries the latest snapshot from the device.

DeviceLast

@tetherto/mdk-react-devkit/foundation

The latest reading wrapper that lives on Device.last.

type DeviceLast = {
  err?: string | null
  type?: string
  snap?: ContainerSnap
  alerts?: Alert[] | null
  [key: string]: unknown
}

err is a connection or upstream error string when the device is unreachable. snap carries the actual stats and config payload.

DeviceInfo

@tetherto/mdk-react-devkit/foundation

Identification and placement metadata that lives on Device.info.

type DeviceInfo = {
  container?: string
  pos?: string
  poolConfig?: string
  serialNum?: string
  macAddress?: string | null
  posHistory?: Partial<PosHistoryEntry[]>
  [key: string]: unknown
}

PosHistoryEntry

@tetherto/mdk-react-devkit/foundation

A single past placement of a miner.

type PosHistoryEntry = {
  container: string
  pos: string
  removedAt: number
}

DeviceData

@tetherto/mdk-react-devkit/foundation

A flattened version of Device with a guaranteed (non-optional) snap field, returned by the getDeviceData helper.

type DeviceData = {
  id: string
  type: string
  tags?: string[]
  rack?: string
  snap: ContainerSnap
  alerts?: Alert[]
  username?: string
  info?: DeviceInfo
  containerId?: string
  address?: string
  err?: string
  [key: string]: unknown
}

Container types

Container

@tetherto/mdk-react-devkit/foundation

A Device specialized for containers, with container-specific info and last shapes.

type Container = {
  info?: Partial<ContainerInfo>
  last?: Partial<ContainerLast>
} & Device

ContainerInfo

@tetherto/mdk-react-devkit/foundation

Cooling, supply, and pressure metadata for a container.

type ContainerInfo = {
  container: string
  cooling_system: Record<string, unknown>
  cdu: Record<string, unknown>
  primary_supply_temp: number
  second_supply_temp1: number
  second_supply_temp2: number
  supply_liquid_temp: number
  supply_liquid_set_temp: number
  supply_liquid_pressure: number
  return_liquid_pressure: number
}

ContainerPosInfo

@tetherto/mdk-react-devkit/foundation

Position descriptor for a device inside a container (PDU/socket coordinates).

type ContainerPosInfo = {
  containerInfo: Partial<{ container: string; type: string }>
  pdu: string | number
  socket: string | number
  pos: string
  [key: string]: unknown
}

ContainerLast

@tetherto/mdk-react-devkit/foundation

Last-snapshot wrapper for a container.

type ContainerLast = {
  snap: {
    stats?: Partial<ContainerStats>
  }
  alerts: unknown[] | null
  err: string | null
}

ContainerSnap

@tetherto/mdk-react-devkit/foundation

The snap payload found on DeviceLast.snap for both miners and containers. stats is what most components read.

type ContainerSnap = {
  stats?: Partial<ContainerStats>
  config?: Record<string, unknown>
}

ContainerStats

@tetherto/mdk-react-devkit/foundation

The big stats blob produced by every container snapshot.

type ContainerStats = {
  status: string
  ambient_temp_c: number
  humidity_percent: number
  power_w: number
  container_specific: Partial<ContainerSpecific>
  distribution_box1_power_w: number
  distribution_box2_power_w: number
  stats: Record<string, unknown>
  temperature_c: Partial<StatsTemperatureC>
  frequency_mhz: Partial<StatsFrequencyMhz>
  miner_specific: Partial<MinerSpecificStats>
  [key: string]: unknown
}

status is one of running, offline, stopped (see CONTAINER_STATUS in Constants).

ContainerSpecific

@tetherto/mdk-react-devkit/foundation

Container-specific stats (currently the PDU array).

type ContainerSpecific = {
  pdu_data: Partial<ContainerPduData>[]
  [key: string]: unknown
}

ContainerPduData

@tetherto/mdk-react-devkit/foundation

Per-PDU power and status reading.

type ContainerPduData = {
  power_w: number
  status: number
}

StatsTemperatureC

@tetherto/mdk-react-devkit/foundation

Temperature stats with per-chip detail.

type StatsTemperatureC = {
  avg: number
  min: number
  max: number
  chips: TempChipData[]
  [key: string]: unknown
}

StatsFrequencyMhz

@tetherto/mdk-react-devkit/foundation

Frequency stats with per-chip detail.

type StatsFrequencyMhz = {
  avg: number
  chips: ChipData[]
  [key: string]: unknown
}

ChipData / TempChipData

@tetherto/mdk-react-devkit/foundation

Per-chip readings.

type ChipData = {
  index: number
  current: number
}

type TempChipData = {
  index: number
  max?: number
  min?: number
  avg?: number
}

MinerSpecificStats

@tetherto/mdk-react-devkit/foundation

Miner-specific stats blob.

type MinerSpecificStats = {
  upfreq_speed: number
  [key: string]: unknown
}

Miner types

MinerStats

@tetherto/mdk-react-devkit/foundation

Per-miner stats reported on each snapshot.

type MinerStats = {
  status?: string
  uptime_ms?: number
  power_w?: number
  hashrate_mhs?: MinerHashrateMhs
  poolHashrate?: string
  temperature_c?: { max?: number }
}

MinerHashrateMhs

@tetherto/mdk-react-devkit/foundation

Hashrate readings, currently just the rolling 5-minute window.

type MinerHashrateMhs = {
  t_5m?: number
}

MinerInfo

@tetherto/mdk-react-devkit/foundation

Identifying info for a miner (used by miner record cards).

type MinerInfo = {
  container?: string
  pos?: string
  macAddress?: string
  serialNum?: string
}

MinerConfig

@tetherto/mdk-react-devkit/foundation

Mutable miner configuration.

type MinerConfig = {
  firmware_ver?: string
  power_mode?: string
  led_status?: boolean
}

power_mode values come from MINER_POWER_MODE (sleep, low, normal, high).

MinerDeviceSnapshot

@tetherto/mdk-react-devkit/foundation

Lightweight snapshot wrapper holding only MinerConfig.

type MinerDeviceSnapshot = {
  last?: { snap?: { config?: MinerConfig } }
}

MinerRecord

@tetherto/mdk-react-devkit/foundation

Combined miner record used by list/table views.

type MinerRecord = {
  id?: string
  shortCode?: string
  info?: MinerInfo
  address?: string
  type?: string
  alerts?: unknown[]
  stats?: MinerStats
  config?: MinerConfig
  device?: MinerDeviceSnapshot
  error?: string
  err?: string
  isPoolStatsEnabled?: boolean
}

Power and cabinet types

PowerMeter

@tetherto/mdk-react-devkit/foundation

Minimal power meter reading shape.

type PowerMeter = {
  last?: {
    snap?: {
      stats?: {
        power_w?: number
      }
    }
  }
}

LvCabinetRecord

@tetherto/mdk-react-devkit/foundation

LV cabinet record carrying its associated power meters.

type LvCabinetRecord = {
  id: string
  powerMeters?: PowerMeter[]
}

Config types

GlobalConfig

@tetherto/mdk-react-devkit/foundation

Site-wide configuration from your API or store, including nominal targets for reporting dashboards. Load this shape in your app from your API or store and pass it into foundation reporting UI as needed.

type GlobalConfig = {
  nominalSiteHashrate_MHS?: number
  nominalAvailablePowerMWh?: number
  nominalPowerConsumption_MW?: number
  nominalWeightedAvgEfficiency_WThs?: number
  nominalMinerCapacity?: number
  isAutoSleepAllowed?: boolean
  siteEnergyDataThresholdMWh?: number
  [key: string]: unknown
}
FieldTypeDescription
nominalSiteHashrate_MHSnumberNominal site hashrate (MH/s)
nominalAvailablePowerMWhnumberNominal available power (MWh on the wire)
nominalPowerConsumption_MWnumberNominal power consumption (MW)
nominalWeightedAvgEfficiency_WThsnumberNominal weighted average efficiency (W/TH)
nominalMinerCapacitynumberNominal miner capacity
isAutoSleepAllowedbooleanWhether auto-sleep is permitted for the site
siteEnergyDataThresholdMWhnumberEnergy data threshold (MWh)
[key: string]unknownAdditional API fields without breaking the type

Timeline chart types

Types for TimelineChart in @tetherto/mdk-react-devkit/foundation. Each segment uses x: [startMs, endMs] and y matching a row in labels.

TimelineChartDataPoint

@tetherto/mdk-react-devkit/foundation

One horizontal segment on a timeline row.

type TimelineChartDataPoint = {
  x: [number, number]
  y: string | undefined
}
FieldTypeDescription
x[number, number]Segment start and end (epoch ms)
ystring | undefinedRow label; must match an entry in TimelineChartData.labels

TimelineChartDataset

@tetherto/mdk-react-devkit/foundation

A named group of segments (legend entry).

type TimelineChartDataset = {
  label: string
  data: TimelineChartDataPoint[]
  borderColor?: string[]
  backgroundColor?: string[]
  color?: string
}

TimelineChartData

@tetherto/mdk-react-devkit/foundation

Full payload for initialData and newData.

type TimelineChartData = {
  labels: string[]
  datasets: TimelineChartDataset[]
}
FieldTypeDescription
labelsstring[]Row names (Y axis)
datasetsTimelineChartDataset[]Segment groups keyed by label

ChartRange

@tetherto/mdk-react-devkit/foundation

Visible time window for the range prop.

type ChartRange = {
  min: Date | number
  max: Date | number
}

AxisTitleText

@tetherto/mdk-react-devkit/foundation

Axis title strings for axisTitleText.

type AxisTitleText = {
  x: string
  y: string
}

Metrics efficiency types

Types for /auth/metrics/efficiency, used by the site view tab on OperationsEfficiency.

MetricsEfficiencyLogEntry

@tetherto/mdk-react-devkit/foundation

One point on the site efficiency time series.

type MetricsEfficiencyLogEntry = {
  ts: number
  efficiencyWThs: number
}
FieldTypeDescription
tsnumberTimestamp (epoch ms)
efficiencyWThsnumberSite efficiency (W/TH) at ts

MetricsEfficiencySummary

@tetherto/mdk-react-devkit/foundation

Summary block returned with the efficiency metrics response.

type MetricsEfficiencySummary = {
  avgEfficiencyWThs: number | null
}

MetricsEfficiencyResponse

@tetherto/mdk-react-devkit/foundation

Wrapper for the efficiency metrics endpoint (log entries plus summary), using the shared MetricsResponse shape from @tetherto/mdk-react-devkit/foundation.

Settings types

SettingsUser

@tetherto/mdk-react-devkit/foundation

A user record as it appears in user-management lists.

type SettingsUser = {
  id: string
  name?: string
  email: string
  role: string
  last_login?: string
  lastActive?: string
  [key: string]: unknown
}

RoleOption

@tetherto/mdk-react-devkit/foundation

Role option for select dropdowns. Also exported as the array USER_ROLES in Constants.

type RoleOption = {
  label: string
  value: string
}

PermLevel

@tetherto/mdk-react-devkit/foundation

Permission level values.

type PermLevel = 'rw' | 'r' | false

RolesPermissionsData

@tetherto/mdk-react-devkit/foundation

The shape consumed by RBACControlSettings.

type RolesPermissionsData = {
  permissions: Record<string, Record<string, PermLevel>>
  labels: Record<string, string>
}

SettingsExportData

@tetherto/mdk-react-devkit/foundation

The export envelope produced and consumed by ImportExportSettings. Generic TExtra lets you attach app-specific extras.

type SettingsExportData<TExtra extends Record<string, unknown> = Record<string, unknown>> = {
  headerControls?: Record<string, boolean>
  featureFlags?: Record<string, boolean>
  timestamp?: string
  version?: string
} & TExtra

ImportResult

@tetherto/mdk-react-devkit/foundation

Result returned from settings import operations.

type ImportResult = {
  success: boolean
  applied?: string[]
  errors?: string[]
  message?: string
}

On this page