@1sat/permission-module-ui 0.0.30 → 0.0.32

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.
@@ -1 +1 @@
1
- {"version":3,"file":"OneSatPermissionPrompt.d.ts","sourceRoot":"","sources":["../src/OneSatPermissionPrompt.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAK5D,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;AAE7C,MAAM,WAAW,2BAA2B;IAC3C,mEAAmE;IACnE,OAAO,EAAE,aAAa,CAAA;IACtB,yFAAyF;IACzF,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,yFAAyF;IACzF,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,KAAK,CAAA;CACb;AAqCD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,EACtC,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAc,GACd,EAAE,2BAA2B,+BAkH7B"}
1
+ {"version":3,"file":"OneSatPermissionPrompt.d.ts","sourceRoot":"","sources":["../src/OneSatPermissionPrompt.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAU5D,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;AAE7C,MAAM,WAAW,2BAA2B;IAC3C,mEAAmE;IACnE,OAAO,EAAE,aAAa,CAAA;IACtB,yFAAyF;IACzF,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,yFAAyF;IACzF,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,KAAK,CAAA;CACb;AAqCD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,EACtC,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAc,GACd,EAAE,2BAA2B,+BAuH7B"}
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // ../types/dist/constants.js
4
4
  var ORDINALS_BASKET = "p 1sat ordinals";
5
5
  var BSV21_BASKET = "p 1sat bsv21";
6
+ var OPNS_BASKET = "p 1sat opns";
6
7
  var LOCK_BASKET = "p 1sat lock";
7
8
  var EXCHANGE_RATE_CACHE_TTL = 5 * 60 * 1000;
8
9
 
@@ -398,7 +399,8 @@ function OneSatPermissionPrompt({
398
399
  children: [
399
400
  summary.network && /* @__PURE__ */ jsxs("span", {
400
401
  children: [
401
- "Network ",
402
+ "Network",
403
+ " ",
402
404
  /* @__PURE__ */ jsx("span", {
403
405
  className: "opp-meta-value",
404
406
  children: summary.network
@@ -492,6 +494,8 @@ function summarizeRequest(req) {
492
494
  return summarizePurchase(req, intent);
493
495
  case "social-post":
494
496
  return summarizeSocialPost(req, intent);
497
+ case "opns":
498
+ return summarizeOpns(req, intent);
495
499
  default:
496
500
  return summarizeUnknownTx(req, intent);
497
501
  }
@@ -640,15 +644,17 @@ function summarizeInscription(req, intent) {
640
644
  };
641
645
  }
642
646
  function summarizeListing(req, intent) {
647
+ const listingOutput = intent.outputs.find((o) => o.tags.some((t) => t.startsWith("price:")));
643
648
  const ordinal = intent.inputs[0];
644
- const origin = tagValue(ordinal?.tags, "origin");
645
- const name = tagValue(ordinal?.tags, "name");
646
- const contentType = tagValue(ordinal?.tags, "type");
649
+ const origin = tagValue(ordinal?.tags, "origin") ?? tagValue(listingOutput?.tags, "origin");
650
+ const name = tagValue(ordinal?.tags, "name") ?? tagValue(listingOutput?.tags, "name");
651
+ const contentType = tagValue(ordinal?.tags, "type") ?? tagValue(listingOutput?.tags, "type");
647
652
  const collectionId = tagValue(ordinal?.tags, "collectionId");
648
653
  const imageUrl = origin ? intent.contentUrls?.[origin] : undefined;
649
- const listingOutput = intent.outputs.find((o) => o.tags.some((t) => t.startsWith("price:")));
650
654
  const price = tagValue(listingOutput?.tags, "price");
651
655
  const rows = [];
656
+ if (name)
657
+ rows.push({ key: "Name", value: name });
652
658
  if (price)
653
659
  rows.push({ key: "Price", value: `${price} sats` });
654
660
  if (origin)
@@ -657,7 +663,7 @@ function summarizeListing(req, intent) {
657
663
  rows.push({ key: "Type", value: contentType });
658
664
  return {
659
665
  title: "List Ordinal for Sale",
660
- subtitle: `${shortenOriginator(req.originator)} wants to list an ordinal for sale`,
666
+ subtitle: `${shortenOriginator(req.originator)} wants to list ${name ? `“${name}”` : "an ordinal"} for sale`,
661
667
  rows,
662
668
  featured: imageUrl ? {
663
669
  imageUrl,
@@ -669,13 +675,16 @@ function summarizeListing(req, intent) {
669
675
  }
670
676
  function summarizeCancelListing(req, intent) {
671
677
  const listing = intent.inputs[0];
672
- const origin = tagValue(listing?.tags, "origin");
673
- const name = tagValue(listing?.tags, "name");
674
- const contentType = tagValue(listing?.tags, "type");
678
+ const reclaimed = intent.outputs[0];
679
+ const origin = tagValue(listing?.tags, "origin") ?? tagValue(reclaimed?.tags, "origin");
680
+ const name = tagValue(listing?.tags, "name") ?? tagValue(reclaimed?.tags, "name");
681
+ const contentType = tagValue(listing?.tags, "type") ?? tagValue(reclaimed?.tags, "type");
675
682
  const collectionId = tagValue(listing?.tags, "collectionId");
676
683
  const price = tagValue(listing?.tags, "price");
677
684
  const imageUrl = origin ? intent.contentUrls?.[origin] : undefined;
678
685
  const rows = [];
686
+ if (name)
687
+ rows.push({ key: "Name", value: name });
679
688
  if (price)
680
689
  rows.push({ key: "Original price", value: `${price} sats` });
681
690
  if (origin)
@@ -684,7 +693,7 @@ function summarizeCancelListing(req, intent) {
684
693
  rows.push({ key: "Type", value: contentType });
685
694
  return {
686
695
  title: "Cancel Listing",
687
- subtitle: `${shortenOriginator(req.originator)} wants to cancel an ordinal listing`,
696
+ subtitle: `${shortenOriginator(req.originator)} wants to cancel ${name ? `the listing of “${name}”` : "an ordinal listing"}`,
688
697
  rows,
689
698
  featured: imageUrl ? {
690
699
  imageUrl,
@@ -745,6 +754,27 @@ function summarizeSocialPost(req, intent) {
745
754
  network: networkLabel(intent.chain)
746
755
  };
747
756
  }
757
+ function summarizeOpns(req, intent) {
758
+ const input = intent.inputs[0];
759
+ const opnsOutput = intent.outputs.find((o) => o.basket === OPNS_BASKET);
760
+ const recipient = intent.outputs.find((o) => !o.basket && o.recipient)?.recipient;
761
+ const name = tagValue(input?.tags, "name") ?? tagValue(opnsOutput?.tags, "name");
762
+ const origin = tagValue(input?.tags, "origin") ?? tagValue(opnsOutput?.tags, "origin");
763
+ const rows = [];
764
+ if (name)
765
+ rows.push({ key: "Name", value: name });
766
+ if (recipient)
767
+ rows.push({ key: "Recipient", value: shortenValue(recipient) });
768
+ if (origin)
769
+ rows.push({ key: "Origin", value: shortenValue(origin) });
770
+ const isTransfer = Boolean(recipient);
771
+ return {
772
+ title: isTransfer ? "Transfer OpNS Name" : "Update OpNS Name",
773
+ subtitle: `${shortenOriginator(req.originator)} wants to ${isTransfer ? "transfer" : "update"} ${name ? `“${name}”` : "an OpNS name"}`,
774
+ rows,
775
+ network: networkLabel(intent.chain)
776
+ };
777
+ }
748
778
  function summarizeUnknownTx(req, intent) {
749
779
  const ins = intent.inputs.length;
750
780
  const outs = intent.outputs.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/permission-module-ui",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "React component for the 1Sat permission module's prompt UX",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@1sat/permission-module": "0.0.34",
31
+ "@1sat/permission-module": "0.0.36",
32
32
  "@1sat/types": "0.0.33"
33
33
  },
34
34
  "peerDependencies": {