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; /** * Quote how many tokens (18-decimal) a USD amount buys, via the sale's on-chain * pricing (`getTokensForUSD` / `getAPNTsForUSD`). */ quote(token: SaleTokenKind, usdAmount: bigint): Promise; /** Read ETH / USDC / USDT / GToken / aPNTs balances for an account. */ getBalances(account: Address): Promise; /** * Buy with the user paying gas: ensures allowance (approves if short) then calls * `buyTokens` / `buyAPNTs`. Tokens are sent to the buyer. Waits for both receipts. */ buySelfPay(params: SelfPayParams): Promise; /** * Buy with zero gas: signs an EIP-3009 USDC `ReceiveWithAuthorization` (to BuyHelper) * and an EIP-712 `BuyIntent`, then posts both to the relayer's `/v3/relay`. Returns the * relayer-submitted tx hash after on-chain confirmation. Payment is always USDC. */ buyGasless(params: GaslessParams): Promise; /** * Build the ordered relayer candidate list: an explicit override wins; otherwise load-balance * across the DVT relay pool — the SINGLE source of truth `getDvtRelayerUrlsForChain(chainId)` * (random start) — with the legacy `relayerUrl` (Cloudflare Worker) appended as a final fallback. * Pure ordering — no network. (Math.random for LB spread is fine here.) */ private relayerCandidates; private requireWallet; /** * Resolve the signing account. Returns the viem account OBJECT (a LocalAccount, or a * JsonRpcAccount for injected wallets) for the `account` field of write/sign calls, plus * its address for message fields. Passing the object — not a bare address string — is what * lets a local private-key account sign locally instead of routing to `eth_signTypedData_v4` * on the (key-less) RPC transport. */ private signer; } declare class FinanceClient { private publicClient; private walletClient; /** * Initialize FinanceClient * @param publicClient The public client for queries * @param walletClient The wallet client for transactions */ constructor(publicClient: PublicClient, walletClient: WalletClient); /** @deprecated Use instance methods instead */ static depositToPaymaster(wallet: WalletClient, paymaster: Address, amount: bigint): Promise<`0x${string}`>; /** @deprecated Use instance methods instead */ static depositViaTransferAndCall(wallet: WalletClient, token: Address, paymaster: Address, amount: bigint): Promise<`0x${string}`>; /** @deprecated Use instance methods instead */ static stakeGToken(wallet: WalletClient, stakingAddr: Address, amount: bigint): Promise<`0x${string}`>; /** @deprecated Use instance methods instead */ static withdrawProtocolRevenue(wallet: WalletClient, paymaster: Address, to: Address, amount: bigint): Promise<`0x${string}`>; /** @deprecated Use instance methods instead */ static depositToEntryPoint(wallet: WalletClient, entryPoint: Address, paymaster: Address, amount: bigint): Promise<`0x${string}`>; /** @deprecated Use instance methods instead */ static getEntryPointBalance(client: any, entryPoint: Address, account: Address): Promise; /** @deprecated Use instance methods instead */ static operatorDeposit(wallet: WalletClient, paymaster: Address, amount: bigint): Promise<`0x${string}`>; /** @deprecated Use instance methods instead */ static operatorNotifyDeposit(wallet: WalletClient, paymaster: Address, amount: bigint): Promise<`0x${string}`>; /** * Get GToken balance */ getGTokenBalance(address: Address): Promise; /** * Get aPNTs balance */ getAPNTsBalance(address: Address): Promise; /** * One-step stake: Approve (if needed) + Stake * * @param amount Amount of GToken to stake * @returns Transaction hash of the stake action */ approveAndStake(amount: bigint): Promise; /** * Get circulating supply (total - locked) */ getCirculatingSupply(): Promise<{ total: bigint; locked: bigint; circulating: bigint; }>; /** * Get comprehensive tokenomics data */ getTokenomicsOverview(): Promise<{ totalSupply: bigint; totalStaked: bigint; totalBurned: bigint; circulatingSupply: bigint; stakingRatio: number; }>; } export { type BuyResult, FinanceClient, type PayToken, type SaleBalances, type SalePrices, type SaleTokenKind, TokenSaleClient, type TokenSaleClientOptions, usd };