Skip to content

Commit

Permalink
chore: yeet
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKheops committed Dec 11, 2024
1 parent df6a8f7 commit 0b4c113
Showing 1 changed file with 1 addition and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useQueries, useQuery } from "@tanstack/react-query"
import { useQuery } from "@tanstack/react-query"
import { ChainId } from "extension-core"

import { useScaleApi } from "@ui/hooks/sapi/useScaleApi"
Expand All @@ -9,8 +9,6 @@ type GetBittensorStakeHotkeys = {
totalStaked?: number
}

type GetBittensorStakesHotkeys = Omit<GetBittensorStakeHotkeys, "address"> & { addresses: string[] }

export const useGetBittensorStakeHotkeys = ({
chainId,
address,
Expand All @@ -26,26 +24,3 @@ export const useGetBittensorStakeHotkeys = ({
enabled: !!sapi && !!address && chainId === "bittensor",
})
}

export const useGetBittensorStakesHotkeys = ({
chainId,
addresses,
totalStaked,
}: GetBittensorStakesHotkeys) => {
const { data: sapi } = useScaleApi(chainId)
return useQueries({
queries: addresses.map((address) => ({
queryKey: ["getBittensorStakeHotkeys", sapi?.id, address, totalStaked],
queryFn: () => sapi?.getStorage<string[]>("SubtensorModule", "StakingHotkeys", [address]),
enabled: !!sapi && !!address && chainId === "bittensor",
})),
combine: (results) => {
return {
data: results.map((result) => result.data),
isPending: results.some((result) => result.isPending),
isLoading: results.some((result) => result.isLoading),
error: results.find((result) => result.isError),
}
},
})
}

0 comments on commit 0b4c113

Please sign in to comment.