Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt

Use this file to discover all available pages before exploring further.

This guide shows how to install and initialize the official Presale Vault TypeScript SDK, @meteora-ag/presale-sdk. Before you begin, here are the main resources:

TypeScript SDK

Presale Vault TypeScript SDK Repository

Presale Vault NPM Package

Published package for transaction builders, PDAs, wrappers, and helpers.

Install

To use the SDK in your project, install it using your preferred package manager:
npm install @meteora-ag/presale @solana/web3.js

Dependencies

PackageVersion
@coral-xyz/anchor^0.31.1
@solana/web3.js^1.98.2
@solana/spl-token^0.4.13
bn.js^5.2.2
decimal.js^10.6.0

Create A Client

Create a client from an existing presale address:
import { Connection, PublicKey } from "@solana/web3.js";
import Presale, { PRESALE_PROGRAM_ID, derivePresale } from "@meteora-ag/presale";

const connection = new Connection(process.env.RPC_URL!, "confirmed");

const baseMint = new PublicKey("BASE_MINT_ADDRESS");
const quoteMint = new PublicKey("QUOTE_MINT_ADDRESS");
const base = new PublicKey("BASE_KEY_ADDRESS");

const presaleAddress = derivePresale(
  baseMint,
  quoteMint,
  base,
  PRESALE_PROGRAM_ID
);

const presale = await Presale.create(
  connection,
  presaleAddress,
  PRESALE_PROGRAM_ID
);
The client caches the presale account, mint accounts, and Token 2022 transfer-hook remaining-account metadata. Call refetchState() before building transactions when your UI may be using stale state.

Program IDs

ConstantValue
PRESALE_PROGRAM_IDpresSVxnf9UU8jMxhgSMqaRwNiT36qeBdNeTRKjTdbj
MEMO_PROGRAM_IDMemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
METAPLEX_PROGRAM_IDmetaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s

Build A Transaction

import BN from "bn.js";

const tx = await presale.deposit({
  owner: wallet.publicKey,
  amount: new BN("500000000"),
});

// Sign, simulate, send, and confirm with your wallet or backend signer.
By default, the SDK estimates compute units and prepends a compute-budget instruction. Disable this behavior if your integration manages compute budget instructions itself:
presale.setComputeUnitOptimization(false);

SDK Examples

Presale Vault Examples

Example scripts for initialization, deposits, claims, refunds, and creator actions.

Testing The SDK

If you have cloned the SDK repository, start with package-level checks and tests:
pnpm install
pnpm run build
pnpm test