@medialane/ui 0.366.0 → 0.368.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/alert.d.cts +1 -1
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/approve-mint-dialog.d.cts +0 -1
- package/dist/components/approve-mint-dialog.d.ts +0 -1
- package/dist/components/asset-card.cjs +3 -3
- package/dist/components/asset-card.cjs.map +1 -1
- package/dist/components/asset-card.js +3 -3
- package/dist/components/asset-card.js.map +1 -1
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/collection-card.cjs +3 -3
- package/dist/components/collection-card.cjs.map +1 -1
- package/dist/components/collection-card.js +3 -3
- package/dist/components/collection-card.js.map +1 -1
- package/dist/components/collection-page.cjs +1 -1
- package/dist/components/collection-page.cjs.map +1 -1
- package/dist/components/collection-page.js +1 -1
- package/dist/components/collection-page.js.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.cjs +25 -51
- package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.d.cts +11 -14
- package/dist/components/fast-mint/asset-form-parts.d.ts +11 -14
- package/dist/components/fast-mint/asset-form-parts.js +27 -52
- package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
- package/dist/components/fast-mint/collection-section.cjs +11 -21
- package/dist/components/fast-mint/collection-section.cjs.map +1 -1
- package/dist/components/fast-mint/collection-section.d.cts +5 -7
- package/dist/components/fast-mint/collection-section.d.ts +5 -7
- package/dist/components/fast-mint/collection-section.js +11 -21
- package/dist/components/fast-mint/collection-section.js.map +1 -1
- package/dist/components/fast-mint/create-then-add.cjs +55 -0
- package/dist/components/fast-mint/create-then-add.cjs.map +1 -0
- package/dist/components/fast-mint/create-then-add.d.cts +24 -0
- package/dist/components/fast-mint/create-then-add.d.ts +24 -0
- package/dist/components/fast-mint/create-then-add.js +30 -0
- package/dist/components/fast-mint/create-then-add.js.map +1 -0
- package/dist/components/fast-mint/dropzone.d.cts +0 -1
- package/dist/components/fast-mint/dropzone.d.ts +0 -1
- package/dist/components/fast-mint/fast-mint.cjs +96 -167
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +98 -169
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/formats/nft.cjs +236 -0
- package/dist/components/fast-mint/formats/nft.cjs.map +1 -0
- package/dist/components/fast-mint/formats/nft.d.cts +19 -0
- package/dist/components/fast-mint/formats/nft.d.ts +19 -0
- package/dist/components/fast-mint/formats/nft.js +217 -0
- package/dist/components/fast-mint/formats/nft.js.map +1 -0
- package/dist/components/fast-mint/formats/pop.cjs +161 -0
- package/dist/components/fast-mint/formats/pop.cjs.map +1 -0
- package/dist/components/fast-mint/formats/pop.d.cts +18 -0
- package/dist/components/fast-mint/formats/pop.d.ts +18 -0
- package/dist/components/fast-mint/formats/pop.js +137 -0
- package/dist/components/fast-mint/formats/pop.js.map +1 -0
- package/dist/components/fast-mint/formats/registry.cjs +42 -0
- package/dist/components/fast-mint/formats/registry.cjs.map +1 -0
- package/dist/components/fast-mint/formats/registry.d.cts +20 -0
- package/dist/components/fast-mint/formats/registry.d.ts +20 -0
- package/dist/components/fast-mint/formats/registry.js +16 -0
- package/dist/components/fast-mint/formats/registry.js.map +1 -0
- package/dist/components/fast-mint/formats/tiers.cjs +206 -0
- package/dist/components/fast-mint/formats/tiers.cjs.map +1 -0
- package/dist/components/fast-mint/formats/tiers.d.cts +19 -0
- package/dist/components/fast-mint/formats/tiers.d.ts +19 -0
- package/dist/components/fast-mint/formats/tiers.js +181 -0
- package/dist/components/fast-mint/formats/tiers.js.map +1 -0
- package/dist/components/fast-mint/formats/types.cjs +31 -0
- package/dist/components/fast-mint/formats/types.cjs.map +1 -0
- package/dist/components/fast-mint/formats/types.d.cts +71 -0
- package/dist/components/fast-mint/formats/types.d.ts +71 -0
- package/dist/components/fast-mint/formats/types.js +7 -0
- package/dist/components/fast-mint/formats/types.js.map +1 -0
- package/dist/components/fast-mint/media-kind.d.cts +0 -1
- package/dist/components/fast-mint/media-kind.d.ts +0 -1
- package/dist/components/fast-mint/success-view.cjs +18 -59
- package/dist/components/fast-mint/success-view.cjs.map +1 -1
- package/dist/components/fast-mint/success-view.d.cts +13 -8
- package/dist/components/fast-mint/success-view.d.ts +13 -8
- package/dist/components/fast-mint/success-view.js +19 -60
- package/dist/components/fast-mint/success-view.js.map +1 -1
- package/dist/components/fast-mint/types.cjs.map +1 -1
- package/dist/components/fast-mint/types.d.cts +0 -3
- package/dist/components/fast-mint/types.d.ts +0 -3
- package/dist/components/launchpad/collection-create-form.cjs +9 -18
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +9 -18
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.cjs +3 -4
- package/dist/components/launchpad/edition-mint-schema.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.ts +1 -1
- package/dist/components/launchpad/edition-mint-schema.js +3 -4
- package/dist/components/launchpad/edition-mint-schema.js.map +1 -1
- package/dist/components/launchpad/pop-create-fields.cjs +8 -6
- package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-fields.d.cts +8 -2
- package/dist/components/launchpad/pop-create-fields.d.ts +8 -2
- package/dist/components/launchpad/pop-create-fields.js +7 -6
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create-schema.cjs +3 -4
- package/dist/components/launchpad/pop-create-schema.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-schema.js +3 -4
- package/dist/components/launchpad/pop-create-schema.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +12 -25
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +12 -25
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad/single-edition-mint.cjs +2 -1
- package/dist/components/launchpad/single-edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/single-edition-mint.js +2 -1
- package/dist/components/launchpad/single-edition-mint.js.map +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs +11 -27
- package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-form.js +9 -25
- package/dist/components/launchpad/tier-mint-form.js.map +1 -1
- package/dist/components/launchpad-page.cjs +1 -2
- package/dist/components/launchpad-page.cjs.map +1 -1
- package/dist/components/launchpad-page.js +1 -2
- package/dist/components/launchpad-page.js.map +1 -1
- package/dist/components/page-skeletons.cjs +79 -47
- package/dist/components/page-skeletons.cjs.map +1 -1
- package/dist/components/page-skeletons.d.cts +3 -1
- package/dist/components/page-skeletons.d.ts +3 -1
- package/dist/components/page-skeletons.js +77 -47
- package/dist/components/page-skeletons.js.map +1 -1
- package/dist/components/pop-burn-button.cjs +1 -1
- package/dist/components/pop-burn-button.cjs.map +1 -1
- package/dist/components/pop-burn-button.js +1 -1
- package/dist/components/pop-burn-button.js.map +1 -1
- package/dist/components/pop-claim-button.cjs +3 -3
- package/dist/components/pop-claim-button.cjs.map +1 -1
- package/dist/components/pop-claim-button.js +3 -3
- package/dist/components/pop-claim-button.js.map +1 -1
- package/dist/components/pop-manage-page.cjs +3 -3
- package/dist/components/pop-manage-page.cjs.map +1 -1
- package/dist/components/pop-manage-page.js +3 -3
- package/dist/components/pop-manage-page.js.map +1 -1
- package/dist/components/service-collections-page.cjs +3 -2
- package/dist/components/service-collections-page.cjs.map +1 -1
- package/dist/components/service-collections-page.d.cts +2 -2
- package/dist/components/service-collections-page.d.ts +2 -2
- package/dist/components/service-collections-page.js +3 -2
- package/dist/components/service-collections-page.js.map +1 -1
- package/dist/components/token-card.cjs +7 -4
- package/dist/components/token-card.cjs.map +1 -1
- package/dist/components/token-card.js +7 -4
- package/dist/components/token-card.js.map +1 -1
- package/dist/components/transfer-dialog.d.cts +0 -1
- package/dist/components/transfer-dialog.d.ts +0 -1
- package/dist/data/launchpad-services.cjs +48 -27
- package/dist/data/launchpad-services.cjs.map +1 -1
- package/dist/data/launchpad-services.d.cts +11 -1
- package/dist/data/launchpad-services.d.ts +11 -1
- package/dist/data/launchpad-services.js +44 -26
- package/dist/data/launchpad-services.js.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/drop/actions.d.cts +0 -1
- package/dist/utils/drop/actions.d.ts +0 -1
- package/dist/utils/drop/draft.cjs +3 -2
- package/dist/utils/drop/draft.cjs.map +1 -1
- package/dist/utils/drop/draft.js +3 -2
- package/dist/utils/drop/draft.js.map +1 -1
- package/dist/utils/drop/sale.cjs +2 -1
- package/dist/utils/drop/sale.cjs.map +1 -1
- package/dist/utils/drop/sale.js +2 -1
- package/dist/utils/drop/sale.js.map +1 -1
- package/dist/utils/drop/types.d.cts +0 -1
- package/dist/utils/drop/types.d.ts +0 -1
- package/dist/utils/launchpad-actions.cjs +90 -0
- package/dist/utils/launchpad-actions.cjs.map +1 -0
- package/dist/utils/launchpad-actions.d.cts +39 -0
- package/dist/utils/launchpad-actions.d.ts +39 -0
- package/dist/utils/launchpad-actions.js +60 -0
- package/dist/utils/launchpad-actions.js.map +1 -0
- package/dist/utils/launchpad-rules.cjs +77 -0
- package/dist/utils/launchpad-rules.cjs.map +1 -0
- package/dist/utils/launchpad-rules.d.cts +13 -0
- package/dist/utils/launchpad-rules.d.ts +13 -0
- package/dist/utils/launchpad-rules.js +35 -0
- package/dist/utils/launchpad-rules.js.map +1 -0
- package/dist/utils/success-messages.cjs +5 -5
- package/dist/utils/success-messages.cjs.map +1 -1
- package/dist/utils/success-messages.d.cts +1 -1
- package/dist/utils/success-messages.d.ts +1 -1
- package/dist/utils/success-messages.js +5 -5
- package/dist/utils/success-messages.js.map +1 -1
- package/dist/utils/use-transaction.d.cts +0 -1
- package/dist/utils/use-transaction.d.ts +0 -1
- package/package.json +1 -1
- package/dist/components/fast-mint/mint-asset.cjs +0 -124
- package/dist/components/fast-mint/mint-asset.cjs.map +0 -1
- package/dist/components/fast-mint/mint-asset.d.cts +0 -41
- package/dist/components/fast-mint/mint-asset.d.ts +0 -41
- package/dist/components/fast-mint/mint-asset.js +0 -100
- package/dist/components/fast-mint/mint-asset.js.map +0 -1
- package/dist/utils/launchpad-handoff.cjs +0 -62
- package/dist/utils/launchpad-handoff.cjs.map +0 -1
- package/dist/utils/launchpad-handoff.d.cts +0 -11
- package/dist/utils/launchpad-handoff.d.ts +0 -11
- package/dist/utils/launchpad-handoff.js +0 -35
- package/dist/utils/launchpad-handoff.js.map +0 -1
|
@@ -0,0 +1,206 @@
|
|
|
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 tiers_exports = {};
|
|
21
|
+
__export(tiers_exports, {
|
|
22
|
+
CLUB_FORMAT: () => CLUB_FORMAT,
|
|
23
|
+
TICKETS_FORMAT: () => TICKETS_FORMAT
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(tiers_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_launchpad_services = require("../../../data/launchpad-services.js");
|
|
32
|
+
var import_ipfs_upload = require("../../../utils/ipfs-upload.js");
|
|
33
|
+
var import_launchpad_rules = require("../../../utils/launchpad-rules.js");
|
|
34
|
+
var import_launchpad_actions = require("../../../utils/launchpad-actions.js");
|
|
35
|
+
var import_tier_mint_presets = require("../../launchpad/tier-mint-presets.js");
|
|
36
|
+
var import_collection_section = require("../collection-section.js");
|
|
37
|
+
var import_licensing_section = require("../licensing-section.js");
|
|
38
|
+
var import_create_then_add = require("../create-then-add.js");
|
|
39
|
+
var import_types = require("./types.js");
|
|
40
|
+
function makeTierFormat(config) {
|
|
41
|
+
const { preset, noun } = config;
|
|
42
|
+
const copy = (0, import_launchpad_services.getMintFormatCopy)(config.service);
|
|
43
|
+
const ownCollections = (shared) => shared.collections.filter((c) => (0, import_sdk.getService)(c.service)?.id === preset.service && !!c.contractAddress);
|
|
44
|
+
function Fields({ shared, state, update }) {
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
import_collection_section.CollectionSection,
|
|
48
|
+
{
|
|
49
|
+
noun,
|
|
50
|
+
mode: state.mode,
|
|
51
|
+
onModeChange: (mode) => update({ mode }),
|
|
52
|
+
collections: ownCollections(shared),
|
|
53
|
+
value: state.existingContract,
|
|
54
|
+
onValue: (existingContract) => update({ existingContract }),
|
|
55
|
+
valueOf: (c) => c.contractAddress,
|
|
56
|
+
draft: shared.draft,
|
|
57
|
+
previewImage: shared.previewImage
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "text-sm font-medium", htmlFor: `fast-mint-${config.key}-supply`, children: [
|
|
62
|
+
config.supplyLabel,
|
|
63
|
+
" *"
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
import_input.Input,
|
|
67
|
+
{
|
|
68
|
+
id: `fast-mint-${config.key}-supply`,
|
|
69
|
+
type: "number",
|
|
70
|
+
min: 1,
|
|
71
|
+
value: state.supply,
|
|
72
|
+
onChange: (e) => update({ supply: e.target.value }),
|
|
73
|
+
className: "max-w-[160px]"
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", children: "Valid" }),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { type: "date", "aria-label": "Valid from", value: state.startDate, onChange: (e) => update({ startDate: e.target.value }) }),
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { type: "date", "aria-label": "Valid until", value: state.endDate, onChange: (e) => update({ endDate: e.target.value }) })
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: preset.copy.validUntilHint })
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_licensing_section.LicensingSection, { form: shared.form })
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
return (0, import_types.defineFormat)({
|
|
89
|
+
key: config.key,
|
|
90
|
+
title: copy.name,
|
|
91
|
+
hint: copy.hint,
|
|
92
|
+
icon: config.icon,
|
|
93
|
+
submitLabel: () => config.submitLabel,
|
|
94
|
+
initial: () => ({ mode: "existing", existingContract: "", supply: "100", startDate: "", endDate: "" }),
|
|
95
|
+
Fields,
|
|
96
|
+
isReady: (shared, state) => {
|
|
97
|
+
if (!(0, import_launchpad_rules.isPositiveInteger)(state.supply)) return false;
|
|
98
|
+
if (state.mode === "new") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;
|
|
99
|
+
return state.existingContract !== "";
|
|
100
|
+
},
|
|
101
|
+
previewLabel: (shared, state) => state.mode === "new" ? shared.draft.name || `New ${noun}` : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || void 0,
|
|
102
|
+
submit: async (shared, state, runtime) => {
|
|
103
|
+
const { client, signer, onStep } = runtime;
|
|
104
|
+
const owner = shared.walletAddress;
|
|
105
|
+
const values = shared.form.getValues();
|
|
106
|
+
const supply = state.supply.trim();
|
|
107
|
+
const uploadToken = await runtime.getUploadToken();
|
|
108
|
+
if (!uploadToken) throw new Error("Sign in first");
|
|
109
|
+
const existing = runtime.resume ?? (state.mode === "existing" && state.existingContract ? state.existingContract : null);
|
|
110
|
+
const contract = await (0, import_create_then_add.createThenAdd)({
|
|
111
|
+
existing,
|
|
112
|
+
noun,
|
|
113
|
+
labels: { create: `Creating the ${noun}`, add: config.addLabel },
|
|
114
|
+
onStep,
|
|
115
|
+
create: async () => {
|
|
116
|
+
const baseUri = await (0, import_ipfs_upload.uploadJsonToIpfs)(
|
|
117
|
+
client.api,
|
|
118
|
+
(0, import_sdk.buildCollectionMetadata)({
|
|
119
|
+
name: shared.draft.name,
|
|
120
|
+
description: shared.draft.description,
|
|
121
|
+
image: shared.image,
|
|
122
|
+
externalLink: values.external_url,
|
|
123
|
+
owner
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
const created = await (0, import_launchpad_actions.serviceCollectionIntent)(client.api, {
|
|
127
|
+
owner,
|
|
128
|
+
name: shared.draft.name,
|
|
129
|
+
symbol: shared.draft.symbol,
|
|
130
|
+
baseUri,
|
|
131
|
+
service: preset.service
|
|
132
|
+
});
|
|
133
|
+
const { receipt } = await (0, import_starknet.executeIntent)(signer, client, created);
|
|
134
|
+
const deployed = (0, import_starknet.deployedCollectionFromReceipt)(receipt, preset.service);
|
|
135
|
+
if (!deployed) throw new Error(`The ${noun} was deployed, but its address couldn't be read \u2014 check My Collections.`);
|
|
136
|
+
return deployed;
|
|
137
|
+
},
|
|
138
|
+
add: async (address) => {
|
|
139
|
+
const pinned = await (0, import_ipfs_upload.pinAssetMetadata)(client.api, {
|
|
140
|
+
name: values.name,
|
|
141
|
+
description: values.description,
|
|
142
|
+
imageUri: shared.image,
|
|
143
|
+
externalUrl: values.external_url,
|
|
144
|
+
ipType: "NFT",
|
|
145
|
+
licenseType: values.licenseType,
|
|
146
|
+
commercialUse: values.commercialUse,
|
|
147
|
+
derivatives: values.derivatives,
|
|
148
|
+
attribution: values.attribution,
|
|
149
|
+
geographicScope: values.geographicScope,
|
|
150
|
+
aiPolicy: values.aiPolicy,
|
|
151
|
+
royalty: String(values.royalty),
|
|
152
|
+
creator: owner,
|
|
153
|
+
templateTraits: (0, import_launchpad_actions.tierTraits)(preset.traitType, supply, address)
|
|
154
|
+
});
|
|
155
|
+
const intents = await (0, import_launchpad_actions.tierIntents)(client.api, {
|
|
156
|
+
owner,
|
|
157
|
+
contract: address,
|
|
158
|
+
service: preset.service,
|
|
159
|
+
tierId: await preset.predictNextId(client.api, address),
|
|
160
|
+
maxSupply: supply,
|
|
161
|
+
startTime: (0, import_launchpad_actions.dateToUnixTimestamp)(state.startDate),
|
|
162
|
+
endTime: (0, import_launchpad_actions.dateToUnixTimestamp)(state.endDate),
|
|
163
|
+
royaltyBps: Math.round(values.royalty * 100),
|
|
164
|
+
metadataUri: pinned.uri
|
|
165
|
+
});
|
|
166
|
+
await (0, import_starknet.executeIntents)(signer, client, intents);
|
|
167
|
+
return address;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
headline: preset.success.title,
|
|
172
|
+
detail: preset.success.description,
|
|
173
|
+
name: values.name,
|
|
174
|
+
collectionLabel: ownCollections(shared).find((c) => c.contractAddress === contract)?.name || (state.mode === "new" ? shared.draft.name : void 0),
|
|
175
|
+
links: [{ href: (0, import_sdk.collectionHref)("STARKNET", contract), label: "View collection", icon: import_lucide_react.Eye }],
|
|
176
|
+
reward: "launch_launchpad"
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const TICKETS_FORMAT = makeTierFormat({
|
|
182
|
+
key: "tickets",
|
|
183
|
+
preset: import_tier_mint_presets.TICKETS_TIER_PRESET,
|
|
184
|
+
service: "ip-tickets",
|
|
185
|
+
icon: import_lucide_react.Ticket,
|
|
186
|
+
noun: "ticket collection",
|
|
187
|
+
supplyLabel: "Number of tickets",
|
|
188
|
+
submitLabel: "Create tickets",
|
|
189
|
+
addLabel: "Minting tickets"
|
|
190
|
+
});
|
|
191
|
+
const CLUB_FORMAT = makeTierFormat({
|
|
192
|
+
key: "club",
|
|
193
|
+
preset: import_tier_mint_presets.CLUB_TIER_PRESET,
|
|
194
|
+
service: "ip-club",
|
|
195
|
+
icon: import_lucide_react.Users,
|
|
196
|
+
noun: "club",
|
|
197
|
+
supplyLabel: "Number of memberships",
|
|
198
|
+
submitLabel: "Create membership",
|
|
199
|
+
addLabel: "Minting memberships"
|
|
200
|
+
});
|
|
201
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
202
|
+
0 && (module.exports = {
|
|
203
|
+
CLUB_FORMAT,
|
|
204
|
+
TICKETS_FORMAT
|
|
205
|
+
});
|
|
206
|
+
//# sourceMappingURL=tiers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fast-mint/formats/tiers.tsx"],"sourcesContent":["\"use client\";\n\nimport { Eye, Ticket, Users } from \"lucide-react\";\nimport { buildCollectionMetadata, collectionHref, getService } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, executeIntents } from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { getMintFormatCopy } from \"../../../data/launchpad-services.js\";\nimport { pinAssetMetadata, uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { isPositiveInteger } from \"../../../utils/launchpad-rules.js\";\nimport { dateToUnixTimestamp, serviceCollectionIntent, tierIntents, tierTraits } from \"../../../utils/launchpad-actions.js\";\nimport { CLUB_TIER_PRESET, TICKETS_TIER_PRESET, type TierMintPreset } from \"../../launchpad/tier-mint-presets.js\";\nimport { CollectionSection, type CollectionMode } from \"../collection-section.js\";\nimport { LicensingSection } from \"../licensing-section.js\";\nimport { createThenAdd } from \"../create-then-add.js\";\nimport { defineFormat, type FormatFieldsProps, type FormatShared } from \"./types.js\";\n\ninterface TierState {\n mode: CollectionMode;\n existingContract: string;\n supply: string;\n startDate: string;\n endDate: string;\n}\n\nfunction makeTierFormat(config: {\n key: \"tickets\" | \"club\";\n service: string;\n preset: TierMintPreset;\n icon: typeof Ticket;\n noun: string;\n supplyLabel: string;\n submitLabel: string;\n addLabel: string;\n}) {\n const { preset, noun } = config;\n const copy = getMintFormatCopy(config.service);\n\n const ownCollections = (shared: FormatShared) =>\n shared.collections.filter((c) => getService(c.service)?.id === preset.service && !!c.contractAddress);\n\n function Fields({ shared, state, update }: FormatFieldsProps<TierState>) {\n return (\n <>\n <CollectionSection\n noun={noun}\n mode={state.mode}\n onModeChange={(mode) => update({ mode })}\n collections={ownCollections(shared)}\n value={state.existingContract}\n onValue={(existingContract) => update({ existingContract })}\n valueOf={(c) => c.contractAddress}\n draft={shared.draft}\n previewImage={shared.previewImage}\n />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor={`fast-mint-${config.key}-supply`}>{config.supplyLabel} *</label>\n <Input\n id={`fast-mint-${config.key}-supply`}\n type=\"number\"\n min={1}\n value={state.supply}\n onChange={(e) => update({ supply: e.target.value })}\n className=\"max-w-[160px]\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Valid</label>\n <div className=\"grid grid-cols-2 gap-2\">\n <Input type=\"date\" aria-label=\"Valid from\" value={state.startDate} onChange={(e) => update({ startDate: e.target.value })} />\n <Input type=\"date\" aria-label=\"Valid until\" value={state.endDate} onChange={(e) => update({ endDate: e.target.value })} />\n </div>\n <p className=\"text-xs text-muted-foreground\">{preset.copy.validUntilHint}</p>\n </div>\n\n <LicensingSection form={shared.form} />\n </>\n );\n }\n\n return defineFormat<TierState>({\n key: config.key,\n title: copy.name,\n hint: copy.hint,\n icon: config.icon,\n submitLabel: () => config.submitLabel,\n initial: () => ({ mode: \"existing\", existingContract: \"\", supply: \"100\", startDate: \"\", endDate: \"\" }),\n Fields,\n isReady: (shared, state) => {\n if (!isPositiveInteger(state.supply)) return false;\n if (state.mode === \"new\") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;\n return state.existingContract !== \"\";\n },\n previewLabel: (shared, state) =>\n state.mode === \"new\"\n ? shared.draft.name || `New ${noun}`\n : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || undefined,\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 supply = state.supply.trim();\n\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n\n const existing = (runtime.resume as string | null) ?? (state.mode === \"existing\" && state.existingContract ? state.existingContract : null);\n\n const contract = await createThenAdd<string, string>({\n existing,\n noun,\n labels: { create: `Creating the ${noun}`, add: config.addLabel },\n onStep,\n create: async () => {\n const baseUri = await uploadJsonToIpfs(\n client.api,\n buildCollectionMetadata({\n name: shared.draft.name,\n description: shared.draft.description,\n image: shared.image,\n externalLink: values.external_url,\n owner,\n }),\n );\n const created = await serviceCollectionIntent(client.api, {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n baseUri,\n service: preset.service,\n });\n const { receipt } = await executeIntent(signer, client, created);\n const deployed = deployedCollectionFromReceipt(receipt, preset.service);\n if (!deployed) throw new Error(`The ${noun} was deployed, but its address couldn't be read — check My Collections.`);\n return deployed;\n },\n add: async (address) => {\n const pinned = await pinAssetMetadata(client.api, {\n name: values.name,\n description: values.description,\n imageUri: shared.image,\n externalUrl: values.external_url,\n ipType: \"NFT\",\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 creator: owner,\n templateTraits: tierTraits(preset.traitType, supply, address),\n });\n const intents = await tierIntents(client.api, {\n owner,\n contract: address,\n service: preset.service,\n tierId: await preset.predictNextId(client.api, address),\n maxSupply: supply,\n startTime: dateToUnixTimestamp(state.startDate),\n endTime: dateToUnixTimestamp(state.endDate),\n royaltyBps: Math.round(values.royalty * 100),\n metadataUri: pinned.uri,\n });\n await executeIntents(signer, client, intents);\n return address;\n },\n });\n\n return {\n headline: preset.success.title,\n detail: preset.success.description,\n name: values.name,\n collectionLabel: ownCollections(shared).find((c) => c.contractAddress === contract)?.name || (state.mode === \"new\" ? shared.draft.name : undefined),\n links: [{ href: collectionHref(\"STARKNET\", contract), label: \"View collection\", icon: Eye }],\n reward: \"launch_launchpad\",\n };\n },\n });\n}\n\nexport const TICKETS_FORMAT = makeTierFormat({\n key: \"tickets\",\n preset: TICKETS_TIER_PRESET,\n service: \"ip-tickets\",\n icon: Ticket,\n noun: \"ticket collection\",\n supplyLabel: \"Number of tickets\",\n submitLabel: \"Create tickets\",\n addLabel: \"Minting tickets\",\n});\n\nexport const CLUB_FORMAT = makeTierFormat({\n key: \"club\",\n preset: CLUB_TIER_PRESET,\n service: \"ip-club\",\n icon: Users,\n noun: \"club\",\n supplyLabel: \"Number of memberships\",\n submitLabel: \"Create membership\",\n addLabel: \"Minting memberships\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CM;AAxCN,0BAAmC;AACnC,iBAAoE;AACpE,sBAA6E;AAC7E,mBAAsB;AACtB,gCAAkC;AAClC,yBAAmD;AACnD,6BAAkC;AAClC,+BAAsF;AACtF,+BAA2E;AAC3E,gCAAuD;AACvD,+BAAiC;AACjC,6BAA8B;AAC9B,mBAAwE;AAUxE,SAAS,eAAe,QASrB;AACD,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,WAAO,6CAAkB,OAAO,OAAO;AAE7C,QAAM,iBAAiB,CAAC,WACtB,OAAO,YAAY,OAAO,CAAC,UAAM,uBAAW,EAAE,OAAO,GAAG,OAAO,OAAO,WAAW,CAAC,CAAC,EAAE,eAAe;AAEtG,WAAS,OAAO,EAAE,QAAQ,OAAO,OAAO,GAAiC;AACvE,WACE,4EACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,MAAM,MAAM;AAAA,UACZ,cAAc,CAAC,SAAS,OAAO,EAAE,KAAK,CAAC;AAAA,UACvC,aAAa,eAAe,MAAM;AAAA,UAClC,OAAO,MAAM;AAAA,UACb,SAAS,CAAC,qBAAqB,OAAO,EAAE,iBAAiB,CAAC;AAAA,UAC1D,SAAS,CAAC,MAAM,EAAE;AAAA,UAClB,OAAO,OAAO;AAAA,UACd,cAAc,OAAO;AAAA;AAAA,MACvB;AAAA,MAEA,6CAAC,SAAI,WAAU,aACb;AAAA,qDAAC,WAAM,WAAU,uBAAsB,SAAS,aAAa,OAA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O;AAAA,QACzI,OAAO,CAAC,EAAE,UAAM,2BAAe,YAAY,QAAQ,GAAG,OAAO,mBAAmB,MAAM,wBAAI,CAAC;AAAA,QAC3F,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,MAAM,iBAAiB,eAAe;AAAA,EAC3C,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AACZ,CAAC;AAEM,MAAM,cAAc,eAAe;AAAA,EACxC,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AACZ,CAAC;","names":[]}
|
|
@@ -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 TICKETS_FORMAT: FormatDefinition<unknown>;
|
|
17
|
+
declare const CLUB_FORMAT: FormatDefinition<unknown>;
|
|
18
|
+
|
|
19
|
+
export { CLUB_FORMAT, TICKETS_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 TICKETS_FORMAT: FormatDefinition<unknown>;
|
|
17
|
+
declare const CLUB_FORMAT: FormatDefinition<unknown>;
|
|
18
|
+
|
|
19
|
+
export { CLUB_FORMAT, TICKETS_FORMAT };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Eye, Ticket, Users } from "lucide-react";
|
|
4
|
+
import { buildCollectionMetadata, collectionHref, getService } from "@medialane/sdk";
|
|
5
|
+
import { deployedCollectionFromReceipt, executeIntent, executeIntents } from "@medialane/sdk/starknet";
|
|
6
|
+
import { Input } from "../../input.js";
|
|
7
|
+
import { getMintFormatCopy } from "../../../data/launchpad-services.js";
|
|
8
|
+
import { pinAssetMetadata, uploadJsonToIpfs } from "../../../utils/ipfs-upload.js";
|
|
9
|
+
import { isPositiveInteger } from "../../../utils/launchpad-rules.js";
|
|
10
|
+
import { dateToUnixTimestamp, serviceCollectionIntent, tierIntents, tierTraits } from "../../../utils/launchpad-actions.js";
|
|
11
|
+
import { CLUB_TIER_PRESET, TICKETS_TIER_PRESET } from "../../launchpad/tier-mint-presets.js";
|
|
12
|
+
import { CollectionSection } from "../collection-section.js";
|
|
13
|
+
import { LicensingSection } from "../licensing-section.js";
|
|
14
|
+
import { createThenAdd } from "../create-then-add.js";
|
|
15
|
+
import { defineFormat } from "./types.js";
|
|
16
|
+
function makeTierFormat(config) {
|
|
17
|
+
const { preset, noun } = config;
|
|
18
|
+
const copy = getMintFormatCopy(config.service);
|
|
19
|
+
const ownCollections = (shared) => shared.collections.filter((c) => getService(c.service)?.id === preset.service && !!c.contractAddress);
|
|
20
|
+
function Fields({ shared, state, update }) {
|
|
21
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
CollectionSection,
|
|
24
|
+
{
|
|
25
|
+
noun,
|
|
26
|
+
mode: state.mode,
|
|
27
|
+
onModeChange: (mode) => update({ mode }),
|
|
28
|
+
collections: ownCollections(shared),
|
|
29
|
+
value: state.existingContract,
|
|
30
|
+
onValue: (existingContract) => update({ existingContract }),
|
|
31
|
+
valueOf: (c) => c.contractAddress,
|
|
32
|
+
draft: shared.draft,
|
|
33
|
+
previewImage: shared.previewImage
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("label", { className: "text-sm font-medium", htmlFor: `fast-mint-${config.key}-supply`, children: [
|
|
38
|
+
config.supplyLabel,
|
|
39
|
+
" *"
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Input,
|
|
43
|
+
{
|
|
44
|
+
id: `fast-mint-${config.key}-supply`,
|
|
45
|
+
type: "number",
|
|
46
|
+
min: 1,
|
|
47
|
+
value: state.supply,
|
|
48
|
+
onChange: (e) => update({ supply: e.target.value }),
|
|
49
|
+
className: "max-w-[160px]"
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
54
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Valid" }),
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Input, { type: "date", "aria-label": "Valid from", value: state.startDate, onChange: (e) => update({ startDate: e.target.value }) }),
|
|
57
|
+
/* @__PURE__ */ jsx(Input, { type: "date", "aria-label": "Valid until", value: state.endDate, onChange: (e) => update({ endDate: e.target.value }) })
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: preset.copy.validUntilHint })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsx(LicensingSection, { form: shared.form })
|
|
62
|
+
] });
|
|
63
|
+
}
|
|
64
|
+
return defineFormat({
|
|
65
|
+
key: config.key,
|
|
66
|
+
title: copy.name,
|
|
67
|
+
hint: copy.hint,
|
|
68
|
+
icon: config.icon,
|
|
69
|
+
submitLabel: () => config.submitLabel,
|
|
70
|
+
initial: () => ({ mode: "existing", existingContract: "", supply: "100", startDate: "", endDate: "" }),
|
|
71
|
+
Fields,
|
|
72
|
+
isReady: (shared, state) => {
|
|
73
|
+
if (!isPositiveInteger(state.supply)) return false;
|
|
74
|
+
if (state.mode === "new") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;
|
|
75
|
+
return state.existingContract !== "";
|
|
76
|
+
},
|
|
77
|
+
previewLabel: (shared, state) => state.mode === "new" ? shared.draft.name || `New ${noun}` : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || void 0,
|
|
78
|
+
submit: async (shared, state, runtime) => {
|
|
79
|
+
const { client, signer, onStep } = runtime;
|
|
80
|
+
const owner = shared.walletAddress;
|
|
81
|
+
const values = shared.form.getValues();
|
|
82
|
+
const supply = state.supply.trim();
|
|
83
|
+
const uploadToken = await runtime.getUploadToken();
|
|
84
|
+
if (!uploadToken) throw new Error("Sign in first");
|
|
85
|
+
const existing = runtime.resume ?? (state.mode === "existing" && state.existingContract ? state.existingContract : null);
|
|
86
|
+
const contract = await createThenAdd({
|
|
87
|
+
existing,
|
|
88
|
+
noun,
|
|
89
|
+
labels: { create: `Creating the ${noun}`, add: config.addLabel },
|
|
90
|
+
onStep,
|
|
91
|
+
create: async () => {
|
|
92
|
+
const baseUri = await uploadJsonToIpfs(
|
|
93
|
+
client.api,
|
|
94
|
+
buildCollectionMetadata({
|
|
95
|
+
name: shared.draft.name,
|
|
96
|
+
description: shared.draft.description,
|
|
97
|
+
image: shared.image,
|
|
98
|
+
externalLink: values.external_url,
|
|
99
|
+
owner
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
const created = await serviceCollectionIntent(client.api, {
|
|
103
|
+
owner,
|
|
104
|
+
name: shared.draft.name,
|
|
105
|
+
symbol: shared.draft.symbol,
|
|
106
|
+
baseUri,
|
|
107
|
+
service: preset.service
|
|
108
|
+
});
|
|
109
|
+
const { receipt } = await executeIntent(signer, client, created);
|
|
110
|
+
const deployed = deployedCollectionFromReceipt(receipt, preset.service);
|
|
111
|
+
if (!deployed) throw new Error(`The ${noun} was deployed, but its address couldn't be read \u2014 check My Collections.`);
|
|
112
|
+
return deployed;
|
|
113
|
+
},
|
|
114
|
+
add: async (address) => {
|
|
115
|
+
const pinned = await pinAssetMetadata(client.api, {
|
|
116
|
+
name: values.name,
|
|
117
|
+
description: values.description,
|
|
118
|
+
imageUri: shared.image,
|
|
119
|
+
externalUrl: values.external_url,
|
|
120
|
+
ipType: "NFT",
|
|
121
|
+
licenseType: values.licenseType,
|
|
122
|
+
commercialUse: values.commercialUse,
|
|
123
|
+
derivatives: values.derivatives,
|
|
124
|
+
attribution: values.attribution,
|
|
125
|
+
geographicScope: values.geographicScope,
|
|
126
|
+
aiPolicy: values.aiPolicy,
|
|
127
|
+
royalty: String(values.royalty),
|
|
128
|
+
creator: owner,
|
|
129
|
+
templateTraits: tierTraits(preset.traitType, supply, address)
|
|
130
|
+
});
|
|
131
|
+
const intents = await tierIntents(client.api, {
|
|
132
|
+
owner,
|
|
133
|
+
contract: address,
|
|
134
|
+
service: preset.service,
|
|
135
|
+
tierId: await preset.predictNextId(client.api, address),
|
|
136
|
+
maxSupply: supply,
|
|
137
|
+
startTime: dateToUnixTimestamp(state.startDate),
|
|
138
|
+
endTime: dateToUnixTimestamp(state.endDate),
|
|
139
|
+
royaltyBps: Math.round(values.royalty * 100),
|
|
140
|
+
metadataUri: pinned.uri
|
|
141
|
+
});
|
|
142
|
+
await executeIntents(signer, client, intents);
|
|
143
|
+
return address;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return {
|
|
147
|
+
headline: preset.success.title,
|
|
148
|
+
detail: preset.success.description,
|
|
149
|
+
name: values.name,
|
|
150
|
+
collectionLabel: ownCollections(shared).find((c) => c.contractAddress === contract)?.name || (state.mode === "new" ? shared.draft.name : void 0),
|
|
151
|
+
links: [{ href: collectionHref("STARKNET", contract), label: "View collection", icon: Eye }],
|
|
152
|
+
reward: "launch_launchpad"
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
const TICKETS_FORMAT = makeTierFormat({
|
|
158
|
+
key: "tickets",
|
|
159
|
+
preset: TICKETS_TIER_PRESET,
|
|
160
|
+
service: "ip-tickets",
|
|
161
|
+
icon: Ticket,
|
|
162
|
+
noun: "ticket collection",
|
|
163
|
+
supplyLabel: "Number of tickets",
|
|
164
|
+
submitLabel: "Create tickets",
|
|
165
|
+
addLabel: "Minting tickets"
|
|
166
|
+
});
|
|
167
|
+
const CLUB_FORMAT = makeTierFormat({
|
|
168
|
+
key: "club",
|
|
169
|
+
preset: CLUB_TIER_PRESET,
|
|
170
|
+
service: "ip-club",
|
|
171
|
+
icon: Users,
|
|
172
|
+
noun: "club",
|
|
173
|
+
supplyLabel: "Number of memberships",
|
|
174
|
+
submitLabel: "Create membership",
|
|
175
|
+
addLabel: "Minting memberships"
|
|
176
|
+
});
|
|
177
|
+
export {
|
|
178
|
+
CLUB_FORMAT,
|
|
179
|
+
TICKETS_FORMAT
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=tiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fast-mint/formats/tiers.tsx"],"sourcesContent":["\"use client\";\n\nimport { Eye, Ticket, Users } from \"lucide-react\";\nimport { buildCollectionMetadata, collectionHref, getService } from \"@medialane/sdk\";\nimport { deployedCollectionFromReceipt, executeIntent, executeIntents } from \"@medialane/sdk/starknet\";\nimport { Input } from \"../../input.js\";\nimport { getMintFormatCopy } from \"../../../data/launchpad-services.js\";\nimport { pinAssetMetadata, uploadJsonToIpfs } from \"../../../utils/ipfs-upload.js\";\nimport { isPositiveInteger } from \"../../../utils/launchpad-rules.js\";\nimport { dateToUnixTimestamp, serviceCollectionIntent, tierIntents, tierTraits } from \"../../../utils/launchpad-actions.js\";\nimport { CLUB_TIER_PRESET, TICKETS_TIER_PRESET, type TierMintPreset } from \"../../launchpad/tier-mint-presets.js\";\nimport { CollectionSection, type CollectionMode } from \"../collection-section.js\";\nimport { LicensingSection } from \"../licensing-section.js\";\nimport { createThenAdd } from \"../create-then-add.js\";\nimport { defineFormat, type FormatFieldsProps, type FormatShared } from \"./types.js\";\n\ninterface TierState {\n mode: CollectionMode;\n existingContract: string;\n supply: string;\n startDate: string;\n endDate: string;\n}\n\nfunction makeTierFormat(config: {\n key: \"tickets\" | \"club\";\n service: string;\n preset: TierMintPreset;\n icon: typeof Ticket;\n noun: string;\n supplyLabel: string;\n submitLabel: string;\n addLabel: string;\n}) {\n const { preset, noun } = config;\n const copy = getMintFormatCopy(config.service);\n\n const ownCollections = (shared: FormatShared) =>\n shared.collections.filter((c) => getService(c.service)?.id === preset.service && !!c.contractAddress);\n\n function Fields({ shared, state, update }: FormatFieldsProps<TierState>) {\n return (\n <>\n <CollectionSection\n noun={noun}\n mode={state.mode}\n onModeChange={(mode) => update({ mode })}\n collections={ownCollections(shared)}\n value={state.existingContract}\n onValue={(existingContract) => update({ existingContract })}\n valueOf={(c) => c.contractAddress}\n draft={shared.draft}\n previewImage={shared.previewImage}\n />\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\" htmlFor={`fast-mint-${config.key}-supply`}>{config.supplyLabel} *</label>\n <Input\n id={`fast-mint-${config.key}-supply`}\n type=\"number\"\n min={1}\n value={state.supply}\n onChange={(e) => update({ supply: e.target.value })}\n className=\"max-w-[160px]\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Valid</label>\n <div className=\"grid grid-cols-2 gap-2\">\n <Input type=\"date\" aria-label=\"Valid from\" value={state.startDate} onChange={(e) => update({ startDate: e.target.value })} />\n <Input type=\"date\" aria-label=\"Valid until\" value={state.endDate} onChange={(e) => update({ endDate: e.target.value })} />\n </div>\n <p className=\"text-xs text-muted-foreground\">{preset.copy.validUntilHint}</p>\n </div>\n\n <LicensingSection form={shared.form} />\n </>\n );\n }\n\n return defineFormat<TierState>({\n key: config.key,\n title: copy.name,\n hint: copy.hint,\n icon: config.icon,\n submitLabel: () => config.submitLabel,\n initial: () => ({ mode: \"existing\", existingContract: \"\", supply: \"100\", startDate: \"\", endDate: \"\" }),\n Fields,\n isReady: (shared, state) => {\n if (!isPositiveInteger(state.supply)) return false;\n if (state.mode === \"new\") return shared.draft.name.trim().length > 0 && shared.draft.symbol.trim().length > 0;\n return state.existingContract !== \"\";\n },\n previewLabel: (shared, state) =>\n state.mode === \"new\"\n ? shared.draft.name || `New ${noun}`\n : ownCollections(shared).find((c) => c.contractAddress === state.existingContract)?.name || undefined,\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 supply = state.supply.trim();\n\n const uploadToken = await runtime.getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n\n const existing = (runtime.resume as string | null) ?? (state.mode === \"existing\" && state.existingContract ? state.existingContract : null);\n\n const contract = await createThenAdd<string, string>({\n existing,\n noun,\n labels: { create: `Creating the ${noun}`, add: config.addLabel },\n onStep,\n create: async () => {\n const baseUri = await uploadJsonToIpfs(\n client.api,\n buildCollectionMetadata({\n name: shared.draft.name,\n description: shared.draft.description,\n image: shared.image,\n externalLink: values.external_url,\n owner,\n }),\n );\n const created = await serviceCollectionIntent(client.api, {\n owner,\n name: shared.draft.name,\n symbol: shared.draft.symbol,\n baseUri,\n service: preset.service,\n });\n const { receipt } = await executeIntent(signer, client, created);\n const deployed = deployedCollectionFromReceipt(receipt, preset.service);\n if (!deployed) throw new Error(`The ${noun} was deployed, but its address couldn't be read — check My Collections.`);\n return deployed;\n },\n add: async (address) => {\n const pinned = await pinAssetMetadata(client.api, {\n name: values.name,\n description: values.description,\n imageUri: shared.image,\n externalUrl: values.external_url,\n ipType: \"NFT\",\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 creator: owner,\n templateTraits: tierTraits(preset.traitType, supply, address),\n });\n const intents = await tierIntents(client.api, {\n owner,\n contract: address,\n service: preset.service,\n tierId: await preset.predictNextId(client.api, address),\n maxSupply: supply,\n startTime: dateToUnixTimestamp(state.startDate),\n endTime: dateToUnixTimestamp(state.endDate),\n royaltyBps: Math.round(values.royalty * 100),\n metadataUri: pinned.uri,\n });\n await executeIntents(signer, client, intents);\n return address;\n },\n });\n\n return {\n headline: preset.success.title,\n detail: preset.success.description,\n name: values.name,\n collectionLabel: ownCollections(shared).find((c) => c.contractAddress === contract)?.name || (state.mode === \"new\" ? shared.draft.name : undefined),\n links: [{ href: collectionHref(\"STARKNET\", contract), label: \"View collection\", icon: Eye }],\n reward: \"launch_launchpad\",\n };\n },\n });\n}\n\nexport const TICKETS_FORMAT = makeTierFormat({\n key: \"tickets\",\n preset: TICKETS_TIER_PRESET,\n service: \"ip-tickets\",\n icon: Ticket,\n noun: \"ticket collection\",\n supplyLabel: \"Number of tickets\",\n submitLabel: \"Create tickets\",\n addLabel: \"Minting tickets\",\n});\n\nexport const CLUB_FORMAT = makeTierFormat({\n key: \"club\",\n preset: CLUB_TIER_PRESET,\n service: \"ip-club\",\n icon: Users,\n noun: \"club\",\n supplyLabel: \"Number of memberships\",\n subm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C3F,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,MAAM,iBAAiB,eAAe;AAAA,EAC3C,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AACZ,CAAC;AAEM,MAAM,cAAc,eAAe;AAAA,EACxC,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AACZ,CAAC;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
defineFormat: () => defineFormat
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(types_exports);
|
|
24
|
+
function defineFormat(format) {
|
|
25
|
+
return format;
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
defineFormat
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/fast-mint/formats/types.ts"],"sourcesContent":["import type { ComponentType, MutableRefObject } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport type { UseFormReturn } from \"react-hook-form\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport type { MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { IPType } from \"../../../data/ip.js\";\nimport type { MetadataField } from \"../../ip-type-fields.js\";\nimport type { FormValues } from \"../form.js\";\nimport type { FastMintSigner, MediaKind, MintedAsset } from \"../types.js\";\nimport type { useNewCollectionDraft } from \"../use-new-collection-draft.js\";\nimport type { StepInfo } from \"../create-then-add.js\";\n\nexport type MintFormat = \"single\" | \"editions\" | \"pop\" | \"tickets\" | \"club\";\n\nexport interface FormatShared {\n form: UseFormReturn<FormValues>;\n draft: ReturnType<typeof useNewCollectionDraft>;\n collections: ApiCollection[];\n walletAddress: string;\n mediaKind: MediaKind;\n mediaUri: string;\n mediaName: string;\n image: string;\n previewImage: string | null;\n ipType: IPType;\n onIpTypeChange: (type: IPType) => void;\n templateFieldsRef: MutableRefObject<MetadataField[]>;\n uploadDocument: (file: File) => Promise<string>;\n}\n\nexport interface FormatRuntime {\n client: MedialaneClient;\n signer: FastMintSigner;\n getUploadToken: () => Promise<string | null>;\n resume: unknown;\n onStep: (step: StepInfo) => void;\n}\n\nexport interface FormatLink {\n href: string;\n label: string;\n icon: LucideIcon;\n}\n\nexport interface FormatResult {\n headline: string;\n detail: string;\n name: string;\n collectionLabel?: string;\n links: FormatLink[];\n reward: string;\n asset?: MintedAsset;\n}\n\nexport interface FormatFieldsProps<S> {\n shared: FormatShared;\n state: S;\n update: (patch: Partial<S>) => void;\n}\n\nexport interface FormatDefinition<S = unknown> {\n key: MintFormat;\n title: string;\n hint: string;\n icon: LucideIcon;\n submitLabel: (state: S) => string;\n initial: () => S;\n Fields: ComponentType<FormatFieldsProps<S>>;\n isReady: (shared: FormatShared, state: S) => boolean;\n previewLabel: (shared: FormatShared, state: S) => string | undefined;\n submit: (shared: FormatShared, state: S, runtime: FormatRuntime) => Promise<FormatResult>;\n}\n\nexport function defineFormat<S>(format: FormatDefinition<S>): FormatDefinition {\n return format as unknown as FormatDefinition;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyEO,SAAS,aAAgB,QAA+C;AAC7E,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ComponentType, MutableRefObject } from 'react';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
4
|
+
import { ApiCollection } from '@medialane/sdk';
|
|
5
|
+
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
6
|
+
import { IPType } from '../../../data/ip.cjs';
|
|
7
|
+
import { MetadataField } from '../../ip-type-fields.cjs';
|
|
8
|
+
import { FormValues } from '../form.cjs';
|
|
9
|
+
import { MintedAsset, MediaKind, FastMintSigner } from '../types.cjs';
|
|
10
|
+
import { useNewCollectionDraft } from '../use-new-collection-draft.cjs';
|
|
11
|
+
import { StepInfo } from '../create-then-add.cjs';
|
|
12
|
+
import 'react/jsx-runtime';
|
|
13
|
+
import 'starknet';
|
|
14
|
+
|
|
15
|
+
type MintFormat = "single" | "editions" | "pop" | "tickets" | "club";
|
|
16
|
+
interface FormatShared {
|
|
17
|
+
form: UseFormReturn<FormValues>;
|
|
18
|
+
draft: ReturnType<typeof useNewCollectionDraft>;
|
|
19
|
+
collections: ApiCollection[];
|
|
20
|
+
walletAddress: string;
|
|
21
|
+
mediaKind: MediaKind;
|
|
22
|
+
mediaUri: string;
|
|
23
|
+
mediaName: string;
|
|
24
|
+
image: string;
|
|
25
|
+
previewImage: string | null;
|
|
26
|
+
ipType: IPType;
|
|
27
|
+
onIpTypeChange: (type: IPType) => void;
|
|
28
|
+
templateFieldsRef: MutableRefObject<MetadataField[]>;
|
|
29
|
+
uploadDocument: (file: File) => Promise<string>;
|
|
30
|
+
}
|
|
31
|
+
interface FormatRuntime {
|
|
32
|
+
client: MedialaneClient;
|
|
33
|
+
signer: FastMintSigner;
|
|
34
|
+
getUploadToken: () => Promise<string | null>;
|
|
35
|
+
resume: unknown;
|
|
36
|
+
onStep: (step: StepInfo) => void;
|
|
37
|
+
}
|
|
38
|
+
interface FormatLink {
|
|
39
|
+
href: string;
|
|
40
|
+
label: string;
|
|
41
|
+
icon: LucideIcon;
|
|
42
|
+
}
|
|
43
|
+
interface FormatResult {
|
|
44
|
+
headline: string;
|
|
45
|
+
detail: string;
|
|
46
|
+
name: string;
|
|
47
|
+
collectionLabel?: string;
|
|
48
|
+
links: FormatLink[];
|
|
49
|
+
reward: string;
|
|
50
|
+
asset?: MintedAsset;
|
|
51
|
+
}
|
|
52
|
+
interface FormatFieldsProps<S> {
|
|
53
|
+
shared: FormatShared;
|
|
54
|
+
state: S;
|
|
55
|
+
update: (patch: Partial<S>) => void;
|
|
56
|
+
}
|
|
57
|
+
interface FormatDefinition<S = unknown> {
|
|
58
|
+
key: MintFormat;
|
|
59
|
+
title: string;
|
|
60
|
+
hint: string;
|
|
61
|
+
icon: LucideIcon;
|
|
62
|
+
submitLabel: (state: S) => string;
|
|
63
|
+
initial: () => S;
|
|
64
|
+
Fields: ComponentType<FormatFieldsProps<S>>;
|
|
65
|
+
isReady: (shared: FormatShared, state: S) => boolean;
|
|
66
|
+
previewLabel: (shared: FormatShared, state: S) => string | undefined;
|
|
67
|
+
submit: (shared: FormatShared, state: S, runtime: FormatRuntime) => Promise<FormatResult>;
|
|
68
|
+
}
|
|
69
|
+
declare function defineFormat<S>(format: FormatDefinition<S>): FormatDefinition;
|
|
70
|
+
|
|
71
|
+
export { type FormatDefinition, type FormatFieldsProps, type FormatLink, type FormatResult, type FormatRuntime, type FormatShared, type MintFormat, defineFormat };
|