Skip to content
IN THIS GUIDE

Quickstart ​

Request a partner key scoped to your collections and application origins, then install the SDK:

bash
npm i @solanadeads/gravemint

The package includes TypeScript types and supports ESM and CommonJS.

Read a drop ​

ts
import { GraveMintClient } from '@solanadeads/gravemint';

const gm = new GraveMintClient({ apiKey: 'gm_pub_…' });
const drop = await gm.v1.collection('deads');

// drop.collection     — name, image, chain and socials
// drop.stats          — totalSupply, mintedCount, availableCount, percentMinted
// drop.phases.active  — array of active phases
// drop.serverTime     — server timestamp for countdowns

The collection read accepts a short ID, UUID or on-chain address. Prefer the short ID for public URLs and preserve address case.

Render the price correctly ​

Read the phase's priceDisplay and handle each kind:

ts
const phase = drop.phases.active[0];
const p = phase?.priceDisplay;
const label = p?.kind === 'amount'
  ? (p.isFree ? 'Free' : `${p.amount} ${p.currency}`)
  : p?.kind === 'range'
    ? `${p.min}–${p.max} ${p.currency}`
    : p?.kind === 'hidden'
      ? 'Price revealed when you qualify'
      : 'See on GraveMint';

This example selects the first active phase. If a collection has several, let the collector choose the appropriate phase. Display hidden and unknown without assigning them a zero price.

Mint ​

Use a base64 signer to connect your wallet library. mint() coordinates preparation, signing and server submission:

ts
import { MintOutcomeUnknownError, type TransactionSigner } from '@solanadeads/gravemint';

async function mintOne(signer: TransactionSigner, walletAddress: string) {
  if (!drop.capabilities.supportedBySurface || !phase) {
    throw new Error('Open the hosted mint page for this collection.');
  }

  try {
    const result = await gm.mint.mint({
      collectionId: drop.collection.id,
      phaseId: phase.id,
      walletAddress,
      quantity: 1,
      signer,
    });
    return result;
  } catch (error) {
    if (error instanceof MintOutcomeUnknownError) {
      // Save error.sessionIds and check the wallet before allowing another mint.
      // The submitted transaction may still complete.
    }
    throw error;
  }
}

The wallet signs the prepared bytes; GraveMint validates and broadcasts them. Pass signed transactions to the SDK rather than broadcasting them with your wallet library. See wallets and signing for the manual flow, batch results and session handling.

Supported features ​

Check the collection's capabilities before enabling the mint flow. For collections that require features outside the core surface, offer the hosted mint page:

tsx
if (!drop.capabilities.supportedBySurface) {
  return drop.capabilities.mintUrl
    ? <a href={drop.capabilities.mintUrl}>Mint on GraveMint</a>
    : <p>This collection is not available through this integration.</p>;
}

Next ​