import { Connection, PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import Decimal from "decimal.js";
import Presale, { PRESALE_PROGRAM_ID } from "@meteora-ag/presale";
import {
Rounding,
UnsoldTokenAction,
WhitelistMode,
} from "@meteora-ag/presale";
const connection = new Connection(process.env.RPC_URL!, "confirmed");
const tx = await Presale.createFixedPricePresale(
connection,
PRESALE_PROGRAM_ID,
{
baseMintPubkey: new PublicKey("BASE_MINT"),
quoteMintPubkey: new PublicKey("QUOTE_MINT"),
basePubkey: baseKeypair.publicKey,
creatorPubkey: creator.publicKey,
feePayerPubkey: creator.publicKey,
presaleArgs: {
presaleMaximumCap: new BN("100000000"),
presaleMinimumCap: new BN("1000000"),
presaleStartTime: new BN(0),
presaleEndTime: new BN(Math.floor(Date.now() / 1000) + 3600),
whitelistMode: WhitelistMode.Permissionless,
unsoldTokenAction: UnsoldTokenAction.Refund,
disableEarlierPresaleEndOnceCapReached: false,
},
presaleRegistries: [
{
buyerMinimumDepositCap: new BN("100000"),
buyerMaximumDepositCap: new BN("100000000"),
presaleSupply: new BN("2000000000"),
depositFeeBps: new BN(0),
},
],
lockedVestingArgs: {
immediateReleaseBps: new BN(10_000),
immediateReleaseTimestamp: new BN(Math.floor(Date.now() / 1000) + 3600),
lockDuration: new BN(0),
vestDuration: new BN(0),
},
},
{
price: new Decimal(0.1),
rounding: Rounding.Down,
disableWithdraw: false,
}
);
// Sign with creator and baseKeypair, then simulate and send.