Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/app/profile/[address]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { getFullUserProfile } from "../../../../lib/actions";
import { truncateAddress } from "../../../../lib/utils";
import { formatPrice, formatSupply } from "../../../../lib/format";
import { getTokenPrice, mcv2BondAbi, erc20Abi, type TokenPriceInfo, get24hPriceChange, getTokenTVL } from "../../../../lib/price";

Check warning on line 14 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'TokenPriceInfo' is defined but never used
import { browserClient } from "../../../../lib/rpc";
import type { FarcasterProfile } from "../../../../lib/farcaster";
import type { AgentMetadata } from "../../../../lib/contracts/erc8004";
Expand Down Expand Up @@ -67,6 +67,20 @@
},
});

// PLOT token balance (on-chain)
const { data: plotBalance } = useQuery({
queryKey: ["profile-plot-balance", address],
queryFn: async () => {
return browserClient.readContract({
address: PLOT_TOKEN,
abi: erc20Abi,
functionName: "balanceOf",
args: [address as Address],
});
},
});
const { data: plotUsdPrice } = usePlotUsdPrice();

// Refresh profile handler (5-min cooldown enforced server-side)
const [refreshing, setRefreshing] = useState(false);
const [refreshError, setRefreshError] = useState<string | null>(null);
Expand Down Expand Up @@ -119,7 +133,7 @@
if (r <= 0) clearInterval(interval);
}, 1000);
return () => clearInterval(interval);
}, [dbUser?.steemhunt_fetched_at]);

Check warning on line 136 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

React Hook useEffect has a missing dependency: 'COOLDOWN_MS'. Either include it or remove the dependency array

const onCooldown = cooldownRemaining > 0;

Expand All @@ -133,6 +147,8 @@
agentLoading={agentLoading}
isAgent={isAgent}
claimedRoyalties={claimedRoyalties ?? null}
plotBalance={plotBalance ?? null}
plotUsdPrice={plotUsdPrice ?? null}
dbUser={dbUser ?? null}
isOwnProfile={isOwnProfile}
onRefresh={handleRefresh}
Expand Down Expand Up @@ -187,6 +203,8 @@
agentLoading,
isAgent,
claimedRoyalties,
plotBalance,
plotUsdPrice,
dbUser,
isOwnProfile,
onRefresh,
Expand All @@ -202,6 +220,8 @@
agentLoading: boolean;
isAgent: boolean;
claimedRoyalties: bigint | null;
plotBalance: bigint | null;
plotUsdPrice: number | null;
dbUser: User | null;
isOwnProfile: boolean;
onRefresh: () => void;
Expand Down Expand Up @@ -446,6 +466,14 @@
</a>
<CopyButton text={address} />
</div>
{plotBalance != null && (
<div className="text-muted mt-1.5 text-[11px]">
Balance: <span className="text-foreground font-medium">{Number(formatUnits(plotBalance, 18)).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} PLOT</span>
{plotUsdPrice != null && (
<span className="text-muted"> (≈ {formatUsdValue(Number(formatUnits(plotBalance, 18)) * plotUsdPrice)})</span>
)}
</div>
)}
{claimedRoyalties != null && claimedRoyalties > BigInt(0) && (
<div className="text-muted mt-1.5 text-[11px]">
Royalties: <span className="text-green-700 font-medium">{formatPrice(formatUnits(claimedRoyalties, 18))} {RESERVE_LABEL}</span>
Expand Down
Loading