ghost-dao-interface/src/hooks/ghost/useApplauseThreshold.js
Uncle Fatso 0a3786b85e
implemented ability to watch cross-chain transaction status
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
2025-08-22 18:00:48 +03:00

24 lines
982 B
JavaScript

import useSWR from "swr"
import { getDynamicBuilder, getLookupFn } from "@polkadot-api/metadata-builders"
import { useUnstableProvider } from "./UnstableProvider"
import { useMetadata } from "./MetadataProvider"
export const useApplauseThreshold = () => {
const { chainId } = useUnstableProvider()
const metadata = useMetadata()
const { data: existentialDeposit } = useSWR(
chainId && metadata
? ["ApplauseThreshold", chainId, metadata]
: null,
([_, chainId, metadata]) => {
const builder = getDynamicBuilder(getLookupFn(metadata))
const codec = builder.buildConstant("GhostSlowClaps", "ApplauseThreshold")
const constants = metadata?.pallets?.find(obj => obj.name === "GhostSlowClaps")?.constants
const value = constants?.find(obj => obj.name === "ApplauseThreshold")?.value
return value ? codec.dec(value) : undefined
}
)
return existentialDeposit
}