Skip to content

Commit

Permalink
fix types error
Browse files Browse the repository at this point in the history
  • Loading branch information
snoopy1412 committed Nov 19, 2024
1 parent 1df6d3b commit 4164b15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/components/collator/collator-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ const CollatorTabs = ({ onClose, isOpen }: CollatorTabsProps) => {
/>
)}
{selected === 'overview' && (
<CollatorOverview sessionKey={sessionKey} commissionOf={commissionOf as bigint} />
<CollatorOverview sessionKey={sessionKey} commissionOf={commissionOf} />
)}
{selected === 'manage' && (
<CollatorManagement
sessionKey={sessionKey}
commissionOf={commissionOf as bigint}
commissionOf={commissionOf}
refetch={refetch}
onStopSuccess={handleStopSuccess}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useAssetsToVotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export async function assetsToVotes(
inputAmount: bigint,
operation: Operation
): Promise<bigint> {
return (await readContract(config, {
return await readContract(config, {
abi,
address,
functionName: 'assetsToVotes',
args: [commission, calculateAssets(totalAmount, inputAmount, operation)]
})) as unknown as bigint;
});
}

function calculateAssets(totalAmount: bigint, inputAmount: bigint, operation: Operation): bigint {
Expand Down
15 changes: 4 additions & 11 deletions src/view/stake/_hooks/staked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import useWalletStatus from '@/hooks/useWalletStatus';
import { useCallback, useMemo } from 'react';
import { useReadContract, useReadContracts } from 'wagmi';
import dayjs from 'dayjs';
import { Abi } from 'viem';

export type StakedDepositsInfo = [account: `0x${string}`, assets: bigint, collator: `0x${string}`];
export type StakedDepositInfo = {
Expand All @@ -25,7 +24,7 @@ export const useStakedDepositsOf = ({ account, enabled = true }: StakedDepositsO
isLoading: isStakedDepositsOfLoading,
isRefetching: isStakedDepositsOfRefetching,
refetch: refetchStakedDepositsOf
} = useReadContract<typeof hubAbi, 'stakedDepositsOf', bigint[]>({
} = useReadContract({
address,
abi: hubAbi,
functionName: 'stakedDepositsOf',
Expand All @@ -44,7 +43,7 @@ export const useStakedDepositsOf = ({ account, enabled = true }: StakedDepositsO
refetch: refetchCombinedInfo
} = useReadContracts({
contracts:
((stakedDepositsOf as bigint[])?.flatMap((deposit) => [
stakedDepositsOf?.flatMap((deposit) => [
{
address: address as `0x${string}`,
abi: hubAbi,
Expand All @@ -57,15 +56,9 @@ export const useStakedDepositsOf = ({ account, enabled = true }: StakedDepositsO
functionName: 'depositOf',
args: [deposit]
}
]) as unknown as readonly {
abi?: Abi | undefined;
functionName?: string | undefined;
args?: readonly unknown[] | undefined;
address?: `0x${string}` | undefined;
chainId?: number | undefined;
}[]) ?? [],
]) ?? [],
query: {
enabled: !!account && !!(stakedDepositsOf as bigint[])?.length,
enabled: !!account && !!stakedDepositsOf?.length,
retry: true,
retryDelay: 1000,
refetchOnWindowFocus: false,
Expand Down

0 comments on commit 4164b15

Please sign in to comment.