@@ -65,6 +78,7 @@ export function BalanceDisplay({ className, compact = false }: BalanceDisplayPro
Available {tokenCode} balance (${usdValue} USD)
+ {tokenCode} decimals: {decimals}
);
@@ -99,6 +113,14 @@ export function BalanceDisplay({ className, compact = false }: BalanceDisplayPro
≈ ${usdValue} USD
+
+ {tokenCode} decimals: {decimals}
+ {issuer && (
+
+ Issuer: {issuer.slice(0, 6)}…
+
+ )}
+
@@ -107,6 +129,7 @@ export function BalanceDisplay({ className, compact = false }: BalanceDisplayPro
onClick={handleCopyContract}
className="flex items-center gap-1 hover:text-gray-700 dark:hover:text-gray-200 transition-colors"
title="Copy contract address"
+ disabled={!contractAddress}
>
{copied ? (
@@ -119,6 +142,14 @@ export function BalanceDisplay({ className, compact = false }: BalanceDisplayPro
: contractAddress}
+
diff --git a/src/lib/hooks/use-token-price.ts b/src/lib/hooks/use-token-price.ts
new file mode 100644
index 0000000..c93c991
--- /dev/null
+++ b/src/lib/hooks/use-token-price.ts
@@ -0,0 +1,79 @@
+"use client";
+
+import { useState, useEffect } from "react";
+
+/**
+ * Fetch a live USD price for a token from Stellar Index's public pricing API
+ * (https://api.stellarindex.io). The quote asset is USD so the returned value
+ * is already a USD-equivalent.
+ *
+ * Falls back to a configurable static rate (via NEXT_PUBLIC_FALLBACK_TOKEN_USD)
+ * when the network call fails so the UI always has a value to render.
+ */
+async function fetchTokenUsdRate(
+ code: string,
+ issuer?: string
+): Promise