@ixo/editor 5.9.1 → 5.10.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.
@@ -4602,15 +4602,51 @@ registerDiffResolver("claim", {
4602
4602
  }
4603
4603
  });
4604
4604
 
4605
- // src/core/lib/actionRegistry/actions/evaluateClaim/evaluateClaim.diff.ts
4606
- var USDC_DENOM2 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
4607
- var DECIMALS = 6;
4608
- function formatCoin2(coin) {
4605
+ // src/core/utils/numbers.ts
4606
+ var numberFormatter = (num, digits) => {
4607
+ const lookup = [
4608
+ { value: 1, symbol: "" },
4609
+ { value: 1e3, symbol: "k" },
4610
+ { value: 1e6, symbol: "M" },
4611
+ { value: 1e9, symbol: "G" },
4612
+ { value: 1e12, symbol: "T" },
4613
+ { value: 1e15, symbol: "P" },
4614
+ { value: 1e18, symbol: "E" }
4615
+ ];
4616
+ const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
4617
+ const item = lookup.slice().reverse().find((lookupItem) => num >= lookupItem.value);
4618
+ return item ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol : "0";
4619
+ };
4620
+ var microAmountToAmount = (microAmount, microUnits = 6) => {
4621
+ const amount = (microAmount ?? 0) / Math.pow(10, microUnits);
4622
+ return amount;
4623
+ };
4624
+ function renderNumber(value) {
4625
+ if (value === 0) return "0";
4626
+ if (!value) return "";
4627
+ const formattedValue = value.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: 6 });
4628
+ return formattedValue;
4629
+ }
4630
+ var formatCoin2 = (coin) => {
4631
+ const USDC_DENOM2 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
4632
+ const DECIMALS = 6;
4609
4633
  const denom = coin.denom === USDC_DENOM2 ? "USDC" : coin.denom === "uixo" ? "IXO" : coin.denom;
4610
4634
  const raw = Number(coin.amount);
4611
4635
  const display = raw >= Math.pow(10, DECIMALS) ? raw / Math.pow(10, DECIMALS) : raw;
4612
4636
  return `${display} ${denom}`;
4613
- }
4637
+ };
4638
+ var formatCoinAmount = (coin, assetsList) => {
4639
+ const pair = assetsList.find((item) => item.display === coin.denom || item.base === coin.denom);
4640
+ if (!pair) {
4641
+ return `${coin.amount} ${coin.denom}`;
4642
+ }
4643
+ const exponent = pair.denomUnits.find((u) => u.denom === pair.display)?.exponent ?? 0;
4644
+ const amount = Number(coin.amount) / Math.pow(10, exponent);
4645
+ const displayDenom = pair.display.toUpperCase();
4646
+ return `${amount.toLocaleString(void 0, { maximumFractionDigits: 6 })} ${displayDenom}`;
4647
+ };
4648
+
4649
+ // src/core/lib/actionRegistry/actions/evaluateClaim/evaluateClaim.diff.ts
4614
4650
  registerDiffResolver("evaluateClaim", {
4615
4651
  resolver: async (inputs, _ctx) => {
4616
4652
  const claimId = String(inputs.claimId || "").trim();
@@ -7545,6 +7581,11 @@ export {
7545
7581
  parseCalendarEventCreateInputs,
7546
7582
  serializeCalendarEventCreateInputs,
7547
7583
  parseAttendeesField,
7584
+ numberFormatter,
7585
+ microAmountToAmount,
7586
+ renderNumber,
7587
+ formatCoin2 as formatCoin,
7588
+ formatCoinAmount,
7548
7589
  createUcanService,
7549
7590
  createUcanDelegationStore,
7550
7591
  createMemoryUcanDelegationStore,
@@ -7584,4 +7625,4 @@ export {
7584
7625
  readFlow,
7585
7626
  setupFlowFromBaseUcan
7586
7627
  };
7587
- //# sourceMappingURL=chunk-OO42QPEG.mjs.map
7628
+ //# sourceMappingURL=chunk-MD3CXTGZ.mjs.map