@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,39 @@
|
|
|
1
|
+
import { ApiClient, ApiIntentCreated } from '@medialane/sdk';
|
|
2
|
+
|
|
3
|
+
declare function claimEndTimestamp(date: string, time: string): number;
|
|
4
|
+
declare function dateToUnixTimestamp(dateStr: string | undefined): number | undefined;
|
|
5
|
+
declare function popEventAttributes(eventType: string, isPublic: boolean): {
|
|
6
|
+
trait_type: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
9
|
+
declare function popEventIntent(api: ApiClient, p: {
|
|
10
|
+
owner: string;
|
|
11
|
+
name: string;
|
|
12
|
+
symbol: string;
|
|
13
|
+
baseUri: string;
|
|
14
|
+
claimEndTimestamp: number;
|
|
15
|
+
}): Promise<ApiIntentCreated>;
|
|
16
|
+
declare function serviceCollectionIntent(api: ApiClient, p: {
|
|
17
|
+
owner: string;
|
|
18
|
+
name: string;
|
|
19
|
+
symbol: string;
|
|
20
|
+
baseUri: string;
|
|
21
|
+
service?: "ip-club" | "ip-tickets" | "mip-erc1155";
|
|
22
|
+
}): Promise<ApiIntentCreated>;
|
|
23
|
+
declare function tierTraits(traitType: string, maxSupply: string, contract: string): {
|
|
24
|
+
traitType: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}[];
|
|
27
|
+
declare function tierIntents(api: ApiClient, p: {
|
|
28
|
+
owner: string;
|
|
29
|
+
contract: string;
|
|
30
|
+
service: "ip-club" | "ip-tickets";
|
|
31
|
+
tierId: number;
|
|
32
|
+
maxSupply: string;
|
|
33
|
+
startTime?: number;
|
|
34
|
+
endTime?: number;
|
|
35
|
+
royaltyBps: number;
|
|
36
|
+
metadataUri: string;
|
|
37
|
+
}): Promise<ApiIntentCreated[]>;
|
|
38
|
+
|
|
39
|
+
export { claimEndTimestamp, dateToUnixTimestamp, popEventAttributes, popEventIntent, serviceCollectionIntent, tierIntents, tierTraits };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ApiClient, ApiIntentCreated } from '@medialane/sdk';
|
|
2
|
+
|
|
3
|
+
declare function claimEndTimestamp(date: string, time: string): number;
|
|
4
|
+
declare function dateToUnixTimestamp(dateStr: string | undefined): number | undefined;
|
|
5
|
+
declare function popEventAttributes(eventType: string, isPublic: boolean): {
|
|
6
|
+
trait_type: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
9
|
+
declare function popEventIntent(api: ApiClient, p: {
|
|
10
|
+
owner: string;
|
|
11
|
+
name: string;
|
|
12
|
+
symbol: string;
|
|
13
|
+
baseUri: string;
|
|
14
|
+
claimEndTimestamp: number;
|
|
15
|
+
}): Promise<ApiIntentCreated>;
|
|
16
|
+
declare function serviceCollectionIntent(api: ApiClient, p: {
|
|
17
|
+
owner: string;
|
|
18
|
+
name: string;
|
|
19
|
+
symbol: string;
|
|
20
|
+
baseUri: string;
|
|
21
|
+
service?: "ip-club" | "ip-tickets" | "mip-erc1155";
|
|
22
|
+
}): Promise<ApiIntentCreated>;
|
|
23
|
+
declare function tierTraits(traitType: string, maxSupply: string, contract: string): {
|
|
24
|
+
traitType: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}[];
|
|
27
|
+
declare function tierIntents(api: ApiClient, p: {
|
|
28
|
+
owner: string;
|
|
29
|
+
contract: string;
|
|
30
|
+
service: "ip-club" | "ip-tickets";
|
|
31
|
+
tierId: number;
|
|
32
|
+
maxSupply: string;
|
|
33
|
+
startTime?: number;
|
|
34
|
+
endTime?: number;
|
|
35
|
+
royaltyBps: number;
|
|
36
|
+
metadataUri: string;
|
|
37
|
+
}): Promise<ApiIntentCreated[]>;
|
|
38
|
+
|
|
39
|
+
export { claimEndTimestamp, dateToUnixTimestamp, popEventAttributes, popEventIntent, serviceCollectionIntent, tierIntents, tierTraits };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
function claimEndTimestamp(date, time) {
|
|
2
|
+
return Math.floor((/* @__PURE__ */ new Date(`${date}T${time}:00`)).getTime() / 1e3);
|
|
3
|
+
}
|
|
4
|
+
function dateToUnixTimestamp(dateStr) {
|
|
5
|
+
if (!dateStr) return void 0;
|
|
6
|
+
const d = new Date(dateStr);
|
|
7
|
+
if (Number.isNaN(d.getTime())) return void 0;
|
|
8
|
+
return Math.floor(d.getTime() / 1e3);
|
|
9
|
+
}
|
|
10
|
+
function popEventAttributes(eventType, isPublic) {
|
|
11
|
+
return [
|
|
12
|
+
{ trait_type: "Visibility", value: isPublic ? "Public" : "Private" },
|
|
13
|
+
{ trait_type: "Event Type", value: eventType }
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
function popEventIntent(api, p) {
|
|
17
|
+
return api.intents.create("create-collection", { ...p, service: "pop-protocol" });
|
|
18
|
+
}
|
|
19
|
+
function serviceCollectionIntent(api, p) {
|
|
20
|
+
const { service, ...rest } = p;
|
|
21
|
+
return api.intents.create("create-collection", { ...rest, ...service ? { service } : {} });
|
|
22
|
+
}
|
|
23
|
+
function tierTraits(traitType, maxSupply, contract) {
|
|
24
|
+
return [
|
|
25
|
+
{ traitType: "Type", value: traitType },
|
|
26
|
+
{ traitType: "Token Standard", value: "ERC-1155" },
|
|
27
|
+
{ traitType: "Max Supply", value: maxSupply },
|
|
28
|
+
{ traitType: "Collection Contract", value: contract }
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
async function tierIntents(api, p) {
|
|
32
|
+
const tier = await api.intents.create("create-tier", {
|
|
33
|
+
owner: p.owner,
|
|
34
|
+
collection: p.contract,
|
|
35
|
+
service: p.service,
|
|
36
|
+
maxSupply: p.maxSupply,
|
|
37
|
+
startTime: p.startTime,
|
|
38
|
+
endTime: p.endTime,
|
|
39
|
+
royaltyBps: p.royaltyBps,
|
|
40
|
+
metadataUri: p.metadataUri
|
|
41
|
+
});
|
|
42
|
+
const mint = await api.intents.create("mint", {
|
|
43
|
+
owner: p.owner,
|
|
44
|
+
recipient: p.owner,
|
|
45
|
+
collectionContract: p.contract,
|
|
46
|
+
tokenId: String(p.tierId),
|
|
47
|
+
amount: p.maxSupply
|
|
48
|
+
});
|
|
49
|
+
return [tier, mint];
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
claimEndTimestamp,
|
|
53
|
+
dateToUnixTimestamp,
|
|
54
|
+
popEventAttributes,
|
|
55
|
+
popEventIntent,
|
|
56
|
+
serviceCollectionIntent,
|
|
57
|
+
tierIntents,
|
|
58
|
+
tierTraits
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=launchpad-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/launchpad-actions.ts"],"sourcesContent":["import type { ApiClient, ApiIntentCreated } from \"@medialane/sdk\";\n\nexport function claimEndTimestamp(date: string, time: string): number {\n return Math.floor(new Date(`${date}T${time}:00`).getTime() / 1000);\n}\n\nexport function dateToUnixTimestamp(dateStr: string | undefined): number | undefined {\n if (!dateStr) return undefined;\n const d = new Date(dateStr);\n if (Number.isNaN(d.getTime())) return undefined;\n return Math.floor(d.getTime() / 1000);\n}\n\nexport function popEventAttributes(eventType: string, isPublic: boolean) {\n return [\n { trait_type: \"Visibility\", value: isPublic ? \"Public\" : \"Private\" },\n { trait_type: \"Event Type\", value: eventType },\n ];\n}\n\nexport function popEventIntent(\n api: ApiClient,\n p: { owner: string; name: string; symbol: string; baseUri: string; claimEndTimestamp: number },\n): Promise<ApiIntentCreated> {\n return api.intents.create(\"create-collection\", { ...p, service: \"pop-protocol\" });\n}\n\nexport function serviceCollectionIntent(\n api: ApiClient,\n p: { owner: string; name: string; symbol: string; baseUri: string; service?: \"ip-club\" | \"ip-tickets\" | \"mip-erc1155\" },\n): Promise<ApiIntentCreated> {\n const { service, ...rest } = p;\n return api.intents.create(\"create-collection\", { ...rest, ...(service ? { service } : {}) });\n}\n\nexport function tierTraits(traitType: string, maxSupply: string, contract: string) {\n return [\n { traitType: \"Type\", value: traitType },\n { traitType: \"Token Standard\", value: \"ERC-1155\" },\n { traitType: \"Max Supply\", value: maxSupply },\n { traitType: \"Collection Contract\", value: contract },\n ];\n}\n\nexport async function tierIntents(\n api: ApiClient,\n p: {\n owner: string;\n contract: string;\n service: \"ip-club\" | \"ip-tickets\";\n tierId: number;\n maxSupply: string;\n startTime?: number;\n endTime?: number;\n royaltyBps: number;\n metadataUri: string;\n },\n): Promise<ApiIntentCreated[]> {\n const tier = await api.intents.create(\"create-tier\", {\n owner: p.owner,\n collection: p.contract,\n service: p.service,\n maxSupply: p.maxSupply,\n startTime: p.startTime,\n endTime: p.endTime,\n royaltyBps: p.royaltyBps,\n metadataUri: p.metadataUri,\n });\n const mint = await api.intents.create(\"mint\", {\n owner: p.owner,\n recipient: p.owner,\n collectionContract: p.contract,\n tokenId: String(p.tierId),\n amount: p.maxSupply,\n });\n return [tier, mint];\n}\n"],"mappings":"AAEO,SAAS,kBAAkB,MAAc,MAAsB;AACpE,SAAO,KAAK,OAAM,oBAAI,KAAK,GAAG,IAAI,IAAI,IAAI,KAAK,GAAE,QAAQ,IAAI,GAAI;AACnE;AAEO,SAAS,oBAAoB,SAAiD;AACnF,MAAI,CAAC,QAAS,QAAO;AACrB,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,IACb,oBAAoB,EAAE;AAAA,IACtB,SAAS,OAAO,EAAE,MAAM;AAAA,IACxB,QAAQ,EAAE;AAAA,EACZ,CAAC;AACD,SAAO,CAAC,MAAM,IAAI;AACpB;","names":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var launchpad_rules_exports = {};
|
|
30
|
+
__export(launchpad_rules_exports, {
|
|
31
|
+
POSITIVE_INTEGER_PATTERN: () => POSITIVE_INTEGER_PATTERN,
|
|
32
|
+
SYMBOL_PATTERN: () => SYMBOL_PATTERN,
|
|
33
|
+
WEB_LINK_MESSAGE: () => WEB_LINK_MESSAGE,
|
|
34
|
+
isPositiveInteger: () => isPositiveInteger,
|
|
35
|
+
isSymbol: () => isSymbol,
|
|
36
|
+
isWebLink: () => isWebLink,
|
|
37
|
+
positiveIntegerField: () => positiveIntegerField,
|
|
38
|
+
symbolField: () => symbolField,
|
|
39
|
+
webLinkField: () => webLinkField
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(launchpad_rules_exports);
|
|
42
|
+
var z = __toESM(require("zod"), 1);
|
|
43
|
+
var import_field_limits = require("./field-limits.js");
|
|
44
|
+
const SYMBOL_PATTERN = new RegExp(`^[A-Z0-9]{1,${import_field_limits.FIELD_LIMITS.symbol}}$`);
|
|
45
|
+
const POSITIVE_INTEGER_PATTERN = /^[1-9]\d*$/;
|
|
46
|
+
const WEB_LINK_MESSAGE = "Must start with http:// or https://";
|
|
47
|
+
function isSymbol(value) {
|
|
48
|
+
return SYMBOL_PATTERN.test(value);
|
|
49
|
+
}
|
|
50
|
+
function isPositiveInteger(value) {
|
|
51
|
+
return POSITIVE_INTEGER_PATTERN.test(value.trim());
|
|
52
|
+
}
|
|
53
|
+
function isWebLink(value) {
|
|
54
|
+
return !value || value.startsWith("http://") || value.startsWith("https://");
|
|
55
|
+
}
|
|
56
|
+
function symbolField() {
|
|
57
|
+
return z.string().min(1, "Symbol required").max(import_field_limits.FIELD_LIMITS.symbol, `Max ${import_field_limits.FIELD_LIMITS.symbol} characters`).regex(/^[A-Z0-9]+$/, "Uppercase letters and numbers only");
|
|
58
|
+
}
|
|
59
|
+
function webLinkField() {
|
|
60
|
+
return z.string().max(500).refine(isWebLink, { message: WEB_LINK_MESSAGE }).optional();
|
|
61
|
+
}
|
|
62
|
+
function positiveIntegerField(requiredMessage) {
|
|
63
|
+
return z.string().min(1, requiredMessage).regex(POSITIVE_INTEGER_PATTERN, "Enter a whole number, 1 or more");
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
POSITIVE_INTEGER_PATTERN,
|
|
68
|
+
SYMBOL_PATTERN,
|
|
69
|
+
WEB_LINK_MESSAGE,
|
|
70
|
+
isPositiveInteger,
|
|
71
|
+
isSymbol,
|
|
72
|
+
isWebLink,
|
|
73
|
+
positiveIntegerField,
|
|
74
|
+
symbolField,
|
|
75
|
+
webLinkField
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=launchpad-rules.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/launchpad-rules.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { FIELD_LIMITS } from \"./field-limits.js\";\n\nexport const SYMBOL_PATTERN = new RegExp(`^[A-Z0-9]{1,${FIELD_LIMITS.symbol}}$`);\nexport const POSITIVE_INTEGER_PATTERN = /^[1-9]\\d*$/;\nexport const WEB_LINK_MESSAGE = \"Must start with http:// or https://\";\n\nexport function isSymbol(value: string): boolean {\n return SYMBOL_PATTERN.test(value);\n}\n\nexport function isPositiveInteger(value: string): boolean {\n return POSITIVE_INTEGER_PATTERN.test(value.trim());\n}\n\nexport function isWebLink(value: string | undefined | null): boolean {\n return !value || value.startsWith(\"http://\") || value.startsWith(\"https://\");\n}\n\nexport function symbolField() {\n return z\n .string()\n .min(1, \"Symbol required\")\n .max(FIELD_LIMITS.symbol, `Max ${FIELD_LIMITS.symbol} characters`)\n .regex(/^[A-Z0-9]+$/, \"Uppercase letters and numbers only\");\n}\n\nexport function webLinkField() {\n return z.string().max(500).refine(isWebLink, { message: WEB_LINK_MESSAGE }).optional();\n}\n\nexport function positiveIntegerField(requiredMessage: string) {\n return z.string().min(1, requiredMessage).regex(POSITIVE_INTEGER_PATTERN, \"Enter a whole number, 1 or more\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AACnB,0BAA6B;AAEtB,MAAM,iBAAiB,IAAI,OAAO,eAAe,iCAAa,MAAM,IAAI;AACxE,MAAM,2BAA2B;AACjC,MAAM,mBAAmB;AAEzB,SAAS,SAAS,OAAwB;AAC/C,SAAO,eAAe,KAAK,KAAK;AAClC;AAEO,SAAS,kBAAkB,OAAwB;AACxD,SAAO,yBAAyB,KAAK,MAAM,KAAK,CAAC;AACnD;AAEO,SAAS,UAAU,OAA2C;AACnE,SAAO,CAAC,SAAS,MAAM,WAAW,SAAS,KAAK,MAAM,WAAW,UAAU;AAC7E;AAEO,SAAS,cAAc;AAC5B,SAAO,EACJ,OAAO,EACP,IAAI,GAAG,iBAAiB,EACxB,IAAI,iCAAa,QAAQ,OAAO,iCAAa,MAAM,aAAa,EAChE,MAAM,eAAe,oCAAoC;AAC9D;AAEO,SAAS,eAAe;AAC7B,SAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,OAAO,WAAW,EAAE,SAAS,iBAAiB,CAAC,EAAE,SAAS;AACvF;AAEO,SAAS,qBAAqB,iBAAyB;AAC5D,SAAO,EAAE,OAAO,EAAE,IAAI,GAAG,eAAe,EAAE,MAAM,0BAA0B,iCAAiC;AAC7G;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const SYMBOL_PATTERN: RegExp;
|
|
4
|
+
declare const POSITIVE_INTEGER_PATTERN: RegExp;
|
|
5
|
+
declare const WEB_LINK_MESSAGE = "Must start with http:// or https://";
|
|
6
|
+
declare function isSymbol(value: string): boolean;
|
|
7
|
+
declare function isPositiveInteger(value: string): boolean;
|
|
8
|
+
declare function isWebLink(value: string | undefined | null): boolean;
|
|
9
|
+
declare function symbolField(): z.ZodString;
|
|
10
|
+
declare function webLinkField(): z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
11
|
+
declare function positiveIntegerField(requiredMessage: string): z.ZodString;
|
|
12
|
+
|
|
13
|
+
export { POSITIVE_INTEGER_PATTERN, SYMBOL_PATTERN, WEB_LINK_MESSAGE, isPositiveInteger, isSymbol, isWebLink, positiveIntegerField, symbolField, webLinkField };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const SYMBOL_PATTERN: RegExp;
|
|
4
|
+
declare const POSITIVE_INTEGER_PATTERN: RegExp;
|
|
5
|
+
declare const WEB_LINK_MESSAGE = "Must start with http:// or https://";
|
|
6
|
+
declare function isSymbol(value: string): boolean;
|
|
7
|
+
declare function isPositiveInteger(value: string): boolean;
|
|
8
|
+
declare function isWebLink(value: string | undefined | null): boolean;
|
|
9
|
+
declare function symbolField(): z.ZodString;
|
|
10
|
+
declare function webLinkField(): z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
11
|
+
declare function positiveIntegerField(requiredMessage: string): z.ZodString;
|
|
12
|
+
|
|
13
|
+
export { POSITIVE_INTEGER_PATTERN, SYMBOL_PATTERN, WEB_LINK_MESSAGE, isPositiveInteger, isSymbol, isWebLink, positiveIntegerField, symbolField, webLinkField };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { FIELD_LIMITS } from "./field-limits.js";
|
|
3
|
+
const SYMBOL_PATTERN = new RegExp(`^[A-Z0-9]{1,${FIELD_LIMITS.symbol}}$`);
|
|
4
|
+
const POSITIVE_INTEGER_PATTERN = /^[1-9]\d*$/;
|
|
5
|
+
const WEB_LINK_MESSAGE = "Must start with http:// or https://";
|
|
6
|
+
function isSymbol(value) {
|
|
7
|
+
return SYMBOL_PATTERN.test(value);
|
|
8
|
+
}
|
|
9
|
+
function isPositiveInteger(value) {
|
|
10
|
+
return POSITIVE_INTEGER_PATTERN.test(value.trim());
|
|
11
|
+
}
|
|
12
|
+
function isWebLink(value) {
|
|
13
|
+
return !value || value.startsWith("http://") || value.startsWith("https://");
|
|
14
|
+
}
|
|
15
|
+
function symbolField() {
|
|
16
|
+
return z.string().min(1, "Symbol required").max(FIELD_LIMITS.symbol, `Max ${FIELD_LIMITS.symbol} characters`).regex(/^[A-Z0-9]+$/, "Uppercase letters and numbers only");
|
|
17
|
+
}
|
|
18
|
+
function webLinkField() {
|
|
19
|
+
return z.string().max(500).refine(isWebLink, { message: WEB_LINK_MESSAGE }).optional();
|
|
20
|
+
}
|
|
21
|
+
function positiveIntegerField(requiredMessage) {
|
|
22
|
+
return z.string().min(1, requiredMessage).regex(POSITIVE_INTEGER_PATTERN, "Enter a whole number, 1 or more");
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
POSITIVE_INTEGER_PATTERN,
|
|
26
|
+
SYMBOL_PATTERN,
|
|
27
|
+
WEB_LINK_MESSAGE,
|
|
28
|
+
isPositiveInteger,
|
|
29
|
+
isSymbol,
|
|
30
|
+
isWebLink,
|
|
31
|
+
positiveIntegerField,
|
|
32
|
+
symbolField,
|
|
33
|
+
webLinkField
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=launchpad-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/launchpad-rules.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { FIELD_LIMITS } from \"./field-limits.js\";\n\nexport const SYMBOL_PATTERN = new RegExp(`^[A-Z0-9]{1,${FIELD_LIMITS.symbol}}$`);\nexport const POSITIVE_INTEGER_PATTERN = /^[1-9]\\d*$/;\nexport const WEB_LINK_MESSAGE = \"Must start with http:// or https://\";\n\nexport function isSymbol(value: string): boolean {\n return SYMBOL_PATTERN.test(value);\n}\n\nexport function isPositiveInteger(value: string): boolean {\n return POSITIVE_INTEGER_PATTERN.test(value.trim());\n}\n\nexport function isWebLink(value: string | undefined | null): boolean {\n return !value || value.startsWith(\"http://\") || value.startsWith(\"https://\");\n}\n\nexport function symbolField() {\n return z\n .string()\n .min(1, \"Symbol required\")\n .max(FIELD_LIMITS.symbol, `Max ${FIELD_LIMITS.symbol} characters`)\n .regex(/^[A-Z0-9]+$/, \"Uppercase letters and numbers only\");\n}\n\nexport function webLinkField() {\n return z.string().max(500).refine(isWebLink, { message: WEB_LINK_MESSAGE }).optional();\n}\n\nexport function positiveIntegerField(requiredMessage: string) {\n return z.string().min(1, requiredMessage).regex(POSITIVE_INTEGER_PATTERN, \"Enter a whole number, 1 or more\");\n}\n"],"mappings":"AAAA,YAAY,OAAO;AACnB,SAAS,oBAAoB;AAEtB,MAAM,iBAAiB,IAAI,OAAO,eAAe,aAAa,MAAM,IAAI;AACxE,MAAM,2BAA2B;AACjC,MAAM,mBAAmB;AAEzB,SAAS,SAAS,OAAwB;AAC/C,SAAO,eAAe,KAAK,KAAK;AAClC;AAEO,SAAS,kBAAkB,OAAwB;AACxD,SAAO,yBAAyB,KAAK,MAAM,KAAK,CAAC;AACnD;AAEO,SAAS,UAAU,OAA2C;AACnE,SAAO,CAAC,SAAS,MAAM,WAAW,SAAS,KAAK,MAAM,WAAW,UAAU;AAC7E;AAEO,SAAS,cAAc;AAC5B,SAAO,EACJ,OAAO,EACP,IAAI,GAAG,iBAAiB,EACxB,IAAI,aAAa,QAAQ,OAAO,aAAa,MAAM,aAAa,EAChE,MAAM,eAAe,oCAAoC;AAC9D;AAEO,SAAS,eAAe;AAC7B,SAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,OAAO,WAAW,EAAE,SAAS,iBAAiB,CAAC,EAAE,SAAS;AACvF;AAEO,SAAS,qBAAqB,iBAAyB;AAC5D,SAAO,EAAE,OAAO,EAAE,IAAI,GAAG,eAAe,EAAE,MAAM,0BAA0B,iCAAiC;AAC7G;","names":[]}
|
|
@@ -51,8 +51,8 @@ const successMessages = {
|
|
|
51
51
|
description: "Your comment is recorded onchain and appears here within about 30 seconds."
|
|
52
52
|
}),
|
|
53
53
|
claimed: () => ({
|
|
54
|
-
title: "
|
|
55
|
-
description: "The
|
|
54
|
+
title: "Certificate claimed",
|
|
55
|
+
description: "The certificate is recorded onchain in the wallet that claimed it."
|
|
56
56
|
}),
|
|
57
57
|
bidPlaced: () => ({
|
|
58
58
|
title: "Bid placed",
|
|
@@ -74,9 +74,9 @@ const successMessages = {
|
|
|
74
74
|
title: "Ownership transferred",
|
|
75
75
|
description: `${to} is the owner of ${name}.`
|
|
76
76
|
}),
|
|
77
|
-
|
|
78
|
-
title: "
|
|
79
|
-
description: "The
|
|
77
|
+
certificateIssued: () => ({
|
|
78
|
+
title: "Certificate issued",
|
|
79
|
+
description: "The certificate is recorded onchain in the participant's wallet."
|
|
80
80
|
}),
|
|
81
81
|
participantsPublished: ({ count }) => ({
|
|
82
82
|
title: "Participants published",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/success-messages.ts"],"sourcesContent":["export interface SuccessMessage {\n title: string;\n description: string;\n}\n\nexport const successMessages = {\n listed: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Listing created\",\n description: `${name} is listed for ${price}. The order is recorded onchain.`,\n }),\n offered: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Offer created\",\n description: `Your offer of ${price} on ${name} is recorded onchain.`,\n }),\n accepted: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Sale completed\",\n description: `${name} sold for ${price}. Ownership is recorded onchain with the buyer's wallet.`,\n }),\n countered: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Counter-offer created\",\n description: `Your counter of ${price} on ${name} is recorded onchain.`,\n }),\n transferred: ({ name, to }: { name: string; to: string }): SuccessMessage => ({\n title: \"Transfer completed\",\n description: `${name} is owned by ${to}.`,\n }),\n purchased: ({ name, quantity }: { name: string; quantity: number }): SuccessMessage => ({\n title: \"Purchase completed\",\n description:\n quantity > 1\n ? `${quantity} editions of ${name} are owned by your wallet. The sale is recorded onchain.`\n : `${name} is owned by your wallet. The sale is recorded onchain.`,\n }),\n commented: (): SuccessMessage => ({\n title: \"Comment published\",\n description: \"Your comment is recorded onchain and appears here within about 30 seconds.\",\n }),\n claimed: (): SuccessMessage => ({\n title: \"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/success-messages.ts"],"sourcesContent":["export interface SuccessMessage {\n title: string;\n description: string;\n}\n\nexport const successMessages = {\n listed: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Listing created\",\n description: `${name} is listed for ${price}. The order is recorded onchain.`,\n }),\n offered: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Offer created\",\n description: `Your offer of ${price} on ${name} is recorded onchain.`,\n }),\n accepted: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Sale completed\",\n description: `${name} sold for ${price}. Ownership is recorded onchain with the buyer's wallet.`,\n }),\n countered: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Counter-offer created\",\n description: `Your counter of ${price} on ${name} is recorded onchain.`,\n }),\n transferred: ({ name, to }: { name: string; to: string }): SuccessMessage => ({\n title: \"Transfer completed\",\n description: `${name} is owned by ${to}.`,\n }),\n purchased: ({ name, quantity }: { name: string; quantity: number }): SuccessMessage => ({\n title: \"Purchase completed\",\n description:\n quantity > 1\n ? `${quantity} editions of ${name} are owned by your wallet. The sale is recorded onchain.`\n : `${name} is owned by your wallet. The sale is recorded onchain.`,\n }),\n commented: (): SuccessMessage => ({\n title: \"Comment published\",\n description: \"Your comment is recorded onchain and appears here within about 30 seconds.\",\n }),\n claimed: (): SuccessMessage => ({\n title: \"Certificate claimed\",\n description: \"The certificate is recorded onchain in the wallet that claimed it.\",\n }),\n bidPlaced: (): SuccessMessage => ({\n title: \"Bid placed\",\n description: \"Your bid is recorded onchain.\",\n }),\n bidAccepted: (): SuccessMessage => ({\n title: \"Bid accepted\",\n description: \"The license is minted to the sponsor's wallet.\",\n }),\n responseSent: (): SuccessMessage => ({\n title: \"Response sent\",\n description: \"Your response is recorded onchain.\",\n }),\n proposalWithdrawn: (): SuccessMessage => ({\n title: \"Proposal withdrawn\",\n description: \"The proposal is closed onchain.\",\n }),\n ownershipTransferred: ({ name, to }: { name: string; to: string }): SuccessMessage => ({\n title: \"Ownership transferred\",\n description: `${to} is the owner of ${name}.`,\n }),\n certificateIssued: (): SuccessMessage => ({\n title: \"Certificate issued\",\n description: \"The certificate is recorded onchain in the participant's wallet.\",\n }),\n participantsPublished: ({ count }: { count: number }): SuccessMessage => ({\n title: \"Participants published\",\n description: `The list of ${count} participant${count !== 1 ? \"s\" : \"\"} is recorded onchain. Each one claims with their own link.`,\n }),\n walletActivated: (): SuccessMessage => ({\n title: \"Wallet activated\",\n description: \"Your wallet is recorded onchain and can receive and send assets.\",\n }),\n sent: ({ amount, symbol, to }: { amount: string; symbol: string; to: string }): SuccessMessage => ({\n title: \"Transfer completed\",\n description: `${amount} ${symbol} sent to ${to}. The transfer is recorded onchain.`,\n }),\n licenseGranted: ({ price }: { price: string }): SuccessMessage => ({\n title: \"License granted\",\n description: `The remix is minted and listed for ${price}. The buyer completes the purchase from their portfolio.`,\n }),\n cancelled: ({ kind }: { kind: string }): SuccessMessage => ({\n title: `${kind.charAt(0).toUpperCase()}${kind.slice(1)} cancelled`,\n description: \"The order is cancelled onchain.\",\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,kBAAkB;AAAA,EAC7B,QAAQ,CAAC,EAAE,MAAM,MAAM,OAAwD;AAAA,IAC7E,OAAO;AAAA,IACP,aAAa,GAAG,IAAI,kBAAkB,KAAK;AAAA,EAC7C;AAAA,EACA,SAAS,CAAC,EAAE,MAAM,MAAM,OAAwD;AAAA,IAC9E,OAAO;AAAA,IACP,aAAa,iBAAiB,KAAK,OAAO,IAAI;AAAA,EAChD;AAAA,EACA,UAAU,CAAC,EAAE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AA,EACxE;AAAA,EACA,iBAAiB,OAAuB;AAAA,IACtC,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,MAAM,CAAC,EAAE,QAAQ,QAAQ,GAAG,OAAuE;AAAA,IACjG,OAAO;AAAA,IACP,aAAa,GAAG,MAAM,IAAI,MAAM,YAAY,EAAE;AAAA,EAChD;AAAA,EACA,gBAAgB,CAAC,EAAE,MAAM,OAA0C;AAAA,IACjE,OAAO;AAAA,IACP,aAAa,sCAAsC,KAAK;AAAA,EAC1D;AAAA,EACA,WAAW,CAAC,EAAE,KAAK,OAAyC;AAAA,IAC1D,OAAO,GAAG,KAAK,OAAO,CAAC,EAAE,YAAY,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC;AAAA,IACtD,aAAa;AAAA,EACf;AACF;","names":[]}
|
|
@@ -28,8 +28,8 @@ const successMessages = {
|
|
|
28
28
|
description: "Your comment is recorded onchain and appears here within about 30 seconds."
|
|
29
29
|
}),
|
|
30
30
|
claimed: () => ({
|
|
31
|
-
title: "
|
|
32
|
-
description: "The
|
|
31
|
+
title: "Certificate claimed",
|
|
32
|
+
description: "The certificate is recorded onchain in the wallet that claimed it."
|
|
33
33
|
}),
|
|
34
34
|
bidPlaced: () => ({
|
|
35
35
|
title: "Bid placed",
|
|
@@ -51,9 +51,9 @@ const successMessages = {
|
|
|
51
51
|
title: "Ownership transferred",
|
|
52
52
|
description: `${to} is the owner of ${name}.`
|
|
53
53
|
}),
|
|
54
|
-
|
|
55
|
-
title: "
|
|
56
|
-
description: "The
|
|
54
|
+
certificateIssued: () => ({
|
|
55
|
+
title: "Certificate issued",
|
|
56
|
+
description: "The certificate is recorded onchain in the participant's wallet."
|
|
57
57
|
}),
|
|
58
58
|
participantsPublished: ({ count }) => ({
|
|
59
59
|
title: "Participants published",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/success-messages.ts"],"sourcesContent":["export interface SuccessMessage {\n title: string;\n description: string;\n}\n\nexport const successMessages = {\n listed: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Listing created\",\n description: `${name} is listed for ${price}. The order is recorded onchain.`,\n }),\n offered: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Offer created\",\n description: `Your offer of ${price} on ${name} is recorded onchain.`,\n }),\n accepted: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Sale completed\",\n description: `${name} sold for ${price}. Ownership is recorded onchain with the buyer's wallet.`,\n }),\n countered: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Counter-offer created\",\n description: `Your counter of ${price} on ${name} is recorded onchain.`,\n }),\n transferred: ({ name, to }: { name: string; to: string }): SuccessMessage => ({\n title: \"Transfer completed\",\n description: `${name} is owned by ${to}.`,\n }),\n purchased: ({ name, quantity }: { name: string; quantity: number }): SuccessMessage => ({\n title: \"Purchase completed\",\n description:\n quantity > 1\n ? `${quantity} editions of ${name} are owned by your wallet. The sale is recorded onchain.`\n : `${name} is owned by your wallet. The sale is recorded onchain.`,\n }),\n commented: (): SuccessMessage => ({\n title: \"Comment published\",\n description: \"Your comment is recorded onchain and appears here within about 30 seconds.\",\n }),\n claimed: (): SuccessMessage => ({\n title: \"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/success-messages.ts"],"sourcesContent":["export interface SuccessMessage {\n title: string;\n description: string;\n}\n\nexport const successMessages = {\n listed: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Listing created\",\n description: `${name} is listed for ${price}. The order is recorded onchain.`,\n }),\n offered: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Offer created\",\n description: `Your offer of ${price} on ${name} is recorded onchain.`,\n }),\n accepted: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Sale completed\",\n description: `${name} sold for ${price}. Ownership is recorded onchain with the buyer's wallet.`,\n }),\n countered: ({ name, price }: { name: string; price: string }): SuccessMessage => ({\n title: \"Counter-offer created\",\n description: `Your counter of ${price} on ${name} is recorded onchain.`,\n }),\n transferred: ({ name, to }: { name: string; to: string }): SuccessMessage => ({\n title: \"Transfer completed\",\n description: `${name} is owned by ${to}.`,\n }),\n purchased: ({ name, quantity }: { name: string; quantity: number }): SuccessMessage => ({\n title: \"Purchase completed\",\n description:\n quantity > 1\n ? `${quantity} editions of ${name} are owned by your wallet. The sale is recorded onchain.`\n : `${name} is owned by your wallet. The sale is recorded onchain.`,\n }),\n commented: (): SuccessMessage => ({\n title: \"Comment published\",\n description: \"Your comment is recorded onchain and appears here within about 30 seconds.\",\n }),\n claimed: (): SuccessMessage => ({\n title: \"Certificate claimed\",\n description: \"The certificate is recorded onchain in the wallet that claimed it.\",\n }),\n bidPlaced: (): SuccessMessage => ({\n title: \"Bid placed\",\n description: \"Your bid is recorded onchain.\",\n }),\n bidAccepted: (): SuccessMessage => ({\n title: \"Bid accepted\",\n description: \"The license is minted to the sponsor's wallet.\",\n }),\n responseSent: (): SuccessMessage => ({\n title: \"Response sent\",\n description: \"Your response is recorded onchain.\",\n }),\n proposalWithdrawn: (): SuccessMessage => ({\n title: \"Proposal withdrawn\",\n description: \"The proposal is closed onchain.\",\n }),\n ownershipTransferred: ({ name, to }: { name: string; to: string }): SuccessMessage => ({\n title: \"Ownership transferred\",\n description: `${to} is the owner of ${name}.`,\n }),\n certificateIssued: (): SuccessMessage => ({\n title: \"Certificate issued\",\n description: \"The certificate is recorded onchain in the participant's wallet.\",\n }),\n participantsPublished: ({ count }: { count: number }): SuccessMessage => ({\n title: \"Participants published\",\n description: `The list of ${count} participant${count !== 1 ? \"s\" : \"\"} is recorded onchain. Each one claims with their own link.`,\n }),\n walletActivated: (): SuccessMessage => ({\n title: \"Wallet activated\",\n description: \"Your wallet is recorded onchain and can receive and send assets.\",\n }),\n sent: ({ amount, symbol, to }: { amount: string; symbol: string; to: string }): SuccessMessage => ({\n title: \"Transfer completed\",\n description: `${amount} ${symbol} sent to ${to}. The transfer is recorded onchain.`,\n }),\n licenseGranted: ({ price }: { price: string }): SuccessMessage => ({\n title: \"License granted\",\n description: `The remix is minted and listed for ${price}. The buyer completes the purchase from their portfolio.`,\n }),\n cancelled: ({ kind }: { kind: string }): SuccessMessage => ({\n title: `${kind.charAt(0).toUpperCase()}${kind.slice(1)} cancelled`,\n description: \"The order is cancelled onchain.\",\n }),\n};\n"],"mappings":"AAKO,MAAM,kBAAkB;AAAA,EAC7B,QAAQ,CAAC,EAAE,MAAM,MAAM,OAAwD;AAAA,IAC7E,OAAO;AAAA,IACP,aAAa,GAAG,IAAI,kBAAkB,KAAK;AAAA,EAC7C;AAAA,EACA,SAAS,CAAC,EAAE,MAAM,MAAM,OAAwD;AAAA,IAC9E,OAAO;AAAA,IACP,aAAa,iBAAiB,KAAK,OAAO,IAAI;AAAA,EAChD;AAAA,EACA,UAAU,CAAC,EAAE,MAAM,MAAM,OAAwD;AAAA,IAC/E,OAAO;AAAA,IACP,aAAa,GAAG,IAAI,aAAa,KAAK;AAAA,EACxC;AAAA,EACA,WAAW,CAAC,EAAE,MAAM,MAAM,OAAwD;AAAA,IAChF,OAAO;AAAA,IACP,aAAa,mBAAmB,KAAK,OAAO,IAAI;AAAA,EAClD;AAAA,EACA,aAAa,CAAC,EAAE,MAAM,GAAG,OAAqD;AAAA,IAC5E,OAAO;AAAA,IACP,aAAa,GAAG,IAAI,gBAAgB,EAAE;AAAA,EACxC;AAAA,EACA,WAAW,CAAC,EAAE,MAAM,SAAS,OAA2D;AAAA,IACtF,OAAO;AAAA,IACP,aACE,WAAW,IACP,GAAG,QAAQ,gBAAgB,IAAI,6DAC/B,GAAG,IAAI;AAAA,EACf;AAAA,EACA,WAAW,OAAuB;AAAA,IAChC,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,SAAS,OAAuB;AAAA,IAC9B,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,WAAW,OAAuB;AAAA,IAChC,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,aAAa,OAAuB;AAAA,IAClC,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,cAAc,OAAuB;AAAA,IACnC,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,mBAAmB,OAAuB;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,sBAAsB,CAAC,EAAE,MAAM,GAAG,OAAqD;AAAA,IACrF,OAAO;AAAA,IACP,aAAa,GAAG,EAAE,oBAAoB,IAAI;AAAA,EAC5C;AAAA,EACA,mBAAmB,OAAuB;AAAA,IACxC,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,uBAAuB,CAAC,EAAE,MAAM,OAA0C;AAAA,IACxE,OAAO;AAAA,IACP,aAAa,eAAe,KAAK,eAAe,UAAU,IAAI,MAAM,EAAE;AAAA,EACxE;AAAA,EACA,iBAAiB,OAAuB;AAAA,IACtC,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,MAAM,CAAC,EAAE,QAAQ,QAAQ,GAAG,OAAuE;AAAA,IACjG,OAAO;AAAA,IACP,aAAa,GAAG,MAAM,IAAI,MAAM,YAAY,EAAE;AAAA,EAChD;AAAA,EACA,gBAAgB,CAAC,EAAE,MAAM,OAA0C;AAAA,IACjE,OAAO;AAAA,IACP,aAAa,sCAAsC,KAAK;AAAA,EAC1D;AAAA,EACA,WAAW,CAAC,EAAE,KAAK,OAAyC;AAAA,IAC1D,OAAO,GAAG,KAAK,OAAO,CAAC,EAAE,YAAY,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC;AAAA,IACtD,aAAa;AAAA,EACf;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,124 +0,0 @@
|
|
|
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 mint_asset_exports = {};
|
|
20
|
-
__export(mint_asset_exports, {
|
|
21
|
-
mintAsset: () => mintAsset
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(mint_asset_exports);
|
|
24
|
-
var import_sdk = require("@medialane/sdk");
|
|
25
|
-
var import_starknet = require("@medialane/sdk/starknet");
|
|
26
|
-
var import_ipfs_upload = require("../../utils/ipfs-upload.js");
|
|
27
|
-
async function pollForNewCollection(refetchCollections, name, symbol) {
|
|
28
|
-
for (let attempt = 0; attempt < 8; attempt++) {
|
|
29
|
-
const list = await refetchCollections();
|
|
30
|
-
const match = list.find((c) => c.name === name && c.symbol === symbol);
|
|
31
|
-
if (match?.collectionId) return match;
|
|
32
|
-
await new Promise((r) => setTimeout(r, 1500));
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
async function mintAsset(input) {
|
|
37
|
-
const { client, signer, walletAddress, values, destination } = input;
|
|
38
|
-
const image = input.mediaKind === "image" ? input.mediaUri : input.featureUri;
|
|
39
|
-
const built = (0, import_sdk.buildAssetMetadata)({
|
|
40
|
-
name: values.name,
|
|
41
|
-
description: values.description || "",
|
|
42
|
-
externalUrl: values.external_url || "",
|
|
43
|
-
imageUri: image,
|
|
44
|
-
creator: walletAddress,
|
|
45
|
-
ipType: input.ipType,
|
|
46
|
-
licenseType: values.licenseType,
|
|
47
|
-
commercialUse: values.commercialUse,
|
|
48
|
-
derivatives: values.derivatives,
|
|
49
|
-
attribution: values.attribution,
|
|
50
|
-
geographicScope: values.geographicScope,
|
|
51
|
-
aiPolicy: values.aiPolicy,
|
|
52
|
-
royalty: String(values.royalty),
|
|
53
|
-
templateTraits: input.templateFields.filter(({ traitType, value }) => traitType.trim() && value.trim()).map(({ traitType, value }) => ({ traitType, value }))
|
|
54
|
-
});
|
|
55
|
-
const metadata = { ...built };
|
|
56
|
-
if (input.mediaKind !== "image") metadata.animation_url = input.mediaUri;
|
|
57
|
-
const uploadToken = await input.getUploadToken();
|
|
58
|
-
if (!uploadToken) throw new Error("Sign in first");
|
|
59
|
-
const tokenUri = await (0, import_ipfs_upload.uploadJsonToIpfs)(client.api, metadata);
|
|
60
|
-
const royaltyBps = Math.round(values.royalty * 100);
|
|
61
|
-
let contractAddress;
|
|
62
|
-
let tokenId;
|
|
63
|
-
if (input.assetType === "single") {
|
|
64
|
-
let collectionId = destination.mode === "existing" ? destination.collectionId : "";
|
|
65
|
-
contractAddress = destination.mode === "existing" ? input.singleCollections.find((c) => c.collectionId === destination.collectionId)?.contractAddress ?? null : null;
|
|
66
|
-
if (destination.mode === "new") {
|
|
67
|
-
const created = await client.api.intents.create("create-collection", {
|
|
68
|
-
owner: walletAddress,
|
|
69
|
-
name: destination.name,
|
|
70
|
-
symbol: destination.symbol,
|
|
71
|
-
description: destination.description || void 0,
|
|
72
|
-
image
|
|
73
|
-
});
|
|
74
|
-
await (0, import_starknet.executeIntent)(signer, client, created);
|
|
75
|
-
const found = await pollForNewCollection(input.refetchCollections, destination.name, destination.symbol);
|
|
76
|
-
if (!found) throw new Error("Collection created, but it's still indexing \u2014 try minting again in a moment from My Collections.");
|
|
77
|
-
collectionId = found.collectionId;
|
|
78
|
-
contractAddress = found.contractAddress ?? null;
|
|
79
|
-
}
|
|
80
|
-
const minted = await client.api.intents.create("mint", {
|
|
81
|
-
owner: walletAddress,
|
|
82
|
-
collectionId,
|
|
83
|
-
recipient: walletAddress,
|
|
84
|
-
tokenUri,
|
|
85
|
-
royaltyBps
|
|
86
|
-
});
|
|
87
|
-
const result = await (0, import_starknet.executeIntent)(signer, client, minted);
|
|
88
|
-
tokenId = contractAddress ? (0, import_starknet.mintedTokenIdFromReceipt)(result.receipt, contractAddress) : null;
|
|
89
|
-
} else {
|
|
90
|
-
let collectionContract = destination.mode === "existing" ? destination.collectionContract : "";
|
|
91
|
-
if (destination.mode === "new") {
|
|
92
|
-
const created = await client.api.intents.create("create-collection", {
|
|
93
|
-
owner: walletAddress,
|
|
94
|
-
name: destination.name,
|
|
95
|
-
symbol: destination.symbol,
|
|
96
|
-
description: destination.description || void 0,
|
|
97
|
-
image,
|
|
98
|
-
baseUri: "",
|
|
99
|
-
service: "mip-erc1155"
|
|
100
|
-
});
|
|
101
|
-
const deployResult = await (0, import_starknet.executeIntent)(signer, client, created);
|
|
102
|
-
const deployed = (0, import_starknet.deployedCollectionFromReceipt)(deployResult.receipt, "mip-erc1155");
|
|
103
|
-
if (!deployed) throw new Error("Collection deployed, but its address couldn't be read \u2014 check My Collections to mint into it.");
|
|
104
|
-
collectionContract = deployed;
|
|
105
|
-
}
|
|
106
|
-
const minted = await client.api.intents.create("mint", {
|
|
107
|
-
owner: walletAddress,
|
|
108
|
-
recipient: walletAddress,
|
|
109
|
-
collectionContract,
|
|
110
|
-
tokenUri,
|
|
111
|
-
value: input.editionCount,
|
|
112
|
-
royaltyBps
|
|
113
|
-
});
|
|
114
|
-
const result = await (0, import_starknet.executeIntent)(signer, client, minted);
|
|
115
|
-
contractAddress = collectionContract;
|
|
116
|
-
tokenId = (0, import_starknet.mintedTokenIdFromReceipt)(result.receipt, collectionContract);
|
|
117
|
-
}
|
|
118
|
-
return contractAddress && tokenId ? { contract: contractAddress, tokenId, image } : null;
|
|
119
|
-
}
|
|
120
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
121
|
-
0 && (module.exports = {
|
|
122
|
-
mintAsset
|
|
123
|
-
});
|
|
124
|
-
//# sourceMappingURL=mint-asset.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/fast-mint/mint-asset.ts"],"sourcesContent":["import { buildAssetMetadata, type ApiCollection } from \"@medialane/sdk\";\nimport { executeIntent, deployedCollectionFromReceipt, mintedTokenIdFromReceipt, type MedialaneClient } from \"@medialane/sdk/starknet\";\nimport type { IPType } from \"../../data/ip.js\";\nimport type { MetadataField } from \"../ip-type-fields.js\";\nimport { uploadJsonToIpfs } from \"../../utils/ipfs-upload.js\";\nimport type { FormValues } from \"./form.js\";\nimport type { FastMintSigner, MediaKind, MintedAsset } from \"./types.js\";\nimport type { MintAssetType } from \"./mintable-collections.js\";\n\nexport type MintDestination =\n | { mode: \"existing\"; collectionId: string; collectionContract: string }\n | { mode: \"new\"; name: string; symbol: string; description: string };\n\nexport interface MintAssetInput {\n client: MedialaneClient;\n signer: FastMintSigner;\n walletAddress: string;\n values: FormValues;\n ipType: IPType;\n templateFields: MetadataField[];\n mediaKind: MediaKind;\n mediaUri: string;\n featureUri: string | null;\n assetType: MintAssetType;\n editionCount: string;\n destination: MintDestination;\n singleCollections: ApiCollection[];\n refetchCollections: () => Promise<ApiCollection[]>;\n getUploadToken: () => Promise<string | null>;\n}\n\nasync function pollForNewCollection(\n refetchCollections: () => Promise<ApiCollection[]>,\n name: string,\n symbol: string,\n): Promise<ApiCollection | null> {\n for (let attempt = 0; attempt < 8; attempt++) {\n const list = await refetchCollections();\n const match = list.find((c) => c.name === name && c.symbol === symbol);\n if (match?.collectionId) return match;\n await new Promise((r) => setTimeout(r, 1500));\n }\n return null;\n}\n\nexport async function mintAsset(input: MintAssetInput): Promise<MintedAsset | null> {\n const { client, signer, walletAddress, values, destination } = input;\n\n const image = input.mediaKind === \"image\" ? input.mediaUri : input.featureUri!;\n const built = buildAssetMetadata({\n name: values.name,\n description: values.description || \"\",\n externalUrl: values.external_url || \"\",\n imageUri: image,\n creator: walletAddress,\n ipType: input.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: input.templateFields\n .filter(({ traitType, value }) => traitType.trim() && value.trim())\n .map(({ traitType, value }) => ({ traitType, value })),\n });\n const metadata: Record<string, unknown> = { ...built };\n if (input.mediaKind !== \"image\") metadata.animation_url = input.mediaUri;\n\n const uploadToken = await input.getUploadToken();\n if (!uploadToken) throw new Error(\"Sign in first\");\n const tokenUri = await uploadJsonToIpfs(client.api, metadata);\n\n const royaltyBps = Math.round(values.royalty * 100);\n let contractAddress: string | null;\n let tokenId: string | null;\n\n if (input.assetType === \"single\") {\n let collectionId = destination.mode === \"existing\" ? destination.collectionId : \"\";\n contractAddress = destination.mode === \"existing\"\n ? input.singleCollections.find((c) => c.collectionId === destination.collectionId)?.contractAddress ?? null\n : null;\n\n if (destination.mode === \"new\") {\n const created = await client.api.intents.create(\"create-collection\", {\n owner: walletAddress,\n name: destination.name,\n symbol: destination.symbol,\n description: destination.description || undefined,\n image,\n });\n await executeIntent(signer, client, created);\n\n const found = await pollForNewCollection(input.refetchCollections, destination.name, destination.symbol);\n if (!found) throw new Error(\"Collection created, but it's still indexing — try minting again in a moment from My Collections.\");\n collectionId = found.collectionId!;\n contractAddress = found.contractAddress ?? null;\n }\n\n const minted = await client.api.intents.create(\"mint\", {\n owner: walletAddress,\n collectionId,\n recipient: walletAddress,\n tokenUri,\n royaltyBps,\n });\n const result = await executeIntent(signer, client, minted);\n tokenId = contractAddress ? mintedTokenIdFromReceipt(result.receipt, contractAddress) : null;\n } else {\n let collectionContract = destination.mode === \"existing\" ? destination.collectionContract : \"\";\n\n if (destination.mode === \"new\") {\n const created = await client.api.intents.create(\"create-collection\", {\n owner: walletAddress,\n name: destination.name,\n symbol: destination.symbol,\n description: destination.description || undefined,\n image,\n baseUri: \"\",\n service: \"mip-erc1155\",\n });\n const deployResult = await executeIntent(signer, client, created);\n\n const deployed = deployedCollectionFromReceipt(deployResult.receipt, \"mip-erc1155\");\n if (!deployed) throw new Error(\"Collection deployed, but its address couldn't be read — check My Collections to mint into it.\");\n collectionContract = deployed;\n }\n\n const minted = await client.api.intents.create(\"mint\", {\n owner: walletAddress,\n recipient: walletAddress,\n collectionContract,\n tokenUri,\n value: input.editionCount,\n royaltyBps,\n });\n const result = await executeIntent(signer, client, minted);\n contractAddress = collectionContract;\n tokenId = mintedTokenIdFromReceipt(result.receipt, collectionContract);\n }\n\n return contractAddress && tokenId ? { contract: contractAddress, tokenId, image } : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAuD;AACvD,sBAA6G;AAG7G,yBAAiC;AA2BjC,eAAe,qBACb,oBACA,MACA,QAC+B;AAC/B,WAAS,UAAU,GAAG,UAAU,GAAG,WAAW;AAC5C,UAAM,OAAO,MAAM,mBAAmB;AACtC,UAAM,QAAQ,KAAK,KAAK,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,WAAW,MAAM;AACrE,QAAI,OAAO,aAAc,QAAO;AAChC,UAAM,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC;AAAA,EAC9C;AACA,SAAO;AACT;AAEA,eAAsB,UAAU,OAAoD;AAClF,QAAM,EAAE,QAAQ,QAAQ,eAAe,QAAQ,YAAY,IAAI;AAE/D,QAAM,QAAQ,MAAM,cAAc,UAAU,MAAM,WAAW,MAAM;AACnE,QAAM,YAAQ,+BAAmB;AAAA,IAC/B,MAAM,OAAO;AAAA,IACb,aAAa,OAAO,eAAe;AAAA,IACnC,aAAa,OAAO,gBAAgB;AAAA,IACpC,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ,MAAM;AAAA,IACd,aAAa,OAAO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