import type { Idl, Program } from "@coral-xyz/anchor"; import { Keypair, PublicKey, type AccountMeta, type TransactionInstruction } from "@solana/web3.js"; import type { ExtData, TransactionProofStruct } from "../proofs/types.js"; import type { NoteCiphers } from "../compactNote.js"; /** Seeds: ["swap_executor", source_mint, dest_mint, nullifier_0, relayer]. */ export declare function getSwapExecutorPda(programId: PublicKey, sourceMint: PublicKey, destMint: PublicKey, inputNullifier0: Uint8Array, relayer: PublicKey): PublicKey; /** Build `fund_native_source`. It must immediately precede `transact_swap`. */ export declare function fundNativeSource(params: { program: Program; relayer: { publicKey: PublicKey; }; sourceMint: PublicKey; destMint: PublicKey; inputNullifier0: Uint8Array; swapAmount: bigint; /** Wrapped-native mint used by the DEX. Defaults to canonical WSOL. */ sourceMintAccount?: PublicKey; }): Promise; export type SwapProofStruct = TransactionProofStruct; /** Fields in the current IDL's `SwapParams` struct. */ export type SwapParams = { minAmountOut: bigint; deadline: bigint; destAmount: bigint; /** SHA-256 of the exact DEX instruction bytes passed as `swapData`. */ swapDataHash: Uint8Array; }; export type TransactSwapParams = { program: Program; relayer: { publicKey: PublicKey; }; sourceMint: PublicKey; destMint: PublicKey; sourceRoot: Uint8Array; sourceTreeId: number; destTreeId: number; inputNullifiers: [Uint8Array, Uint8Array]; /** Output 0 is source-mint change; output 1 is the destination note. */ outputCommitments: [Uint8Array, Uint8Array]; proof: SwapProofStruct; swapParams: SwapParams; swapAmount: bigint; /** Exact raw data from the DEX/Jupiter instruction. */ swapData: Uint8Array | Buffer; extData: ExtData; noteCiphers?: NoteCiphers | null; sourceVaultTokenAccount: PublicKey; /** Actual DEX source mint (WSOL for the native-SOL pool sentinel). */ sourceMintAccount: PublicKey; destVaultTokenAccount: PublicKey; /** Actual DEX destination mint (WSOL for the native-SOL pool sentinel). */ destMintAccount: PublicKey; relayerTokenAccount: PublicKey; swapProgram: PublicKey; jupiterEventAuthority: PublicKey; /** Preserve the DEX instruction's account order and duplicates exactly. */ remainingAccounts?: AccountMeta[]; }; /** Build the current IDL's `transact_swap` instruction without submitting it. */ export declare function buildTransactSwapInstruction(params: TransactSwapParams): Promise; /** Build the atomic instruction sequence, including native-source funding. */ export declare function buildPrivateSwapInstructions(params: TransactSwapParams): Promise; /** * Submit the parity-correct instructions as a legacy transaction. For Jupiter * routes, prefer `buildPrivateSwapInstructions` and compile v0 with route ALTs. */ export declare function transactSwap(params: TransactSwapParams & { relayer: Keypair; }): Promise;