To create a collection, use the createCollectionOrder method:
async function createCollection() { const collectionOrder = await handCashMinter.createCollectionOrder({ name: 'My Game Collection', description: 'A collection of digital items for my game', mediaDetails: { image: { url: 'https://example.com/collection-image.png', contentType: 'image/png', }, }, }); console.log('Collection order created:', collectionOrder.id); // Wait for collection to be created (typically takes less than 5 seconds) await new Promise(resolve => setTimeout(resolve, 5000)); // Get the created collection const items = await handCashMinter.getOrderItems(collectionOrder.id); const collectionId = items[0].id; console.log(`Collection Created. ID: ${collectionId}`); return collectionId;}
async function getCollection(collectionId: string) { // Collections are items themselves, so you can retrieve them like any other item const collection = await handCashMinter.getItem(collectionId); console.log('Collection details:', collection); return collection;}