@oasisprotocol/privana-sdk 0.5.8 → 0.5.9

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.
@@ -2876,15 +2876,16 @@ function cloneAllowance(allowance) {
2876
2876
  function cn(...inputs) {
2877
2877
  return twMerge(clsx(inputs));
2878
2878
  }
2879
- function formatTokenAmount(amount, decimals = 18) {
2879
+ function formatTokenAmount(amount, decimals = 18, maxDecimals = 6) {
2880
2880
  const value = typeof amount === "string" ? BigInt(amount) : amount;
2881
- const divisor = BigInt(10 ** decimals);
2881
+ const divisor = 10n ** BigInt(decimals);
2882
2882
  const integerPart = value / divisor;
2883
2883
  const fractionalPart = value % divisor;
2884
2884
  const fractionalStr = fractionalPart.toString().padStart(decimals, "0");
2885
- const twoDecimals = fractionalStr.slice(0, 2).padEnd(2, "0");
2885
+ const shown = fractionalStr.slice(0, Math.max(2, Math.min(maxDecimals, decimals)));
2886
+ const trimmed = shown.replace(/0+$/, "").padEnd(2, "0");
2886
2887
  const integerWithSpaces = integerPart.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "\u2009");
2887
- return `${integerWithSpaces}.${twoDecimals}`;
2888
+ return `${integerWithSpaces}.${trimmed}`;
2888
2889
  }
2889
2890
  function parseTokenAmount(amount, decimals = 18) {
2890
2891
  const sanitized = amount.replace(/[\s\u2009]/g, "").replace(/,/g, ".");
@@ -6056,5 +6057,5 @@ function useTransakOnRamp(options) {
6056
6057
  }
6057
6058
 
6058
6059
  export { AccountingApiError, Button, DEFAULT_LOCK_DURATION_SECONDS, DEFAULT_ONRAMP_LOCK_BUFFER, FiatOnRampForm, HOSTED_AUTH_CLOCK_SKEW_MS, HostedAuthError, HostedAuthRequiredError, HostedAuthStateMismatchError, HttpClient, LOCK_TYPES, MODIFY_LOCK_TYPES, NETWORK_CONFIG, NetworkError, PostDepositLockError, PrivanaClient, PrivanaProvider, SUPPORTED_CHAINS, SiweAuthProvider, Skeleton, TRANSFER_LOCKED_TYPES, TRANSFER_TYPES, ValidationError, WITHDRAW_FROM_LOCK_TYPES, WITHDRAW_TYPES, applyLockBuffer, applyRefreshResponse, buildHostedAuthSession, buildSiweStatement, buttonVariants, canRetryOnRampVerification, canUseBrowserStorage, canUseSharedBrowserStorage, clampLockAmount, clearHostedAuthPendingTransaction, clearPendingLock, cn, createDomain, createHostedAuthPendingStorageKey, createHostedAuthState, createHostedAuthStorageKey, createLockExpiry, createPkceChallenge, createPkceVerifier, createProductOnRampFlowSnapshot, createProductOnRampOutcomeCallbacks, createSignedLockRequest, formatCountdown, formatTimeRemaining, formatTokenAmount, getAccountingContract, getApiUrl, getBlockNumber, getBrowserStorageItem, getChainById, getChainId, getExplorerAddressUrl, getExplorerLabel, getSharedBrowserStorageItem, getTransactionReceipt, getTransakMinimumTargetBaseUnits, getWalletClient3 as getWalletClient, isHostedAuthRefreshActive, isHostedAuthSessionActive, isMoonPayProductOnRamp, isSignedLockUsable, loadPendingLock, matchesFrozenOnRampToken, matchesOnRampTransaction, matchesProductOnRampScope, normalizeAddress, normalizeHex, parseHostedAuthCallback, parseTokenAmount, persistHostedAuthPendingTransaction, readHostedAuthPendingTransaction, readStoredHostedAuthSession, removeBrowserStorageItem, removeSharedBrowserStorageItem, requireDepositLockOwner, requireServiceAddress, resolveProductOnRamp, savePendingLock, setBrowserStorageItem, setSharedBrowserStorageItem, shortenAddress, signLockMessage, signModifyLockMessage, signTransferLockedMessage, signTransferMessage, signWithdrawFromLockMessage, signWithdrawMessage, stripHostedAuthCallbackParams, submitPendingLock, syncHostedAuthSessionToClient, useDepositVerification, useEnsureCorrectChain, useFiatOnRamp, usePrivanaContext, usePrivateReadRequest, useSafeAccount, useSafePrivanaContext, useSiweAuth, useTransakOnRamp, waitForTransactionReceipt };
6059
- //# sourceMappingURL=chunk-ONXJGUOH.js.map
6060
- //# sourceMappingURL=chunk-ONXJGUOH.js.map
6060
+ //# sourceMappingURL=chunk-RDYNQUMV.js.map
6061
+ //# sourceMappingURL=chunk-RDYNQUMV.js.map