diff --git a/apps/renderer/src/modules/power/my-wallet-section/index.tsx b/apps/renderer/src/modules/power/my-wallet-section/index.tsx index 67cc6e586..57d22b583 100644 --- a/apps/renderer/src/modules/power/my-wallet-section/index.tsx +++ b/apps/renderer/src/modules/power/my-wallet-section/index.tsx @@ -1,7 +1,6 @@ import { useMutation } from "@tanstack/react-query" import { Trans, useTranslation } from "react-i18next" -import { useWhoami } from "~/atoms/user" import { Button } from "~/components/ui/button" import { CopyButton } from "~/components/ui/code-highlighter" import { LoadingWithIcon } from "~/components/ui/loading" @@ -19,8 +18,7 @@ import { WithdrawButton } from "./withdraw" export const MyWalletSection = () => { const { t } = useTranslation("settings") - const user = useWhoami() - const wallet = useWallet({ userId: user?.id }) + const wallet = useWallet() const myWallet = wallet.data?.[0] const refreshMutation = useMutation({ diff --git a/apps/renderer/src/modules/power/my-wallet-section/withdraw.tsx b/apps/renderer/src/modules/power/my-wallet-section/withdraw.tsx index ba10bc143..2a6542ff5 100644 --- a/apps/renderer/src/modules/power/my-wallet-section/withdraw.tsx +++ b/apps/renderer/src/modules/power/my-wallet-section/withdraw.tsx @@ -7,7 +7,6 @@ import { Trans, useTranslation } from "react-i18next" import { toast } from "sonner" import { z } from "zod" -import { useWhoami } from "~/atoms/user" import { Button } from "~/components/ui/button" import { Form, @@ -44,8 +43,7 @@ export const WithdrawButton = () => { const WithdrawModalContent = ({ dismiss }: { dismiss: () => void }) => { const { t } = useTranslation("settings") - const user = useWhoami() - const wallet = useWallet({ userId: user?.id }) + const wallet = useWallet() const cashablePowerTokenBigInt = [BigInt(wallet.data?.[0].cashablePowerToken || 0n), 18] as const const cashablePowerTokenNumber = toNumber(cashablePowerTokenBigInt) diff --git a/apps/renderer/src/modules/power/transaction-section/index.tsx b/apps/renderer/src/modules/power/transaction-section/index.tsx index f66857a74..f65177b2d 100644 --- a/apps/renderer/src/modules/power/transaction-section/index.tsx +++ b/apps/renderer/src/modules/power/transaction-section/index.tsx @@ -26,7 +26,7 @@ import { useWallet, useWalletTransactions } from "~/queries/wallet" export const TransactionsSection: Component = ({ className }) => { const { t } = useTranslation("settings") const user = useWhoami() - const wallet = useWallet({ userId: user?.id }) + const wallet = useWallet() const myWallet = wallet.data?.[0] const transactions = useWalletTransactions({ fromOrToUserId: user?.id }) diff --git a/apps/renderer/src/modules/user/ProfileButton.tsx b/apps/renderer/src/modules/user/ProfileButton.tsx index a703d2c79..b63005308 100644 --- a/apps/renderer/src/modules/user/ProfileButton.tsx +++ b/apps/renderer/src/modules/user/ProfileButton.tsx @@ -4,7 +4,6 @@ import { memo, useState } from "react" import { useTranslation } from "react-i18next" import { useNavigate } from "react-router-dom" -import { useWhoami } from "~/atoms/user" import { useSignOut } from "~/hooks/biz/useSignOut" import { useMeasure } from "~/hooks/common" import { nextFrame } from "~/lib/dom" @@ -157,8 +156,7 @@ export const ProfileButton: FC = memo((props) => { ProfileButton.displayName = "ProfileButton" function PowerButton() { - const user = useWhoami() - const wallet = useWallet({ userId: user?.id }) + const wallet = useWallet() const { isLoading } = wallet const myWallet = wallet.data?.[0] diff --git a/apps/renderer/src/modules/wallet/tip-modal.tsx b/apps/renderer/src/modules/wallet/tip-modal.tsx index ebf920d91..73e7a9c4e 100644 --- a/apps/renderer/src/modules/wallet/tip-modal.tsx +++ b/apps/renderer/src/modules/wallet/tip-modal.tsx @@ -2,7 +2,6 @@ import { from } from "dnum" import type { FC } from "react" import { useState } from "react" -import { useWhoami } from "~/atoms/user" import { Button } from "~/components/ui/button" import { Divider } from "~/components/ui/divider" import { LoadingWithIcon } from "~/components/ui/loading" @@ -21,8 +20,7 @@ import { Balance } from "./balance" const DEFAULT_RECOMMENDED_TIP = 10 const useMyWallet = () => { - const user = useWhoami() - const myWallet = useWallet({ userId: user?.id }) + const myWallet = useWallet() return myWallet } diff --git a/apps/renderer/src/pages/(main)/(layer)/(subview)/power/index.tsx b/apps/renderer/src/pages/(main)/(layer)/(subview)/power/index.tsx index 2171398c4..ab0a2bc5c 100644 --- a/apps/renderer/src/pages/(main)/(layer)/(subview)/power/index.tsx +++ b/apps/renderer/src/pages/(main)/(layer)/(subview)/power/index.tsx @@ -8,7 +8,7 @@ export function Component() { const { t } = useTranslation() return ( -
+
diff --git a/apps/renderer/src/queries/wallet.tsx b/apps/renderer/src/queries/wallet.tsx index 28f413014..b954dc65e 100644 --- a/apps/renderer/src/queries/wallet.tsx +++ b/apps/renderer/src/queries/wallet.tsx @@ -44,8 +44,7 @@ export const wallet = { }, } -export const useWallet = ({ userId }: { userId?: string } = {}) => - useAuthQuery(wallet.get({ userId }), { enabled: !!userId }) +export const useWallet = () => useAuthQuery(wallet.get()) export const useWalletTransactions = (query: Parameters[0] = {}) => useAuthQuery(wallet.transactions.get(query)) diff --git a/packages/shared/src/hono.ts b/packages/shared/src/hono.ts index 36560327f..9184f21f3 100644 --- a/packages/shared/src/hono.ts +++ b/packages/shared/src/hono.ts @@ -3968,15 +3968,15 @@ declare const walletsOpenAPISchema: zod.ZodObject<{ }, zod.UnknownKeysParam, zod.ZodTypeAny, { createdAt: string; userId: string; - address: string | null; addressIndex: number; + address: string | null; dailyPowerToken: string; cashablePowerToken: string; }, { createdAt: string; userId: string; - address: string | null; addressIndex: number; + address: string | null; dailyPowerToken: string; cashablePowerToken: string; }>; @@ -4895,19 +4895,14 @@ declare const _routes: hono_hono_base.HonoBase