@volr/react 0.1.110 → 0.1.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -982,18 +982,26 @@ interface TokenBalance {
982
982
  balanceRaw: bigint;
983
983
  /** Formatted balance string */
984
984
  balance: string;
985
- /** USD value (if available) */
985
+ /** Token price in USD (from backend) */
986
+ priceUsd?: number;
987
+ /** USD value (balance * price) */
986
988
  balanceUsd?: number;
987
989
  /** Whether balance is loading */
988
990
  isLoading: boolean;
989
991
  /** Error if balance fetch failed */
990
992
  error?: string;
991
993
  }
994
+ /**
995
+ * Extended deposit asset with price info from API
996
+ */
997
+ interface DepositAssetWithPrice extends DepositAsset$1 {
998
+ priceUsd?: number;
999
+ }
992
1000
  /**
993
1001
  * Branding data with payment enabled flag
994
1002
  */
995
1003
  interface BrandingData {
996
- depositAssets: DepositAsset$1[];
1004
+ depositAssets: DepositAssetWithPrice[];
997
1005
  paymentEnabled: boolean;
998
1006
  }
999
1007
  interface UseUserBalancesReturn {
package/dist/index.d.ts CHANGED
@@ -982,18 +982,26 @@ interface TokenBalance {
982
982
  balanceRaw: bigint;
983
983
  /** Formatted balance string */
984
984
  balance: string;
985
- /** USD value (if available) */
985
+ /** Token price in USD (from backend) */
986
+ priceUsd?: number;
987
+ /** USD value (balance * price) */
986
988
  balanceUsd?: number;
987
989
  /** Whether balance is loading */
988
990
  isLoading: boolean;
989
991
  /** Error if balance fetch failed */
990
992
  error?: string;
991
993
  }
994
+ /**
995
+ * Extended deposit asset with price info from API
996
+ */
997
+ interface DepositAssetWithPrice extends DepositAsset$1 {
998
+ priceUsd?: number;
999
+ }
992
1000
  /**
993
1001
  * Branding data with payment enabled flag
994
1002
  */
995
1003
  interface BrandingData {
996
- depositAssets: DepositAsset$1[];
1004
+ depositAssets: DepositAssetWithPrice[];
997
1005
  paymentEnabled: boolean;
998
1006
  }
999
1007
  interface UseUserBalancesReturn {
package/dist/index.js CHANGED
@@ -20002,6 +20002,7 @@ function useUserBalances() {
20002
20002
  isNative,
20003
20003
  balanceRaw: 0n,
20004
20004
  balance: "0",
20005
+ priceUsd: asset.priceUsd,
20005
20006
  isLoading: true
20006
20007
  };
20007
20008
  });
@@ -20063,7 +20064,12 @@ function useUserBalances() {
20063
20064
  (prev) => prev.map((b) => {
20064
20065
  const result = results.find((r) => r.id === b.id);
20065
20066
  if (result) {
20066
- return { ...b, ...result };
20067
+ let balanceUsd;
20068
+ if (b.priceUsd !== void 0 && result.balanceRaw !== void 0) {
20069
+ const balanceNum = Number(result.balanceRaw) / Math.pow(10, b.decimals);
20070
+ balanceUsd = balanceNum * b.priceUsd;
20071
+ }
20072
+ return { ...b, ...result, balanceUsd };
20067
20073
  }
20068
20074
  return b;
20069
20075
  })