/** * @name tools/perpspad/dbc-launch * @description Direct Meteora DBC launch builder (Option 2): bypasses the * PerpsPad API in the critical path by building create_config + * initialize_virtual_pool_with_spl_token with caller-visible ephemeral * keypairs. fee_claimer = escrow PDA (70/30 split via the creator-split * escrow program's future claim_and_split CPI). The ephemeral secrets * never leave the gateway process and control nothing of value. * * @module tools/perpspad/dbc-launch */ import { Keypair, PublicKey, Transaction } from '@solana/web3.js'; /** Meteora DBC program (mainnet). */ export declare const DBC_PROGRAM_ID: PublicKey; /** PerpsPad's event_authority (copied from their live config tx — program-level constant). */ export declare const DBC_EVENT_AUTHORITY: PublicKey; /** Wrapped SOL mint (quote token for crypto-perp launches). */ export declare const WSOL_MINT: PublicKey; /** Metaplex Token Metadata program (mint metadata account owner). */ export declare const METADATA_PROGRAM_ID: PublicKey; /** SPL Token (legacy) program — the base token is a standard SPL mint. */ export declare const TOKEN_PROGRAM_ID: PublicKey; /** create_config anchor discriminator (sighash "global:create_config", verified against the captured tx). */ export declare const CREATE_CONFIG_DISCRIMINATOR: Buffer; /** initialize_virtual_pool_with_spl_token discriminator — sighash("global","initialize_virtual_pool_with_spl_token"). */ export declare const DBC_INIT_POOL_DISCRIMINATOR: Buffer; /** Anchor sighash for DBC transfer_pool_creator — sha256("global:transfer_pool_creator")[0..8]. */ export declare const TRANSFER_POOL_CREATOR_DISCRIMINATOR: Buffer; /** The verbatim ConfigParameters args from PerpsPad's live config tx (283 bytes, curve preset ground truth, quote = WSOL 9 decimals). */ export declare const PERPSPAD_CONFIG_ARGS: Buffer; export declare function getQuoteDecimals(connection: { getAccountInfo(pk: PublicKey): Promise<{ data: Uint8Array; } | null>; }, quoteMint: PublicKey): Promise; /** * Scales the quote-denominated fields of the PerpsPad preset for a quote mint * with `quoteDecimals` decimals (preset is 9-dec WSOL). Scale factor for * amounts = 10^(quoteDecimals - 9); for sqrt prices = its square root. */ export declare function buildConfigArgsForQuote(quoteDecimals: number, creatorTradingFeePercentage?: number): Buffer; /** DBC pool_authority — const PDA from the official SDK. On-chain verified: this * account EXISTS on mainnet (owner SystemProgram, ~59 SOL of accumulated fees). * NOTE: PerpsPad's live txs use a different (fork/legacy) interface where the * pool authority is a signer keypair — the mainline program's source * (`address = const_pda::pool_authority::ID`) and the SDK both point here. */ export declare const DBC_POOL_AUTHORITY: PublicKey; /** Anchor sighash: sha256(":").slice(0, 8). */ export declare function anchorSighash(namespace: string, name: string): Buffer; /** Metaplex metadata PDA — OFFICIAL SDK derivation (seeds ["metadata", program_id, mint]; my previous ["metadata", mint] was missing the program id and failed Metaplex seed validation on-chain). */ export declare function deriveMintMetadata(mint: PublicKey): PublicKey; /** DBC pool PDA — OFFICIAL Meteora SDK derivation (deriveDbcPoolAddress handles the max/min key ordering internally). Verified: derives PerpsPad's live pool HyhQAsTw… byte-for-byte. */ export declare function deriveDbcPool(mint: PublicKey, config: PublicKey, quoteMint?: PublicKey): PublicKey; /** DBC token vault PDA — OFFICIAL Meteora SDK derivation, works for base AND quote vaults. */ export declare function deriveDbcVault(mint: PublicKey, pool: PublicKey): PublicKey; /** @deprecated use deriveDbcVault — kept for the re-export surface. */ export declare const deriveDbcBaseVault: typeof deriveDbcVault; /** * Builds the DBC `create_config` transaction with OUR config keypair. * Signers: payer wallet (user) + config keypair (generated here, secret discarded). * fee_claimer = escrow PDA; leftover_receiver = agent wallet. * The ConfigParameters bytes are the VERBATIM preset captured from * PerpsPad's live config tx (identical curve). */ export declare function buildCreateConfigTx(params: { configKeypair: Keypair; escrowPda: PublicKey; agentWallet: PublicKey; payer: PublicKey; quoteMint: PublicKey; /** Quote mint decimals (6-9). The caller fetches it via getQuoteDecimals. */ quoteDecimals: number; }): Transaction; /** InitializePoolParameters — string fields are dynamic; numerics pinned from PerpsPad's live pool tx. */ export interface InitializePoolParams { readonly name: string; readonly symbol: string; readonly uri: string; } /** * Borsh-encodes InitializePoolParameters. Decoded from PerpsPad's live pool * tx (2026-09-16): the args are EXACTLY three borsh strings — name, symbol, * uri — 114 bytes total, NO numeric tail (the uri is the token's metadata * JSON endpoint; ours points at our own metadata host). */ export declare function encodeInitializePoolParams(p: InitializePoolParams): Buffer; /** * Builds the DBC `initialize_virtual_pool_with_spl_token` transaction. * creator = escrow PDA — signed via the escrow PDA? No: this tx is signed by * the payer wallet + base_mint ephemeral. The escrow PDA as creator works * because DBC's initialize_virtual_pool records `creator` from the SIGNED * `creator` account: it must be a signer UNLESS the program tolerates the * payer co-signing for it. ⚠️ OPEN ITEM: if DBC demands the PDA's signature, * the escrow program needs a `create_pool` CPI instruction (tracked in the * plan doc). The chosen default swaps creator = payer wallet (fee_claimer * stays the escrow PDA — that is the split-relevant field). */ /** SPL Token-2022 program (quote mints like xStocks are Token-2022 mints). */ export declare const TOKEN_2022_PROGRAM_ID: PublicKey; /** * Which token program owns the quote mint's token accounts. The DBC * initialize_virtual_pool_with_spl_token ctx declares quote_mint with * `mint::token_program = token_quote_program` (source: * ix_initialize_virtual_pool_with_spl_token.rs), so the account we pass as * token_quote_program MUST match the quote mint's owner program. Verified * on-chain: xStocks mints (TSLAx/NVDAx/SPCXx/AAPLx/AMZNx) are owned by * Token-2022. */ export declare function tokenProgramForMint(mintOwner: PublicKey): PublicKey; export declare function buildInitializePoolTx(params: { configAddress: PublicKey; mintKeypair: Keypair; escrowPda: PublicKey; payer: PublicKey; metadata: InitializePoolParams; creatorAddress?: PublicKey; /** Quote mint: must match the one baked into the config. */ quoteMint: PublicKey; /** Owner program of the quote mint (from getAccountInfo). Defaults to legacy SPL. */ quoteMintOwner?: PublicKey; }): { tx: Transaction; poolAddress: PublicKey; }; /** * Co-signs a transaction with the ephemeral keypairs (brand-new accounts that * control nothing of value). Returns the same tx for chaining. */ export declare function coSignWithEphemerals(tx: Transaction, signers: readonly Keypair[]): Transaction; /** * Builds the DBC `transfer_pool_creator` transaction: moves pool creatorship * from the initializePool signer (payer) to the escrow PDA. Verified from DBC * source (ix_transfer_pool_creator.rs): TransferPoolCreatorCtx = 4 accounts * (virtual_pool mut, config, creator signer, new_creator ≠ creator) and the * #[event_cpi] macro appends event_authority + program → 6 keys total. * Guard: PreBondingCurve (pool not migrated) → always permitted. */ export declare function buildTransferPoolCreatorTx(params: { poolAddress: PublicKey; configAddress: PublicKey; /** Current pool creator (the initializePool signer). */ currentCreator: PublicKey; /** New creator — our escrow PDA. Must differ from currentCreator. */ newCreator: PublicKey; }): Transaction; /** * End-to-end builder: creates the ephemerals, builds both txs, co-signs them * with the ephemerals, and returns everything the client needs. The * ephemeral secrets live only in this call frame and are never persisted. */ export declare function buildDirectDbcLaunch(params: { configKeypair: Keypair; mintKeypair: Keypair; escrowPda: PublicKey; agentWallet: PublicKey; payer: PublicKey; latestBlockhash: string; metadata: InitializePoolParams; /** Quote mint: WSOL (default), USDC, or any SPL/Token-2022 mint 6-9 decimals. */ quoteMint: PublicKey; /** Quote mint decimals (6-9), fetched by the caller via getQuoteDecimals. */ quoteDecimals: number; /** Owner program of the quote mint (SPL legacy or Token-2022). Optional — defaults to legacy SPL. */ quoteMintOwner?: PublicKey; }): { bootstrapTxBase64: string; configTxBase64: string; poolTxBase64: string; /** transfer_pool_creator (payer → escrow PDA) — payer-signed, no ephemerals. */ transferCreatorTxBase64: string; configAddress: string; poolAddress: string; }; //# sourceMappingURL=dbc-launch.d.ts.map