@medialane/ui 0.365.0 → 0.367.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.
Files changed (112) hide show
  1. package/dist/components/approve-mint-dialog.d.cts +0 -1
  2. package/dist/components/approve-mint-dialog.d.ts +0 -1
  3. package/dist/components/fast-mint/asset-form-parts.cjs +28 -47
  4. package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
  5. package/dist/components/fast-mint/asset-form-parts.d.cts +13 -8
  6. package/dist/components/fast-mint/asset-form-parts.d.ts +13 -8
  7. package/dist/components/fast-mint/asset-form-parts.js +29 -48
  8. package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
  9. package/dist/components/fast-mint/collection-section.cjs +11 -21
  10. package/dist/components/fast-mint/collection-section.cjs.map +1 -1
  11. package/dist/components/fast-mint/collection-section.d.cts +5 -7
  12. package/dist/components/fast-mint/collection-section.d.ts +5 -7
  13. package/dist/components/fast-mint/collection-section.js +11 -21
  14. package/dist/components/fast-mint/collection-section.js.map +1 -1
  15. package/dist/components/fast-mint/create-then-add.cjs +55 -0
  16. package/dist/components/fast-mint/create-then-add.cjs.map +1 -0
  17. package/dist/components/fast-mint/create-then-add.d.cts +24 -0
  18. package/dist/components/fast-mint/create-then-add.d.ts +24 -0
  19. package/dist/components/fast-mint/create-then-add.js +30 -0
  20. package/dist/components/fast-mint/create-then-add.js.map +1 -0
  21. package/dist/components/fast-mint/dropzone.d.cts +0 -1
  22. package/dist/components/fast-mint/dropzone.d.ts +0 -1
  23. package/dist/components/fast-mint/fast-mint.cjs +68 -102
  24. package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
  25. package/dist/components/fast-mint/fast-mint.js +70 -104
  26. package/dist/components/fast-mint/fast-mint.js.map +1 -1
  27. package/dist/components/fast-mint/formats/nft.cjs +233 -0
  28. package/dist/components/fast-mint/formats/nft.cjs.map +1 -0
  29. package/dist/components/fast-mint/formats/nft.d.cts +19 -0
  30. package/dist/components/fast-mint/formats/nft.d.ts +19 -0
  31. package/dist/components/fast-mint/formats/nft.js +214 -0
  32. package/dist/components/fast-mint/formats/nft.js.map +1 -0
  33. package/dist/components/fast-mint/formats/pop.cjs +160 -0
  34. package/dist/components/fast-mint/formats/pop.cjs.map +1 -0
  35. package/dist/components/fast-mint/formats/pop.d.cts +18 -0
  36. package/dist/components/fast-mint/formats/pop.d.ts +18 -0
  37. package/dist/components/fast-mint/formats/pop.js +136 -0
  38. package/dist/components/fast-mint/formats/pop.js.map +1 -0
  39. package/dist/components/fast-mint/formats/registry.cjs +42 -0
  40. package/dist/components/fast-mint/formats/registry.cjs.map +1 -0
  41. package/dist/components/fast-mint/formats/registry.d.cts +20 -0
  42. package/dist/components/fast-mint/formats/registry.d.ts +20 -0
  43. package/dist/components/fast-mint/formats/registry.js +16 -0
  44. package/dist/components/fast-mint/formats/registry.js.map +1 -0
  45. package/dist/components/fast-mint/formats/tiers.cjs +206 -0
  46. package/dist/components/fast-mint/formats/tiers.cjs.map +1 -0
  47. package/dist/components/fast-mint/formats/tiers.d.cts +19 -0
  48. package/dist/components/fast-mint/formats/tiers.d.ts +19 -0
  49. package/dist/components/fast-mint/formats/tiers.js +181 -0
  50. package/dist/components/fast-mint/formats/tiers.js.map +1 -0
  51. package/dist/components/fast-mint/formats/types.cjs +31 -0
  52. package/dist/components/fast-mint/formats/types.cjs.map +1 -0
  53. package/dist/components/fast-mint/formats/types.d.cts +71 -0
  54. package/dist/components/fast-mint/formats/types.d.ts +71 -0
  55. package/dist/components/fast-mint/formats/types.js +7 -0
  56. package/dist/components/fast-mint/formats/types.js.map +1 -0
  57. package/dist/components/fast-mint/media-kind.d.cts +0 -1
  58. package/dist/components/fast-mint/media-kind.d.ts +0 -1
  59. package/dist/components/fast-mint/success-view.cjs +18 -59
  60. package/dist/components/fast-mint/success-view.cjs.map +1 -1
  61. package/dist/components/fast-mint/success-view.d.cts +13 -8
  62. package/dist/components/fast-mint/success-view.d.ts +13 -8
  63. package/dist/components/fast-mint/success-view.js +19 -60
  64. package/dist/components/fast-mint/success-view.js.map +1 -1
  65. package/dist/components/fast-mint/types.cjs.map +1 -1
  66. package/dist/components/fast-mint/types.d.cts +0 -2
  67. package/dist/components/fast-mint/types.d.ts +0 -2
  68. package/dist/components/launchpad/collection-create-form.cjs +3 -2
  69. package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
  70. package/dist/components/launchpad/collection-create-form.js +3 -2
  71. package/dist/components/launchpad/collection-create-form.js.map +1 -1
  72. package/dist/components/launchpad/pop-create-fields.cjs +5 -3
  73. package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
  74. package/dist/components/launchpad/pop-create-fields.d.cts +8 -2
  75. package/dist/components/launchpad/pop-create-fields.d.ts +8 -2
  76. package/dist/components/launchpad/pop-create-fields.js +4 -3
  77. package/dist/components/launchpad/pop-create-fields.js.map +1 -1
  78. package/dist/components/launchpad/pop-create.cjs +8 -12
  79. package/dist/components/launchpad/pop-create.cjs.map +1 -1
  80. package/dist/components/launchpad/pop-create.js +8 -12
  81. package/dist/components/launchpad/pop-create.js.map +1 -1
  82. package/dist/components/launchpad/tier-mint-form.cjs +8 -25
  83. package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
  84. package/dist/components/launchpad/tier-mint-form.js +6 -23
  85. package/dist/components/launchpad/tier-mint-form.js.map +1 -1
  86. package/dist/components/transfer-dialog.d.cts +0 -1
  87. package/dist/components/transfer-dialog.d.ts +0 -1
  88. package/dist/data/launchpad-services.cjs +12 -12
  89. package/dist/data/launchpad-services.cjs.map +1 -1
  90. package/dist/data/launchpad-services.js +12 -12
  91. package/dist/data/launchpad-services.js.map +1 -1
  92. package/dist/index.d.cts +4 -0
  93. package/dist/index.d.ts +4 -0
  94. package/dist/utils/drop/actions.d.cts +0 -1
  95. package/dist/utils/drop/actions.d.ts +0 -1
  96. package/dist/utils/drop/types.d.cts +0 -1
  97. package/dist/utils/drop/types.d.ts +0 -1
  98. package/dist/utils/launchpad-actions.cjs +90 -0
  99. package/dist/utils/launchpad-actions.cjs.map +1 -0
  100. package/dist/utils/launchpad-actions.d.cts +39 -0
  101. package/dist/utils/launchpad-actions.d.ts +39 -0
  102. package/dist/utils/launchpad-actions.js +60 -0
  103. package/dist/utils/launchpad-actions.js.map +1 -0
  104. package/dist/utils/use-transaction.d.cts +0 -1
  105. package/dist/utils/use-transaction.d.ts +0 -1
  106. package/package.json +1 -1
  107. package/dist/components/fast-mint/mint-asset.cjs +0 -124
  108. package/dist/components/fast-mint/mint-asset.cjs.map +0 -1
  109. package/dist/components/fast-mint/mint-asset.d.cts +0 -41
  110. package/dist/components/fast-mint/mint-asset.d.ts +0 -41
  111. package/dist/components/fast-mint/mint-asset.js +0 -100
  112. package/dist/components/fast-mint/mint-asset.js.map +0 -1
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var nft_exports = {};
21
+ __export(nft_exports, {
22
+ EDITIONS_FORMAT: () => EDITIONS_FORMAT,
23
+ SINGLE_FORMAT: () => SINGLE_FORMAT
24
+ });
25
+ module.exports = __toCommonJS(nft_exports);
26
+ var import_jsx_runtime = require("react/jsx-runtime");
27
+ var import_lucide_react = require("lucide-react");
28
+ var import_sdk = require("@medialane/sdk");
29
+ var import_starknet = require("@medialane/sdk/starknet");
30
+ var import_input = require("../../input.js");
31
+ var import_ipfs_upload = require("../../../utils/ipfs-upload.js");
32
+ var import_collection_section = require("../collection-section.js");
33
+ var import_licensing_section = require("../licensing-section.js");
34
+ var import_ip_type_section = require("../ip-type-section.js");
35
+ var import_mintable_collections = require("../mintable-collections.js");
36
+ var import_create_then_add = require("../create-then-add.js");
37
+ var import_types = require("./types.js");
38
+ function assetLinks(contract, tokenId) {
39
+ if (!contract || !tokenId) return [];
40
+ const asset = `/asset/STARKNET/${contract}/${tokenId}`;
41
+ return [
42
+ { href: asset, label: "View asset", icon: import_lucide_react.Eye },
43
+ { href: `${asset}?action=list`, label: "Sell on marketplace", icon: import_lucide_react.Tag },
44
+ { href: `${asset}?action=transfer`, label: "Transfer", icon: import_lucide_react.ArrowRightLeft },
45
+ { href: `/create/remix/${contract}/${tokenId}`, label: "Create a remix", icon: import_lucide_react.GitBranch }
46
+ ];
47
+ }
48
+ async function pinTokenUri(shared, runtime) {
49
+ const values = shared.form.getValues();
50
+ const built = (0, import_sdk.buildAssetMetadata)({
51
+ name: values.name,
52
+ description: values.description || "",
53
+ externalUrl: values.external_url || "",
54
+ imageUri: shared.image,
55
+ creator: shared.walletAddress,
56
+ ipType: shared.ipType,
57
+ licenseType: values.licenseType,
58
+ commercialUse: values.commercialUse,
59
+ derivatives: values.derivatives,
60
+ attribution: values.attribution,
61
+ geographicScope: values.geographicScope,
62
+ aiPolicy: values.aiPolicy,
63
+ royalty: String(values.royalty),
64
+ templateTraits: shared.templateFieldsRef.current.filter(({ traitType, value }) => traitType.trim() && value.trim()).map(({ traitType, value }) => ({ traitType, value }))
65
+ });
66
+ const metadata = { ...built };
67
+ if (shared.mediaKind !== "image") metadata.animation_url = shared.mediaUri;
68
+ const uploadToken = await runtime.getUploadToken();
69
+ if (!uploadToken) throw new Error("Sign in first");
70
+ return (0, import_ipfs_upload.uploadJsonToIpfs)(runtime.client.api, metadata);
71
+ }
72
+ function makeNftFormat(kind) {
73
+ const single = kind === "single";
74
+ function Fields({ shared, state, update }) {
75
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
76
+ !single && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", htmlFor: "fast-mint-copies", children: "Number of copies" }),
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
+ import_input.Input,
80
+ {
81
+ id: "fast-mint-copies",
82
+ type: "number",
83
+ min: 1,
84
+ value: state.editionCount,
85
+ onChange: (e) => update({ editionCount: e.target.value }),
86
+ className: "max-w-[140px]"
87
+ }
88
+ )
89
+ ] }),
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
+ import_collection_section.CollectionSection,
92
+ {
93
+ mode: state.mode,
94
+ onModeChange: (mode) => update({ mode }),
95
+ collections: (0, import_mintable_collections.mintableCollections)(kind, shared.collections),
96
+ value: single ? state.existingId : state.existingContract,
97
+ onValue: (value) => update(single ? { existingId: value } : { existingContract: value }),
98
+ valueOf: (0, import_mintable_collections.collectionKey)(kind),
99
+ draft: shared.draft,
100
+ previewImage: shared.previewImage
101
+ }
102
+ ),
103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_licensing_section.LicensingSection, { form: shared.form }),
104
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
105
+ import_ip_type_section.IpTypeSection,
106
+ {
107
+ ipType: shared.ipType,
108
+ onIpTypeChange: shared.onIpTypeChange,
109
+ fieldsRef: shared.templateFieldsRef,
110
+ uploadDocument: shared.uploadDocument,
111
+ existingDocument: shared.mediaKind === "document" ? { uri: shared.mediaUri, name: shared.mediaName } : null
112
+ }
113
+ )
114
+ ] });
115
+ }
116
+ const selected = (shared, state) => (0, import_mintable_collections.mintableCollections)(kind, shared.collections).find((c) => (0, import_mintable_collections.collectionKey)(kind)(c) === (single ? state.existingId : state.existingContract));
117
+ return (0, import_types.defineFormat)({
118
+ key: kind,
119
+ title: single ? "Single NFT" : "Limited Editions",
120
+ hint: single ? "One copy, yours to keep or sell" : "Numbered copies people can collect",
121
+ icon: single ? import_lucide_react.ImagePlus : import_lucide_react.Layers,
122
+ submitLabel: () => single ? "Mint NFT" : "Mint Editions",
123
+ initial: () => ({ mode: "existing", existingId: "", existingContract: "", editionCount: "10" }),
124
+ Fields,
125
+ isReady: (shared, state) => {
126
+ if (!single && !/^[1-9]\d*$/.test(state.editionCount.trim())) return false;
127
+ if (state.mode === "new") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;
128
+ return (single ? state.existingId : state.existingContract) !== "";
129
+ },
130
+ previewLabel: (shared, state) => state.mode === "new" ? shared.draft.name || "New collection" : selected(shared, state)?.name || "IP Asset",
131
+ submit: async (shared, state, runtime) => {
132
+ const { client, signer, onStep } = runtime;
133
+ const owner = shared.walletAddress;
134
+ const values = shared.form.getValues();
135
+ const tokenUri = await pinTokenUri(shared, runtime);
136
+ const royaltyBps = Math.round(values.royalty * 100);
137
+ const labels = { create: "Creating the collection", add: single ? "Minting" : "Minting editions" };
138
+ if (single) {
139
+ const picked2 = state.mode === "existing" ? selected(shared, state) : void 0;
140
+ const existing2 = runtime.resume ?? (picked2?.collectionId ? { collectionId: picked2.collectionId, contract: picked2.contractAddress ?? null } : null);
141
+ const result2 = await (0, import_create_then_add.createThenAdd)({
142
+ existing: existing2,
143
+ noun: "collection",
144
+ labels,
145
+ onStep,
146
+ create: async () => {
147
+ const created = await client.api.intents.create("create-collection", {
148
+ owner,
149
+ name: shared.draft.name,
150
+ symbol: shared.draft.symbol,
151
+ description: shared.draft.description || void 0,
152
+ image: shared.image
153
+ });
154
+ const { receipt } = await (0, import_starknet.executeIntent)(signer, client, created);
155
+ const registry = (0, import_sdk.getCoordinates)("STARKNET").collection721;
156
+ const collectionId = (0, import_starknet.createdCollectionFromReceipt)(receipt, registry)?.collectionId;
157
+ if (!collectionId) throw new Error("Collection created, but its id couldn't be read \u2014 check My Collections to mint into it.");
158
+ return { collectionId, contract: await (0, import_starknet.createdCollectionAddress)(client.provider, registry, collectionId) };
159
+ },
160
+ add: async (destination) => {
161
+ const minted = await client.api.intents.create("mint", {
162
+ owner,
163
+ collectionId: destination.collectionId,
164
+ recipient: owner,
165
+ tokenUri,
166
+ royaltyBps
167
+ });
168
+ const { receipt } = await (0, import_starknet.executeIntent)(signer, client, minted);
169
+ return {
170
+ contract: destination.contract,
171
+ tokenId: destination.contract ? (0, import_starknet.mintedTokenIdFromReceipt)(receipt, destination.contract) : null
172
+ };
173
+ }
174
+ });
175
+ return nftResult(shared, values.name, result2.contract, result2.tokenId);
176
+ }
177
+ const picked = state.mode === "existing" ? state.existingContract : "";
178
+ const existing = runtime.resume ?? (picked || null);
179
+ const result = await (0, import_create_then_add.createThenAdd)({
180
+ existing,
181
+ noun: "collection",
182
+ labels,
183
+ onStep,
184
+ create: async () => {
185
+ const created = await client.api.intents.create("create-collection", {
186
+ owner,
187
+ name: shared.draft.name,
188
+ symbol: shared.draft.symbol,
189
+ description: shared.draft.description || void 0,
190
+ image: shared.image,
191
+ baseUri: "",
192
+ service: "mip-erc1155"
193
+ });
194
+ const { receipt } = await (0, import_starknet.executeIntent)(signer, client, created);
195
+ const deployed = (0, import_starknet.deployedCollectionFromReceipt)(receipt, "mip-erc1155");
196
+ if (!deployed) throw new Error("Collection deployed, but its address couldn't be read \u2014 check My Collections to mint into it.");
197
+ return deployed;
198
+ },
199
+ add: async (contract) => {
200
+ const minted = await client.api.intents.create("mint", {
201
+ owner,
202
+ recipient: owner,
203
+ collectionContract: contract,
204
+ tokenUri,
205
+ value: state.editionCount.trim(),
206
+ royaltyBps
207
+ });
208
+ const { receipt } = await (0, import_starknet.executeIntent)(signer, client, minted);
209
+ return { contract, tokenId: (0, import_starknet.mintedTokenIdFromReceipt)(receipt, contract) };
210
+ }
211
+ });
212
+ return nftResult(shared, values.name, result.contract, result.tokenId);
213
+ }
214
+ });
215
+ }
216
+ function nftResult(shared, name, contract, tokenId) {
217
+ return {
218
+ headline: "Asset published",
219
+ detail: "It is recorded onchain with your wallet as owner.",
220
+ name,
221
+ links: assetLinks(contract, tokenId),
222
+ reward: "mint_asset",
223
+ asset: contract && tokenId ? { contract, tokenId, image: shared.image } : void 0
224
+ };
225
+ }
226
+ const SINGLE_FORMAT = makeNftFormat("single");
227
+ const EDITIONS_FORMAT = makeNftFormat("editions");
228
+ // Annotate the CommonJS export names for ESM import in node:
229
+ 0 && (module.exports = {
230
+ EDITIONS_FORMAT,
231
+ SINGLE_FORMAT
232
+ });
233
+ //# sourceMappingURL=nft.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/fast-mint/formats/nft.tsx"],"sourcesContent":["\"use client\";\n\nimport { ArrowRightLeft, Eye, GitBranch, ImagePlus, Layers, Tag } from \"lucide-react\";\nimport { buildAssetMetadata, getCoordinates } from \"@medialane/sdk\";\nimport {\n createdCollectionAddress,\n createdCollectionFromReceipt,\n deployedCollectionFromReceipt,\n executeIntent,\n mintedTokenIdFromReceipt,\n} from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { CollectionSection, type CollectionMode } from \"../collection-section.js\";\nimport { LicensingSection } from \"../licensing-section.js\";\nimport { IpTypeSection } from \"../ip-type-section.js\";\nimport { collectionKey, mintableCollections, type MintAssetType } from \"../mintable-collections.js\";\nimport { createThenAdd } from \"../create-then-add.js\";\nimport { defineFormat, type FormatFieldsProps, type FormatResult, type FormatRuntime, type FormatShared } from \"./types.js\";\n\ninterface NftState {\n mode: CollectionMode;\n existingId: string;\n existingContract: string;\n editionCount: string;\n}\n\ninterface SingleDestination {\n collectionId: string;\n contract: string | null;\n}\n\nfunction assetLinks(contract: string | null, tokenId: string | null): FormatResult[\"links\"] {\n if (!contract || !tokenId) return [];\n const asset = `/asset/STARKNET/${contract}/${tokenId}`;\n return [\n { href: asset, label: \"View asset\", icon: Eye },\n { href: `${asset}?action=list`, label: \"Sell on marketplace\", icon: Tag },\n { href: `${asset}?action=transfer`, label: \"Transfer\", icon: ArrowRightLeft },\n { href: `/create/remix/${contract}/${tokenId}`, label: \"Create a remix\", icon: GitBranch },\n ];\n}\n\nasync function pinTokenUri(shared: FormatShared, runtime: FormatRuntime): Promise<string> {\n const values = shared.form.getValues();\n const built = buildAssetMetadata({\n name: values.name,\n description: values.description || \"\",\n externalUrl: values.external_url || \"\",\n imageUri: shared.image,\n creator: shared.walletAddress,\n ipType: shared.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: shared.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 (shared.mediaKind !== \"image\") metadata.animation_url = shared.mediaUri;\n\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n return uploadJsonToIpfs(runtime.client.api, metadata);\n}\n\nfunction makeNftFormat(kind: MintAssetType) {\n const single = kind === \"single\";\n\n function Fields({ shared, state, update }: FormatFieldsProps<NftState>) {\n return (\n <>\n {!single && (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor=\"fast-mint-copies\">Number of copies</label>\n <Input\n id=\"fast-mint-copies\"\n type=\"number\"\n min={1}\n value={state.editionCount}\n onChange={(e) => update({ editionCount: e.target.value })}\n className=\"max-w-[140px]\"\n />\n </div>\n )}\n <CollectionSection\n mode={state.mode}\n onModeChange={(mode) => update({ mode })}\n collections={mintableCollections(kind, shared.collections)}\n value={single ? state.existingId : state.existingContract}\n onValue={(value) => update(single ? { existingId: value } : { existingContract: value })}\n valueOf={collectionKey(kind)}\n draft={shared.draft}\n previewImage={shared.previewImage}\n />\n <LicensingSection form={shared.form} />\n <IpTypeSection\n ipType={shared.ipType}\n onIpTypeChange={shared.onIpTypeChange}\n fieldsRef={shared.templateFieldsRef}\n uploadDocument={shared.uploadDocument}\n existingDocument={shared.mediaKind === \"document\" ? { uri: shared.mediaUri, name: shared.mediaName } : null}\n />\n </>\n );\n }\n\n const selected = (shared: FormatShared, state: NftState) =>\n mintableCollections(kind, shared.collections).find((c) => collectionKey(kind)(c) === (single ? state.existingId : state.existingContract));\n\n return defineFormat<NftState>({\n key: kind,\n title: single ? \"Single NFT\" : \"Limited Editions\",\n hint: single ? \"One copy, yours to keep or sell\" : \"Numbered copies people can collect\",\n icon: single ? ImagePlus : Layers,\n submitLabel: () => (single ? \"Mint NFT\" : \"Mint Editions\"),\n initial: () => ({ mode: \"existing\", existingId: \"\", existingContract: \"\", editionCount: \"10\" }),\n Fields,\n isReady: (shared, state) => {\n if (!single && !/^[1-9]\\d*$/.test(state.editionCount.trim())) return false;\n if (state.mode === \"new\") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;\n return (single ? state.existingId : state.existingContract) !== \"\";\n },\n previewLabel: (shared, state) =>\n state.mode === \"new\" ? shared.draft.name || \"New collection\" : selected(shared, state)?.name || \"IP Asset\",\n submit: async (shared, state, runtime) => {\n const { client, signer, onStep } = runtime;\n const owner = shared.walletAddress;\n const values = shared.form.getValues();\n const tokenUri = await pinTokenUri(shared, runtime);\n const royaltyBps = Math.round(values.royalty * 100);\n const labels = { create: \"Creating the collection\", add: single ? \"Minting\" : \"Minting editions\" };\n\n if (single) {\n const picked = state.mode === \"existing\" ? selected(shared, state) : undefined;\n const existing: SingleDestination | null =\n (runtime.resume as SingleDestination | null) ??\n (picked?.collectionId ? { collectionId: picked.collectionId, contract: picked.contractAddress ?? null } : null);\n\n const result = await createThenAdd<SingleDestination, { contract: string | null; tokenId: string | null }>({\n existing,\n noun: \"collection\",\n labels,\n onStep,\n create: async () => {\n const created = await client.api.intents.create(\"create-collection\", {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n description: shared.draft.description || undefined,\n image: shared.image,\n });\n const { receipt } = await executeIntent(signer, client, created);\n const registry = getCoordinates(\"STARKNET\").collection721;\n const collectionId = createdCollectionFromReceipt(receipt, registry)?.collectionId;\n if (!collectionId) throw new Error(\"Collection created, but its id couldn't be read — check My Collections to mint into it.\");\n return { collectionId, contract: await createdCollectionAddress(client.provider, registry, collectionId) };\n },\n add: async (destination) => {\n const minted = await client.api.intents.create(\"mint\", {\n owner,\n collectionId: destination.collectionId,\n recipient: owner,\n tokenUri,\n royaltyBps,\n });\n const { receipt } = await executeIntent(signer, client, minted);\n return {\n contract: destination.contract,\n tokenId: destination.contract ? mintedTokenIdFromReceipt(receipt, destination.contract) : null,\n };\n },\n });\n return nftResult(shared, values.name, result.contract, result.tokenId);\n }\n\n const picked = state.mode === \"existing\" ? state.existingContract : \"\";\n const existing = (runtime.resume as string | null) ?? (picked || null);\n const result = await createThenAdd<string, { contract: string; tokenId: string | null }>({\n existing,\n noun: \"collection\",\n labels,\n onStep,\n create: async () => {\n const created = await client.api.intents.create(\"create-collection\", {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n description: shared.draft.description || undefined,\n image: shared.image,\n baseUri: \"\",\n service: \"mip-erc1155\",\n });\n const { receipt } = await executeIntent(signer, client, created);\n const deployed = deployedCollectionFromReceipt(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 return deployed;\n },\n add: async (contract) => {\n const minted = await client.api.intents.create(\"mint\", {\n owner,\n recipient: owner,\n collectionContract: contract,\n tokenUri,\n value: state.editionCount.trim(),\n royaltyBps,\n });\n const { receipt } = await executeIntent(signer, client, minted);\n return { contract, tokenId: mintedTokenIdFromReceipt(receipt, contract) };\n },\n });\n return nftResult(shared, values.name, result.contract, result.tokenId);\n },\n });\n}\n\nfunction nftResult(shared: FormatShared, name: string, contract: string | null, tokenId: string | null): FormatResult {\n return {\n headline: \"Asset published\",\n detail: \"It is recorded onchain with your wallet as owner.\",\n name,\n links: assetLinks(contract, tokenId),\n reward: \"mint_asset\",\n asset: contract && tokenId ? { contract, tokenId, image: shared.image } : undefined,\n };\n}\n\nexport const SINGLE_FORMAT = makeNftFormat(\"single\");\nexport const EDITIONS_FORMAT = makeNftFormat(\"editions\");\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4EM;AA1EN,0BAAuE;AACvE,iBAAmD;AACnD,sBAMO;AACP,mBAAsB;AACtB,yBAAiC;AACjC,gCAAuD;AACvD,+BAAiC;AACjC,6BAA8B;AAC9B,kCAAuE;AACvE,6BAA8B;AAC9B,mBAA+G;AAc/G,SAAS,WAAW,UAAyB,SAA+C;AAC1F,MAAI,CAAC,YAAY,CAAC,QAAS,QAAO,CAAC;AACnC,QAAM,QAAQ,mBAAmB,QAAQ,IAAI,OAAO;AACpD,SAAO;AAAA,IACL,EAAE,MAAM,OAAO,OAAO,cAAc,MAAM,wBAAI;AAAA,IAC9C,EAAE,MAAM,GAAG,KAAK,gBAAgB,OAAO,uBAAuB,MAAM,wBAAI;AAAA,IACxE,EAAE,MAAM,GAAG,KAAK,oBAAoB,OAAO,YAAY,MAAM,mCAAe;AAAA,IAC5E,EAAE,MAAM,iBAAiB,QAAQ,IAAI,OAAO,IAAI,OAAO,kBAAkB,MAAM,8BAAU;AAAA,EAC3F;AACF;AAEA,eAAe,YAAY,QAAsB,SAAyC;AACxF,QAAM,SAAS,OAAO,KAAK,UAAU;AACrC,QAAM,YAAQ,+BAAmB;AAAA,IAC/B,MAAM,OAAO;AAAA,IACb,aAAa,OAAO,eAAe;AAAA,IACnC,aAAa,OAAO,gBAAgB;AAAA,IACpC,UAAU,OAAO;AAAA,IACjB,SAAS,OAAO;AAAA,IAChB,QAAQ,OAAO;AAAA,IACf,aAAa,OAAO;AAAA,IAC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AAC;AACD,gBAAM,EAAE,QAAQ,IAAI,UAAM,+BAAc,QAAQ,QAAQ,MAAM;AAC9D,iBAAO,EAAE,UAAU,aAAS,0CAAyB,SAAS,QAAQ,EAAE;AAAA,QAC1E;AAAA,MACF,CAAC;AACD,aAAO,UAAU,QAAQ,OAAO,MAAM,OAAO,UAAU,OAAO,OAAO;AAAA,IACvE;AAAA,EACF,CAAC;AACH;AAEA,SAAS,UAAU,QAAsB,MAAc,UAAyB,SAAsC;AACpH,SAAO;AAAA,IACL,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,IACA,OAAO,WAAW,UAAU,OAAO;AAAA,IACnC,QAAQ;AAAA,IACR,OAAO,YAAY,UAAU,EAAE,UAAU,SAAS,OAAO,OAAO,MAAM,IAAI;AAAA,EAC5E;AACF;AAEO,MAAM,gBAAgB,cAAc,QAAQ;AAC5C,MAAM,kBAAkB,cAAc,UAAU;","names":["picked","existing","result"]}
@@ -0,0 +1,19 @@
1
+ import { FormatDefinition } from './types.cjs';
2
+ import 'react';
3
+ import 'lucide-react';
4
+ import 'react-hook-form';
5
+ import '@medialane/sdk';
6
+ import '@medialane/sdk/starknet';
7
+ import '../../../data/ip.cjs';
8
+ import '../../ip-type-fields.cjs';
9
+ import 'react/jsx-runtime';
10
+ import '../form.cjs';
11
+ import '../types.cjs';
12
+ import 'starknet';
13
+ import '../use-new-collection-draft.cjs';
14
+ import '../create-then-add.cjs';
15
+
16
+ declare const SINGLE_FORMAT: FormatDefinition<unknown>;
17
+ declare const EDITIONS_FORMAT: FormatDefinition<unknown>;
18
+
19
+ export { EDITIONS_FORMAT, SINGLE_FORMAT };
@@ -0,0 +1,19 @@
1
+ import { FormatDefinition } from './types.js';
2
+ import 'react';
3
+ import 'lucide-react';
4
+ import 'react-hook-form';
5
+ import '@medialane/sdk';
6
+ import '@medialane/sdk/starknet';
7
+ import '../../../data/ip.js';
8
+ import '../../ip-type-fields.js';
9
+ import 'react/jsx-runtime';
10
+ import '../form.js';
11
+ import '../types.js';
12
+ import 'starknet';
13
+ import '../use-new-collection-draft.js';
14
+ import '../create-then-add.js';
15
+
16
+ declare const SINGLE_FORMAT: FormatDefinition<unknown>;
17
+ declare const EDITIONS_FORMAT: FormatDefinition<unknown>;
18
+
19
+ export { EDITIONS_FORMAT, SINGLE_FORMAT };
@@ -0,0 +1,214 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { ArrowRightLeft, Eye, GitBranch, ImagePlus, Layers, Tag } from "lucide-react";
4
+ import { buildAssetMetadata, getCoordinates } from "@medialane/sdk";
5
+ import {
6
+ createdCollectionAddress,
7
+ createdCollectionFromReceipt,
8
+ deployedCollectionFromReceipt,
9
+ executeIntent,
10
+ mintedTokenIdFromReceipt
11
+ } from "@medialane/sdk/starknet";
12
+ import { Input } from "../../input.js";
13
+ import { uploadJsonToIpfs } from "../../../utils/ipfs-upload.js";
14
+ import { CollectionSection } from "../collection-section.js";
15
+ import { LicensingSection } from "../licensing-section.js";
16
+ import { IpTypeSection } from "../ip-type-section.js";
17
+ import { collectionKey, mintableCollections } from "../mintable-collections.js";
18
+ import { createThenAdd } from "../create-then-add.js";
19
+ import { defineFormat } from "./types.js";
20
+ function assetLinks(contract, tokenId) {
21
+ if (!contract || !tokenId) return [];
22
+ const asset = `/asset/STARKNET/${contract}/${tokenId}`;
23
+ return [
24
+ { href: asset, label: "View asset", icon: Eye },
25
+ { href: `${asset}?action=list`, label: "Sell on marketplace", icon: Tag },
26
+ { href: `${asset}?action=transfer`, label: "Transfer", icon: ArrowRightLeft },
27
+ { href: `/create/remix/${contract}/${tokenId}`, label: "Create a remix", icon: GitBranch }
28
+ ];
29
+ }
30
+ async function pinTokenUri(shared, runtime) {
31
+ const values = shared.form.getValues();
32
+ const built = buildAssetMetadata({
33
+ name: values.name,
34
+ description: values.description || "",
35
+ externalUrl: values.external_url || "",
36
+ imageUri: shared.image,
37
+ creator: shared.walletAddress,
38
+ ipType: shared.ipType,
39
+ licenseType: values.licenseType,
40
+ commercialUse: values.commercialUse,
41
+ derivatives: values.derivatives,
42
+ attribution: values.attribution,
43
+ geographicScope: values.geographicScope,
44
+ aiPolicy: values.aiPolicy,
45
+ royalty: String(values.royalty),
46
+ templateTraits: shared.templateFieldsRef.current.filter(({ traitType, value }) => traitType.trim() && value.trim()).map(({ traitType, value }) => ({ traitType, value }))
47
+ });
48
+ const metadata = { ...built };
49
+ if (shared.mediaKind !== "image") metadata.animation_url = shared.mediaUri;
50
+ const uploadToken = await runtime.getUploadToken();
51
+ if (!uploadToken) throw new Error("Sign in first");
52
+ return uploadJsonToIpfs(runtime.client.api, metadata);
53
+ }
54
+ function makeNftFormat(kind) {
55
+ const single = kind === "single";
56
+ function Fields({ shared, state, update }) {
57
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ !single && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
59
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", htmlFor: "fast-mint-copies", children: "Number of copies" }),
60
+ /* @__PURE__ */ jsx(
61
+ Input,
62
+ {
63
+ id: "fast-mint-copies",
64
+ type: "number",
65
+ min: 1,
66
+ value: state.editionCount,
67
+ onChange: (e) => update({ editionCount: e.target.value }),
68
+ className: "max-w-[140px]"
69
+ }
70
+ )
71
+ ] }),
72
+ /* @__PURE__ */ jsx(
73
+ CollectionSection,
74
+ {
75
+ mode: state.mode,
76
+ onModeChange: (mode) => update({ mode }),
77
+ collections: mintableCollections(kind, shared.collections),
78
+ value: single ? state.existingId : state.existingContract,
79
+ onValue: (value) => update(single ? { existingId: value } : { existingContract: value }),
80
+ valueOf: collectionKey(kind),
81
+ draft: shared.draft,
82
+ previewImage: shared.previewImage
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(LicensingSection, { form: shared.form }),
86
+ /* @__PURE__ */ jsx(
87
+ IpTypeSection,
88
+ {
89
+ ipType: shared.ipType,
90
+ onIpTypeChange: shared.onIpTypeChange,
91
+ fieldsRef: shared.templateFieldsRef,
92
+ uploadDocument: shared.uploadDocument,
93
+ existingDocument: shared.mediaKind === "document" ? { uri: shared.mediaUri, name: shared.mediaName } : null
94
+ }
95
+ )
96
+ ] });
97
+ }
98
+ const selected = (shared, state) => mintableCollections(kind, shared.collections).find((c) => collectionKey(kind)(c) === (single ? state.existingId : state.existingContract));
99
+ return defineFormat({
100
+ key: kind,
101
+ title: single ? "Single NFT" : "Limited Editions",
102
+ hint: single ? "One copy, yours to keep or sell" : "Numbered copies people can collect",
103
+ icon: single ? ImagePlus : Layers,
104
+ submitLabel: () => single ? "Mint NFT" : "Mint Editions",
105
+ initial: () => ({ mode: "existing", existingId: "", existingContract: "", editionCount: "10" }),
106
+ Fields,
107
+ isReady: (shared, state) => {
108
+ if (!single && !/^[1-9]\d*$/.test(state.editionCount.trim())) return false;
109
+ if (state.mode === "new") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;
110
+ return (single ? state.existingId : state.existingContract) !== "";
111
+ },
112
+ previewLabel: (shared, state) => state.mode === "new" ? shared.draft.name || "New collection" : selected(shared, state)?.name || "IP Asset",
113
+ submit: async (shared, state, runtime) => {
114
+ const { client, signer, onStep } = runtime;
115
+ const owner = shared.walletAddress;
116
+ const values = shared.form.getValues();
117
+ const tokenUri = await pinTokenUri(shared, runtime);
118
+ const royaltyBps = Math.round(values.royalty * 100);
119
+ const labels = { create: "Creating the collection", add: single ? "Minting" : "Minting editions" };
120
+ if (single) {
121
+ const picked2 = state.mode === "existing" ? selected(shared, state) : void 0;
122
+ const existing2 = runtime.resume ?? (picked2?.collectionId ? { collectionId: picked2.collectionId, contract: picked2.contractAddress ?? null } : null);
123
+ const result2 = await createThenAdd({
124
+ existing: existing2,
125
+ noun: "collection",
126
+ labels,
127
+ onStep,
128
+ create: async () => {
129
+ const created = await client.api.intents.create("create-collection", {
130
+ owner,
131
+ name: shared.draft.name,
132
+ symbol: shared.draft.symbol,
133
+ description: shared.draft.description || void 0,
134
+ image: shared.image
135
+ });
136
+ const { receipt } = await executeIntent(signer, client, created);
137
+ const registry = getCoordinates("STARKNET").collection721;
138
+ const collectionId = createdCollectionFromReceipt(receipt, registry)?.collectionId;
139
+ if (!collectionId) throw new Error("Collection created, but its id couldn't be read \u2014 check My Collections to mint into it.");
140
+ return { collectionId, contract: await createdCollectionAddress(client.provider, registry, collectionId) };
141
+ },
142
+ add: async (destination) => {
143
+ const minted = await client.api.intents.create("mint", {
144
+ owner,
145
+ collectionId: destination.collectionId,
146
+ recipient: owner,
147
+ tokenUri,
148
+ royaltyBps
149
+ });
150
+ const { receipt } = await executeIntent(signer, client, minted);
151
+ return {
152
+ contract: destination.contract,
153
+ tokenId: destination.contract ? mintedTokenIdFromReceipt(receipt, destination.contract) : null
154
+ };
155
+ }
156
+ });
157
+ return nftResult(shared, values.name, result2.contract, result2.tokenId);
158
+ }
159
+ const picked = state.mode === "existing" ? state.existingContract : "";
160
+ const existing = runtime.resume ?? (picked || null);
161
+ const result = await createThenAdd({
162
+ existing,
163
+ noun: "collection",
164
+ labels,
165
+ onStep,
166
+ create: async () => {
167
+ const created = await client.api.intents.create("create-collection", {
168
+ owner,
169
+ name: shared.draft.name,
170
+ symbol: shared.draft.symbol,
171
+ description: shared.draft.description || void 0,
172
+ image: shared.image,
173
+ baseUri: "",
174
+ service: "mip-erc1155"
175
+ });
176
+ const { receipt } = await executeIntent(signer, client, created);
177
+ const deployed = deployedCollectionFromReceipt(receipt, "mip-erc1155");
178
+ if (!deployed) throw new Error("Collection deployed, but its address couldn't be read \u2014 check My Collections to mint into it.");
179
+ return deployed;
180
+ },
181
+ add: async (contract) => {
182
+ const minted = await client.api.intents.create("mint", {
183
+ owner,
184
+ recipient: owner,
185
+ collectionContract: contract,
186
+ tokenUri,
187
+ value: state.editionCount.trim(),
188
+ royaltyBps
189
+ });
190
+ const { receipt } = await executeIntent(signer, client, minted);
191
+ return { contract, tokenId: mintedTokenIdFromReceipt(receipt, contract) };
192
+ }
193
+ });
194
+ return nftResult(shared, values.name, result.contract, result.tokenId);
195
+ }
196
+ });
197
+ }
198
+ function nftResult(shared, name, contract, tokenId) {
199
+ return {
200
+ headline: "Asset published",
201
+ detail: "It is recorded onchain with your wallet as owner.",
202
+ name,
203
+ links: assetLinks(contract, tokenId),
204
+ reward: "mint_asset",
205
+ asset: contract && tokenId ? { contract, tokenId, image: shared.image } : void 0
206
+ };
207
+ }
208
+ const SINGLE_FORMAT = makeNftFormat("single");
209
+ const EDITIONS_FORMAT = makeNftFormat("editions");
210
+ export {
211
+ EDITIONS_FORMAT,
212
+ SINGLE_FORMAT
213
+ };
214
+ //# sourceMappingURL=nft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/fast-mint/formats/nft.tsx"],"sourcesContent":["\"use client\";\n\nimport { ArrowRightLeft, Eye, GitBranch, ImagePlus, Layers, Tag } from \"lucide-react\";\nimport { buildAssetMetadata, getCoordinates } from \"@medialane/sdk\";\nimport {\n createdCollectionAddress,\n createdCollectionFromReceipt,\n deployedCollectionFromReceipt,\n executeIntent,\n mintedTokenIdFromReceipt,\n} from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { CollectionSection, type CollectionMode } from \"../collection-section.js\";\nimport { LicensingSection } from \"../licensing-section.js\";\nimport { IpTypeSection } from \"../ip-type-section.js\";\nimport { collectionKey, mintableCollections, type MintAssetType } from \"../mintable-collections.js\";\nimport { createThenAdd } from \"../create-then-add.js\";\nimport { defineFormat, type FormatFieldsProps, type FormatResult, type FormatRuntime, type FormatShared } from \"./types.js\";\n\ninterface NftState {\n mode: CollectionMode;\n existingId: string;\n existingContract: string;\n editionCount: string;\n}\n\ninterface SingleDestination {\n collectionId: string;\n contract: string | null;\n}\n\nfunction assetLinks(contract: string | null, tokenId: string | null): FormatResult[\"links\"] {\n if (!contract || !tokenId) return [];\n const asset = `/asset/STARKNET/${contract}/${tokenId}`;\n return [\n { href: asset, label: \"View asset\", icon: Eye },\n { href: `${asset}?action=list`, label: \"Sell on marketplace\", icon: Tag },\n { href: `${asset}?action=transfer`, label: \"Transfer\", icon: ArrowRightLeft },\n { href: `/create/remix/${contract}/${tokenId}`, label: \"Create a remix\", icon: GitBranch },\n ];\n}\n\nasync function pinTokenUri(shared: FormatShared, runtime: FormatRuntime): Promise<string> {\n const values = shared.form.getValues();\n const built = buildAssetMetadata({\n name: values.name,\n description: values.description || \"\",\n externalUrl: values.external_url || \"\",\n imageUri: shared.image,\n creator: shared.walletAddress,\n ipType: shared.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: shared.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 (shared.mediaKind !== \"image\") metadata.animation_url = shared.mediaUri;\n\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n return uploadJsonToIpfs(runtime.client.api, metadata);\n}\n\nfunction makeNftFormat(kind: MintAssetType) {\n const single = kind === \"single\";\n\n function Fields({ shared, state, update }: FormatFieldsProps<NftState>) {\n return (\n <>\n {!single && (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor=\"fast-mint-copies\">Number of copies</label>\n <Input\n id=\"fast-mint-copies\"\n type=\"number\"\n min={1}\n value={state.editionCount}\n onChange={(e) => update({ editionCount: e.target.value })}\n className=\"max-w-[140px]\"\n />\n </div>\n )}\n <CollectionSection\n mode={state.mode}\n onModeChange={(mode) => update({ mode })}\n collections={mintableCollections(kind, shared.collections)}\n value={single ? state.existingId : state.existingContract}\n onValue={(value) => update(single ? { existingId: value } : { existingContract: value })}\n valueOf={collectionKey(kind)}\n draft={shared.draft}\n previewImage={shared.previewImage}\n />\n <LicensingSection form={shared.form} />\n <IpTypeSection\n ipType={shared.ipType}\n onIpTypeChange={shared.onIpTypeChange}\n fieldsRef={shared.templateFieldsRef}\n uploadDocument={shared.uploadDocument}\n existingDocument={shared.mediaKind === \"document\" ? { uri: shared.mediaUri, name: shared.mediaName } : null}\n />\n </>\n );\n }\n\n const selected = (shared: FormatShared, state: NftState) =>\n mintableCollections(kind, shared.collections).find((c) => collectionKey(kind)(c) === (single ? state.existingId : state.existingContract));\n\n return defineFormat<NftState>({\n key: kind,\n title: single ? \"Single NFT\" : \"Limited Editions\",\n hint: single ? \"One copy, yours to keep or sell\" : \"Numbered copies people can collect\",\n icon: single ? ImagePlus : Layers,\n submitLabel: () => (single ? \"Mint NFT\" : \"Mint Editions\"),\n initial: () => ({ mode: \"existing\", existingId: \"\", existingContract: \"\", editionCount: \"10\" }),\n Fields,\n isReady: (shared, state) => {\n if (!single && !/^[1-9]\\d*$/.test(state.editionCount.trim())) return false;\n if (state.mode === \"new\") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;\n return (single ? state.existingId : state.existingContract) !== \"\";\n },\n previewLabel: (shared, state) =>\n state.mode === \"new\" ? shared.draft.name || \"New collection\" : selected(shared, state)?.name || \"IP Asset\",\n submit: async (shared, state, runtime) => {\n const { client, signer, onStep } = runtime;\n const owner = shared.walletAddress;\n const values = shared.form.getValues();\n const tokenUri = await pinTokenUri(shared, runtime);\n const royaltyBps = Math.round(values.royalty * 100);\n const labels = { create: \"Creating the collection\", add: single ? \"Minting\" : \"Minting editions\" };\n\n if (single) {\n const picked = state.mode === \"existing\" ? selected(shared, state) : undefined;\n const existing: SingleDestination | null =\n (runtime.resume as SingleDestination | null) ??\n (picked?.collectionId ? { collectionId: picked.collectionId, contract: picked.contractAddress ?? null } : null);\n\n const result = await createThenAdd<SingleDestination, { contract: string | null; tokenId: string | null }>({\n existing,\n noun: \"collection\",\n labels,\n onStep,\n create: async () => {\n const created = await client.api.intents.create(\"create-collection\", {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n description: shared.draft.description || undefined,\n image: shared.image,\n });\n const { receipt } = await executeIntent(signer, client, created);\n const registry = getCoordinates(\"STARKNET\").collection721;\n const collectionId = createdCollectionFromReceipt(receipt, registry)?.collectionId;\n if (!collectionId) throw new Error(\"Collection created, but its id couldn't be read — check My Collections to mint into it.\");\n return { collectionId, contract: await createdCollectionAddress(client.provider, registry, collectionId) };\n },\n add: async (destination) => {\n const minted = await client.api.intents.create(\"mint\", {\n owner,\n collectionId: destination.collectionId,\n recipient: owner,\n tokenUri,\n royaltyBps,\n });\n const { receipt } = await executeIntent(signer, client, minted);\n return {\n contract: destination.contract,\n tokenId: destination.contract ? mintedTokenIdFromReceipt(receipt, destination.contract) : null,\n };\n },\n });\n return nftResult(shared, values.name, result.contract, result.tokenId);\n }\n\n const picked = state.mode === \"existing\" ? state.existingContract : \"\";\n const existing = (runtime.resume as string | null) ?? (picked || null);\n const result = await createThenAdd<string, { contract: string; tokenId: string | null }>({\n existing,\n noun: \"collection\",\n labels,\n onStep,\n create: async () => {\n const created = await client.api.intents.create(\"create-collection\", {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n description: shared.draft.description || undefined,\n image: shared.image,\n baseUri: \"\",\n service: \"mip-erc1155\",\n });\n const { receipt } = await executeIntent(signer, client, created);\n const deployed = deployedCollectionFromReceipt(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 return deployed;\n },\n add: async (contract) => {\n const minted = await client.api.intents.create(\"mint\", {\n owner,\n recipient: owner,\n collectionContract: contract,\n tokenUri,\n value: state.editionCount.trim(),\n royaltyBps,\n });\n const { receipt } = await executeIntent(signer, client, minted);\n return { contract, tokenId: mintedTokenIdFromReceipt(receipt, contract) };\n },\n });\n return nftResult(shared, values.name, result.contract, result.tokenId);\n },\n });\n}\n\nfunction nftResult(shared: FormatShared, name: string, contract: string | null, tokenId: string | null): FormatResult {\n return {\n headline: \"Asset published\",\n detail: \"It is recorded onchain with your wallet as owner.\",\n name,\n links: assetLinks(contract, tokenId),\n reward: \"mint_asset\",\n asset: contract && tokenId ? { contract, tokenId, image: shared.image } : undefined,\n };\n}\n\nexport const SINGLE_FORMAT = makeNftFormat(\"single\");\nexport const EDITIONS_FORMAT = makeNftFormat(\"editions\");\n"],"mappings":";AA4EM,mBAGM,KADF,YAFJ;AA1EN,SAAS,gBAAgB,KAAK,WAAW,WAAW,QAAQ,WAAW;AACvE,SAAS,oBAAoB,sBAAsB;AACnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,yBAA8C;AACvD,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,eAAe,2BAA+C;AACvE,SAAS,qBAAqB;AAC9B,SAAS,oBAAsG;AAc/G,SAAS,WAAW,UAAyB,SAA+C;AAC1F,MAAI,CAAC,YAAY,CAAC,QAAS,QAAO,CAAC;AACnC,QAAM,QAAQ,mBAAmB,QAAQ,IAAI,OAAO;AACpD,SAAO;AAAA,IACL,EAAE,MAAM,OAAO,OAAO,cAAc,MAAM,IAAI;AAAA,IAC9C,EAAE,MAAM,GAAG,KAAK,gBAAgB,OAAO,uBAAuB,MAAM,IAAI;AAAA,IACxE,EAAE,MAAM,GAAG,KAAK,oBAAoB,OAAO,YAAY,MAAM,eAAe;AAAA,IAC5E,EAAE,MAAM,iBAAiB,QAAQ,IAAI,OAAO,IAAI,OAAO,kBAAkB,MAAM,UAAU;AAAA,EAC3F;AACF;AAEA,eAAe,YAAY,QAAsB,SAAyC;AACxF,QAAM,SAAS,OAAO,KAAK,UAAU;AACrC,QAAM,QAAQ,mBAAmB;AAAA,IAC/B,MAAM,OAAO;AAAA,IACb,aAAa,OAAO,eAAe;AAAA,IACnC,aAAa,OAAO,gBAAgB;AAAA,IACpC,UAAU,OAAO;AAAA,I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