Tradeport Launchpad SDK

A TypeScript SDK for interacting with the Tradeport Launchpad API, which enables developers to create, manage, and mint NFT collections on the SUI blockchain.

Installation

npm install @tradeport/launchpad

# Or if you prefer pnpm

pnpm add @tradeport/launchpad

Features

Getting Started

import { Launchpad } from '@tradeport/launchpad';

// Initialize
const launchpad = new Launchpad({
    authentication: {
        getWalletData: () => ({
            walletAddress: '0x11111', // used wallet address,
            publicKey: '0x22222', // used wallet public key,
        }),
        signMessage: async (walletAddress, message) =>
            // wallet interaction code to sign the message and return the signature as hex string like 0xaaaaa,
    },
});

// Or if you have already JWT

const launchpad = new Launchpad({
    jwt: 'your-jwt-token',
});

// Or if you going to use only public API

const launchpad = new Launchpad();

Usage

Create collection


// Create collection record
const {id: collectionId} = await launchpad.createCollection({
    name: `Super collection`,
    description: `My super collection`,
    type: 'Edition',
    royalty: 1,
    beneficiaryAddress: '0x12345678',
});

// Upload collection media file
await launchpad.uploadCollectionMediaFile(collectionId, {
    file: collectionMediaFile, // File object
});

// Add 1 or several tokens
const tokens = await launchpad.createTokens(collectionId, [
    {
        name: 'NFT #1',
        description: 'This is NFT 1',
        attributes: [{name: 'Color', value: 'Red'}],
        supplyType: 'Fixed',
        supplyCount: 2,
    },
    {
        name: 'NFT #2',
        description: 'This is NFT 2',
        attributes: [{name: 'Color', value: 'Blue'}],
        supplyType: 'Fixed',
        supplyCount: 3,
    },
]);

// Upload token media files
await launchpad.uploadTokenMediaFile(collectionId, tokens[0].id, {
    file: tokenMediaFile1, // File object
});

await launchpad.uploadTokenMediaFile(collectionId, tokens[1].id, {
    file: tokenMediaFile2, // File object
});

// Do some other changes

// Validate collection
await launchpad.validateCollection(collectionId);

// Create collection on blockchain

const {createCollectionTransaction} =
    await launchpad.publishCollection(collectionId); // for new collection the first call of publishCollection() returns createCollectionTransaction, i.e. transaction that creates collection on blockchain

// execute createCollectionTransaction using your favorite blockchain client or wallet

await launchpad.finishTransaction({
    transactionHash: '<transaction hash of createCollectionTransaction>',
}); // to make the backend to know that the transaction was executed

// Publish collection on blockchain

const {fundCollectionTransaction} =
    await launchpad.publishCollection(collectionId);

// execute fundCollectionTransaction using your favorite blockchain client or wallet

await launchpad.finishTransaction({
    transactionHash: '<transaction hash of fundCollectionTransaction>',
}); // to make the backend to know that the transaction was executed

// In some seconds/minutes collection will be published: all media files will be uploaded to IPFS, for Drops all tokens will be uploaded to the blockchain
// You can check publishing status using launchpad.getTasks(collectionId). Look at publish-collection.ts in smaples for more details

Mint tokens