@medialane/ui 0.366.0 → 0.367.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/approve-mint-dialog.d.cts +0 -1
- package/dist/components/approve-mint-dialog.d.ts +0 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- 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 +95 -167
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +97 -169
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/formats/nft.cjs +233 -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 +214 -0
- package/dist/components/fast-mint/formats/nft.js.map +1 -0
- package/dist/components/fast-mint/formats/pop.cjs +160 -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 +136 -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 +6 -14
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +6 -14
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +4 -4
- package/dist/components/launchpad/edition-mint-schema.d.ts +4 -4
- package/dist/components/launchpad/pop-create-fields.cjs +5 -3
- 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 +4 -3
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +9 -22
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +9 -22
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs +8 -25
- package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-form.js +6 -23
- package/dist/components/launchpad/tier-mint-form.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 +12 -12
- package/dist/data/launchpad-services.cjs.map +1 -1
- package/dist/data/launchpad-services.js +12 -12
- package/dist/data/launchpad-services.js.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/utils/drop/actions.d.cts +0 -1
- package/dist/utils/drop/actions.d.ts +0 -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/media-wallet/use-erc20-balance.d.cts +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.ts +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
|
@@ -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;A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,SAAS,aAAa;AAClF,UAAI,CAAC,SAAU,OAAM,IAAI,MAAM,oGAA+F;AAC9H,2BAAqB;AAAA,IACvB;AAEA,UAAM,SAAS,MAAM,OAAO,IAAI,QAAQ,OAAO,QAAQ;AAAA,MACrD,OAAO;AAAA,MACP,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OAAO,MAAM;AAAA,MACb;AAAA,IACF,CAAC;AACD,UAAM,SAAS,UAAM,+BAAc,QAAQ,QAAQ,MAAM;AACzD,sBAAkB;AAClB,kBAAU,0CAAyB,OAAO,SAAS,kBAAkB;AAAA,EACvE;AAEA,SAAO,mBAAmB,UAAU,EAAE,UAAU,iBAAiB,SAAS,MAAM,IAAI;AACtF;","names":[]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ApiCollection } from '@medialane/sdk';
|
|
2
|
-
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
|
-
import { IPType } from '../../data/ip.cjs';
|
|
4
|
-
import { MetadataField } from '../ip-type-fields.cjs';
|
|
5
|
-
import { FormValues } from './form.cjs';
|
|
6
|
-
import { FastMintSigner, MediaKind, MintedAsset } from './types.cjs';
|
|
7
|
-
import { MintAssetType } from './mintable-collections.cjs';
|
|
8
|
-
import 'react/jsx-runtime';
|
|
9
|
-
import 'react';
|
|
10
|
-
import 'starknet';
|
|
11
|
-
|
|
12
|
-
type MintDestination = {
|
|
13
|
-
mode: "existing";
|
|
14
|
-
collectionId: string;
|
|
15
|
-
collectionContract: string;
|
|
16
|
-
} | {
|
|
17
|
-
mode: "new";
|
|
18
|
-
name: string;
|
|
19
|
-
symbol: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
interface MintAssetInput {
|
|
23
|
-
client: MedialaneClient;
|
|
24
|
-
signer: FastMintSigner;
|
|
25
|
-
walletAddress: string;
|
|
26
|
-
values: FormValues;
|
|
27
|
-
ipType: IPType;
|
|
28
|
-
templateFields: MetadataField[];
|
|
29
|
-
mediaKind: MediaKind;
|
|
30
|
-
mediaUri: string;
|
|
31
|
-
featureUri: string | null;
|
|
32
|
-
assetType: MintAssetType;
|
|
33
|
-
editionCount: string;
|
|
34
|
-
destination: MintDestination;
|
|
35
|
-
singleCollections: ApiCollection[];
|
|
36
|
-
refetchCollections: () => Promise<ApiCollection[]>;
|
|
37
|
-
getUploadToken: () => Promise<string | null>;
|
|
38
|
-
}
|
|
39
|
-
declare function mintAsset(input: MintAssetInput): Promise<MintedAsset | null>;
|
|
40
|
-
|
|
41
|
-
export { type MintAssetInput, type MintDestination, mintAsset };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ApiCollection } from '@medialane/sdk';
|
|
2
|
-
import { MedialaneClient } from '@medialane/sdk/starknet';
|
|
3
|
-
import { IPType } from '../../data/ip.js';
|
|
4
|
-
import { MetadataField } from '../ip-type-fields.js';
|
|
5
|
-
import { FormValues } from './form.js';
|
|
6
|
-
import { FastMintSigner, MediaKind, MintedAsset } from './types.js';
|
|
7
|
-
import { MintAssetType } from './mintable-collections.js';
|
|
8
|
-
import 'react/jsx-runtime';
|
|
9
|
-
import 'react';
|
|
10
|
-
import 'starknet';
|
|
11
|
-
|
|
12
|
-
type MintDestination = {
|
|
13
|
-
mode: "existing";
|
|
14
|
-
collectionId: string;
|
|
15
|
-
collectionContract: string;
|
|
16
|
-
} | {
|
|
17
|
-
mode: "new";
|
|
18
|
-
name: string;
|
|
19
|
-
symbol: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
interface MintAssetInput {
|
|
23
|
-
client: MedialaneClient;
|
|
24
|
-
signer: FastMintSigner;
|
|
25
|
-
walletAddress: string;
|
|
26
|
-
values: FormValues;
|
|
27
|
-
ipType: IPType;
|
|
28
|
-
templateFields: MetadataField[];
|
|
29
|
-
mediaKind: MediaKind;
|
|
30
|
-
mediaUri: string;
|
|
31
|
-
featureUri: string | null;
|
|
32
|
-
assetType: MintAssetType;
|
|
33
|
-
editionCount: string;
|
|
34
|
-
destination: MintDestination;
|
|
35
|
-
singleCollections: ApiCollection[];
|
|
36
|
-
refetchCollections: () => Promise<ApiCollection[]>;
|
|
37
|
-
getUploadToken: () => Promise<string | null>;
|
|
38
|
-
}
|
|
39
|
-
declare function mintAsset(input: MintAssetInput): Promise<MintedAsset | null>;
|
|
40
|
-
|
|
41
|
-
export { type MintAssetInput, type MintDestination, mintAsset };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { buildAssetMetadata } from "@medialane/sdk";
|
|
2
|
-
import { executeIntent, deployedCollectionFromReceipt, mintedTokenIdFromReceipt } from "@medialane/sdk/starknet";
|
|
3
|
-
import { uploadJsonToIpfs } from "../../utils/ipfs-upload.js";
|
|
4
|
-
async function pollForNewCollection(refetchCollections, name, symbol) {
|
|
5
|
-
for (let attempt = 0; attempt < 8; attempt++) {
|
|
6
|
-
const list = await refetchCollections();
|
|
7
|
-
const match = list.find((c) => c.name === name && c.symbol === symbol);
|
|
8
|
-
if (match?.collectionId) return match;
|
|
9
|
-
await new Promise((r) => setTimeout(r, 1500));
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
async function mintAsset(input) {
|
|
14
|
-
const { client, signer, walletAddress, values, destination } = input;
|
|
15
|
-
const image = input.mediaKind === "image" ? input.mediaUri : input.featureUri;
|
|
16
|
-
const built = buildAssetMetadata({
|
|
17
|
-
name: values.name,
|
|
18
|
-
description: values.description || "",
|
|
19
|
-
externalUrl: values.external_url || "",
|
|
20
|
-
imageUri: image,
|
|
21
|
-
creator: walletAddress,
|
|
22
|
-
ipType: input.ipType,
|
|
23
|
-
licenseType: values.licenseType,
|
|
24
|
-
commercialUse: values.commercialUse,
|
|
25
|
-
derivatives: values.derivatives,
|
|
26
|
-
attribution: values.attribution,
|
|
27
|
-
geographicScope: values.geographicScope,
|
|
28
|
-
aiPolicy: values.aiPolicy,
|
|
29
|
-
royalty: String(values.royalty),
|
|
30
|
-
templateTraits: input.templateFields.filter(({ traitType, value }) => traitType.trim() && value.trim()).map(({ traitType, value }) => ({ traitType, value }))
|
|
31
|
-
});
|
|
32
|
-
const metadata = { ...built };
|
|
33
|
-
if (input.mediaKind !== "image") metadata.animation_url = input.mediaUri;
|
|
34
|
-
const uploadToken = await input.getUploadToken();
|
|
35
|
-
if (!uploadToken) throw new Error("Sign in first");
|
|
36
|
-
const tokenUri = await uploadJsonToIpfs(client.api, metadata);
|
|
37
|
-
const royaltyBps = Math.round(values.royalty * 100);
|
|
38
|
-
let contractAddress;
|
|
39
|
-
let tokenId;
|
|
40
|
-
if (input.assetType === "single") {
|
|
41
|
-
let collectionId = destination.mode === "existing" ? destination.collectionId : "";
|
|
42
|
-
contractAddress = destination.mode === "existing" ? input.singleCollections.find((c) => c.collectionId === destination.collectionId)?.contractAddress ?? null : null;
|
|
43
|
-
if (destination.mode === "new") {
|
|
44
|
-
const created = await client.api.intents.create("create-collection", {
|
|
45
|
-
owner: walletAddress,
|
|
46
|
-
name: destination.name,
|
|
47
|
-
symbol: destination.symbol,
|
|
48
|
-
description: destination.description || void 0,
|
|
49
|
-
image
|
|
50
|
-
});
|
|
51
|
-
await executeIntent(signer, client, created);
|
|
52
|
-
const found = await pollForNewCollection(input.refetchCollections, destination.name, destination.symbol);
|
|
53
|
-
if (!found) throw new Error("Collection created, but it's still indexing \u2014 try minting again in a moment from My Collections.");
|
|
54
|
-
collectionId = found.collectionId;
|
|
55
|
-
contractAddress = found.contractAddress ?? null;
|
|
56
|
-
}
|
|
57
|
-
const minted = await client.api.intents.create("mint", {
|
|
58
|
-
owner: walletAddress,
|
|
59
|
-
collectionId,
|
|
60
|
-
recipient: walletAddress,
|
|
61
|
-
tokenUri,
|
|
62
|
-
royaltyBps
|
|
63
|
-
});
|
|
64
|
-
const result = await executeIntent(signer, client, minted);
|
|
65
|
-
tokenId = contractAddress ? mintedTokenIdFromReceipt(result.receipt, contractAddress) : null;
|
|
66
|
-
} else {
|
|
67
|
-
let collectionContract = destination.mode === "existing" ? destination.collectionContract : "";
|
|
68
|
-
if (destination.mode === "new") {
|
|
69
|
-
const created = await client.api.intents.create("create-collection", {
|
|
70
|
-
owner: walletAddress,
|
|
71
|
-
name: destination.name,
|
|
72
|
-
symbol: destination.symbol,
|
|
73
|
-
description: destination.description || void 0,
|
|
74
|
-
image,
|
|
75
|
-
baseUri: "",
|
|
76
|
-
service: "mip-erc1155"
|
|
77
|
-
});
|
|
78
|
-
const deployResult = await executeIntent(signer, client, created);
|
|
79
|
-
const deployed = deployedCollectionFromReceipt(deployResult.receipt, "mip-erc1155");
|
|
80
|
-
if (!deployed) throw new Error("Collection deployed, but its address couldn't be read \u2014 check My Collections to mint into it.");
|
|
81
|
-
collectionContract = deployed;
|
|
82
|
-
}
|
|
83
|
-
const minted = await client.api.intents.create("mint", {
|
|
84
|
-
owner: walletAddress,
|
|
85
|
-
recipient: walletAddress,
|
|
86
|
-
collectionContract,
|
|
87
|
-
tokenUri,
|
|
88
|
-
value: input.editionCount,
|
|
89
|
-
royaltyBps
|
|
90
|
-
});
|
|
91
|
-
const result = await executeIntent(signer, client, minted);
|
|
92
|
-
contractAddress = collectionContract;
|
|
93
|
-
tokenId = mintedTokenIdFromReceipt(result.receipt, collectionContract);
|
|
94
|
-
}
|
|
95
|
-
return contractAddress && tokenId ? { contract: contractAddress, tokenId, image } : null;
|
|
96
|
-
}
|
|
97
|
-
export {
|
|
98
|
-
mintAsset
|
|
99
|
-
};
|
|
100
|
-
//# sourceMappingURL=mint-asset.js.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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E,OAAO;AAAA,QACP,MAAM,YAAY;AAAA,QAClB,QAAQ,YAAY;AAAA,QACpB,aAAa,YAAY,eAAe;AAAA,QACxC;AAAA,QACA,SAAS;AAAA,QACT,SAAS;AAAA,MACX,CAAC;AACD,YAAM,eAAe,MAAM,cAAc,QAAQ,QAAQ,OAAO;AAEhE,YAAM,WAAW,8BAA8B,aAAa,SAAS,aAAa;AAClF,UAAI,CAAC,SAAU,OAAM,IAAI,MAAM,oGAA+F;AAC9H,2BAAqB;AAAA,IACvB;AAEA,UAAM,SAAS,MAAM,OAAO,IAAI,QAAQ,OAAO,QAAQ;AAAA,MACrD,OAAO;AAAA,MACP,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OAAO,MAAM;AAAA,MACb;AAAA,IACF,CAAC;AACD,UAAM,SAAS,MAAM,cAAc,QAAQ,QAAQ,MAAM;AACzD,sBAAkB;AAClB,cAAU,yBAAyB,OAAO,SAAS,kBAAkB;AAAA,EACvE;AAEA,SAAO,mBAAmB,UAAU,EAAE,UAAU,iBAAiB,SAAS,MAAM,IAAI;AACtF;","names":[]}
|
|
@@ -1,62 +0,0 @@
|
|
|
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 launchpad_handoff_exports = {};
|
|
21
|
-
__export(launchpad_handoff_exports, {
|
|
22
|
-
HANDOFF_ROUTES: () => HANDOFF_ROUTES,
|
|
23
|
-
handoffHref: () => handoffHref,
|
|
24
|
-
readHandoff: () => readHandoff,
|
|
25
|
-
useAppliedHandoff: () => useAppliedHandoff
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(launchpad_handoff_exports);
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_field_limits = require("./field-limits.js");
|
|
30
|
-
const HANDOFF_ROUTES = {
|
|
31
|
-
pop: "/launchpad/pop/create",
|
|
32
|
-
tickets: "/launchpad/tickets/create",
|
|
33
|
-
club: "/launchpad/club/create"
|
|
34
|
-
};
|
|
35
|
-
function handoffHref(format, { name, imageUri }) {
|
|
36
|
-
const params = new URLSearchParams();
|
|
37
|
-
if (name.trim()) params.set("name", name.trim());
|
|
38
|
-
params.set("image", imageUri);
|
|
39
|
-
return `${HANDOFF_ROUTES[format]}?${params.toString()}`;
|
|
40
|
-
}
|
|
41
|
-
function readHandoff(search) {
|
|
42
|
-
const params = new URLSearchParams(search);
|
|
43
|
-
const name = (params.get("name") ?? "").trim().slice(0, import_field_limits.FIELD_LIMITS.name);
|
|
44
|
-
const image = params.get("image") ?? "";
|
|
45
|
-
const imageUri = image.startsWith("ipfs://") ? image : "";
|
|
46
|
-
if (!name && !imageUri) return null;
|
|
47
|
-
return { ...name && { name }, ...imageUri && { imageUri } };
|
|
48
|
-
}
|
|
49
|
-
function useAppliedHandoff(apply) {
|
|
50
|
-
(0, import_react.useEffect)(() => {
|
|
51
|
-
const handoff = readHandoff(window.location.search);
|
|
52
|
-
if (handoff) apply(handoff);
|
|
53
|
-
}, []);
|
|
54
|
-
}
|
|
55
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
-
0 && (module.exports = {
|
|
57
|
-
HANDOFF_ROUTES,
|
|
58
|
-
handoffHref,
|
|
59
|
-
readHandoff,
|
|
60
|
-
useAppliedHandoff
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=launchpad-handoff.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/launchpad-handoff.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { FIELD_LIMITS } from \"./field-limits.js\";\n\nexport type HandoffFormat = \"pop\" | \"tickets\" | \"club\";\n\nexport const HANDOFF_ROUTES: Record<HandoffFormat, string> = {\n pop: \"/launchpad/pop/create\",\n tickets: \"/launchpad/tickets/create\",\n club: \"/launchpad/club/create\",\n};\n\nexport interface Handoff {\n name: string;\n imageUri: string;\n}\n\nexport function handoffHref(format: HandoffFormat, { name, imageUri }: Handoff): string {\n const params = new URLSearchParams();\n if (name.trim()) params.set(\"name\", name.trim());\n params.set(\"image\", imageUri);\n return `${HANDOFF_ROUTES[format]}?${params.toString()}`;\n}\n\nexport function readHandoff(search: string): Partial<Handoff> | null {\n const params = new URLSearchParams(search);\n const name = (params.get(\"name\") ?? \"\").trim().slice(0, FIELD_LIMITS.name);\n const image = params.get(\"image\") ?? \"\";\n const imageUri = image.startsWith(\"ipfs://\") ? image : \"\";\n if (!name && !imageUri) return null;\n return { ...(name && { name }), ...(imageUri && { imageUri }) };\n}\n\nexport function useAppliedHandoff(apply: (handoff: Partial<Handoff>) => void) {\n useEffect(() => {\n const handoff = readHandoff(window.location.search);\n if (handoff) apply(handoff);\n }, []);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAC1B,0BAA6B;AAItB,MAAM,iBAAgD;AAAA,EAC3D,KAAK;AAAA,EACL,SAAS;AAAA,EACT,MAAM;AACR;AAOO,SAAS,YAAY,QAAuB,EAAE,MAAM,SAAS,GAAoB;AACtF,QAAM,SAAS,IAAI,gBAAgB;AACnC,MAAI,KAAK,KAAK,EAAG,QAAO,IAAI,QAAQ,KAAK,KAAK,CAAC;AAC/C,SAAO,IAAI,SAAS,QAAQ;AAC5B,SAAO,GAAG,eAAe,MAAM,CAAC,IAAI,OAAO,SAAS,CAAC;AACvD;AAEO,SAAS,YAAY,QAAyC;AACnE,QAAM,SAAS,IAAI,gBAAgB,MAAM;AACzC,QAAM,QAAQ,OAAO,IAAI,MAAM,KAAK,IAAI,KAAK,EAAE,MAAM,GAAG,iCAAa,IAAI;AACzE,QAAM,QAAQ,OAAO,IAAI,OAAO,KAAK;AACrC,QAAM,WAAW,MAAM,WAAW,SAAS,IAAI,QAAQ;AACvD,MAAI,CAAC,QAAQ,CAAC,SAAU,QAAO;AAC/B,SAAO,EAAE,GAAI,QAAQ,EAAE,KAAK,GAAI,GAAI,YAAY,EAAE,SAAS,EAAG;AAChE;AAEO,SAAS,kBAAkB,OAA4C;AAC5E,8BAAU,MAAM;AACd,UAAM,UAAU,YAAY,OAAO,SAAS,MAAM;AAClD,QAAI,QAAS,OAAM,OAAO;AAAA,EAC5B,GAAG,CAAC,CAAC;AACP;","names":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type HandoffFormat = "pop" | "tickets" | "club";
|
|
2
|
-
declare const HANDOFF_ROUTES: Record<HandoffFormat, string>;
|
|
3
|
-
interface Handoff {
|
|
4
|
-
name: string;
|
|
5
|
-
imageUri: string;
|
|
6
|
-
}
|
|
7
|
-
declare function handoffHref(format: HandoffFormat, { name, imageUri }: Handoff): string;
|
|
8
|
-
declare function readHandoff(search: string): Partial<Handoff> | null;
|
|
9
|
-
declare function useAppliedHandoff(apply: (handoff: Partial<Handoff>) => void): void;
|
|
10
|
-
|
|
11
|
-
export { HANDOFF_ROUTES, type Handoff, type HandoffFormat, handoffHref, readHandoff, useAppliedHandoff };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type HandoffFormat = "pop" | "tickets" | "club";
|
|
2
|
-
declare const HANDOFF_ROUTES: Record<HandoffFormat, string>;
|
|
3
|
-
interface Handoff {
|
|
4
|
-
name: string;
|
|
5
|
-
imageUri: string;
|
|
6
|
-
}
|
|
7
|
-
declare function handoffHref(format: HandoffFormat, { name, imageUri }: Handoff): string;
|
|
8
|
-
declare function readHandoff(search: string): Partial<Handoff> | null;
|
|
9
|
-
declare function useAppliedHandoff(apply: (handoff: Partial<Handoff>) => void): void;
|
|
10
|
-
|
|
11
|
-
export { HANDOFF_ROUTES, type Handoff, type HandoffFormat, handoffHref, readHandoff, useAppliedHandoff };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { FIELD_LIMITS } from "./field-limits.js";
|
|
4
|
-
const HANDOFF_ROUTES = {
|
|
5
|
-
pop: "/launchpad/pop/create",
|
|
6
|
-
tickets: "/launchpad/tickets/create",
|
|
7
|
-
club: "/launchpad/club/create"
|
|
8
|
-
};
|
|
9
|
-
function handoffHref(format, { name, imageUri }) {
|
|
10
|
-
const params = new URLSearchParams();
|
|
11
|
-
if (name.trim()) params.set("name", name.trim());
|
|
12
|
-
params.set("image", imageUri);
|
|
13
|
-
return `${HANDOFF_ROUTES[format]}?${params.toString()}`;
|
|
14
|
-
}
|
|
15
|
-
function readHandoff(search) {
|
|
16
|
-
const params = new URLSearchParams(search);
|
|
17
|
-
const name = (params.get("name") ?? "").trim().slice(0, FIELD_LIMITS.name);
|
|
18
|
-
const image = params.get("image") ?? "";
|
|
19
|
-
const imageUri = image.startsWith("ipfs://") ? image : "";
|
|
20
|
-
if (!name && !imageUri) return null;
|
|
21
|
-
return { ...name && { name }, ...imageUri && { imageUri } };
|
|
22
|
-
}
|
|
23
|
-
function useAppliedHandoff(apply) {
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const handoff = readHandoff(window.location.search);
|
|
26
|
-
if (handoff) apply(handoff);
|
|
27
|
-
}, []);
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
HANDOFF_ROUTES,
|
|
31
|
-
handoffHref,
|
|
32
|
-
readHandoff,
|
|
33
|
-
useAppliedHandoff
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=launchpad-handoff.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/launchpad-handoff.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { FIELD_LIMITS } from \"./field-limits.js\";\n\nexport type HandoffFormat = \"pop\" | \"tickets\" | \"club\";\n\nexport const HANDOFF_ROUTES: Record<HandoffFormat, string> = {\n pop: \"/launchpad/pop/create\",\n tickets: \"/launchpad/tickets/create\",\n club: \"/launchpad/club/create\",\n};\n\nexport interface Handoff {\n name: string;\n imageUri: string;\n}\n\nexport function handoffHref(format: HandoffFormat, { name, imageUri }: Handoff): string {\n const params = new URLSearchParams();\n if (name.trim()) params.set(\"name\", name.trim());\n params.set(\"image\", imageUri);\n return `${HANDOFF_ROUTES[format]}?${params.toString()}`;\n}\n\nexport function readHandoff(search: string): Partial<Handoff> | null {\n const params = new URLSearchParams(search);\n const name = (params.get(\"name\") ?? \"\").trim().slice(0, FIELD_LIMITS.name);\n const image = params.get(\"image\") ?? \"\";\n const imageUri = image.startsWith(\"ipfs://\") ? image : \"\";\n if (!name && !imageUri) return null;\n return { ...(name && { name }), ...(imageUri && { imageUri }) };\n}\n\nexport function useAppliedHandoff(apply: (handoff: Partial<Handoff>) => void) {\n useEffect(() => {\n const handoff = readHandoff(window.location.search);\n if (handoff) apply(handoff);\n }, []);\n}\n"],"mappings":";AAEA,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAItB,MAAM,iBAAgD;AAAA,EAC3D,KAAK;AAAA,EACL,SAAS;AAAA,EACT,MAAM;AACR;AAOO,SAAS,YAAY,QAAuB,EAAE,MAAM,SAAS,GAAoB;AACtF,QAAM,SAAS,IAAI,gBAAgB;AACnC,MAAI,KAAK,KAAK,EAAG,QAAO,IAAI,QAAQ,KAAK,KAAK,CAAC;AAC/C,SAAO,IAAI,SAAS,QAAQ;AAC5B,SAAO,GAAG,eAAe,MAAM,CAAC,IAAI,OAAO,SAAS,CAAC;AACvD;AAEO,SAAS,YAAY,QAAyC;AACnE,QAAM,SAAS,IAAI,gBAAgB,MAAM;AACzC,QAAM,QAAQ,OAAO,IAAI,MAAM,KAAK,IAAI,KAAK,EAAE,MAAM,GAAG,aAAa,IAAI;AACzE,QAAM,QAAQ,OAAO,IAAI,OAAO,KAAK;AACrC,QAAM,WAAW,MAAM,WAAW,SAAS,IAAI,QAAQ;AACvD,MAAI,CAAC,QAAQ,CAAC,SAAU,QAAO;AAC/B,SAAO,EAAE,GAAI,QAAQ,EAAE,KAAK,GAAI,GAAI,YAAY,EAAE,SAAS,EAAG;AAChE;AAEO,SAAS,kBAAkB,OAA4C;AAC5E,YAAU,MAAM;AACd,UAAM,UAAU,YAAY,OAAO,SAAS,MAAM;AAClD,QAAI,QAAS,OAAM,OAAO;AAAA,EAC5B,GAAG,CAAC,CAAC;AACP;","names":[]}
|