@medialane/ui 0.159.1 → 0.160.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.
- package/dist/components/creator-chip.cjs +1 -1
- package/dist/components/creator-chip.cjs.map +1 -1
- package/dist/components/creator-chip.js +1 -1
- package/dist/components/creator-chip.js.map +1 -1
- package/dist/components/fast-mint/fast-mint.cjs +10 -49
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +11 -50
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/index.cjs +0 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/fast-mint/execute-and-sync.cjs +0 -34
- package/dist/components/fast-mint/execute-and-sync.cjs.map +0 -1
- package/dist/components/fast-mint/execute-and-sync.d.cts +0 -7
- package/dist/components/fast-mint/execute-and-sync.d.ts +0 -7
- package/dist/components/fast-mint/execute-and-sync.js +0 -10
- package/dist/components/fast-mint/execute-and-sync.js.map +0 -1
- package/dist/utils/sync-transaction.cjs +0 -61
- package/dist/utils/sync-transaction.cjs.map +0 -1
- package/dist/utils/sync-transaction.d.cts +0 -8
- package/dist/utils/sync-transaction.d.ts +0 -8
- package/dist/utils/sync-transaction.js +0 -37
- package/dist/utils/sync-transaction.js.map +0 -1
|
@@ -38,7 +38,7 @@ var import_use_profiles = require("../utils/use-profiles.js");
|
|
|
38
38
|
var import_address_display = require("./address-display.js");
|
|
39
39
|
function CreatorChip({ getClient, address }) {
|
|
40
40
|
const { profile } = (0, import_use_profiles.useCreatorProfile)(getClient, address);
|
|
41
|
-
const label = profile?.
|
|
41
|
+
const label = profile?.name || profile?.username || null;
|
|
42
42
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
43
43
|
import_link.default,
|
|
44
44
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/creator-chip.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"./link.js\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useCreatorProfile } from \"../utils/use-profiles.js\";\nimport { AddressDisplay } from \"./address-display.js\";\n\nexport interface CreatorChipProps {\n getClient: () => MedialaneClient;\n address: string;\n}\n\nexport function CreatorChip({ getClient, address }: CreatorChipProps) {\n const { profile } = useCreatorProfile(getClient, address);\n const label = profile?.
|
|
1
|
+
{"version":3,"sources":["../../src/components/creator-chip.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"./link.js\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useCreatorProfile } from \"../utils/use-profiles.js\";\nimport { AddressDisplay } from \"./address-display.js\";\n\nexport interface CreatorChipProps {\n getClient: () => MedialaneClient;\n address: string;\n}\n\nexport function CreatorChip({ getClient, address }: CreatorChipProps) {\n const { profile } = useCreatorProfile(getClient, address);\n const label = profile?.name || profile?.username || null;\n\n return (\n <Link\n href={`/account/${address}`}\n className=\"inline-flex items-center gap-1.5 text-sm rounded-full px-2 py-1 hover:bg-muted/60 active:scale-[0.98] transition\"\n >\n <span className=\"text-muted-foreground shrink-0\">by</span>\n {label ? (\n <span className=\"font-semibold text-foreground truncate\">{label}</span>\n ) : (\n <AddressDisplay address={address} chars={6} showCopy={false} className=\"font-semibold text-foreground\" />\n )}\n </Link>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBI;AAfJ,kBAAiB;AAEjB,0BAAkC;AAClC,6BAA+B;AAOxB,SAAS,YAAY,EAAE,WAAW,QAAQ,GAAqB;AACpE,QAAM,EAAE,QAAQ,QAAI,uCAAkB,WAAW,OAAO;AACxD,QAAM,QAAQ,SAAS,QAAQ,SAAS,YAAY;AAEpD,SACE;AAAA,IAAC,YAAAA;AAAA,IAAA;AAAA,MACC,MAAM,YAAY,OAAO;AAAA,MACzB,WAAU;AAAA,MAEV;AAAA,oDAAC,UAAK,WAAU,kCAAiC,gBAAE;AAAA,QAClD,QACC,4CAAC,UAAK,WAAU,0CAA0C,iBAAM,IAEhE,4CAAC,yCAAe,SAAkB,OAAO,GAAG,UAAU,OAAO,WAAU,iCAAgC;AAAA;AAAA;AAAA,EAE3G;AAEJ;","names":["Link"]}
|
|
@@ -5,7 +5,7 @@ import { useCreatorProfile } from "../utils/use-profiles.js";
|
|
|
5
5
|
import { AddressDisplay } from "./address-display.js";
|
|
6
6
|
function CreatorChip({ getClient, address }) {
|
|
7
7
|
const { profile } = useCreatorProfile(getClient, address);
|
|
8
|
-
const label = profile?.
|
|
8
|
+
const label = profile?.name || profile?.username || null;
|
|
9
9
|
return /* @__PURE__ */ jsxs(
|
|
10
10
|
Link,
|
|
11
11
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/creator-chip.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"./link.js\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useCreatorProfile } from \"../utils/use-profiles.js\";\nimport { AddressDisplay } from \"./address-display.js\";\n\nexport interface CreatorChipProps {\n getClient: () => MedialaneClient;\n address: string;\n}\n\nexport function CreatorChip({ getClient, address }: CreatorChipProps) {\n const { profile } = useCreatorProfile(getClient, address);\n const label = profile?.
|
|
1
|
+
{"version":3,"sources":["../../src/components/creator-chip.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"./link.js\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport { useCreatorProfile } from \"../utils/use-profiles.js\";\nimport { AddressDisplay } from \"./address-display.js\";\n\nexport interface CreatorChipProps {\n getClient: () => MedialaneClient;\n address: string;\n}\n\nexport function CreatorChip({ getClient, address }: CreatorChipProps) {\n const { profile } = useCreatorProfile(getClient, address);\n const label = profile?.name || profile?.username || null;\n\n return (\n <Link\n href={`/account/${address}`}\n className=\"inline-flex items-center gap-1.5 text-sm rounded-full px-2 py-1 hover:bg-muted/60 active:scale-[0.98] transition\"\n >\n <span className=\"text-muted-foreground shrink-0\">by</span>\n {label ? (\n <span className=\"font-semibold text-foreground truncate\">{label}</span>\n ) : (\n <AddressDisplay address={address} chars={6} showCopy={false} className=\"font-semibold text-foreground\" />\n )}\n </Link>\n );\n}\n"],"mappings":";AAiBI,SAIE,KAJF;AAfJ,OAAO,UAAU;AAEjB,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAOxB,SAAS,YAAY,EAAE,WAAW,QAAQ,GAAqB;AACpE,QAAM,EAAE,QAAQ,IAAI,kBAAkB,WAAW,OAAO;AACxD,QAAM,QAAQ,SAAS,QAAQ,SAAS,YAAY;AAEpD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,YAAY,OAAO;AAAA,MACzB,WAAU;AAAA,MAEV;AAAA,4BAAC,UAAK,WAAU,kCAAiC,gBAAE;AAAA,QAClD,QACC,oBAAC,UAAK,WAAU,0CAA0C,iBAAM,IAEhE,oBAAC,kBAAe,SAAkB,OAAO,GAAG,UAAU,OAAO,WAAU,iCAAgC;AAAA;AAAA;AAAA,EAE3G;AAEJ;","names":[]}
|
|
@@ -36,11 +36,9 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_image = __toESM(require("next/image"), 1);
|
|
38
38
|
var import_react_hook_form = require("react-hook-form");
|
|
39
|
-
var import_starknet = require("starknet");
|
|
40
39
|
var import_sdk = require("@medialane/sdk");
|
|
41
|
-
var
|
|
40
|
+
var import_starknet = require("@medialane/sdk/starknet");
|
|
42
41
|
var import_mintable_collections = require("./mintable-collections.js");
|
|
43
|
-
var import_execute_and_sync = require("./execute-and-sync.js");
|
|
44
42
|
var import_lucide_react = require("lucide-react");
|
|
45
43
|
var import_input = require("../input.js");
|
|
46
44
|
var import_textarea = require("../textarea.js");
|
|
@@ -58,27 +56,6 @@ var import_ipfs = require("../../utils/ipfs.js");
|
|
|
58
56
|
var import_cn = require("../../utils/cn.js");
|
|
59
57
|
var import_dropzone = require("./dropzone.js");
|
|
60
58
|
var import_success_view = require("./success-view.js");
|
|
61
|
-
const COLLECTION_DEPLOYED_SELECTOR = import_starknet.hash.getSelectorFromName("CollectionDeployed");
|
|
62
|
-
const IP_MINTED_SELECTOR = import_starknet.hash.getSelectorFromName("IPMinted");
|
|
63
|
-
async function readMintedTokenId(provider, txHash, contractAddress) {
|
|
64
|
-
let receipt = null;
|
|
65
|
-
for (let attempt = 0; attempt < 3 && !receipt; attempt++) {
|
|
66
|
-
try {
|
|
67
|
-
if (attempt > 0) await new Promise((r) => setTimeout(r, 2e3));
|
|
68
|
-
const raw = await provider.getTransactionReceipt(txHash);
|
|
69
|
-
receipt = raw;
|
|
70
|
-
} catch {
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const events = receipt?.events ?? [];
|
|
74
|
-
const mintEvent = events.find(
|
|
75
|
-
(e) => e.from_address && BigInt(e.from_address) === BigInt(contractAddress) && e.keys?.[0] && BigInt(e.keys[0]) === BigInt(IP_MINTED_SELECTOR)
|
|
76
|
-
);
|
|
77
|
-
if (!mintEvent?.keys?.[1]) return null;
|
|
78
|
-
const low = BigInt(mintEvent.keys[1] ?? 0);
|
|
79
|
-
const high = BigInt(mintEvent.keys[2] ?? 0);
|
|
80
|
-
return (low + (high << 128n)).toString();
|
|
81
|
-
}
|
|
82
59
|
const MEDIA_ROUTE_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
83
60
|
"image/jpeg",
|
|
84
61
|
"image/png",
|
|
@@ -434,7 +411,7 @@ function FastMint(props) {
|
|
|
434
411
|
description: newCollectionDescription || void 0,
|
|
435
412
|
image
|
|
436
413
|
});
|
|
437
|
-
await (0,
|
|
414
|
+
await (0, import_starknet.executeIntent)(provider, signer, client, intentRes2.data);
|
|
438
415
|
const found = await pollForNewCollection(newCollectionName, newCollectionSymbol);
|
|
439
416
|
if (!found) throw new Error("Collection created, but it's still indexing \u2014 try minting again in a moment from My Collections.");
|
|
440
417
|
collectionId = found.collectionId;
|
|
@@ -447,14 +424,10 @@ function FastMint(props) {
|
|
|
447
424
|
tokenUri,
|
|
448
425
|
royaltyBps: Math.round(values.royalty * 100)
|
|
449
426
|
});
|
|
450
|
-
|
|
451
|
-
const calls = intentRes.data.calls;
|
|
452
|
-
contractAddress = calls[calls.length - 1]?.contractAddress ?? contractAddress;
|
|
453
|
-
}
|
|
454
|
-
result = await (0, import_execute_and_sync.executeAndSync)(() => (0, import_starknet2.executeIntent)(provider, signer, client, intentRes.data));
|
|
427
|
+
result = await (0, import_starknet.executeIntent)(provider, signer, client, intentRes.data);
|
|
455
428
|
finalContractAddress = contractAddress;
|
|
456
429
|
if (finalContractAddress) {
|
|
457
|
-
finalTokenId =
|
|
430
|
+
finalTokenId = (0, import_starknet.mintedTokenIdFromReceipt)(result.receipt, finalContractAddress);
|
|
458
431
|
}
|
|
459
432
|
} else {
|
|
460
433
|
let collectionContract = existingCollectionContract;
|
|
@@ -468,22 +441,10 @@ function FastMint(props) {
|
|
|
468
441
|
baseUri: "",
|
|
469
442
|
service: "mip-erc1155"
|
|
470
443
|
});
|
|
471
|
-
const deployResult = await (0,
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
if (attempt > 0) await new Promise((r) => setTimeout(r, 2e3));
|
|
476
|
-
const raw = await provider.getTransactionReceipt(deployResult.txHash);
|
|
477
|
-
receipt = raw;
|
|
478
|
-
} catch {
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
const events = receipt?.events ?? [];
|
|
482
|
-
const deployEvent = events.find(
|
|
483
|
-
(e) => e.keys?.[0] && BigInt(e.keys[0]) === BigInt(COLLECTION_DEPLOYED_SELECTOR)
|
|
484
|
-
);
|
|
485
|
-
if (!deployEvent?.keys?.[1]) throw new Error("Collection deployed, but its address couldn't be read \u2014 check My Collections to mint into it.");
|
|
486
|
-
collectionContract = (0, import_sdk.normalizeAddress)("STARKNET", deployEvent.keys[1]);
|
|
444
|
+
const deployResult = await (0, import_starknet.executeIntent)(provider, signer, client, intentRes2.data);
|
|
445
|
+
const deployed = (0, import_starknet.deployedCollectionFromReceipt)(deployResult.receipt, "mip-erc1155");
|
|
446
|
+
if (!deployed) throw new Error("Collection deployed, but its address couldn't be read \u2014 check My Collections to mint into it.");
|
|
447
|
+
collectionContract = deployed;
|
|
487
448
|
}
|
|
488
449
|
const intentRes = await client.api.createMintIntent({
|
|
489
450
|
owner: walletAddress,
|
|
@@ -493,9 +454,9 @@ function FastMint(props) {
|
|
|
493
454
|
value: editionCount,
|
|
494
455
|
royaltyBps: Math.round(values.royalty * 100)
|
|
495
456
|
});
|
|
496
|
-
result = await (0,
|
|
457
|
+
result = await (0, import_starknet.executeIntent)(provider, signer, client, intentRes.data);
|
|
497
458
|
finalContractAddress = collectionContract;
|
|
498
|
-
finalTokenId =
|
|
459
|
+
finalTokenId = (0, import_starknet.mintedTokenIdFromReceipt)(result.receipt, collectionContract);
|
|
499
460
|
}
|
|
500
461
|
if (finalContractAddress && finalTokenId) {
|
|
501
462
|
const asset = { contract: finalContractAddress, tokenId: finalTokenId, image };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/fast-mint/fast-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport Image from \"next/image\";\nimport { useForm } from \"react-hook-form\";\nimport { hash } from \"starknet\";\nimport { normalizeAddress, buildAssetMetadata, type ApiCollection } from \"@medialane/sdk\";\nimport { executeIntent } from \"@medialane/sdk/starknet\";\nimport { mintableCollections, collectionKey } from \"./mintable-collections.js\";\nimport { executeAndSync } from \"./execute-and-sync.js\";\nimport {\n ImagePlus, Music, Video, FileText, Loader2,\n Layers, ImagePlus as SingleIcon, ChevronDown, Boxes, Plus, Check,\n ShieldCheck, X,\n} from \"lucide-react\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"../select.js\";\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from \"../collapsible.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { MedialaneCollectionCard } from \"../medialane-collection-card.js\";\nimport { ActionDialog } from \"../action-dialog.js\";\nimport { IPTypeFields, type MetadataField } from \"../ip-type-fields.js\";\nimport {\n IP_TYPES, LICENSE_TYPES, GEOGRAPHIC_SCOPES, AI_POLICIES, DERIVATIVES_OPTIONS,\n type IPType,\n} from \"../../data/ip.js\";\nimport { IP_TEMPLATES } from \"../../data/ip-templates.js\";\nimport { suggestLaunchpadSymbol } from \"../../utils/launchpad-defaults.js\";\nimport { uploadFileToIpfs, uploadJsonToIpfs, uploadFailureToast } from \"../../utils/ipfs-upload.js\";\nimport { ipfsToHttp } from \"../../utils/ipfs.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { Dropzone } from \"./dropzone.js\";\nimport { SuccessView } from \"./success-view.js\";\nimport type { FastMintProps, FastMintSigner, MediaKind, MintedAsset } from \"./types.js\";\n\nconst COLLECTION_DEPLOYED_SELECTOR = hash.getSelectorFromName(\"CollectionDeployed\");\nconst IP_MINTED_SELECTOR = hash.getSelectorFromName(\"IPMinted\");\n\nasync function readMintedTokenId(\n provider: { getTransactionReceipt(txHash: string): Promise<unknown> },\n txHash: string,\n contractAddress: string,\n): Promise<string | null> {\n let receipt: { events?: { from_address?: string; keys?: string[] }[] } | null = null;\n for (let attempt = 0; attempt < 3 && !receipt; attempt++) {\n try {\n if (attempt > 0) await new Promise((r) => setTimeout(r, 2000));\n const raw = await provider.getTransactionReceipt(txHash);\n receipt = raw as { events?: { from_address?: string; keys?: string[] }[] };\n } catch { /* retry */ }\n }\n const events = receipt?.events ?? [];\n const mintEvent = events.find((e) =>\n e.from_address && BigInt(e.from_address) === BigInt(contractAddress) &&\n e.keys?.[0] && BigInt(e.keys[0]) === BigInt(IP_MINTED_SELECTOR)\n );\n if (!mintEvent?.keys?.[1]) return null;\n const low = BigInt(mintEvent.keys[1] ?? 0);\n const high = BigInt(mintEvent.keys[2] ?? 0);\n return (low + (high << 128n)).toString();\n}\n\nconst MEDIA_ROUTE_MIME_TYPES = new Set([\n \"image/jpeg\", \"image/png\", \"image/gif\", \"image/webp\", \"image/svg+xml\", \"image/avif\",\n \"video/mp4\", \"video/webm\", \"video/ogg\",\n \"audio/mpeg\", \"audio/ogg\", \"audio/wav\", \"audio/webm\", \"audio/flac\",\n \"application/pdf\",\n]);\nconst DOCUMENT_SIGNED_URL_MIME_TYPES = new Set([\n \"application/msword\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"application/vnd.oasis.opendocument.text\",\n \"application/rtf\",\n \"text/plain\",\n \"text/markdown\",\n]);\nconst MEDIA_MAX_BYTES = 100 * 1024 * 1024;\nconst DOCUMENT_MAX_BYTES = 20 * 1024 * 1024;\n\nfunction detectMediaKind(mime: string): MediaKind | null {\n if (mime.startsWith(\"image/\")) return MEDIA_ROUTE_MIME_TYPES.has(mime) ? \"image\" : null;\n if (mime.startsWith(\"video/\")) return MEDIA_ROUTE_MIME_TYPES.has(mime) ? \"video\" : null;\n if (mime.startsWith(\"audio/\")) return MEDIA_ROUTE_MIME_TYPES.has(mime) ? \"audio\" : null;\n if (mime === \"application/pdf\" || DOCUMENT_SIGNED_URL_MIME_TYPES.has(mime)) return \"document\";\n return null;\n}\n\nconst IP_TYPE_BY_KIND: Record<MediaKind, IPType> = {\n image: \"NFT\",\n audio: \"Audio\",\n video: \"Video\",\n document: \"Documents\",\n};\n\nconst MEDIA_KIND_ICON: Record<MediaKind, typeof ImagePlus> = {\n image: ImagePlus,\n audio: Music,\n video: Video,\n document: FileText,\n};\n\nfunction ToggleGroup({\n value, options, onChange,\n}: { value: string; options: readonly string[]; onChange: (v: string) => void }) {\n return (\n <div className=\"flex rounded-lg border border-border overflow-hidden w-full\">\n {options.map((opt, i) => (\n <button\n key={opt}\n type=\"button\"\n onClick={() => onChange(opt)}\n className={cn(\n \"flex-1 px-3 py-2 text-sm transition-colors\",\n i > 0 && \"border-l border-border\",\n value === opt ? \"bg-primary text-primary-foreground font-medium\" : \"bg-background hover:bg-muted text-muted-foreground\"\n )}\n >\n {opt}\n </button>\n ))}\n </div>\n );\n}\n\nfunction collectionDisplayLabel(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction CollectionThumb({ image }: { image: string | null | undefined }) {\n const imageUrl = image ? ipfsToHttp(image) : null;\n return (\n <div className=\"relative h-10 w-10 rounded-lg overflow-hidden bg-muted shrink-0\">\n {imageUrl ? (\n <Image src={imageUrl} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nfunction CollectionPicker({\n collections, value, onChange, valueOf,\n}: {\n collections: ApiCollection[];\n value: string;\n onChange: (id: string) => void;\n valueOf: (c: ApiCollection) => string | null | undefined;\n}) {\n const [open, setOpen] = useState(false);\n const selected = value\n ? collections.find((c) => valueOf(c) === value) ?? null\n : null;\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40\"\n >\n <CollectionThumb image={selected?.image} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold truncate\">\n {selected ? collectionDisplayLabel(selected) : collections.length ? \"Choose a collection\" : \"No collections yet\"}\n </p>\n <p className=\"text-xs text-muted-foreground\">\n {selected ? `${selected.totalSupply ?? 0} work${selected.totalSupply === 1 ? \"\" : \"s\"}` : \"Where this work will live\"}\n </p>\n </div>\n <ChevronDown className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n <div className=\"max-h-64 overflow-y-auto p-1\">\n {collections.length === 0 ? (\n <p className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No collections yet — create one instead.</p>\n ) : (\n collections.map((col) => {\n const id = valueOf(col);\n const isSelected = !!id && value === id;\n return (\n <button\n key={id ?? col.contractAddress ?? col.name}\n type=\"button\"\n disabled={!id}\n onClick={() => { if (!id) return; onChange(id); setOpen(false); }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60\"\n >\n <CollectionThumb image={col.image} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium truncate\">{collectionDisplayLabel(col)}</p>\n <p className=\"text-xs text-muted-foreground\">{col.totalSupply ?? 0} work{col.totalSupply === 1 ? \"\" : \"s\"}</p>\n </div>\n {isSelected && <Check className=\"h-4 w-4 text-brand-blue shrink-0\" />}\n </button>\n );\n })\n )}\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\ninterface FormValues {\n name: string;\n description: string;\n external_url: string;\n licenseType: string;\n commercialUse: \"Yes\" | \"No\";\n derivatives: \"Allowed\" | \"Not Allowed\" | \"Share-Alike\";\n attribution: \"Required\" | \"Not Required\";\n geographicScope: string;\n aiPolicy: \"Allowed\" | \"Not Allowed\" | \"Training Only\";\n royalty: number;\n}\n\nexport function FastMint(props: FastMintProps) {\n const {\n presentation = \"inline\", open = true, onClose, mediaKindLock, onMinted,\n collections, refetchCollections,\n hasWallet, walletAddress, onRequireWallet, connectLabel, getUploadToken, getSigner,\n client, provider,\n } = props;\n\n const [status, setStatus] = useState<\"idle\" | \"minting\" | \"success\" | \"error\">(\"idle\");\n const [errorMsg, setErrorMsg] = useState<string | null>(null);\n\n const [mediaFile, setMediaFile] = useState<File | null>(null);\n const [mediaPreview, setMediaPreview] = useState<string | null>(null);\n const [mediaUri, setMediaUri] = useState<string | null>(null);\n const [mediaKind, setMediaKind] = useState<MediaKind>(\"image\");\n const [mediaUploading, setMediaUploading] = useState(false);\n const previewUrlRef = useRef<string | null>(null);\n const mediaInputRef = useRef<HTMLInputElement>(null);\n\n const [featurePreview, setFeaturePreview] = useState<string | null>(null);\n const [featureUri, setFeatureUri] = useState<string | null>(null);\n const [featureUploading, setFeatureUploading] = useState(false);\n const featurePreviewRef = useRef<string | null>(null);\n const featureInputRef = useRef<HTMLInputElement>(null);\n\n const [assetType, setAssetType] = useState<\"single\" | \"editions\">(\"single\");\n const [editionCount, setEditionCount] = useState(\"10\");\n\n const [collectionMode, setCollectionMode] = useState<\"existing\" | \"new\">(\"existing\");\n const [existingCollectionId, setExistingCollectionId] = useState(\"\");\n const [existingCollectionContract, setExistingCollectionContract] = useState(\"\");\n const [newCollectionName, setNewCollectionName] = useState(\"\");\n const [newCollectionSymbol, setNewCollectionSymbol] = useState(\"\");\n const [newCollectionDescription, setNewCollectionDescription] = useState(\"\");\n const [autoSymbol, setAutoSymbol] = useState(\"\");\n const [autoCollectionName, setAutoCollectionName] = useState(\"\");\n const [autoCollectionDescription, setAutoCollectionDescription] = useState(\"\");\n\n const [ipType, setIpType] = useState<IPType>(\"NFT\");\n const [advancedOpen, setAdvancedOpen] = useState(false);\n const [ipTypeOpen, setIpTypeOpen] = useState(false);\n const templateFieldsRef = useRef<MetadataField[]>([]);\n\n const [mintedAsset, setMintedAsset] = useState<MintedAsset | null>(null);\n\n useEffect(() => () => {\n if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);\n if (featurePreviewRef.current) URL.revokeObjectURL(featurePreviewRef.current);\n }, []);\n\n const form = useForm<FormValues>({\n defaultValues: {\n name: \"\", description: \"\", external_url: \"\",\n licenseType: \"CC BY-SA\", commercialUse: \"Yes\", derivatives: \"Share-Alike\",\n attribution: \"Required\", geographicScope: \"Worldwide\", aiPolicy: \"Not Allowed\", royalty: 0,\n },\n });\n const name = form.watch(\"name\");\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"external_url\")) {\n form.setValue(\"external_url\", `https://medialane.io/account/${walletAddress}`);\n }\n }, [walletAddress, form]);\n\n useEffect(() => {\n const s = suggestLaunchpadSymbol(name);\n if (!s) return;\n if (!newCollectionSymbol || newCollectionSymbol === autoSymbol) {\n setNewCollectionSymbol(s);\n setAutoSymbol(s);\n }\n if (!newCollectionName || newCollectionName === autoCollectionName) {\n setNewCollectionName(name);\n setAutoCollectionName(name);\n }\n }, [name, autoSymbol, autoCollectionName, newCollectionSymbol, newCollectionName]);\n\n const description = form.watch(\"description\");\n useEffect(() => {\n if (!newCollectionDescription || newCollectionDescription === autoCollectionDescription) {\n setNewCollectionDescription(description);\n setAutoCollectionDescription(description);\n }\n }, [description, autoCollectionDescription, newCollectionDescription]);\n\n const erc721Collections = mintableCollections(\"single\", collections);\n const erc1155Collections = mintableCollections(\"editions\", collections);\n\n const handleMediaSelect = async (file: File) => {\n const kind = detectMediaKind(file.type);\n if (!kind) {\n setErrorMsg(\"Publish an image, audio, video (JPG/PNG/GIF/SVG/WebP, MP3/WAV/OGG/FLAC, MP4/WebM), or document (PDF, DOC, DOCX, ODT, RTF, TXT, MD).\");\n return;\n }\n if (mediaKindLock && kind !== mediaKindLock) {\n setErrorMsg(`Please upload a${mediaKindLock === \"image\" ? \"n\" : \"\"} ${mediaKindLock}.`);\n return;\n }\n const viaMediaRoute = MEDIA_ROUTE_MIME_TYPES.has(file.type);\n const maxBytes = viaMediaRoute ? MEDIA_MAX_BYTES : DOCUMENT_MAX_BYTES;\n if (file.size > maxBytes) {\n setErrorMsg(`Maximum size is ${maxBytes / (1024 * 1024)} MB.`);\n return;\n }\n setMediaFile(file);\n setMediaKind(kind);\n setIpType(IP_TYPE_BY_KIND[kind]);\n if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);\n const objectUrl = URL.createObjectURL(file);\n previewUrlRef.current = objectUrl;\n setMediaPreview(objectUrl);\n setMediaUri(null);\n setMediaUploading(true);\n try {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n const { uri } = await uploadFileToIpfs(file, viaMediaRoute ? \"media\" : \"document\");\n setMediaUri(uri);\n } catch (err) {\n const t = uploadFailureToast(err);\n setErrorMsg(t.description ?? t.title);\n } finally {\n setMediaUploading(false);\n }\n };\n\n const clearMedia = () => {\n setMediaFile(null);\n setMediaPreview(null);\n setMediaUri(null);\n if (mediaInputRef.current) mediaInputRef.current.value = \"\";\n };\n\n const handleFeatureSelect = async (file: File) => {\n if (featurePreviewRef.current) URL.revokeObjectURL(featurePreviewRef.current);\n const objectUrl = URL.createObjectURL(file);\n featurePreviewRef.current = objectUrl;\n setFeaturePreview(objectUrl);\n setFeatureUri(null);\n setFeatureUploading(true);\n try {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n const { uri } = await uploadFileToIpfs(file, \"image\");\n setFeatureUri(uri);\n } catch (err) {\n const t = uploadFailureToast(err);\n setErrorMsg(t.description ?? t.title);\n } finally {\n setFeatureUploading(false);\n }\n };\n\n const handleLicenseChange = (value: string) => {\n form.setValue(\"licenseType\", value);\n const def = LICENSE_TYPES.find((l) => l.value === value);\n if (def) {\n form.setValue(\"commercialUse\", def.commercialUse);\n form.setValue(\"derivatives\", def.derivatives);\n form.setValue(\"attribution\", def.attribution);\n }\n };\n\n const ready = !!mediaUri && !mediaUploading && name.trim().length > 0 &&\n (mediaKind === \"image\" || !!featureUri) &&\n (collectionMode === \"existing\"\n ? assetType === \"single\" ? !!existingCollectionId : !!existingCollectionContract\n : newCollectionName.trim().length > 0 && newCollectionSymbol.trim().length > 0);\n\n async function pollForNewCollection(name: string, symbol: string): Promise<ApiCollection | null> {\n for (let attempt = 0; attempt < 8; attempt++) {\n const list = await refetchCollections();\n const match = list.find((c) => c.name === name && c.symbol === symbol);\n if (match?.collectionId) return match;\n await new Promise((r) => setTimeout(r, 1500));\n }\n return null;\n }\n\n const onSubmit = async (values: FormValues) => {\n if (!hasWallet) { onRequireWallet(); return; }\n if (!walletAddress || !mediaUri) return;\n if (values.external_url && !values.external_url.startsWith(\"http://\") && !values.external_url.startsWith(\"https://\")) {\n setErrorMsg(\"External link must start with http:// or https://\");\n return;\n }\n\n setStatus(\"minting\");\n setErrorMsg(null);\n\n try {\n const signer: FastMintSigner = await getSigner();\n\n const image = mediaKind === \"image\" ? mediaUri : featureUri!;\n const animationUrl = mediaKind === \"image\" ? undefined : mediaUri;\n\n const built = buildAssetMetadata({\n name: values.name,\n description: values.description || \"\",\n externalUrl: values.external_url || \"\",\n imageUri: image,\n creator: walletAddress,\n ipType,\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n templateTraits: templateFieldsRef.current\n .filter(({ traitType, value }) => traitType.trim() && value.trim())\n .map(({ traitType, value }) => ({ traitType, value })),\n });\n const metadata: Record<string, unknown> = { ...built };\n if (animationUrl) metadata.animation_url = animationUrl;\n\n const uploadToken = await getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n const tokenUri = await uploadJsonToIpfs(metadata);\n\n let result: { txHash: string };\n let finalContractAddress: string | null;\n let finalTokenId: string | null = null;\n\n if (assetType === \"single\") {\n let collectionId = existingCollectionId;\n let contractAddress = erc721Collections.find((c) => c.collectionId === existingCollectionId)?.contractAddress ?? null;\n\n if (collectionMode === \"new\") {\n const intentRes = await client.api.createCollectionIntent({\n owner: walletAddress,\n name: newCollectionName,\n symbol: newCollectionSymbol,\n description: newCollectionDescription || undefined,\n image,\n });\n await executeAndSync(() => executeIntent(provider, signer, client, intentRes.data));\n\n const found = await pollForNewCollection(newCollectionName, newCollectionSymbol);\n if (!found) throw new Error(\"Collection created, but it's still indexing — try minting again in a moment from My Collections.\");\n collectionId = found.collectionId!;\n contractAddress = found.contractAddress ?? null;\n }\n\n const intentRes = await client.api.createMintIntent({\n owner: walletAddress,\n collectionId,\n recipient: walletAddress,\n tokenUri,\n royaltyBps: Math.round(values.royalty * 100),\n });\n if (!intentRes.data.requiresSignature) {\n const calls = intentRes.data.calls;\n contractAddress = calls[calls.length - 1]?.contractAddress ?? contractAddress;\n }\n result = await executeAndSync(() => executeIntent(provider, signer, client, intentRes.data));\n finalContractAddress = contractAddress;\n\n if (finalContractAddress) {\n finalTokenId = await readMintedTokenId(provider, result.txHash, finalContractAddress);\n }\n } else {\n let collectionContract = existingCollectionContract;\n\n if (collectionMode === \"new\") {\n const intentRes = await client.api.createCollectionIntent({\n owner: walletAddress,\n name: newCollectionName,\n symbol: newCollectionSymbol,\n description: newCollectionDescription || undefined,\n image,\n baseUri: \"\",\n service: \"mip-erc1155\",\n });\n const deployResult = await executeAndSync(() => executeIntent(provider, signer, client, intentRes.data));\n\n let receipt: { events?: { keys?: string[] }[] } | null = null;\n for (let attempt = 0; attempt < 3 && !receipt; attempt++) {\n try {\n if (attempt > 0) await new Promise((r) => setTimeout(r, 2000));\n const raw = await provider.getTransactionReceipt(deployResult.txHash);\n receipt = raw as { events?: { keys?: string[] }[] };\n } catch { /* retry */ }\n }\n const events = receipt?.events ?? [];\n const deployEvent = events.find((e) =>\n e.keys?.[0] && BigInt(e.keys[0]) === BigInt(COLLECTION_DEPLOYED_SELECTOR)\n );\n if (!deployEvent?.keys?.[1]) throw new Error(\"Collection deployed, but its address couldn't be read — check My Collections to mint into it.\");\n collectionContract = normalizeAddress(\"STARKNET\", deployEvent.keys[1]);\n }\n\n const intentRes = await client.api.createMintIntent({\n owner: walletAddress,\n recipient: walletAddress,\n collectionContract,\n tokenUri,\n value: editionCount,\n royaltyBps: Math.round(values.royalty * 100),\n });\n result = await executeAndSync(() => executeIntent(provider, signer, client, intentRes.data));\n finalContractAddress = collectionContract;\n finalTokenId = await readMintedTokenId(provider, result.txHash, collectionContract);\n }\n\n if (finalContractAddress && finalTokenId) {\n const asset: MintedAsset = { contract: finalContractAddress, tokenId: finalTokenId, image };\n setMintedAsset(asset);\n onMinted?.(asset);\n }\n setStatus(\"success\");\n } catch (err) {\n setErrorMsg(err instanceof Error ? err.message : \"Something went wrong. Please try again.\");\n setStatus(\"error\");\n }\n };\n\n const resetAll = () => {\n setStatus(\"idle\");\n setErrorMsg(null);\n setMintedAsset(null);\n form.reset();\n clearMedia();\n setFeaturePreview(null);\n setFeatureUri(null);\n setAssetType(\"single\");\n setEditionCount(\"10\");\n setCollectionMode(\"existing\");\n setExistingCollectionId(\"\");\n setExistingCollectionContract(\"\");\n setNewCollectionName(\"\");\n setNewCollectionSymbol(\"\");\n setNewCollectionDescription(\"\");\n setAutoSymbol(\"\");\n setAutoCollectionName(\"\");\n setAutoCollectionDescription(\"\");\n templateFieldsRef.current = [];\n };\n\n const busy = status === \"minting\";\n const KindIcon = MEDIA_KIND_ICON[mediaKind];\n const selectedExistingCollection = assetType === \"single\"\n ? erc721Collections.find((c) => c.collectionId === existingCollectionId)\n : erc1155Collections.find((c) => c.contractAddress === existingCollectionContract);\n const collectionLabel = mediaUri\n ? (collectionMode === \"new\"\n ? (newCollectionName || \"New collection\")\n : (selectedExistingCollection?.name || \"IP Asset\"))\n : undefined;\n\n const wrap = (node: React.ReactNode) => {\n if (presentation !== \"dialog\") return node;\n return (\n <ActionDialog open={open} onClose={onClose ?? (() => {})} width={640}>\n <div className=\"relative p-6 sm:p-8\">\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close\"\n className=\"absolute top-4 right-4 h-8 w-8 rounded-full hover:bg-muted flex items-center justify-center text-muted-foreground\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n {node}\n </div>\n </ActionDialog>\n );\n };\n\n if (status === \"success\") {\n return wrap(\n <SuccessView\n presentation={presentation}\n previewImage={mediaKind === \"image\" ? mediaPreview : featurePreview}\n name={name}\n collectionLabel={collectionLabel}\n mintedAsset={mintedAsset}\n onPublishAnother={resetAll}\n />\n );\n }\n\n if (!mediaFile) {\n return wrap(\n <Dropzone\n mediaKindLock={mediaKindLock}\n presentation={presentation}\n hasWallet={hasWallet}\n onRequireWallet={onRequireWallet}\n connectLabel={connectLabel}\n onFileSelected={handleMediaSelect}\n />\n );\n }\n\n return wrap(\n <section className=\"space-y-6\">\n <div className=\"flex items-center gap-4 rounded-xl border border-border p-3\">\n <div className=\"relative h-14 w-14 rounded-lg bg-muted overflow-hidden shrink-0\">\n {mediaKind === \"image\" && mediaPreview ? (\n <Image src={mediaPreview} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <KindIcon className=\"h-6 w-6 text-muted-foreground\" />\n </div>\n )}\n {mediaUploading && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-background/70\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <p className=\"text-sm font-semibold truncate\">{mediaFile.name}</p>\n <div className=\"flex items-center gap-2 flex-wrap\">\n <p className=\"text-xs text-muted-foreground\">\n {mediaUploading ? \"Uploading…\" : mediaUri ? \"Uploaded\" : \"Upload failed\"}\n </p>\n {mediaUri && (() => {\n const template = IP_TEMPLATES[ipType];\n const TemplateIcon = template.icon;\n return (\n <span\n className={cn(\n \"inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium\",\n template.color.bg, template.color.text, template.color.border\n )}\n >\n <TemplateIcon className=\"h-3 w-3\" />\n {template.label}\n </span>\n );\n })()}\n </div>\n </div>\n <button\n type=\"button\"\n onClick={() => mediaInputRef.current?.click()}\n className=\"text-xs font-semibold text-brand-blue hover:underline shrink-0\"\n >\n Change\n </button>\n <input ref={mediaInputRef} type=\"file\" className=\"hidden\" onChange={(e) => { const f = e.target.files?.[0]; if (f) handleMediaSelect(f); }} />\n </div>\n\n {mediaUri && (\n <div className=\"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start\">\n <div className=\"space-y-5\">\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Title *</label>\n <Input\n value={name}\n onChange={(e) => form.setValue(\"name\", e.target.value)}\n placeholder=\"My Creative Work\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Description</label>\n <Textarea\n value={form.watch(\"description\")}\n onChange={(e) => form.setValue(\"description\", e.target.value)}\n placeholder=\"Describe your work, its story, and any context for buyers…\"\n rows={3}\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">External link <span className=\"text-muted-foreground font-normal\">(optional)</span></label>\n <Input\n value={form.watch(\"external_url\")}\n onChange={(e) => form.setValue(\"external_url\", e.target.value)}\n placeholder=\"https://yourwebsite.com\"\n />\n </div>\n\n {mediaKind !== \"image\" && (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Upload a cover image for your asset *</label>\n <div className=\"flex items-center gap-4\">\n <div\n role=\"button\"\n tabIndex={0}\n onClick={() => !featureUploading && featureInputRef.current?.click()}\n onKeyDown={(e) => { if ((e.key === \"Enter\" || e.key === \" \") && !featureUploading) { e.preventDefault(); featureInputRef.current?.click(); } }}\n className=\"relative h-20 w-20 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors\"\n >\n {featurePreview ? (\n <Image src={featurePreview} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <ImagePlus className=\"h-6 w-6 text-muted-foreground\" />\n )}\n {featureUploading && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-background/70\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n )}\n <input ref={featureInputRef} type=\"file\" accept=\"image/*\" className=\"hidden\" onChange={(e) => { const f = e.target.files?.[0]; if (f) handleFeatureSelect(f); }} />\n </div>\n <p className=\"text-xs text-muted-foreground\">Cover art shown wherever the work is previewed. JPG, PNG, GIF, SVG or WebP.</p>\n </div>\n </div>\n )}\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Asset Type</label>\n <div className=\"grid grid-cols-2 gap-3\">\n <button\n type=\"button\"\n onClick={() => setAssetType(\"single\")}\n className={cn(\"flex items-start gap-3 rounded-xl border p-4 text-left transition-colors\",\n assetType === \"single\" ? \"border-brand-blue bg-brand-blue/5\" : \"border-border hover:bg-muted/40\")}\n >\n <SingleIcon className={cn(\"h-5 w-5 shrink-0 mt-0.5\", assetType === \"single\" ? \"text-brand-blue\" : \"text-muted-foreground\")} />\n <span>\n <span className=\"block text-sm font-semibold\">Single Edition NFT</span>\n <span className=\"block text-xs mt-0.5 text-muted-foreground\">Minted once</span>\n </span>\n </button>\n <button\n type=\"button\"\n onClick={() => setAssetType(\"editions\")}\n className={cn(\"flex items-start gap-3 rounded-xl border p-4 text-left transition-colors\",\n assetType === \"editions\" ? \"border-brand-blue bg-brand-blue/5\" : \"border-border hover:bg-muted/40\")}\n >\n <Layers className={cn(\"h-5 w-5 shrink-0 mt-0.5\", assetType === \"editions\" ? \"text-brand-blue\" : \"text-muted-foreground\")} />\n <span>\n <span className=\"block text-sm font-semibold\">Limited Editions NFT</span>\n <span className=\"block text-xs mt-0.5 text-muted-foreground\">Several numbered copies</span>\n </span>\n </button>\n </div>\n </div>\n\n {assetType === \"editions\" && (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Number of copies</label>\n <Input\n type=\"number\"\n min={1}\n value={editionCount}\n onChange={(e) => setEditionCount(e.target.value)}\n className=\"max-w-[140px]\"\n />\n </div>\n )}\n\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <label className=\"text-sm font-medium flex items-center gap-1.5\">\n <Boxes className=\"h-4 w-4\" />\n Collection *\n </label>\n <div className=\"flex rounded-lg border border-border overflow-hidden\">\n <button\n type=\"button\"\n onClick={() => setCollectionMode(\"existing\")}\n className={cn(\"px-3 h-7 text-xs font-medium transition-colors\",\n collectionMode === \"existing\" ? \"bg-primary text-primary-foreground\" : \"bg-background hover:bg-muted text-muted-foreground\")}\n >\n Existing\n </button>\n <button\n type=\"button\"\n onClick={() => setCollectionMode(\"new\")}\n className={cn(\"px-3 h-7 text-xs font-medium border-l border-border transition-colors flex items-center gap-1\",\n collectionMode === \"new\" ? \"bg-primary text-primary-foreground\" : \"bg-background hover:bg-muted text-muted-foreground\")}\n >\n <Plus className=\"h-3 w-3\" />New\n </button>\n </div>\n </div>\n\n {collectionMode === \"existing\" ? (\n <CollectionPicker\n collections={assetType === \"single\" ? erc721Collections : erc1155Collections}\n value={assetType === \"single\" ? existingCollectionId : existingCollectionContract}\n onChange={assetType === \"single\" ? setExistingCollectionId : setExistingCollectionContract}\n valueOf={collectionKey(assetType === \"single\" ? \"single\" : \"editions\")}\n />\n ) : (\n <div className=\"flex gap-3 rounded-xl border border-border p-3\">\n <div className=\"relative h-16 w-16 rounded-lg overflow-hidden bg-muted shrink-0\">\n {(mediaKind === \"image\" ? mediaPreview : featurePreview) ? (\n <Image\n src={(mediaKind === \"image\" ? mediaPreview : featurePreview)!}\n alt=\"\"\n fill\n className=\"object-cover\"\n unoptimized\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-5 w-5 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1 space-y-2\">\n <div className=\"grid grid-cols-[1fr_100px] gap-2\">\n <Input\n value={newCollectionName}\n onChange={(e) => setNewCollectionName(e.target.value)}\n placeholder=\"Collection name\"\n className=\"h-9 text-sm\"\n />\n <Input\n value={newCollectionSymbol}\n onChange={(e) => setNewCollectionSymbol(e.target.value.toUpperCase())}\n placeholder=\"SYMBOL\"\n className=\"h-9 text-sm\"\n />\n </div>\n <Textarea\n value={newCollectionDescription}\n onChange={(e) => setNewCollectionDescription(e.target.value)}\n placeholder=\"Describe this collection…\"\n rows={2}\n className=\"text-sm resize-none\"\n />\n <p className=\"text-2xs text-muted-foreground\">Prefilled from your asset — edit anything above.</p>\n </div>\n </div>\n )}\n </div>\n\n <Collapsible open={advancedOpen} onOpenChange={setAdvancedOpen}>\n <div className=\"rounded-xl border border-border overflow-hidden\">\n <CollapsibleTrigger asChild>\n <button type=\"button\" className=\"w-full flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors\">\n <span className=\"flex items-center gap-2\">\n <ShieldCheck className=\"h-4 w-4 text-primary\" />\n <span className=\"text-sm font-semibold\">Licensing Terms</span>\n <span className=\"text-xs text-muted-foreground font-normal\">Optional · Berne Convention</span>\n </span>\n <ChevronDown className={cn(\"h-4 w-4 text-muted-foreground transition-transform\", advancedOpen && \"rotate-180\")} />\n </button>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"px-4 pb-4 space-y-4 border-t border-border/60 pt-4\">\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">License</label>\n <Select value={form.watch(\"licenseType\")} onValueChange={handleLicenseChange}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {LICENSE_TYPES.map((l) => <SelectItem key={l.value} value={l.value}>{l.label}</SelectItem>)}\n </SelectContent>\n </Select>\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">Commercial use</label>\n <ToggleGroup value={form.watch(\"commercialUse\")} options={[\"Yes\", \"No\"]} onChange={(v) => form.setValue(\"commercialUse\", v as \"Yes\" | \"No\")} />\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">Derivatives</label>\n <ToggleGroup value={form.watch(\"derivatives\")} options={DERIVATIVES_OPTIONS} onChange={(v) => form.setValue(\"derivatives\", v as FormValues[\"derivatives\"])} />\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">Territory</label>\n <Select value={form.watch(\"geographicScope\")} onValueChange={(v) => form.setValue(\"geographicScope\", v)}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {GEOGRAPHIC_SCOPES.map((s) => <SelectItem key={s} value={s}>{s}</SelectItem>)}\n </SelectContent>\n </Select>\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">AI & data mining</label>\n <ToggleGroup value={form.watch(\"aiPolicy\")} options={AI_POLICIES} onChange={(v) => form.setValue(\"aiPolicy\", v as FormValues[\"aiPolicy\"])} />\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">Royalty % (0–50)</label>\n <Input\n type=\"number\" min={0} max={50} step={0.5}\n value={form.watch(\"royalty\")}\n onChange={(e) => form.setValue(\"royalty\", parseFloat(e.target.value) || 0)}\n className=\"max-w-[120px]\"\n />\n </div>\n </div>\n </CollapsibleContent>\n </div>\n </Collapsible>\n\n <Collapsible open={ipTypeOpen} onOpenChange={setIpTypeOpen}>\n <div className=\"rounded-xl border border-border overflow-hidden\">\n <CollapsibleTrigger asChild>\n <button type=\"button\" className=\"w-full flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors\">\n <span className=\"flex items-center gap-2\">\n <Layers className=\"h-4 w-4 text-primary\" />\n <span className=\"text-sm font-semibold\">IP Type & Metadata</span>\n <span className=\"text-xs text-muted-foreground font-normal\">Optional</span>\n </span>\n <ChevronDown className={cn(\"h-4 w-4 text-muted-foreground transition-transform\", ipTypeOpen && \"rotate-180\")} />\n </button>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"px-4 pb-4 space-y-4 border-t border-border/60 pt-4\">\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">IP Type</label>\n <Select value={ipType} onValueChange={(v) => setIpType(v as IPType)}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {IP_TYPES.map((t) => <SelectItem key={t} value={t}>{t}</SelectItem>)}\n </SelectContent>\n </Select>\n </div>\n <IPTypeFields\n ipType={ipType}\n onChange={(fields) => { templateFieldsRef.current = fields; }}\n uploadDocument={async (file) => {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n const { uri } = await uploadFileToIpfs(file, \"document\");\n return uri;\n }}\n existingDocument={mediaKind === \"document\" && mediaUri && mediaFile ? { uri: mediaUri, name: mediaFile.name } : null}\n />\n </div>\n </CollapsibleContent>\n </div>\n </Collapsible>\n\n {status === \"error\" && errorMsg && <p className=\"text-xs text-destructive\">{errorMsg}</p>}\n\n <button\n type=\"button\"\n disabled={!ready || busy || !hasWallet}\n onClick={form.handleSubmit(onSubmit)}\n className={cn(\n \"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue\",\n (!ready || busy || !hasWallet) && \"opacity-40 pointer-events-none\"\n )}\n >\n {busy ? <><Loader2 className=\"h-4 w-4 animate-spin\" />Minting…</> : assetType === \"single\" ? \"Mint NFT\" : \"Mint Editions\"}\n </button>\n <p className=\"text-xs text-center text-muted-foreground\">\n Zero platform fees to mint.\n </p>\n </div>\n\n <div className=\"order-first lg:order-last lg:sticky lg:top-20 max-w-[260px] mx-auto w-full lg:max-w-none lg:mx-0\">\n <MedialaneCollectionCard\n image={mediaKind === \"image\" ? mediaPreview : featurePreview}\n name={name}\n collection={collectionLabel}\n creator={walletAddress ? `${walletAddress.slice(0, 6)}…${walletAddress.slice(-4)}` : undefined}\n creatorHref={walletAddress ? `/account/${walletAddress}` : undefined}\n />\n </div>\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4GQ;AA1GR,mBAA4C;AAC5C,mBAAkB;AAClB,6BAAwB;AACxB,sBAAqB;AACrB,iBAAyE;AACzE,IAAAA,mBAA8B;AAC9B,kCAAmD;AACnD,8BAA+B;AAC/B,0BAIO;AACP,mBAAsB;AACtB,sBAAyB;AACzB,oBAA8E;AAC9E,yBAAoE;AACpE,qBAAwD;AACxD,uCAAwC;AACxC,2BAA6B;AAC7B,4BAAiD;AACjD,gBAGO;AACP,0BAA6B;AAC7B,gCAAuC;AACvC,yBAAuE;AACvE,kBAA2B;AAC3B,gBAAmB;AACnB,sBAAyB;AACzB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L,UAAU,CAAC,SAAS,QAAQ,CAAC;AAAA,cAC7B,SAAS,KAAK,aAAa,QAAQ;AAAA,cACnC,eAAW;AAAA,gBACT;AAAA,iBACC,CAAC,SAAS,QAAQ,CAAC,cAAc;AAAA,cACpC;AAAA,cAEC,iBAAO,4EAAE;AAAA,4DAAC,+BAAQ,WAAU,wBAAuB;AAAA,gBAAE;AAAA,iBAAQ,IAAM,cAAc,WAAW,aAAa;AAAA;AAAA,UAC5G;AAAA,UACA,4CAAC,OAAE,WAAU,6CAA4C,yCAEzD;AAAA,WACF;AAAA,QAEA,4CAAC,SAAI,WAAU,oGACb;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,cAAc,UAAU,eAAe;AAAA,YAC9C;AAAA,YACA,YAAY;AAAA,YACZ,SAAS,gBAAgB,GAAG,cAAc,MAAM,GAAG,CAAC,CAAC,SAAI,cAAc,MAAM,EAAE,CAAC,KAAK;AAAA,YACrF,aAAa,gBAAgB,YAAY,aAAa,KAAK;AAAA;AAAA,QAC7D,GACF;AAAA,SACF;AAAA,OAEJ;AAAA,EACF;AACF;","names":["import_starknet","Image","name","intentRes","SingleIcon"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/fast-mint/fast-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport Image from \"next/image\";\nimport { useForm } from \"react-hook-form\";\nimport { buildAssetMetadata, type ApiCollection } from \"@medialane/sdk\";\nimport { executeIntent, deployedCollectionFromReceipt, mintedTokenIdFromReceipt } from \"@medialane/sdk/starknet\";\nimport { mintableCollections, collectionKey } from \"./mintable-collections.js\";\nimport {\n ImagePlus, Music, Video, FileText, Loader2,\n Layers, ImagePlus as SingleIcon, ChevronDown, Boxes, Plus, Check,\n ShieldCheck, X,\n} from \"lucide-react\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"../select.js\";\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from \"../collapsible.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { MedialaneCollectionCard } from \"../medialane-collection-card.js\";\nimport { ActionDialog } from \"../action-dialog.js\";\nimport { IPTypeFields, type MetadataField } from \"../ip-type-fields.js\";\nimport {\n IP_TYPES, LICENSE_TYPES, GEOGRAPHIC_SCOPES, AI_POLICIES, DERIVATIVES_OPTIONS,\n type IPType,\n} from \"../../data/ip.js\";\nimport { IP_TEMPLATES } from \"../../data/ip-templates.js\";\nimport { suggestLaunchpadSymbol } from \"../../utils/launchpad-defaults.js\";\nimport { uploadFileToIpfs, uploadJsonToIpfs, uploadFailureToast } from \"../../utils/ipfs-upload.js\";\nimport { ipfsToHttp } from \"../../utils/ipfs.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { Dropzone } from \"./dropzone.js\";\nimport { SuccessView } from \"./success-view.js\";\nimport type { FastMintProps, FastMintSigner, MediaKind, MintedAsset } from \"./types.js\";\n\nconst MEDIA_ROUTE_MIME_TYPES = new Set([\n \"image/jpeg\", \"image/png\", \"image/gif\", \"image/webp\", \"image/svg+xml\", \"image/avif\",\n \"video/mp4\", \"video/webm\", \"video/ogg\",\n \"audio/mpeg\", \"audio/ogg\", \"audio/wav\", \"audio/webm\", \"audio/flac\",\n \"application/pdf\",\n]);\nconst DOCUMENT_SIGNED_URL_MIME_TYPES = new Set([\n \"application/msword\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"application/vnd.oasis.opendocument.text\",\n \"application/rtf\",\n \"text/plain\",\n \"text/markdown\",\n]);\nconst MEDIA_MAX_BYTES = 100 * 1024 * 1024;\nconst DOCUMENT_MAX_BYTES = 20 * 1024 * 1024;\n\nfunction detectMediaKind(mime: string): MediaKind | null {\n if (mime.startsWith(\"image/\")) return MEDIA_ROUTE_MIME_TYPES.has(mime) ? \"image\" : null;\n if (mime.startsWith(\"video/\")) return MEDIA_ROUTE_MIME_TYPES.has(mime) ? \"video\" : null;\n if (mime.startsWith(\"audio/\")) return MEDIA_ROUTE_MIME_TYPES.has(mime) ? \"audio\" : null;\n if (mime === \"application/pdf\" || DOCUMENT_SIGNED_URL_MIME_TYPES.has(mime)) return \"document\";\n return null;\n}\n\nconst IP_TYPE_BY_KIND: Record<MediaKind, IPType> = {\n image: \"NFT\",\n audio: \"Audio\",\n video: \"Video\",\n document: \"Documents\",\n};\n\nconst MEDIA_KIND_ICON: Record<MediaKind, typeof ImagePlus> = {\n image: ImagePlus,\n audio: Music,\n video: Video,\n document: FileText,\n};\n\nfunction ToggleGroup({\n value, options, onChange,\n}: { value: string; options: readonly string[]; onChange: (v: string) => void }) {\n return (\n <div className=\"flex rounded-lg border border-border overflow-hidden w-full\">\n {options.map((opt, i) => (\n <button\n key={opt}\n type=\"button\"\n onClick={() => onChange(opt)}\n className={cn(\n \"flex-1 px-3 py-2 text-sm transition-colors\",\n i > 0 && \"border-l border-border\",\n value === opt ? \"bg-primary text-primary-foreground font-medium\" : \"bg-background hover:bg-muted text-muted-foreground\"\n )}\n >\n {opt}\n </button>\n ))}\n </div>\n );\n}\n\nfunction collectionDisplayLabel(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction CollectionThumb({ image }: { image: string | null | undefined }) {\n const imageUrl = image ? ipfsToHttp(image) : null;\n return (\n <div className=\"relative h-10 w-10 rounded-lg overflow-hidden bg-muted shrink-0\">\n {imageUrl ? (\n <Image src={imageUrl} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nfunction CollectionPicker({\n collections, value, onChange, valueOf,\n}: {\n collections: ApiCollection[];\n value: string;\n onChange: (id: string) => void;\n valueOf: (c: ApiCollection) => string | null | undefined;\n}) {\n const [open, setOpen] = useState(false);\n const selected = value\n ? collections.find((c) => valueOf(c) === value) ?? null\n : null;\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40\"\n >\n <CollectionThumb image={selected?.image} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold truncate\">\n {selected ? collectionDisplayLabel(selected) : collections.length ? \"Choose a collection\" : \"No collections yet\"}\n </p>\n <p className=\"text-xs text-muted-foreground\">\n {selected ? `${selected.totalSupply ?? 0} work${selected.totalSupply === 1 ? \"\" : \"s\"}` : \"Where this work will live\"}\n </p>\n </div>\n <ChevronDown className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n <div className=\"max-h-64 overflow-y-auto p-1\">\n {collections.length === 0 ? (\n <p className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No collections yet — create one instead.</p>\n ) : (\n collections.map((col) => {\n const id = valueOf(col);\n const isSelected = !!id && value === id;\n return (\n <button\n key={id ?? col.contractAddress ?? col.name}\n type=\"button\"\n disabled={!id}\n onClick={() => { if (!id) return; onChange(id); setOpen(false); }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60\"\n >\n <CollectionThumb image={col.image} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium truncate\">{collectionDisplayLabel(col)}</p>\n <p className=\"text-xs text-muted-foreground\">{col.totalSupply ?? 0} work{col.totalSupply === 1 ? \"\" : \"s\"}</p>\n </div>\n {isSelected && <Check className=\"h-4 w-4 text-brand-blue shrink-0\" />}\n </button>\n );\n })\n )}\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\ninterface FormValues {\n name: string;\n description: string;\n external_url: string;\n licenseType: string;\n commercialUse: \"Yes\" | \"No\";\n derivatives: \"Allowed\" | \"Not Allowed\" | \"Share-Alike\";\n attribution: \"Required\" | \"Not Required\";\n geographicScope: string;\n aiPolicy: \"Allowed\" | \"Not Allowed\" | \"Training Only\";\n royalty: number;\n}\n\nexport function FastMint(props: FastMintProps) {\n const {\n presentation = \"inline\", open = true, onClose, mediaKindLock, onMinted,\n collections, refetchCollections,\n hasWallet, walletAddress, onRequireWallet, connectLabel, getUploadToken, getSigner,\n client, provider,\n } = props;\n\n const [status, setStatus] = useState<\"idle\" | \"minting\" | \"success\" | \"error\">(\"idle\");\n const [errorMsg, setErrorMsg] = useState<string | null>(null);\n\n const [mediaFile, setMediaFile] = useState<File | null>(null);\n const [mediaPreview, setMediaPreview] = useState<string | null>(null);\n const [mediaUri, setMediaUri] = useState<string | null>(null);\n const [mediaKind, setMediaKind] = useState<MediaKind>(\"image\");\n const [mediaUploading, setMediaUploading] = useState(false);\n const previewUrlRef = useRef<string | null>(null);\n const mediaInputRef = useRef<HTMLInputElement>(null);\n\n const [featurePreview, setFeaturePreview] = useState<string | null>(null);\n const [featureUri, setFeatureUri] = useState<string | null>(null);\n const [featureUploading, setFeatureUploading] = useState(false);\n const featurePreviewRef = useRef<string | null>(null);\n const featureInputRef = useRef<HTMLInputElement>(null);\n\n const [assetType, setAssetType] = useState<\"single\" | \"editions\">(\"single\");\n const [editionCount, setEditionCount] = useState(\"10\");\n\n const [collectionMode, setCollectionMode] = useState<\"existing\" | \"new\">(\"existing\");\n const [existingCollectionId, setExistingCollectionId] = useState(\"\");\n const [existingCollectionContract, setExistingCollectionContract] = useState(\"\");\n const [newCollectionName, setNewCollectionName] = useState(\"\");\n const [newCollectionSymbol, setNewCollectionSymbol] = useState(\"\");\n const [newCollectionDescription, setNewCollectionDescription] = useState(\"\");\n const [autoSymbol, setAutoSymbol] = useState(\"\");\n const [autoCollectionName, setAutoCollectionName] = useState(\"\");\n const [autoCollectionDescription, setAutoCollectionDescription] = useState(\"\");\n\n const [ipType, setIpType] = useState<IPType>(\"NFT\");\n const [advancedOpen, setAdvancedOpen] = useState(false);\n const [ipTypeOpen, setIpTypeOpen] = useState(false);\n const templateFieldsRef = useRef<MetadataField[]>([]);\n\n const [mintedAsset, setMintedAsset] = useState<MintedAsset | null>(null);\n\n useEffect(() => () => {\n if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);\n if (featurePreviewRef.current) URL.revokeObjectURL(featurePreviewRef.current);\n }, []);\n\n const form = useForm<FormValues>({\n defaultValues: {\n name: \"\", description: \"\", external_url: \"\",\n licenseType: \"CC BY-SA\", commercialUse: \"Yes\", derivatives: \"Share-Alike\",\n attribution: \"Required\", geographicScope: \"Worldwide\", aiPolicy: \"Not Allowed\", royalty: 0,\n },\n });\n const name = form.watch(\"name\");\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"external_url\")) {\n form.setValue(\"external_url\", `https://medialane.io/account/${walletAddress}`);\n }\n }, [walletAddress, form]);\n\n useEffect(() => {\n const s = suggestLaunchpadSymbol(name);\n if (!s) return;\n if (!newCollectionSymbol || newCollectionSymbol === autoSymbol) {\n setNewCollectionSymbol(s);\n setAutoSymbol(s);\n }\n if (!newCollectionName || newCollectionName === autoCollectionName) {\n setNewCollectionName(name);\n setAutoCollectionName(name);\n }\n }, [name, autoSymbol, autoCollectionName, newCollectionSymbol, newCollectionName]);\n\n const description = form.watch(\"description\");\n useEffect(() => {\n if (!newCollectionDescription || newCollectionDescription === autoCollectionDescription) {\n setNewCollectionDescription(description);\n setAutoCollectionDescription(description);\n }\n }, [description, autoCollectionDescription, newCollectionDescription]);\n\n const erc721Collections = mintableCollections(\"single\", collections);\n const erc1155Collections = mintableCollections(\"editions\", collections);\n\n const handleMediaSelect = async (file: File) => {\n const kind = detectMediaKind(file.type);\n if (!kind) {\n setErrorMsg(\"Publish an image, audio, video (JPG/PNG/GIF/SVG/WebP, MP3/WAV/OGG/FLAC, MP4/WebM), or document (PDF, DOC, DOCX, ODT, RTF, TXT, MD).\");\n return;\n }\n if (mediaKindLock && kind !== mediaKindLock) {\n setErrorMsg(`Please upload a${mediaKindLock === \"image\" ? \"n\" : \"\"} ${mediaKindLock}.`);\n return;\n }\n const viaMediaRoute = MEDIA_ROUTE_MIME_TYPES.has(file.type);\n const maxBytes = viaMediaRoute ? MEDIA_MAX_BYTES : DOCUMENT_MAX_BYTES;\n if (file.size > maxBytes) {\n setErrorMsg(`Maximum size is ${maxBytes / (1024 * 1024)} MB.`);\n return;\n }\n setMediaFile(file);\n setMediaKind(kind);\n setIpType(IP_TYPE_BY_KIND[kind]);\n if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);\n const objectUrl = URL.createObjectURL(file);\n previewUrlRef.current = objectUrl;\n setMediaPreview(objectUrl);\n setMediaUri(null);\n setMediaUploading(true);\n try {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n const { uri } = await uploadFileToIpfs(file, viaMediaRoute ? \"media\" : \"document\");\n setMediaUri(uri);\n } catch (err) {\n const t = uploadFailureToast(err);\n setErrorMsg(t.description ?? t.title);\n } finally {\n setMediaUploading(false);\n }\n };\n\n const clearMedia = () => {\n setMediaFile(null);\n setMediaPreview(null);\n setMediaUri(null);\n if (mediaInputRef.current) mediaInputRef.current.value = \"\";\n };\n\n const handleFeatureSelect = async (file: File) => {\n if (featurePreviewRef.current) URL.revokeObjectURL(featurePreviewRef.current);\n const objectUrl = URL.createObjectURL(file);\n featurePreviewRef.current = objectUrl;\n setFeaturePreview(objectUrl);\n setFeatureUri(null);\n setFeatureUploading(true);\n try {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n const { uri } = await uploadFileToIpfs(file, \"image\");\n setFeatureUri(uri);\n } catch (err) {\n const t = uploadFailureToast(err);\n setErrorMsg(t.description ?? t.title);\n } finally {\n setFeatureUploading(false);\n }\n };\n\n const handleLicenseChange = (value: string) => {\n form.setValue(\"licenseType\", value);\n const def = LICENSE_TYPES.find((l) => l.value === value);\n if (def) {\n form.setValue(\"commercialUse\", def.commercialUse);\n form.setValue(\"derivatives\", def.derivatives);\n form.setValue(\"attribution\", def.attribution);\n }\n };\n\n const ready = !!mediaUri && !mediaUploading && name.trim().length > 0 &&\n (mediaKind === \"image\" || !!featureUri) &&\n (collectionMode === \"existing\"\n ? assetType === \"single\" ? !!existingCollectionId : !!existingCollectionContract\n : newCollectionName.trim().length > 0 && newCollectionSymbol.trim().length > 0);\n\n async function pollForNewCollection(name: string, symbol: string): Promise<ApiCollection | null> {\n for (let attempt = 0; attempt < 8; attempt++) {\n const list = await refetchCollections();\n const match = list.find((c) => c.name === name && c.symbol === symbol);\n if (match?.collectionId) return match;\n await new Promise((r) => setTimeout(r, 1500));\n }\n return null;\n }\n\n const onSubmit = async (values: FormValues) => {\n if (!hasWallet) { onRequireWallet(); return; }\n if (!walletAddress || !mediaUri) return;\n if (values.external_url && !values.external_url.startsWith(\"http://\") && !values.external_url.startsWith(\"https://\")) {\n setErrorMsg(\"External link must start with http:// or https://\");\n return;\n }\n\n setStatus(\"minting\");\n setErrorMsg(null);\n\n try {\n const signer: FastMintSigner = await getSigner();\n\n const image = mediaKind === \"image\" ? mediaUri : featureUri!;\n const animationUrl = mediaKind === \"image\" ? undefined : mediaUri;\n\n const built = buildAssetMetadata({\n name: values.name,\n description: values.description || \"\",\n externalUrl: values.external_url || \"\",\n imageUri: image,\n creator: walletAddress,\n ipType,\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n templateTraits: templateFieldsRef.current\n .filter(({ traitType, value }) => traitType.trim() && value.trim())\n .map(({ traitType, value }) => ({ traitType, value })),\n });\n const metadata: Record<string, unknown> = { ...built };\n if (animationUrl) metadata.animation_url = animationUrl;\n\n const uploadToken = await getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n const tokenUri = await uploadJsonToIpfs(metadata);\n\n let result: Awaited<ReturnType<typeof executeIntent>>;\n let finalContractAddress: string | null;\n let finalTokenId: string | null = null;\n\n if (assetType === \"single\") {\n let collectionId = existingCollectionId;\n let contractAddress = erc721Collections.find((c) => c.collectionId === existingCollectionId)?.contractAddress ?? null;\n\n if (collectionMode === \"new\") {\n const intentRes = await client.api.createCollectionIntent({\n owner: walletAddress,\n name: newCollectionName,\n symbol: newCollectionSymbol,\n description: newCollectionDescription || undefined,\n image,\n });\n await executeIntent(provider, signer, client, intentRes.data);\n\n const found = await pollForNewCollection(newCollectionName, newCollectionSymbol);\n if (!found) throw new Error(\"Collection created, but it's still indexing — try minting again in a moment from My Collections.\");\n collectionId = found.collectionId!;\n contractAddress = found.contractAddress ?? null;\n }\n\n const intentRes = await client.api.createMintIntent({\n owner: walletAddress,\n collectionId,\n recipient: walletAddress,\n tokenUri,\n royaltyBps: Math.round(values.royalty * 100),\n });\n result = await executeIntent(provider, signer, client, intentRes.data);\n finalContractAddress = contractAddress;\n\n if (finalContractAddress) {\n finalTokenId = mintedTokenIdFromReceipt(result.receipt, finalContractAddress);\n }\n } else {\n let collectionContract = existingCollectionContract;\n\n if (collectionMode === \"new\") {\n const intentRes = await client.api.createCollectionIntent({\n owner: walletAddress,\n name: newCollectionName,\n symbol: newCollectionSymbol,\n description: newCollectionDescription || undefined,\n image,\n baseUri: \"\",\n service: \"mip-erc1155\",\n });\n const deployResult = await executeIntent(provider, signer, client, intentRes.data);\n\n const deployed = deployedCollectionFromReceipt(deployResult.receipt, \"mip-erc1155\");\n if (!deployed) throw new Error(\"Collection deployed, but its address couldn't be read — check My Collections to mint into it.\");\n collectionContract = deployed;\n }\n\n const intentRes = await client.api.createMintIntent({\n owner: walletAddress,\n recipient: walletAddress,\n collectionContract,\n tokenUri,\n value: editionCount,\n royaltyBps: Math.round(values.royalty * 100),\n });\n result = await executeIntent(provider, signer, client, intentRes.data);\n finalContractAddress = collectionContract;\n finalTokenId = mintedTokenIdFromReceipt(result.receipt, collectionContract);\n }\n\n if (finalContractAddress && finalTokenId) {\n const asset: MintedAsset = { contract: finalContractAddress, tokenId: finalTokenId, image };\n setMintedAsset(asset);\n onMinted?.(asset);\n }\n setStatus(\"success\");\n } catch (err) {\n setErrorMsg(err instanceof Error ? err.message : \"Something went wrong. Please try again.\");\n setStatus(\"error\");\n }\n };\n\n const resetAll = () => {\n setStatus(\"idle\");\n setErrorMsg(null);\n setMintedAsset(null);\n form.reset();\n clearMedia();\n setFeaturePreview(null);\n setFeatureUri(null);\n setAssetType(\"single\");\n setEditionCount(\"10\");\n setCollectionMode(\"existing\");\n setExistingCollectionId(\"\");\n setExistingCollectionContract(\"\");\n setNewCollectionName(\"\");\n setNewCollectionSymbol(\"\");\n setNewCollectionDescription(\"\");\n setAutoSymbol(\"\");\n setAutoCollectionName(\"\");\n setAutoCollectionDescription(\"\");\n templateFieldsRef.current = [];\n };\n\n const busy = status === \"minting\";\n const KindIcon = MEDIA_KIND_ICON[mediaKind];\n const selectedExistingCollection = assetType === \"single\"\n ? erc721Collections.find((c) => c.collectionId === existingCollectionId)\n : erc1155Collections.find((c) => c.contractAddress === existingCollectionContract);\n const collectionLabel = mediaUri\n ? (collectionMode === \"new\"\n ? (newCollectionName || \"New collection\")\n : (selectedExistingCollection?.name || \"IP Asset\"))\n : undefined;\n\n const wrap = (node: React.ReactNode) => {\n if (presentation !== \"dialog\") return node;\n return (\n <ActionDialog open={open} onClose={onClose ?? (() => {})} width={640}>\n <div className=\"relative p-6 sm:p-8\">\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Close\"\n className=\"absolute top-4 right-4 h-8 w-8 rounded-full hover:bg-muted flex items-center justify-center text-muted-foreground\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n {node}\n </div>\n </ActionDialog>\n );\n };\n\n if (status === \"success\") {\n return wrap(\n <SuccessView\n presentation={presentation}\n previewImage={mediaKind === \"image\" ? mediaPreview : featurePreview}\n name={name}\n collectionLabel={collectionLabel}\n mintedAsset={mintedAsset}\n onPublishAnother={resetAll}\n />\n );\n }\n\n if (!mediaFile) {\n return wrap(\n <Dropzone\n mediaKindLock={mediaKindLock}\n presentation={presentation}\n hasWallet={hasWallet}\n onRequireWallet={onRequireWallet}\n connectLabel={connectLabel}\n onFileSelected={handleMediaSelect}\n />\n );\n }\n\n return wrap(\n <section className=\"space-y-6\">\n <div className=\"flex items-center gap-4 rounded-xl border border-border p-3\">\n <div className=\"relative h-14 w-14 rounded-lg bg-muted overflow-hidden shrink-0\">\n {mediaKind === \"image\" && mediaPreview ? (\n <Image src={mediaPreview} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <KindIcon className=\"h-6 w-6 text-muted-foreground\" />\n </div>\n )}\n {mediaUploading && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-background/70\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <p className=\"text-sm font-semibold truncate\">{mediaFile.name}</p>\n <div className=\"flex items-center gap-2 flex-wrap\">\n <p className=\"text-xs text-muted-foreground\">\n {mediaUploading ? \"Uploading…\" : mediaUri ? \"Uploaded\" : \"Upload failed\"}\n </p>\n {mediaUri && (() => {\n const template = IP_TEMPLATES[ipType];\n const TemplateIcon = template.icon;\n return (\n <span\n className={cn(\n \"inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium\",\n template.color.bg, template.color.text, template.color.border\n )}\n >\n <TemplateIcon className=\"h-3 w-3\" />\n {template.label}\n </span>\n );\n })()}\n </div>\n </div>\n <button\n type=\"button\"\n onClick={() => mediaInputRef.current?.click()}\n className=\"text-xs font-semibold text-brand-blue hover:underline shrink-0\"\n >\n Change\n </button>\n <input ref={mediaInputRef} type=\"file\" className=\"hidden\" onChange={(e) => { const f = e.target.files?.[0]; if (f) handleMediaSelect(f); }} />\n </div>\n\n {mediaUri && (\n <div className=\"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start\">\n <div className=\"space-y-5\">\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Title *</label>\n <Input\n value={name}\n onChange={(e) => form.setValue(\"name\", e.target.value)}\n placeholder=\"My Creative Work\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Description</label>\n <Textarea\n value={form.watch(\"description\")}\n onChange={(e) => form.setValue(\"description\", e.target.value)}\n placeholder=\"Describe your work, its story, and any context for buyers…\"\n rows={3}\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">External link <span className=\"text-muted-foreground font-normal\">(optional)</span></label>\n <Input\n value={form.watch(\"external_url\")}\n onChange={(e) => form.setValue(\"external_url\", e.target.value)}\n placeholder=\"https://yourwebsite.com\"\n />\n </div>\n\n {mediaKind !== \"image\" && (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Upload a cover image for your asset *</label>\n <div className=\"flex items-center gap-4\">\n <div\n role=\"button\"\n tabIndex={0}\n onClick={() => !featureUploading && featureInputRef.current?.click()}\n onKeyDown={(e) => { if ((e.key === \"Enter\" || e.key === \" \") && !featureUploading) { e.preventDefault(); featureInputRef.current?.click(); } }}\n className=\"relative h-20 w-20 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors\"\n >\n {featurePreview ? (\n <Image src={featurePreview} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <ImagePlus className=\"h-6 w-6 text-muted-foreground\" />\n )}\n {featureUploading && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-background/70\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n )}\n <input ref={featureInputRef} type=\"file\" accept=\"image/*\" className=\"hidden\" onChange={(e) => { const f = e.target.files?.[0]; if (f) handleFeatureSelect(f); }} />\n </div>\n <p className=\"text-xs text-muted-foreground\">Cover art shown wherever the work is previewed. JPG, PNG, GIF, SVG or WebP.</p>\n </div>\n </div>\n )}\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Asset Type</label>\n <div className=\"grid grid-cols-2 gap-3\">\n <button\n type=\"button\"\n onClick={() => setAssetType(\"single\")}\n className={cn(\"flex items-start gap-3 rounded-xl border p-4 text-left transition-colors\",\n assetType === \"single\" ? \"border-brand-blue bg-brand-blue/5\" : \"border-border hover:bg-muted/40\")}\n >\n <SingleIcon className={cn(\"h-5 w-5 shrink-0 mt-0.5\", assetType === \"single\" ? \"text-brand-blue\" : \"text-muted-foreground\")} />\n <span>\n <span className=\"block text-sm font-semibold\">Single Edition NFT</span>\n <span className=\"block text-xs mt-0.5 text-muted-foreground\">Minted once</span>\n </span>\n </button>\n <button\n type=\"button\"\n onClick={() => setAssetType(\"editions\")}\n className={cn(\"flex items-start gap-3 rounded-xl border p-4 text-left transition-colors\",\n assetType === \"editions\" ? \"border-brand-blue bg-brand-blue/5\" : \"border-border hover:bg-muted/40\")}\n >\n <Layers className={cn(\"h-5 w-5 shrink-0 mt-0.5\", assetType === \"editions\" ? \"text-brand-blue\" : \"text-muted-foreground\")} />\n <span>\n <span className=\"block text-sm font-semibold\">Limited Editions NFT</span>\n <span className=\"block text-xs mt-0.5 text-muted-foreground\">Several numbered copies</span>\n </span>\n </button>\n </div>\n </div>\n\n {assetType === \"editions\" && (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Number of copies</label>\n <Input\n type=\"number\"\n min={1}\n value={editionCount}\n onChange={(e) => setEditionCount(e.target.value)}\n className=\"max-w-[140px]\"\n />\n </div>\n )}\n\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <label className=\"text-sm font-medium flex items-center gap-1.5\">\n <Boxes className=\"h-4 w-4\" />\n Collection *\n </label>\n <div className=\"flex rounded-lg border border-border overflow-hidden\">\n <button\n type=\"button\"\n onClick={() => setCollectionMode(\"existing\")}\n className={cn(\"px-3 h-7 text-xs font-medium transition-colors\",\n collectionMode === \"existing\" ? \"bg-primary text-primary-foreground\" : \"bg-background hover:bg-muted text-muted-foreground\")}\n >\n Existing\n </button>\n <button\n type=\"button\"\n onClick={() => setCollectionMode(\"new\")}\n className={cn(\"px-3 h-7 text-xs font-medium border-l border-border transition-colors flex items-center gap-1\",\n collectionMode === \"new\" ? \"bg-primary text-primary-foreground\" : \"bg-background hover:bg-muted text-muted-foreground\")}\n >\n <Plus className=\"h-3 w-3\" />New\n </button>\n </div>\n </div>\n\n {collectionMode === \"existing\" ? (\n <CollectionPicker\n collections={assetType === \"single\" ? erc721Collections : erc1155Collections}\n value={assetType === \"single\" ? existingCollectionId : existingCollectionContract}\n onChange={assetType === \"single\" ? setExistingCollectionId : setExistingCollectionContract}\n valueOf={collectionKey(assetType === \"single\" ? \"single\" : \"editions\")}\n />\n ) : (\n <div className=\"flex gap-3 rounded-xl border border-border p-3\">\n <div className=\"relative h-16 w-16 rounded-lg overflow-hidden bg-muted shrink-0\">\n {(mediaKind === \"image\" ? mediaPreview : featurePreview) ? (\n <Image\n src={(mediaKind === \"image\" ? mediaPreview : featurePreview)!}\n alt=\"\"\n fill\n className=\"object-cover\"\n unoptimized\n />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-5 w-5 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1 space-y-2\">\n <div className=\"grid grid-cols-[1fr_100px] gap-2\">\n <Input\n value={newCollectionName}\n onChange={(e) => setNewCollectionName(e.target.value)}\n placeholder=\"Collection name\"\n className=\"h-9 text-sm\"\n />\n <Input\n value={newCollectionSymbol}\n onChange={(e) => setNewCollectionSymbol(e.target.value.toUpperCase())}\n placeholder=\"SYMBOL\"\n className=\"h-9 text-sm\"\n />\n </div>\n <Textarea\n value={newCollectionDescription}\n onChange={(e) => setNewCollectionDescription(e.target.value)}\n placeholder=\"Describe this collection…\"\n rows={2}\n className=\"text-sm resize-none\"\n />\n <p className=\"text-2xs text-muted-foreground\">Prefilled from your asset — edit anything above.</p>\n </div>\n </div>\n )}\n </div>\n\n <Collapsible open={advancedOpen} onOpenChange={setAdvancedOpen}>\n <div className=\"rounded-xl border border-border overflow-hidden\">\n <CollapsibleTrigger asChild>\n <button type=\"button\" className=\"w-full flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors\">\n <span className=\"flex items-center gap-2\">\n <ShieldCheck className=\"h-4 w-4 text-primary\" />\n <span className=\"text-sm font-semibold\">Licensing Terms</span>\n <span className=\"text-xs text-muted-foreground font-normal\">Optional · Berne Convention</span>\n </span>\n <ChevronDown className={cn(\"h-4 w-4 text-muted-foreground transition-transform\", advancedOpen && \"rotate-180\")} />\n </button>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"px-4 pb-4 space-y-4 border-t border-border/60 pt-4\">\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">License</label>\n <Select value={form.watch(\"licenseType\")} onValueChange={handleLicenseChange}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {LICENSE_TYPES.map((l) => <SelectItem key={l.value} value={l.value}>{l.label}</SelectItem>)}\n </SelectContent>\n </Select>\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">Commercial use</label>\n <ToggleGroup value={form.watch(\"commercialUse\")} options={[\"Yes\", \"No\"]} onChange={(v) => form.setValue(\"commercialUse\", v as \"Yes\" | \"No\")} />\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">Derivatives</label>\n <ToggleGroup value={form.watch(\"derivatives\")} options={DERIVATIVES_OPTIONS} onChange={(v) => form.setValue(\"derivatives\", v as FormValues[\"derivatives\"])} />\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">Territory</label>\n <Select value={form.watch(\"geographicScope\")} onValueChange={(v) => form.setValue(\"geographicScope\", v)}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {GEOGRAPHIC_SCOPES.map((s) => <SelectItem key={s} value={s}>{s}</SelectItem>)}\n </SelectContent>\n </Select>\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">AI & data mining</label>\n <ToggleGroup value={form.watch(\"aiPolicy\")} options={AI_POLICIES} onChange={(v) => form.setValue(\"aiPolicy\", v as FormValues[\"aiPolicy\"])} />\n </div>\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">Royalty % (0–50)</label>\n <Input\n type=\"number\" min={0} max={50} step={0.5}\n value={form.watch(\"royalty\")}\n onChange={(e) => form.setValue(\"royalty\", parseFloat(e.target.value) || 0)}\n className=\"max-w-[120px]\"\n />\n </div>\n </div>\n </CollapsibleContent>\n </div>\n </Collapsible>\n\n <Collapsible open={ipTypeOpen} onOpenChange={setIpTypeOpen}>\n <div className=\"rounded-xl border border-border overflow-hidden\">\n <CollapsibleTrigger asChild>\n <button type=\"button\" className=\"w-full flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors\">\n <span className=\"flex items-center gap-2\">\n <Layers className=\"h-4 w-4 text-primary\" />\n <span className=\"text-sm font-semibold\">IP Type & Metadata</span>\n <span className=\"text-xs text-muted-foreground font-normal\">Optional</span>\n </span>\n <ChevronDown className={cn(\"h-4 w-4 text-muted-foreground transition-transform\", ipTypeOpen && \"rotate-180\")} />\n </button>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"px-4 pb-4 space-y-4 border-t border-border/60 pt-4\">\n <div className=\"space-y-1.5\">\n <label className=\"text-xs font-medium text-muted-foreground\">IP Type</label>\n <Select value={ipType} onValueChange={(v) => setIpType(v as IPType)}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {IP_TYPES.map((t) => <SelectItem key={t} value={t}>{t}</SelectItem>)}\n </SelectContent>\n </Select>\n </div>\n <IPTypeFields\n ipType={ipType}\n onChange={(fields) => { templateFieldsRef.current = fields; }}\n uploadDocument={async (file) => {\n const token = await getUploadToken();\n if (!token) throw new Error(\"Sign in first\");\n const { uri } = await uploadFileToIpfs(file, \"document\");\n return uri;\n }}\n existingDocument={mediaKind === \"document\" && mediaUri && mediaFile ? { uri: mediaUri, name: mediaFile.name } : null}\n />\n </div>\n </CollapsibleContent>\n </div>\n </Collapsible>\n\n {status === \"error\" && errorMsg && <p className=\"text-xs text-destructive\">{errorMsg}</p>}\n\n <button\n type=\"button\"\n disabled={!ready || busy || !hasWallet}\n onClick={form.handleSubmit(onSubmit)}\n className={cn(\n \"w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] bg-brand-blue\",\n (!ready || busy || !hasWallet) && \"opacity-40 pointer-events-none\"\n )}\n >\n {busy ? <><Loader2 className=\"h-4 w-4 animate-spin\" />Minting…</> : assetType === \"single\" ? \"Mint NFT\" : \"Mint Editions\"}\n </button>\n <p className=\"text-xs text-center text-muted-foreground\">\n Zero platform fees to mint.\n </p>\n </div>\n\n <div className=\"order-first lg:order-last lg:sticky lg:top-20 max-w-[260px] mx-auto w-full lg:max-w-none lg:mx-0\">\n <MedialaneCollectionCard\n image={mediaKind === \"image\" ? mediaPreview : featurePreview}\n name={name}\n collection={collectionLabel}\n creator={walletAddress ? `${walletAddress.slice(0, 6)}…${walletAddress.slice(-4)}` : undefined}\n creatorHref={walletAddress ? `/account/${walletAddress}` : undefined}\n />\n </div>\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+EQ;AA7ER,mBAA4C;AAC5C,mBAAkB;AAClB,6BAAwB;AACxB,iBAAuD;AACvD,sBAAuF;AACvF,kCAAmD;AACnD,0BAIO;AACP,mBAAsB;AACtB,sBAAyB;AACzB,oBAA8E;AAC9E,yBAAoE;AACpE,qBAAwD;AACxD,uCAAwC;AACxC,2BAA6B;AAC7B,4BAAiD;AACjD,gBAGO;AACP,0BAA6B;AAC7B,gCAAuC;AACvC,yBAAuE;AACvE,kBAA2B;A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AM,cAAc,WAAW,aAAa;AAAA;AAAA,UAC5G;AAAA,UACA,4CAAC,OAAE,WAAU,6CAA4C,yCAEzD;AAAA,WACF;AAAA,QAEA,4CAAC,SAAI,WAAU,oGACb;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,cAAc,UAAU,eAAe;AAAA,YAC9C;AAAA,YACA,YAAY;AAAA,YACZ,SAAS,gBAAgB,GAAG,cAAc,MAAM,GAAG,CAAC,CAAC,SAAI,cAAc,MAAM,EAAE,CAAC,KAAK;AAAA,YACrF,aAAa,gBAAgB,YAAY,aAAa,KAAK;AAAA;AAAA,QAC7D,GACF;AAAA,SACF;AAAA,OAEJ;AAAA,EACF;AACF;","names":["Image","name","intentRes","SingleIcon"]}
|
|
@@ -3,11 +3,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import Image from "next/image";
|
|
5
5
|
import { useForm } from "react-hook-form";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { executeIntent } from "@medialane/sdk/starknet";
|
|
6
|
+
import { buildAssetMetadata } from "@medialane/sdk";
|
|
7
|
+
import { executeIntent, deployedCollectionFromReceipt, mintedTokenIdFromReceipt } from "@medialane/sdk/starknet";
|
|
9
8
|
import { mintableCollections, collectionKey } from "./mintable-collections.js";
|
|
10
|
-
import { executeAndSync } from "./execute-and-sync.js";
|
|
11
9
|
import {
|
|
12
10
|
ImagePlus,
|
|
13
11
|
Music,
|
|
@@ -45,27 +43,6 @@ import { ipfsToHttp } from "../../utils/ipfs.js";
|
|
|
45
43
|
import { cn } from "../../utils/cn.js";
|
|
46
44
|
import { Dropzone } from "./dropzone.js";
|
|
47
45
|
import { SuccessView } from "./success-view.js";
|
|
48
|
-
const COLLECTION_DEPLOYED_SELECTOR = hash.getSelectorFromName("CollectionDeployed");
|
|
49
|
-
const IP_MINTED_SELECTOR = hash.getSelectorFromName("IPMinted");
|
|
50
|
-
async function readMintedTokenId(provider, txHash, contractAddress) {
|
|
51
|
-
let receipt = null;
|
|
52
|
-
for (let attempt = 0; attempt < 3 && !receipt; attempt++) {
|
|
53
|
-
try {
|
|
54
|
-
if (attempt > 0) await new Promise((r) => setTimeout(r, 2e3));
|
|
55
|
-
const raw = await provider.getTransactionReceipt(txHash);
|
|
56
|
-
receipt = raw;
|
|
57
|
-
} catch {
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const events = receipt?.events ?? [];
|
|
61
|
-
const mintEvent = events.find(
|
|
62
|
-
(e) => e.from_address && BigInt(e.from_address) === BigInt(contractAddress) && e.keys?.[0] && BigInt(e.keys[0]) === BigInt(IP_MINTED_SELECTOR)
|
|
63
|
-
);
|
|
64
|
-
if (!mintEvent?.keys?.[1]) return null;
|
|
65
|
-
const low = BigInt(mintEvent.keys[1] ?? 0);
|
|
66
|
-
const high = BigInt(mintEvent.keys[2] ?? 0);
|
|
67
|
-
return (low + (high << 128n)).toString();
|
|
68
|
-
}
|
|
69
46
|
const MEDIA_ROUTE_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
70
47
|
"image/jpeg",
|
|
71
48
|
"image/png",
|
|
@@ -421,7 +398,7 @@ function FastMint(props) {
|
|
|
421
398
|
description: newCollectionDescription || void 0,
|
|
422
399
|
image
|
|
423
400
|
});
|
|
424
|
-
await
|
|
401
|
+
await executeIntent(provider, signer, client, intentRes2.data);
|
|
425
402
|
const found = await pollForNewCollection(newCollectionName, newCollectionSymbol);
|
|
426
403
|
if (!found) throw new Error("Collection created, but it's still indexing \u2014 try minting again in a moment from My Collections.");
|
|
427
404
|
collectionId = found.collectionId;
|
|
@@ -434,14 +411,10 @@ function FastMint(props) {
|
|
|
434
411
|
tokenUri,
|
|
435
412
|
royaltyBps: Math.round(values.royalty * 100)
|
|
436
413
|
});
|
|
437
|
-
|
|
438
|
-
const calls = intentRes.data.calls;
|
|
439
|
-
contractAddress = calls[calls.length - 1]?.contractAddress ?? contractAddress;
|
|
440
|
-
}
|
|
441
|
-
result = await executeAndSync(() => executeIntent(provider, signer, client, intentRes.data));
|
|
414
|
+
result = await executeIntent(provider, signer, client, intentRes.data);
|
|
442
415
|
finalContractAddress = contractAddress;
|
|
443
416
|
if (finalContractAddress) {
|
|
444
|
-
finalTokenId =
|
|
417
|
+
finalTokenId = mintedTokenIdFromReceipt(result.receipt, finalContractAddress);
|
|
445
418
|
}
|
|
446
419
|
} else {
|
|
447
420
|
let collectionContract = existingCollectionContract;
|
|
@@ -455,22 +428,10 @@ function FastMint(props) {
|
|
|
455
428
|
baseUri: "",
|
|
456
429
|
service: "mip-erc1155"
|
|
457
430
|
});
|
|
458
|
-
const deployResult = await
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
if (attempt > 0) await new Promise((r) => setTimeout(r, 2e3));
|
|
463
|
-
const raw = await provider.getTransactionReceipt(deployResult.txHash);
|
|
464
|
-
receipt = raw;
|
|
465
|
-
} catch {
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
const events = receipt?.events ?? [];
|
|
469
|
-
const deployEvent = events.find(
|
|
470
|
-
(e) => e.keys?.[0] && BigInt(e.keys[0]) === BigInt(COLLECTION_DEPLOYED_SELECTOR)
|
|
471
|
-
);
|
|
472
|
-
if (!deployEvent?.keys?.[1]) throw new Error("Collection deployed, but its address couldn't be read \u2014 check My Collections to mint into it.");
|
|
473
|
-
collectionContract = normalizeAddress("STARKNET", deployEvent.keys[1]);
|
|
431
|
+
const deployResult = await executeIntent(provider, signer, client, intentRes2.data);
|
|
432
|
+
const deployed = deployedCollectionFromReceipt(deployResult.receipt, "mip-erc1155");
|
|
433
|
+
if (!deployed) throw new Error("Collection deployed, but its address couldn't be read \u2014 check My Collections to mint into it.");
|
|
434
|
+
collectionContract = deployed;
|
|
474
435
|
}
|
|
475
436
|
const intentRes = await client.api.createMintIntent({
|
|
476
437
|
owner: walletAddress,
|
|
@@ -480,9 +441,9 @@ function FastMint(props) {
|
|
|
480
441
|
value: editionCount,
|
|
481
442
|
royaltyBps: Math.round(values.royalty * 100)
|
|
482
443
|
});
|
|
483
|
-
result = await
|
|
444
|
+
result = await executeIntent(provider, signer, client, intentRes.data);
|
|
484
445
|
finalContractAddress = collectionContract;
|
|
485
|
-
finalTokenId =
|
|
446
|
+
finalTokenId = mintedTokenIdFromReceipt(result.receipt, collectionContract);
|
|
486
447
|
}
|
|
487
448
|
if (finalContractAddress && finalTokenId) {
|
|
488
449
|
const asset = { contract: finalContractAddress, tokenId: finalTokenId, image };
|