fix: `useAccountBalance` issues
This commit is contained in:
parent
16de217d1f
commit
47a0d04905
|
|
@ -2,7 +2,6 @@ import {
|
|||
useConnectModal,
|
||||
useAccountState,
|
||||
useDisconnectModal,
|
||||
useAccountBalance,
|
||||
GeneralAccount,
|
||||
} from "@crossbell/connect-kit"
|
||||
import { useAccountSites } from "~/queries/site"
|
||||
|
|
@ -23,6 +22,7 @@ import {
|
|||
useShowNotificationModal,
|
||||
useNotifications,
|
||||
} from "@crossbell/notification"
|
||||
import { useAccountBalance } from "~/hooks/use-account-balance"
|
||||
|
||||
export const ConnectButton: React.FC<{
|
||||
left?: boolean
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
import { useBalance } from "wagmi"
|
||||
import {
|
||||
useAccountState,
|
||||
useAccountBalance as _useAccountBalance,
|
||||
} from "@crossbell/connect-kit"
|
||||
|
||||
export function useAccountBalance(): ReturnType<typeof _useAccountBalance> {
|
||||
const account = useAccountState((s) => s.computed.account)
|
||||
const walletBalance = useBalance({
|
||||
address: account?.address as `0x${string}` | undefined,
|
||||
})
|
||||
const accountBalance = _useAccountBalance()
|
||||
|
||||
if (account?.type === "email") {
|
||||
return accountBalance
|
||||
} else {
|
||||
return {
|
||||
balance: walletBalance.data,
|
||||
isLoading: walletBalance.isLoading,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,8 @@ import { BigNumber } from "ethers"
|
|||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { useAccountSites } from "~/queries/site"
|
||||
import { getSite } from "~/models/site.model"
|
||||
import { useAccountBalance, useAccountState } from "@crossbell/connect-kit"
|
||||
import { useAccountState } from "@crossbell/connect-kit"
|
||||
import { useAccountBalance } from "~/hooks/use-account-balance"
|
||||
|
||||
export default function NewSitePage() {
|
||||
const router = useRouter()
|
||||
|
|
|
|||
Loading…
Reference in New Issue