* feat: created useAssetIds and useAssetInfo hook * feat: created pay with asset component * feat: add paywith asset component with Transfer modal * fix: signer options as prop * fix: payment info * feat: created PayWithAsset provider and integrated with transfer form * chore: rename variable * fix: PayWithAsset provider wrapping * feat: integrate PayWithAsset context and enhance asset info fetching * fix: some build errors * refactor: update imports and simplify getFeeAssetLocation function * refactor: simplify component structure and update PayWithAsset import paths * fix: all build errors * fix: avoid redundant type * feat: added translation * feat: enhance fee payment info & fee asset handling * fix: translations ordering * fix: remove redundant types and hooks * chore: added statemine chain * refactor: generalize fee acceptance check for non-native assets * fix: remove constants and generalize palletIndex
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
// Copyright 2017-2025 @polkadot/react-hooks authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { UseJudgements } from '@polkadot/react-components/types';
|
|
|
|
import { useMemo } from 'react';
|
|
|
|
import { getJudgements } from './utils/getJudgements.js';
|
|
import { matchRegistrarAccountsWithIndexes } from './utils/matchRegistrarAccountsWithIndexes.js';
|
|
import { createNamedHook } from './createNamedHook.js';
|
|
import { useAccountInfo } from './useAccountInfo.js';
|
|
import { useRegistrars } from './useRegistrars.js';
|
|
|
|
function useJudgementsImpl (address: string): UseJudgements {
|
|
const { identity } = useAccountInfo(address);
|
|
const { registrars: allRegistrars } = useRegistrars();
|
|
|
|
const judgementsWithRegistrarIndexes = useMemo(() => getJudgements(identity), [identity]);
|
|
|
|
return useMemo(
|
|
() => matchRegistrarAccountsWithIndexes(judgementsWithRegistrarIndexes, allRegistrars),
|
|
[allRegistrars, judgementsWithRegistrarIndexes]
|
|
);
|
|
}
|
|
|
|
export const useJudgements = createNamedHook('useJudgements', useJudgementsImpl);
|