@ixo/editor 5.9.1 → 5.10.1

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.
@@ -2668,6 +2668,12 @@ registerAction({
2668
2668
  eligibleForEventTrigger: true,
2669
2669
  outputSchema: [
2670
2670
  { path: "entityDid", displayName: "Entity DID", type: "string", description: "The DID of the newly created domain entity" },
2671
+ {
2672
+ path: "governanceGroupCoreAddress",
2673
+ displayName: "Governance Group Core Address",
2674
+ type: "string",
2675
+ description: "The core address of the created governance group, when one was created"
2676
+ },
2671
2677
  { path: "transactionHash", displayName: "Transaction Hash", type: "string", description: "The on-chain transaction hash for domain creation" }
2672
2678
  ],
2673
2679
  events: [
@@ -2677,9 +2683,15 @@ registerAction({
2677
2683
  description: "Fires after the domain entity is successfully created on-chain.",
2678
2684
  payloadSchema: [
2679
2685
  { path: "entityDid", displayName: "Entity DID", type: "string", description: "DID of the newly created domain" },
2686
+ {
2687
+ path: "governanceGroupCoreAddress",
2688
+ displayName: "Governance Group Core Address",
2689
+ type: "string",
2690
+ description: "Core address of the created governance group, when present"
2691
+ },
2680
2692
  { path: "transactionHash", displayName: "Transaction Hash", type: "string", description: "On-chain transaction hash" }
2681
2693
  ],
2682
- pendingDisplayFields: ["entityDid"]
2694
+ pendingDisplayFields: ["entityDid", "governanceGroupCoreAddress"]
2683
2695
  }
2684
2696
  ],
2685
2697
  run: async (inputs, ctx) => {
@@ -2752,6 +2764,7 @@ registerAction({
2752
2764
  description: `Domain Card for ${domainCardData.credentialSubject?.name || "Domain"}`
2753
2765
  });
2754
2766
  let governanceGroupLinkedEntities = [];
2767
+ let governanceGroupCoreAddress = "";
2755
2768
  const govConfig = parseJsonInput(inputs.governanceConfig);
2756
2769
  const memberConfig = parseJsonInput(inputs.memberConfig);
2757
2770
  if (govConfig && handlers.createGovernanceGroup) {
@@ -2763,9 +2776,10 @@ registerAction({
2763
2776
  name: govConfig.groupName || domainCardData.credentialSubject?.name || "Governance Group",
2764
2777
  config
2765
2778
  });
2779
+ governanceGroupCoreAddress = groupResult.coreAddress;
2766
2780
  governanceGroupLinkedEntities = [
2767
2781
  {
2768
- id: groupResult.coreAddress,
2782
+ id: governanceGroupCoreAddress,
2769
2783
  type: "group",
2770
2784
  relationship: "governs",
2771
2785
  service: ""
@@ -2783,9 +2797,11 @@ registerAction({
2783
2797
  return {
2784
2798
  output: {
2785
2799
  entityDid: newEntityDid,
2800
+ governanceGroupCoreAddress,
2801
+ linkedEntities: governanceGroupLinkedEntities,
2786
2802
  transactionHash
2787
2803
  },
2788
- events: [{ name: "created", payload: { entityDid: newEntityDid, transactionHash } }]
2804
+ events: [{ name: "created", payload: { entityDid: newEntityDid, governanceGroupCoreAddress, transactionHash } }]
2789
2805
  };
2790
2806
  }
2791
2807
  });
@@ -4602,15 +4618,51 @@ registerDiffResolver("claim", {
4602
4618
  }
4603
4619
  });
4604
4620
 
4605
- // src/core/lib/actionRegistry/actions/evaluateClaim/evaluateClaim.diff.ts
4606
- var USDC_DENOM2 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
4607
- var DECIMALS = 6;
4608
- function formatCoin2(coin) {
4621
+ // src/core/utils/numbers.ts
4622
+ var numberFormatter = (num, digits) => {
4623
+ const lookup = [
4624
+ { value: 1, symbol: "" },
4625
+ { value: 1e3, symbol: "k" },
4626
+ { value: 1e6, symbol: "M" },
4627
+ { value: 1e9, symbol: "G" },
4628
+ { value: 1e12, symbol: "T" },
4629
+ { value: 1e15, symbol: "P" },
4630
+ { value: 1e18, symbol: "E" }
4631
+ ];
4632
+ const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
4633
+ const item = lookup.slice().reverse().find((lookupItem) => num >= lookupItem.value);
4634
+ return item ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol : "0";
4635
+ };
4636
+ var microAmountToAmount = (microAmount, microUnits = 6) => {
4637
+ const amount = (microAmount ?? 0) / Math.pow(10, microUnits);
4638
+ return amount;
4639
+ };
4640
+ function renderNumber(value) {
4641
+ if (value === 0) return "0";
4642
+ if (!value) return "";
4643
+ const formattedValue = value.toLocaleString(void 0, { minimumFractionDigits: 0, maximumFractionDigits: 6 });
4644
+ return formattedValue;
4645
+ }
4646
+ var formatCoin2 = (coin) => {
4647
+ const USDC_DENOM2 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
4648
+ const DECIMALS = 6;
4609
4649
  const denom = coin.denom === USDC_DENOM2 ? "USDC" : coin.denom === "uixo" ? "IXO" : coin.denom;
4610
4650
  const raw = Number(coin.amount);
4611
4651
  const display = raw >= Math.pow(10, DECIMALS) ? raw / Math.pow(10, DECIMALS) : raw;
4612
4652
  return `${display} ${denom}`;
4613
- }
4653
+ };
4654
+ var formatCoinAmount = (coin, assetsList) => {
4655
+ const pair = assetsList.find((item) => item.display === coin.denom || item.base === coin.denom);
4656
+ if (!pair) {
4657
+ return `${coin.amount} ${coin.denom}`;
4658
+ }
4659
+ const exponent = pair.denomUnits.find((u) => u.denom === pair.display)?.exponent ?? 0;
4660
+ const amount = Number(coin.amount) / Math.pow(10, exponent);
4661
+ const displayDenom = pair.display.toUpperCase();
4662
+ return `${amount.toLocaleString(void 0, { maximumFractionDigits: 6 })} ${displayDenom}`;
4663
+ };
4664
+
4665
+ // src/core/lib/actionRegistry/actions/evaluateClaim/evaluateClaim.diff.ts
4614
4666
  registerDiffResolver("evaluateClaim", {
4615
4667
  resolver: async (inputs, _ctx) => {
4616
4668
  const claimId = String(inputs.claimId || "").trim();
@@ -6473,7 +6525,7 @@ function getActionForBlock(block) {
6473
6525
  }
6474
6526
 
6475
6527
  // src/core/lib/flowEngine/emitEvents.ts
6476
- function writeRunRecordAndReconcile(editor, blockId, output, events, actorDid) {
6528
+ function writeRunRecordAndReconcile(editor, blockId, output, events, actorDid, detailsPatch = {}) {
6477
6529
  const yDoc = editor._yDoc;
6478
6530
  if (!yDoc) return;
6479
6531
  if (events.length === 0) return;
@@ -6485,7 +6537,8 @@ function writeRunRecordAndReconcile(editor, blockId, output, events, actorDid) {
6485
6537
  events,
6486
6538
  startedAt: now,
6487
6539
  completedAt: now,
6488
- actorDid
6540
+ actorDid,
6541
+ ...detailsPatch
6489
6542
  };
6490
6543
  appendRunRecord(yDoc, blockId, details, actorDid);
6491
6544
  reconcilePendingInvocations(editor);
@@ -7545,6 +7598,11 @@ export {
7545
7598
  parseCalendarEventCreateInputs,
7546
7599
  serializeCalendarEventCreateInputs,
7547
7600
  parseAttendeesField,
7601
+ numberFormatter,
7602
+ microAmountToAmount,
7603
+ renderNumber,
7604
+ formatCoin2 as formatCoin,
7605
+ formatCoinAmount,
7548
7606
  createUcanService,
7549
7607
  createUcanDelegationStore,
7550
7608
  createMemoryUcanDelegationStore,
@@ -7584,4 +7642,4 @@ export {
7584
7642
  readFlow,
7585
7643
  setupFlowFromBaseUcan
7586
7644
  };
7587
- //# sourceMappingURL=chunk-OO42QPEG.mjs.map
7645
+ //# sourceMappingURL=chunk-DQCYLHDD.mjs.map