MDK Logo

Miscellaneous Hooks

Miscellaneous and uncategorized hooks

Miscellaneous and general-purpose hooks.

Package

@tetherto/mdk-react-devkit

Hooks

@tetherto/mdk-react-devkit

useEnergyReportSite

Merges site energy consumption (v2 /auth/metrics/consumption) with snapshot tail-log and container list data for the Energy report site tab.

({ dateRange: _dateRange, consumptionLog, consumptionLoading, consumptionFetching, consumptionError, nominalPowerAvailabilityMw, nominalConfigLoading, tailLog, tailLogLoading, containers, containersLoading, }: UseEnergyReportSiteInput) => U/* see source */

useHashBalance

Derives hash-balance metrics and chart datasets from finance log entries for the active date range, currency, and timeframe type. Used by hash balance panels.

({ data, log, currency, dateRange, timeframeType, }: UseHashBalanceInput) => { siteHashRevenueChartData: BarChartDataResult; networkHashpriceChartData: BarChartDataResult; combinedCostChartData: BarChartDataResult; isEmpty: boolean; periodT… /* see source */

useSubsidyFees

Aggregates raw subsidy-fee log entries into chart-ready datasets keyed by the active period type (day / week / month / year) and surfaces a summary for the matching reporting widgets. Used by SubsidyFee; expose to downstream apps that need to recompose the same datasets in a custom UI.

({ data, log, dateRange }: UseSubsidyFeesInput) => { summary: SubsidyFeeSummary; filteredLog: SubsidyFeesLogEntry[]; aggregatedData: AggregatedPeriodData[]; subsidyFeesChartData: BarChartDataResult; averageFeesChartData: BarChartDataResult;… /* see source */

useUpdateExistedActions

Mutation hook that updates only the changed fields of an existing action record.

Removes tags from existing pending submissions if those tags belong to the newly selected devices; if the resulting tag list is empty, the submission itself is removed. This avoids duplicate pending actions for the same device.

() => { updateExistedActions: ({ actionType, pendingSubmissions, selectedDevices, }: UpdateExistedActionsParams) => void; }
@tetherto/mdk-react-devkit

useHashrate

Base hook for a single Hashrate tab (single-site mode). Normalizes a grouped-hashrate query result to the { log, isLoading, error } shape consumed by <HashrateSiteView>, <HashrateMinerTypeView>, and <HashrateMiningUnitView>. Call once per tab the consumer needs to render - each tab fetches independently because they use different groupBy axes and (typically) different date ranges.

({ query }?: UseHashrateOptions) => UseHashrateResult

useOperationsDashboard

Shapes raw operational metric logs into chart-ready payloads for the four operational-dashboard cards. DI-style: it never fetches - wire your data layer (RTK Query, TanStack, fixtures) and pass the results in. All unit conversion and series shaping happens here so the chart components stay purely presentational.

(input?: Partial<{ hashrate: Partial<{ log: readonly OperationsTrendPoint[]; nominalValue: number | null; isLoading: boolean; error: unknown; }>; consumption: Partial<{ log: readonly OperationsTrendPoint[]; nominalValue: number | null; isLo… /* see source */

On this page