MDK Logo
ReferenceUI KitReactUI Kit foundationComponentsDialogs

AssignPoolModal

Modal dialog for bulk-assigning a set of selected miners to a pool config. Displays the miner list, a pool selector with metadata (unit/miner counts, last-up…

Modal dialog for bulk-assigning a set of selected miners to a pool config. Displays the miner list, a pool selector with metadata (unit/miner counts, last-updated time), an endpoints preview, and an optional credential template preview. Submission is async; the modal stays open with a loading state until the parent resolves.

import { AssignPoolModal } from "@tetherto/mdk-react-devkit";
PropStatusTypeDefaultDescription
isOpenRequiredboolean
onCloseRequired() => void
onSubmitRequired(values: { pool: PoolSummary; }) => Promise<void>
minersRequiredDevice[]
poolConfigRequiredPoolConfigEntry[]

Usage

Modal dialog for bulk-assigning a set of selected miners to a pool config. Displays the miner list, a pool selector with metadata (unit/miner counts, last-updated time), an endpoints preview, and an optional credential template preview. Submission is async; the modal stays open with a loading state until the parent resolves.

Data contracts

  • Devicefoundation/types/device.ts; only id, code, tags, info.container, info.poolConfig, and last.snap.stats.status are read.
  • PoolConfigDatafoundation/components/pool-manager/hooks/use-pool-configs.ts; the hook parses poolUrls into typed PoolEndpoint[] and resolves pool metadata.
  • PoolSummaryfoundation/components/pool-manager/types.ts; returned in onSubmit.

Notes

  • The modal does not fetch data itself — pass pre-fetched miners and poolConfig from the parent.
  • The credential template preview section is gated by the SHOW_CREDENTIAL_TEMPLATE constant in pool-manager-constants.ts.
  • Use PoolManagerMinerExplorer when you need a full miner-selection workflow before opening this modal.

Example

/** * Runnable example for AssignPoolModal. */import { useState } from 'react'import type { Device, PoolConfigData, PoolSummary } from '@tetherto/mdk-react-devkit'import { AssignPoolModal } from '@tetherto/mdk-react-devkit'const mockPoolConfig: PoolConfigData[] = [  {    id: 'pool-1',    poolConfigName: 'Alpha Pool',    description: 'Primary pool with failover',    poolUrls: [      { url: 'stratum+tcp://pool-primary.example.com:3333', pool: 'pool1', workerName: 'wn-1', workerPassword: 'x' },      { url: 'stratum+tcp://pool-failover.example.com:3333', pool: 'pool1', workerName: 'wn-1', workerPassword: 'x' },    ],    miners: 120,    containers: 4,    updatedAt: 1773159239533,  },  {    id: 'pool-2',    poolConfigName: 'Beta Pool',    description: 'Secondary pool — low fees',    poolUrls: [      { url: 'stratum+tcp://pool-secondary.example.com:3333', pool: 'pool2', workerName: 'worker1', workerPassword: 'x' },    ],    miners: 39,    containers: 6,    updatedAt: 1773172151132,  },]const mockMiners: Device[] = [  {    id: 'miner-1',    type: 'miner',    code: 'S19XP.192.168.1.10',    tags: ['site-a'],    info: { container: 'Unit-01', poolConfig: 'pool-1' },    last: { snap: { stats: { status: 'mining' } } },  },  {    id: 'miner-2',    type: 'miner',    code: 'S21.192.168.1.11',    tags: ['site-a'],    info: { container: 'Unit-01', poolConfig: 'pool-2' },    last: { snap: { stats: { status: 'offline' } } },  },]export const AssignPoolModalExample = () => {  const [isOpen, setIsOpen] = useState(false)  const handleSubmit = async ({ pool }: { pool: PoolSummary }) => {    await new Promise((resolve) => setTimeout(resolve, 800))    // eslint-disable-next-line no-console    console.log(`Assigned ${mockMiners.length} miners to "${pool.name}"`)    setIsOpen(false)  }  return (    <>      <button onClick={() => setIsOpen(true)}>Assign Pool</button>      <AssignPoolModal        isOpen={isOpen}        onClose={() => setIsOpen(false)}        onSubmit={handleSubmit}        miners={mockMiners}        poolConfig={mockPoolConfig}      />    </>  )}