// Copyright 2017-2026 @pezkuwi/app-staking-async authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { SubmittableExtrinsic } from '@pezkuwi/api/types'; import type { DeriveStakingQuery } from '@pezkuwi/api-derive/types'; import React, { useEffect, useMemo, useState } from 'react'; import { InputAddressMulti, Modal, Spinner, TxButton } from '@pezkuwi/react-components'; import { useApi, useCall } from '@pezkuwi/react-hooks'; import { useTranslation } from '../../translate.js'; import SenderInfo from '../partials/SenderInfo.js'; interface Props { className?: string; controllerId: string; nominating?: string[]; onClose: () => void; stashId: string; } const MAX_KICK = 128; const accountOpts = { withExposure: true }; function KickNominees ({ className = '', controllerId, nominating, onClose, stashId }: Props): React.ReactElement | null { const { t } = useTranslation(); const { api } = useApi(); const [selected, setSelected] = useState([]); const [{ kickTx }, setTx] = useState<{ kickTx?: null | SubmittableExtrinsic<'promise'> }>({}); const queryInfo = useCall(api.derive.staking.query, [stashId, accountOpts]); const nominators = useMemo( () => queryInfo?.exposurePaged.isSome && queryInfo?.exposurePaged.unwrap().others.map(({ who }) => who.toString()), [queryInfo] ); useEffect((): void => { try { setTx({ kickTx: selected.length ? api.tx.staking.kick(selected as any) : null }); } catch { setTx({ kickTx: null }); } }, [api, selected]); return ( {nominators ? ( ) : } ); } export default React.memo(KickNominees);