ghost-portal/packages/react-hooks/src/useDelegations.ts
Jaco 4929b1c6fd
Update headers for 2023 (#8665)
* Update headers for 2023

* Adjust env-config
2023-01-01 10:32:05 +02:00

18 lines
639 B
TypeScript

// Copyright 2017-2023 @polkadot/react-hooks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletDemocracyVoteVoting } from '@polkadot/types/lookup';
import { useAccounts, useApi, useCall } from '@polkadot/react-hooks';
import { createNamedHook } from './createNamedHook';
function useDelegationsImpl (): PalletDemocracyVoteVoting[] | undefined {
const { api } = useApi();
const { allAccounts } = useAccounts();
return useCall<PalletDemocracyVoteVoting[]>(api.query.democracy?.votingOf?.multi, [allAccounts]);
}
export const useDelegations = createNamedHook('useDelegations', useDelegationsImpl);