@volr/react 0.2.8 → 0.3.0

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
@@ -76,6 +76,14 @@ declare class APIClient {
76
76
  * POST request
77
77
  */
78
78
  post<T>(endpoint: string, body: any, idempotencyKey?: string): Promise<T>;
79
+ /**
80
+ * Verify the current access token and return decoded claims
81
+ */
82
+ verifyToken(): Promise<{
83
+ userId: string;
84
+ projectId: string;
85
+ email: string | null;
86
+ }>;
79
87
  /**
80
88
  * POST request that returns raw binary (ArrayBuffer)
81
89
  * - Uses axios instance with interceptors (auto 401 refresh)
@@ -188,6 +196,15 @@ interface TransactionDto {
188
196
  gasUsed?: string;
189
197
  meta?: any;
190
198
  }
199
+ /**
200
+ * Token Verify Result
201
+ * Response from /auth/verify endpoint
202
+ */
203
+ interface TokenVerifyResult {
204
+ userId: string;
205
+ projectId: string;
206
+ email: string | null;
207
+ }
191
208
  /**
192
209
  * API Response Wrapper
193
210
  * Common wrapper for all API responses
@@ -1775,4 +1792,63 @@ declare function useEIP6963(): UseEIP6963Return;
1775
1792
  */
1776
1793
  declare function detectWalletConnector(provider: any, providerInfo: EIP6963ProviderInfo | null): string;
1777
1794
 
1778
- export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, InAppBrowserNotSupportedError, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OidcExchangeResult, type OnSignRequest, type OnWalletRequired, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SetSessionParams, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletRequiredAction, WalletRequiredError, type WalletRequiredRequest, type WalletStateComparison, WebAuthnBusyError, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWalletRequiredError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useVolrSession, useWithdraw };
1795
+ /**
1796
+ * Fiat currency information
1797
+ */
1798
+ interface FiatCurrencyInfo {
1799
+ code: string;
1800
+ symbol: string;
1801
+ name: string;
1802
+ decimalPlaces: number;
1803
+ }
1804
+ /**
1805
+ * Format a number as currency using Intl.NumberFormat
1806
+ *
1807
+ * @param amount - The numeric amount to format
1808
+ * @param currencyCode - ISO 4217 currency code (e.g., "USD", "KRW", "EUR")
1809
+ * @param locale - Optional locale (defaults to browser's navigator.language)
1810
+ * @returns Formatted currency string (e.g., "$1,234.56", "₩5,000", "€99,99")
1811
+ *
1812
+ * @example
1813
+ * formatCurrency(1234.56, 'USD') // "$1,234.56"
1814
+ * formatCurrency(5000, 'KRW') // "₩5,000"
1815
+ * formatCurrency(99.99, 'EUR', 'de-DE') // "99,99 €"
1816
+ */
1817
+ declare function formatCurrency(amount: number, currencyCode: string, locale?: string): string;
1818
+ /**
1819
+ * Format currency with custom decimal places
1820
+ *
1821
+ * @param amount - The numeric amount to format
1822
+ * @param currencyCode - ISO 4217 currency code
1823
+ * @param options - Formatting options
1824
+ * @returns Formatted currency string
1825
+ */
1826
+ declare function formatCurrencyWithOptions(amount: number, currencyCode: string, options?: {
1827
+ locale?: string;
1828
+ minimumFractionDigits?: number;
1829
+ maximumFractionDigits?: number;
1830
+ }): string;
1831
+ /**
1832
+ * Get currency symbol for a given currency code
1833
+ *
1834
+ * @param currencyCode - ISO 4217 currency code
1835
+ * @param locale - Optional locale
1836
+ * @returns Currency symbol (e.g., "$", "₩", "€")
1837
+ */
1838
+ declare function getCurrencySymbol(currencyCode: string, locale?: string): string;
1839
+ /**
1840
+ * Detect user's preferred currency based on browser locale
1841
+ *
1842
+ * @returns Suggested currency code based on locale
1843
+ */
1844
+ declare function detectPreferredCurrency(): string;
1845
+ /**
1846
+ * Parse a formatted currency string back to a number
1847
+ * Note: This is a best-effort function and may not work for all formats
1848
+ *
1849
+ * @param formattedValue - Formatted currency string
1850
+ * @returns Parsed number or NaN if parsing fails
1851
+ */
1852
+ declare function parseCurrency(formattedValue: string): number;
1853
+
1854
+ export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, type FiatCurrencyInfo, InAppBrowserNotSupportedError, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OidcExchangeResult, type OnSignRequest, type OnWalletRequired, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SetSessionParams, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TokenVerifyResult, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletRequiredAction, WalletRequiredError, type WalletRequiredRequest, type WalletStateComparison, WebAuthnBusyError, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectPreferredCurrency, detectWalletConnector, diagnoseTransactionFailure, formatCurrency, formatCurrencyWithOptions, getBrowserVersion, getCurrencySymbol, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWalletRequiredError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, parseCurrency, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useVolrSession, useWithdraw };
package/dist/index.d.ts CHANGED
@@ -76,6 +76,14 @@ declare class APIClient {
76
76
  * POST request
77
77
  */
78
78
  post<T>(endpoint: string, body: any, idempotencyKey?: string): Promise<T>;
79
+ /**
80
+ * Verify the current access token and return decoded claims
81
+ */
82
+ verifyToken(): Promise<{
83
+ userId: string;
84
+ projectId: string;
85
+ email: string | null;
86
+ }>;
79
87
  /**
80
88
  * POST request that returns raw binary (ArrayBuffer)
81
89
  * - Uses axios instance with interceptors (auto 401 refresh)
@@ -188,6 +196,15 @@ interface TransactionDto {
188
196
  gasUsed?: string;
189
197
  meta?: any;
190
198
  }
199
+ /**
200
+ * Token Verify Result
201
+ * Response from /auth/verify endpoint
202
+ */
203
+ interface TokenVerifyResult {
204
+ userId: string;
205
+ projectId: string;
206
+ email: string | null;
207
+ }
191
208
  /**
192
209
  * API Response Wrapper
193
210
  * Common wrapper for all API responses
@@ -1775,4 +1792,63 @@ declare function useEIP6963(): UseEIP6963Return;
1775
1792
  */
1776
1793
  declare function detectWalletConnector(provider: any, providerInfo: EIP6963ProviderInfo | null): string;
1777
1794
 
1778
- export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, InAppBrowserNotSupportedError, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OidcExchangeResult, type OnSignRequest, type OnWalletRequired, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SetSessionParams, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletRequiredAction, WalletRequiredError, type WalletRequiredRequest, type WalletStateComparison, WebAuthnBusyError, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWalletRequiredError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useVolrSession, useWithdraw };
1795
+ /**
1796
+ * Fiat currency information
1797
+ */
1798
+ interface FiatCurrencyInfo {
1799
+ code: string;
1800
+ symbol: string;
1801
+ name: string;
1802
+ decimalPlaces: number;
1803
+ }
1804
+ /**
1805
+ * Format a number as currency using Intl.NumberFormat
1806
+ *
1807
+ * @param amount - The numeric amount to format
1808
+ * @param currencyCode - ISO 4217 currency code (e.g., "USD", "KRW", "EUR")
1809
+ * @param locale - Optional locale (defaults to browser's navigator.language)
1810
+ * @returns Formatted currency string (e.g., "$1,234.56", "₩5,000", "€99,99")
1811
+ *
1812
+ * @example
1813
+ * formatCurrency(1234.56, 'USD') // "$1,234.56"
1814
+ * formatCurrency(5000, 'KRW') // "₩5,000"
1815
+ * formatCurrency(99.99, 'EUR', 'de-DE') // "99,99 €"
1816
+ */
1817
+ declare function formatCurrency(amount: number, currencyCode: string, locale?: string): string;
1818
+ /**
1819
+ * Format currency with custom decimal places
1820
+ *
1821
+ * @param amount - The numeric amount to format
1822
+ * @param currencyCode - ISO 4217 currency code
1823
+ * @param options - Formatting options
1824
+ * @returns Formatted currency string
1825
+ */
1826
+ declare function formatCurrencyWithOptions(amount: number, currencyCode: string, options?: {
1827
+ locale?: string;
1828
+ minimumFractionDigits?: number;
1829
+ maximumFractionDigits?: number;
1830
+ }): string;
1831
+ /**
1832
+ * Get currency symbol for a given currency code
1833
+ *
1834
+ * @param currencyCode - ISO 4217 currency code
1835
+ * @param locale - Optional locale
1836
+ * @returns Currency symbol (e.g., "$", "₩", "€")
1837
+ */
1838
+ declare function getCurrencySymbol(currencyCode: string, locale?: string): string;
1839
+ /**
1840
+ * Detect user's preferred currency based on browser locale
1841
+ *
1842
+ * @returns Suggested currency code based on locale
1843
+ */
1844
+ declare function detectPreferredCurrency(): string;
1845
+ /**
1846
+ * Parse a formatted currency string back to a number
1847
+ * Note: This is a best-effort function and may not work for all formats
1848
+ *
1849
+ * @param formattedValue - Formatted currency string
1850
+ * @returns Parsed number or NaN if parsing fails
1851
+ */
1852
+ declare function parseCurrency(formattedValue: string): number;
1853
+
1854
+ export { type ApiResponse, type AuthRefreshResponseDto, type AuthResult, type BrandingData, type BuildCallOptions, type ContractAnalysisResult, DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, type DecryptEntropyParams, type DepositAsset$1 as DepositAsset, type DepositConfig, type EIP6963AnnounceProviderEvent, type EIP6963ProviderDetail, type EIP6963ProviderInfo, type ERC20BalanceComparison, type Erc20Token$1 as Erc20Token, type EvmChainClient, type EvmClient, type EvmNamespace, type FiatCurrencyInfo, InAppBrowserNotSupportedError, type KeyStorageType, type MigrationCompleteParams, type MigrationCompleteResult, type MigrationError, type MigrationMessage, type MigrationRequestParams, type MigrationRequestResult, type MigrationSeedRequest, type MigrationSeedResponse, type MpcConnectionStep, type NetworkDto, type NetworkInfo, type OidcExchangeResult, type OnSignRequest, type OnWalletRequired, type PasskeyAdapterOptions, type PasskeyEnrollmentStep, PasskeyNotFoundError, type PayOptions, type PaymentContext, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentHistoryOptions, type PaymentHistoryResult, type PaymentItem, type PaymentResult, type PaymentStatus, type PaymentToken, type PlatformCheckResult, type PrfCompatibilityResult, type PrfInputDto, PrfNotSupportedError, type RegisteredPasskeyDto, type SendBatchOverloads, type SendTxOptions, type SetSessionParams, type SignRequest, type SignerType, type SiweSession, type SiweSessionStatus, type SocialProvider, type TokenBalance, type TokenVerifyResult, type TransactionDto, type TransactionStatus, type UseEIP6963Return, type UseMpcConnectionReturn, type UsePasskeyEnrollmentReturn, type UseUserBalancesReturn, type UseVolrAuthCallbackOptions, type UseVolrAuthCallbackReturn, type UseVolrLoginReturn, type UseVolrPaymentApiReturn, type UseWithdrawReturn, UserCancelledError, type UserDto, type VolrClient, type VolrConfig, type VolrContextValue, VolrProvider, type VolrUser, type WalletDisplayInfo, type WalletRequiredAction, WalletRequiredError, type WalletRequiredRequest, type WalletStateComparison, WebAuthnBusyError, type WithdrawParams, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectPreferredCurrency, detectWalletConnector, diagnoseTransactionFailure, formatCurrency, formatCurrencyWithOptions, getBrowserVersion, getCurrencySymbol, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWalletRequiredError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, parseCurrency, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useVolrSession, useWithdraw };
package/dist/index.js CHANGED
@@ -9318,7 +9318,8 @@ var APIClient = class {
9318
9318
  "/auth/siwe/verify",
9319
9319
  "/auth/email/send-code",
9320
9320
  "/auth/email/verify-code",
9321
- "/auth/social/"
9321
+ "/auth/social/",
9322
+ "/auth/verify"
9322
9323
  ];
