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.

The presale IDL exposes the instructions below. Integrators should use the TypeScript SDK for transaction construction or build through CPI.

Presale Initialization

InstructionUseNotes
initialize_fixed_price_presale_argsCreates the fixed-price extra-args account.Required before initializing a fixed-price presale. Stores q_price, owner, presale address, and disable_withdraw.
initialize_presaleCreates the main Presale account and base and quote vaults, then transfers presale base tokens into the base vault.Used for fixed-price, prorata, and FCFS modes. Accepts InitializePresaleArgs and RemainingAccountsInfo.
close_fixed_price_presale_argsCloses the fixed-price extra-args account.The account has has_one = owner and closes rent to owner.

initialize_presale Inputs

InputMeaning
presale_paramsCaps, timestamps, whitelist mode, presale mode, unsold-token action, and early-end flag.
locked_vesting_paramsImmediate release bps, lock duration, vest duration, and immediate release timestamp. Zeroed values mean no locked vesting.
presale_registriesOne to five registry configs. Multiple registries require a permissioned whitelist mode.
remaining_account_infoToken 2022 transfer-hook slices for the base mint, when required.

Mode-specific Initialization

ModeAdditional behavior
Fixed priceRequires the fixed-price extra-args account as the first remaining account. Validates q_price, buyer-cap ranges, supply coverage, and min/max cap gap.
ProrataAllows oversubscription. If permissioned, each initialized registry must use buyer min cap 1 and buyer max cap equal to presale_maximum_cap.
FCFSDoes not allow withdrawals after deposit. If permissioned, each initialized registry must use buyer min cap 1 and buyer max cap equal to presale_maximum_cap.

Whitelist And Escrow Setup

InstructionUseAvailability
create_permissionless_escrowCreates an Escrow for a buyer in registry index 0.Only when whitelist_mode is Permissionless.
create_permissioned_escrow_with_merkle_proofCreates an Escrow after verifying a Merkle proof against MerkleRootConfig.Only when whitelist_mode is PermissionWithMerkleProof.
create_permissioned_escrow_with_creatorCreates an Escrow authorized by a creator operator.Only when whitelist_mode is PermissionWithAuthority.
create_merkle_root_configCreates a Merkle root config for a presale and version.Only for Merkle proof presales before the presale ends.
close_merkle_root_configCloses a Merkle root config.Allowed when the presale is not ongoing.
create_operatorCreates an operator permission account for a creator and operator owner.Used by authority-permissioned launches.
revoke_operatorCloses an operator account back to the creator.Requires the operator account to have the creator.
create_permissioned_server_metadataStores a URL for Merkle proofs or authority partial-signing.Only for Merkle proof or authority permissioned presales before the presale ends.
close_permissioned_server_metadataCloses the permissioned metadata account.Allowed in any presale progress state.

Permissioned Merkle Leaf

The program verifies a leaf derived from:
Leaf componentSource
Ownerowner account passed to create_permissioned_escrow_with_merkle_proof.
Registry indexparams.registry_index.
Deposit capparams.deposit_cap.
The Merkle proof uses a leaf prefix and sorted pair hashing in the on-chain verifier.

Buyer Flows

InstructionUseNotes
depositDeposits quote tokens into the presale quote vault and updates the buyer escrow.Only while progress is Ongoing. The max_amount argument excludes transfer fees and deposit fees.
withdrawWithdraws quote tokens from an escrow during the presale.Only while progress is Ongoing, and only when the mode allows withdrawals. FCFS does not allow withdrawals. Fixed price can disable withdrawals.
claimClaims bought base tokens after a successful presale.Only when progress is Completed. It refreshes pending claim amount before transferring.
withdraw_remaining_quoteWithdraws refundable quote tokens.Allowed for failed presales and completed prorata presales with oversubscription. Each escrow can do this once.
refresh_escrowUpdates pending_claim_token for an escrow.If the presale is completed, it calculates claimable amount for the current timestamp.
close_escrowCloses an escrow and sends rent to rent_receiver.Escrow must be empty for the current lifecycle state.

Creator Flows

InstructionUseNotes
creator_withdrawWithdraws creator funds after the presale ends.If completed, withdraws raised quote up to presale_maximum_cap. If failed, withdraws base supply. Can run once.
creator_collect_feeCollects deposit fees after a successful presale.Can run once when progress is Completed. Prorata excludes the fee share tied to refunded overflow quote.
perform_unsold_base_token_actionBurns or refunds unsold base tokens after completion.Only after Completed, only once, and only when unsold base tokens exist.

Lifecycle Conditions

FlowRequired state
Escrow creationOngoing.
DepositOngoing.
WithdrawOngoing and mode permits withdrawal.
ClaimCompleted.
Remaining quote refundFailed, or Completed with prorata mode.
Creator withdrawCompleted or Failed.
Creator collect feeCompleted and fee not already collected.
Unsold base token actionCompleted and action not already performed.
Close Merkle root configAny state except Ongoing.

Account Lists

Use generated clients for exact account ordering. The main business accounts for each instruction are:
InstructionMain accounts
initialize_fixed_price_presale_argsfixed_price_presale_params, owner, payer, system_program
initialize_presalepresale_mint, presale, presale_authority, quote_token_mint, presale_vault, quote_token_vault, payer_presale_token, creator, base, payer, base_token_program, quote_token_program, system_program
create_merkle_root_configpresale, merkle_root_config, creator, system_program
close_merkle_root_configpresale, merkle_root_config, rent_receiver, creator
create_permissionless_escrowpresale, escrow, owner, payer, system_program
create_permissioned_escrow_with_merkle_proofpresale, escrow, owner, merkle_root_config, payer, system_program
create_permissioned_escrow_with_creatorpresale, escrow, owner, operator, operator_owner, payer, system_program
create_operatoroperator, operator_owner, creator, system_program
revoke_operatoroperator, creator
depositpresale, quote_token_vault, quote_mint, escrow, payer_quote_token, payer, token_program
withdrawpresale, quote_token_vault, quote_mint, presale_authority, escrow, owner_quote_token, owner, token_program, memo_program
claimpresale, base_token_vault, base_mint, presale_authority, escrow, owner_base_token, owner, token_program, memo_program
withdraw_remaining_quotepresale, quote_token_vault, quote_mint, presale_authority, escrow, owner_quote_token, owner, token_program, memo_program
perform_unsold_base_token_actionpresale, base_token_vault, base_mint, presale_authority, creator_base_token, token_program, memo_program
creator_withdrawpresale, presale_authority, owner_token, owner, token_program, memo_program, plus mode-dependent vault and mint remaining accounts
creator_collect_feepresale, presale_authority, quote_token_vault, quote_mint, fee_receiving_account, owner, token_program, memo_program
refresh_escrowpresale, escrow
close_escrowpresale, escrow, owner, rent_receiver
create_permissioned_server_metadatapresale, permissioned_server_metadata, owner, system_program
close_permissioned_server_metadatapresale, permissioned_server_metadata, rent_receiver, owner
close_fixed_price_presale_argsfixed_price_presale_args, owner

Token 2022 Remaining Accounts

Transfer-hook mints require extra account metas. The program consumes them through RemainingAccountsInfo.slices.
Accounts typeUse
TransferHookBaseBase token transfers, including initialization base-token transfer, claims, creator failed-presale withdrawal, and unsold base token refund.
TransferHookQuoteQuote token transfers, including deposits, withdrawals, remaining quote refunds, creator completed-presale withdrawal, and creator fee collection.
The SDK fetches transfer-hook extra account metas and passes the correct slices value for supported flows. Manual clients must ensure the slice length matches the remaining accounts that follow the instruction account list.