// Define the API URL
const apiUrl = "https://staging.crossmint.com/api/v1-alpha1/collections";
// Set up the request body with actual data instead of placeholders
const requestBody = {
chain: "ethereum", // replace with actual chain name
contractType: "erc-721", // choose between "erc-721" or "erc-1155" or "thirdweb-drop" or "candy-machine"
args: {
contractAddress: "0x123...", // replace with actual contract address
mintFunctionName: "mintUSDC(address,uint256)", // specify the mint function
abi: [], // provide the actual contract ABI array
toParamName: "toAddress", // specify the 'to' parameter name in the mint function
erc20MintCurrency: "usdc", // the ERC20 currency to be used for minting
},
metadata: {
title: "<collection_title>", // replace '<collection_title>' with the actual collection name
description: "<description>", // replace `<description>` with the actual collection's description
imageUrl: "<image_url>", // replace '<image_url>' with actual URL to an image
},
ownership: "external", // optional - if you are regestering the collection on behalf of a creator or yourself, choose "external". Else, choose "self".
category: "Art", // specify the verification category - this expedites the collection review
scopes: ["payments:credit-card"], // required scopes- "payments:cross-chain" or "payments:credit-card", must specify at least one
};
// Set up the request options
const requestOptions = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'X-API-KEY': '<api-key>', // replace '<api-key>' with the API Key that has the scope `collections.write`
},
body: JSON.stringify(requestBody), // Convert the JavaScript object to a JSON string
};
// Make the fetch request
fetch(apiUrl, requestOptions)
.then((response) => response.json()) // Parsing the JSON response
.then((data) => console.log("Success:", data))
.catch((error) => console.error("Error:", error));