9323
9324
  const isPublicAuthEndpoint = publicAuthEndpoints.some(
9324
9325
  (endpoint) => requestUrl.includes(endpoint)
@@ -9537,6 +9538,15 @@ var APIClient = class {
9537
9538
  throw error;
9538
9539
  }
9539
9540
  }
9541
+ /**
9542
+ * Verify the current access token and return decoded claims
9543
+ */
9544
+ async verifyToken() {
9545
+ if (!this.accessToken) {
9546
+ throw new Error("No access token available. Please log in first.");
9547
+ }
9548
+ return this.post("/auth/verify", { accessToken: this.accessToken });
9549
+ }
9540
9550
  /**
9541
9551
  * POST request that returns raw binary (ArrayBuffer)
9542
9552
  * - Uses axios instance with interceptors (auto 401 refresh)
@@ -21529,6 +21539,74 @@ function detectWalletConnector(provider, providerInfo) {
21529
21539
  if (provider.isPhantom) return "app.phantom";
21530
21540
  return "unknown";
21531
21541
  }
21542
+
21543
+ // src/utils/currency.ts
21544
+ function formatCurrency(amount, currencyCode, locale) {
21545
+ try {
21546
+ return new Intl.NumberFormat(locale ?? navigator?.language ?? "en-US", {
21547
+ style: "currency",
21548
+ currency: currencyCode
21549
+ }).format(amount);
21550
+ } catch (error) {
21551
+ return `${currencyCode} ${amount.toLocaleString()}`;
21552
+ }
21553
+ }
21554
+ function formatCurrencyWithOptions(amount, currencyCode, options) {
21555
+ try {
21556
+ return new Intl.NumberFormat(options?.locale ?? navigator?.language ?? "en-US", {
21557
+ style: "currency",
21558
+ currency: currencyCode,
21559
+ minimumFractionDigits: options?.minimumFractionDigits,
21560
+ maximumFractionDigits: options?.maximumFractionDigits
21561
+ }).format(amount);
21562
+ } catch (error) {
21563
+ return `${currencyCode} ${amount.toLocaleString()}`;
21564
+ }
21565
+ }
21566
+ function getCurrencySymbol(currencyCode, locale) {
21567
+ try {
21568
+ const formatted = new Intl.NumberFormat(locale ?? "en-US", {
21569
+ style: "currency",
21570
+ currency: currencyCode,
21571
+ currencyDisplay: "narrowSymbol"
21572
+ }).format(0);
21573
+ return formatted.replace(/[\d.,\s]/g, "").trim();
21574
+ } catch (error) {
21575
+ return currencyCode;
21576
+ }
21577
+ }
21578
+ function detectPreferredCurrency() {
21579
+ if (typeof navigator === "undefined") return "USD";
21580
+ const locale = navigator.language || "en-US";
21581
+ const region = locale.split("-")[1]?.toUpperCase();
21582
+ const localeToCurrency = {
21583
+ US: "USD",
21584
+ KR: "KRW",
21585
+ JP: "JPY",
21586
+ CN: "CNY",
21587
+ GB: "GBP",
21588
+ DE: "EUR",
21589
+ FR: "EUR",
21590
+ IT: "EUR",
21591
+ ES: "EUR",
21592
+ NL: "EUR",
21593
+ AT: "EUR",
21594
+ BE: "EUR",
21595
+ AU: "AUD",
21596
+ CA: "CAD",
21597
+ CH: "CHF",
21598
+ SG: "SGD",
21599
+ HK: "HKD"
21600
+ };
21601
+ return localeToCurrency[region] || "USD";
21602
+ }
21603
+ function parseCurrency(formattedValue) {
21604
+ const cleaned = formattedValue.replace(/[^\d.,-]/g, "");
21605
+ if (/,\d{2}$/.test(cleaned)) {
21606
+ return parseFloat(cleaned.replace(/\./g, "").replace(",", "."));
21607
+ }
21608
+ return parseFloat(cleaned.replace(/,/g, ""));
21609
+ }
21532
21610
  /*! Bundled license information:
21533
21611
 
21534
21612
  @noble/hashes/esm/utils.js:
@@ -21543,6 +21621,6 @@ function detectWalletConnector(provider, providerInfo) {
21543
21621
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
21544
21622
  */
21545
21623
 
21546
- export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, InAppBrowserNotSupportedError, PasskeyNotFoundError, PrfNotSupportedError, UserCancelledError, VolrProvider, WalletRequiredError, WebAuthnBusyError, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWalletRequiredError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useVolrSession, useWithdraw };
21624
+ export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, InAppBrowserNotSupportedError, PasskeyNotFoundError, PrfNotSupportedError, UserCancelledError, VolrProvider, WalletRequiredError, WebAuthnBusyError, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectPreferredCurrency, detectWalletConnector, diagnoseTransactionFailure, formatCurrency, formatCurrencyWithOptions, getBrowserVersion, getCurrencySymbol, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isInAppBrowserNotSupportedError, isUserCancelledError, isWalletRequiredError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, parseCurrency, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useVolrSession, useWithdraw };
21547
21625
  //# sourceMappingURL=index.js.map
21548
21626
  //# sourceMappingURL=index.js.map