import { Address, Hash } from 'viem'; import { P as PublicClient, W as WalletClient } from './doc-types-471vSmPO.cjs'; import { L as LaunchSaleAddresses } from './addresses-BKnDLMaN.cjs'; /** Which token to buy from the launch sale stack. */ type SaleTokenKind = 'GTOKEN' | 'APNTS'; /** Stablecoin used to pay (both 6-decimal). Gasless supports USDC only. */ type PayToken = 'USDC' | 'USDT'; /** Live USD prices (6-decimal) for one unit of each sale token. */ interface SalePrices { /** USD price per GToken, 6-decimal (e.g. 150000n = $0.15). */ gToken: bigint; /** USD price per aPNTs, 6-decimal. */ aPNTs: bigint; } /** Wallet balances relevant to the sale (raw base units). */ interface SaleBalances { /** Native ETH (wei). */ eth: bigint; /** USDC (6-decimal). */ usdc: bigint; /** USDT (6-decimal). */ usdt: bigint; /** GToken (18-decimal). */ gToken: bigint; /** aPNTs (18-decimal). */ aPNTs: bigint; } /** Result of a completed buy (self-pay or gasless). */ interface BuyResult { /** Transaction hash (gasless: the relayer-submitted tx). */ txHash: Hash; /** Relayer rule that matched (gasless only). */ matchedRule?: string; } interface TokenSaleClientOptions { /** * Chain id. Defaults to `publicClient.chain?.id` / `walletClient.chain?.id`. * Used to look up {@link getLaunchSaleAddresses}. */ chainId?: number; /** Explicit address group override (skips the per-chain lookup). */ addresses?: LaunchSaleAddresses; } interface SelfPayParams { token: SaleTokenKind; /** USD to spend, in 6-decimal base units (use {@link usd}). */ usdAmount: bigint; /** Payment stablecoin. Default `'USDC'`. */ payToken?: PayToken; /** Minimum tokens out (slippage guard, 18-decimal). Default `0n`. */ minOut?: bigint; /** * Deliver the purchased tokens to this address instead of the payer (e.g. buy USDT-paid aPNTs * straight into an AirAccount). Routes through `buyTokensFor` / `buyAPNTsFor` (launch#21). * Default: the payer. (aPNTs has no on-chain slippage param, so `minOut` is still rejected for it.) */ recipient?: Address; } interface GaslessParams { token: SaleTokenKind; /** USD to spend, in 6-decimal base units (use {@link usd}). Paid in USDC. */ usdAmount: bigint; /** Recipient of the purchased tokens. Default: the buyer. */ recipient?: Address; /** Minimum tokens out (18-decimal). Default `0n`. */ minOut?: bigint; /** Authorization validity window in seconds. Default `1800` (30 min). */ deadlineSeconds?: number; /** Override the relayer base URL (default: the address group's `relayerUrl`). */ relayerUrl?: string; } /** Convert a human USD amount to 6-decimal base units. `usd(1.5)` → `1500000n`. */ declare function usd(amount: number): bigint; /** * TokenSaleClient — buy aPoints (aPNTs) and the governance token (GToken) from the * MushroomDAO launch sale stack. Abstraction of the `launch.mushroom.cv/join` page. * * Two flows: * - {@link buySelfPay}: user pays gas; `approve` (if needed) then `buyTokens` / `buyAPNTs`. * - {@link buyGasless}: zero-gas; signs EIP-3009 (USDC) + an EIP-712 `BuyIntent` and posts * them to the relayer, which executes the buy via BuyHelper. * * The token actually paid out is read ON-CHAIN from the sale contract (`gToken()` / `aPNTs()`), * never from a stored address — so it stays correct across sale redeploys. * * @example * ```ts * const sale = new TokenSaleClient(publicClient, walletClient); * await sale.buyGasless({ token: 'GTOKEN', usdAmount: usd(5) }); // $5, zero gas * ``` */ declare class TokenSaleClient { private readonly publicClient; private readonly walletClient?; private readonly addrs; private readonly chainId; /** Cache of on-chain-resolved payout token addresses. */ private payoutToken; constructor(publicClient: PublicClient, walletClient?: WalletClient | undefined, options?: TokenSaleClientOptions); /** The resolved address group in use. */ get addresses(): LaunchSaleAddresses; /** Sale contract address for a token kind. */ private saleFor; /** * Resolve (and cache) the ERC-20 the sale actually pays out, by reading the sale * contract's `gToken()` / `aPNTs()` immutable getter. This is the single source of * truth for the payout token — no address is duplicated in the config. */ getPayoutToken(token: SaleTokenKind): Promise
; /** Read live USD prices (6-decimal) for both sale tokens. */ getPrices(): Promise