@1sat/permission-module-ui 0.0.31 → 0.0.33
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.
- package/dist/OneSatPermissionPrompt.d.ts.map +1 -1
- package/dist/index.js +42 -10
- package/package.json +3 -3
|
@@ -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;
|
|
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,8 +3,11 @@
|
|
|
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";
|
|
8
|
+
var MAX_INSCRIPTION_BYTES = 50 * 1024 * 1024;
|
|
7
9
|
var EXCHANGE_RATE_CACHE_TTL = 5 * 60 * 1000;
|
|
10
|
+
var DEFAULT_STREAM_CHUNK_SIZE = 1024 * 1024;
|
|
8
11
|
|
|
9
12
|
// ../types/dist/index.js
|
|
10
13
|
var TokenType;
|
|
@@ -398,7 +401,8 @@ function OneSatPermissionPrompt({
|
|
|
398
401
|
children: [
|
|
399
402
|
summary.network && /* @__PURE__ */ jsxs("span", {
|
|
400
403
|
children: [
|
|
401
|
-
"Network
|
|
404
|
+
"Network",
|
|
405
|
+
" ",
|
|
402
406
|
/* @__PURE__ */ jsx("span", {
|
|
403
407
|
className: "opp-meta-value",
|
|
404
408
|
children: summary.network
|
|
@@ -492,6 +496,8 @@ function summarizeRequest(req) {
|
|
|
492
496
|
return summarizePurchase(req, intent);
|
|
493
497
|
case "social-post":
|
|
494
498
|
return summarizeSocialPost(req, intent);
|
|
499
|
+
case "opns":
|
|
500
|
+
return summarizeOpns(req, intent);
|
|
495
501
|
default:
|
|
496
502
|
return summarizeUnknownTx(req, intent);
|
|
497
503
|
}
|
|
@@ -640,15 +646,17 @@ function summarizeInscription(req, intent) {
|
|
|
640
646
|
};
|
|
641
647
|
}
|
|
642
648
|
function summarizeListing(req, intent) {
|
|
649
|
+
const listingOutput = intent.outputs.find((o) => o.tags.some((t) => t.startsWith("price:")));
|
|
643
650
|
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");
|
|
651
|
+
const origin = tagValue(ordinal?.tags, "origin") ?? tagValue(listingOutput?.tags, "origin");
|
|
652
|
+
const name = tagValue(ordinal?.tags, "name") ?? tagValue(listingOutput?.tags, "name");
|
|
653
|
+
const contentType = tagValue(ordinal?.tags, "type") ?? tagValue(listingOutput?.tags, "type");
|
|
647
654
|
const collectionId = tagValue(ordinal?.tags, "collectionId");
|
|
648
655
|
const imageUrl = origin ? intent.contentUrls?.[origin] : undefined;
|
|
649
|
-
const listingOutput = intent.outputs.find((o) => o.tags.some((t) => t.startsWith("price:")));
|
|
650
656
|
const price = tagValue(listingOutput?.tags, "price");
|
|
651
657
|
const rows = [];
|
|
658
|
+
if (name)
|
|
659
|
+
rows.push({ key: "Name", value: name });
|
|
652
660
|
if (price)
|
|
653
661
|
rows.push({ key: "Price", value: `${price} sats` });
|
|
654
662
|
if (origin)
|
|
@@ -657,7 +665,7 @@ function summarizeListing(req, intent) {
|
|
|
657
665
|
rows.push({ key: "Type", value: contentType });
|
|
658
666
|
return {
|
|
659
667
|
title: "List Ordinal for Sale",
|
|
660
|
-
subtitle: `${shortenOriginator(req.originator)} wants to list an ordinal for sale`,
|
|
668
|
+
subtitle: `${shortenOriginator(req.originator)} wants to list ${name ? `“${name}”` : "an ordinal"} for sale`,
|
|
661
669
|
rows,
|
|
662
670
|
featured: imageUrl ? {
|
|
663
671
|
imageUrl,
|
|
@@ -669,13 +677,16 @@ function summarizeListing(req, intent) {
|
|
|
669
677
|
}
|
|
670
678
|
function summarizeCancelListing(req, intent) {
|
|
671
679
|
const listing = intent.inputs[0];
|
|
672
|
-
const
|
|
673
|
-
const
|
|
674
|
-
const
|
|
680
|
+
const reclaimed = intent.outputs[0];
|
|
681
|
+
const origin = tagValue(listing?.tags, "origin") ?? tagValue(reclaimed?.tags, "origin");
|
|
682
|
+
const name = tagValue(listing?.tags, "name") ?? tagValue(reclaimed?.tags, "name");
|
|
683
|
+
const contentType = tagValue(listing?.tags, "type") ?? tagValue(reclaimed?.tags, "type");
|
|
675
684
|
const collectionId = tagValue(listing?.tags, "collectionId");
|
|
676
685
|
const price = tagValue(listing?.tags, "price");
|
|
677
686
|
const imageUrl = origin ? intent.contentUrls?.[origin] : undefined;
|
|
678
687
|
const rows = [];
|
|
688
|
+
if (name)
|
|
689
|
+
rows.push({ key: "Name", value: name });
|
|
679
690
|
if (price)
|
|
680
691
|
rows.push({ key: "Original price", value: `${price} sats` });
|
|
681
692
|
if (origin)
|
|
@@ -684,7 +695,7 @@ function summarizeCancelListing(req, intent) {
|
|
|
684
695
|
rows.push({ key: "Type", value: contentType });
|
|
685
696
|
return {
|
|
686
697
|
title: "Cancel Listing",
|
|
687
|
-
subtitle: `${shortenOriginator(req.originator)} wants to cancel an ordinal listing`,
|
|
698
|
+
subtitle: `${shortenOriginator(req.originator)} wants to cancel ${name ? `the listing of “${name}”` : "an ordinal listing"}`,
|
|
688
699
|
rows,
|
|
689
700
|
featured: imageUrl ? {
|
|
690
701
|
imageUrl,
|
|
@@ -745,6 +756,27 @@ function summarizeSocialPost(req, intent) {
|
|
|
745
756
|
network: networkLabel(intent.chain)
|
|
746
757
|
};
|
|
747
758
|
}
|
|
759
|
+
function summarizeOpns(req, intent) {
|
|
760
|
+
const input = intent.inputs[0];
|
|
761
|
+
const opnsOutput = intent.outputs.find((o) => o.basket === OPNS_BASKET);
|
|
762
|
+
const recipient = intent.outputs.find((o) => !o.basket && o.recipient)?.recipient;
|
|
763
|
+
const name = tagValue(input?.tags, "name") ?? tagValue(opnsOutput?.tags, "name");
|
|
764
|
+
const origin = tagValue(input?.tags, "origin") ?? tagValue(opnsOutput?.tags, "origin");
|
|
765
|
+
const rows = [];
|
|
766
|
+
if (name)
|
|
767
|
+
rows.push({ key: "Name", value: name });
|
|
768
|
+
if (recipient)
|
|
769
|
+
rows.push({ key: "Recipient", value: shortenValue(recipient) });
|
|
770
|
+
if (origin)
|
|
771
|
+
rows.push({ key: "Origin", value: shortenValue(origin) });
|
|
772
|
+
const isTransfer = Boolean(recipient);
|
|
773
|
+
return {
|
|
774
|
+
title: isTransfer ? "Transfer OpNS Name" : "Update OpNS Name",
|
|
775
|
+
subtitle: `${shortenOriginator(req.originator)} wants to ${isTransfer ? "transfer" : "update"} ${name ? `“${name}”` : "an OpNS name"}`,
|
|
776
|
+
rows,
|
|
777
|
+
network: networkLabel(intent.chain)
|
|
778
|
+
};
|
|
779
|
+
}
|
|
748
780
|
function summarizeUnknownTx(req, intent) {
|
|
749
781
|
const ins = intent.inputs.length;
|
|
750
782
|
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.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"description": "React component for the 1Sat permission module's prompt UX",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@1sat/permission-module": "0.0.
|
|
32
|
-
"@1sat/types": "0.0.
|
|
31
|
+
"@1sat/permission-module": "0.0.37",
|
|
32
|
+
"@1sat/types": "0.0.34"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.0.0 || ^19.0.0"
|