import { HandCashMinter, Types } from "@handcash/handcash-connect";
const handCashMinter = HandCashMinter.fromAppCredentials({
appId: handCashConfig.appId,
authToken: handCashConfig.authToken,
appSecret: handCashConfig.appSecret,
});
async function createCollection() {
const collection: Types.CreateCollectionOrder = {
name: 'HandCash Team Caricatures',
description: 'A unique collection of caricatures of the HandCash team',
mediaDetails: {
image: {
url: 'https://res.cloudinary.com/handcash-iae/image/upload/v1685141160/round-handcash-logo_cj47fp_xnteyo_oy3nbd.png',
contentType: 'image/png',
},
},
};
const creationOrder = await handCashMinter.createCollectionOrder(collection);
// Wait for collection to be created in the background
await new Promise(resolve => setTimeout(resolve, 5000));
const items = await handCashMinter.getOrderItems(creationOrder.id);
console.log(`Collection Created. ID: ${items[0].id}`);
}
(async () => {
try {
await createCollection();
} catch (error) {
console.error('Error creating collection:', error);
}
})();