@coinlist-co/react 0.12.1 → 0.12.2-rc.726778a

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.
@@ -19,7 +19,7 @@ import {
19
19
  generateSecureRandomBase64Url,
20
20
  internalLogger,
21
21
  sha256
22
- } from "./chunk-MOE5S6CE.js";
22
+ } from "./chunk-IRV5YU42.js";
23
23
 
24
24
  // src/universal/types/oauth.ts
25
25
  var AuthorizationCode = (value) => value;
@@ -406,4 +406,4 @@ export {
406
406
  UserEmail,
407
407
  User
408
408
  };
409
- //# sourceMappingURL=chunk-VH34YC3Q.js.map
409
+ //# sourceMappingURL=chunk-3UQPCAU4.js.map
@@ -7,7 +7,7 @@ import {
7
7
  getUUIDv4,
8
8
  internalLogger,
9
9
  viemChain
10
- } from "./chunk-MOE5S6CE.js";
10
+ } from "./chunk-IRV5YU42.js";
11
11
 
12
12
  // src/universal/api/nabu/config.ts
13
13
  var NABU_BASE_URL = "https://asset.coinlist.co";
@@ -402,4 +402,4 @@ export {
402
402
  SDK_LOGGER_NAME,
403
403
  loggerOverPino
404
404
  };
405
- //# sourceMappingURL=chunk-DCW7NQXH.js.map
405
+ //# sourceMappingURL=chunk-C6F5FOFP.js.map
@@ -1069,7 +1069,11 @@ function formatAmount(amount, locale, options) {
1069
1069
  const decimal = formatRawAmount(amount);
1070
1070
  let [integerPart, fractionPart = ""] = decimal.split(".");
1071
1071
  const maxFractionDigits = options?.maxFractionDigits;
1072
- const minFractionDigits = maxFractionDigits !== void 0 ? Math.min(maxFractionDigits, amount.decimals) : Math.min(2, amount.decimals);
1072
+ const minFractionDigits = Math.min(
1073
+ options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
1074
+ maxFractionDigits ?? amount.decimals,
1075
+ amount.decimals
1076
+ );
1073
1077
  if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
1074
1078
  ({ integerPart, fractionPart } = roundFractionHalfUp(
1075
1079
  integerPart,
@@ -1077,7 +1081,8 @@ function formatAmount(amount, locale, options) {
1077
1081
  maxFractionDigits
1078
1082
  ));
1079
1083
  }
1080
- const fraction = minFractionDigits === 0 ? "" : fractionPart.padEnd(minFractionDigits, "0");
1084
+ const trimmed = fractionPart.replace(/0+$/, "");
1085
+ const fraction = trimmed.padEnd(minFractionDigits, "0");
1081
1086
  const integerFormatted = BigInt(integerPart).toLocaleString(locale);
1082
1087
  if (minFractionDigits === 0 && fraction === "") {
1083
1088
  return FormattedAmountUi(integerFormatted);
@@ -1146,6 +1151,14 @@ function assetAmount(amount, symbol) {
1146
1151
  return FormattedAmountAssetUi(`${amount} ${symbol}`);
1147
1152
  }
1148
1153
  var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
1154
+ var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
1155
+ var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
1156
+ function formatShareAmount(amount, locale) {
1157
+ return formatAmount(amount, locale, {
1158
+ maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
1159
+ minFractionDigits: SHARE_MIN_FRACTION_DIGITS
1160
+ });
1161
+ }
1149
1162
  var USD_FRACTION_DIGITS = AssetDecimals(2);
1150
1163
  function formattedUsdPrice(amount, locale) {
1151
1164
  if (!amount) return NA_AMOUNT_ASSET_UI;
@@ -3473,6 +3486,7 @@ export {
3473
3486
  usdAmount,
3474
3487
  assetAmount,
3475
3488
  NA_AMOUNT_ASSET_UI,
3489
+ formatShareAmount,
3476
3490
  formattedUsdPrice,
3477
3491
  viemChain,
3478
3492
  getChainId,
@@ -3521,4 +3535,4 @@ export {
3521
3535
  OAuthRefreshToken,
3522
3536
  OAuthSession
3523
3537
  };
3524
- //# sourceMappingURL=chunk-MOE5S6CE.js.map
3538
+ //# sourceMappingURL=chunk-IRV5YU42.js.map