/** * Entry guards for trade / tools / transfer commands. * * The core invariant: every command that touches trading logic for a specific * token MUST call `assertSupportedToken(ca)` before doing any signing or * on-chain write. This is how fourMM enforces "TaxToken and X Mode are out of * scope" without having to repeat the check inside each command body. * * Failure mode: `assertSupportedToken` throws `UnsupportedTokenError`, which * command handlers can catch and return as a structured `c.error({...})` * with a clean error code. */ import type { Address } from 'viem'; import { identifyToken, type IdentifyResult } from './identify.js'; import type { TokenVariant } from '../datastore/types.js'; /** The two variants that fourMM actively supports */ export type SupportedVariant = Extract; export declare class UnsupportedTokenError extends Error { readonly variant: TokenVariant; readonly ca: Address; readonly reason: string; readonly code: "UNSUPPORTED_TOKEN"; constructor(variant: TokenVariant, ca: Address, reason: string); } export declare class TokenNotFoundError extends Error { readonly ca: Address; readonly code: "TOKEN_NOT_FOUND"; constructor(ca: Address); } /** * Throw if the token is a variant fourMM does not support OR the API says the * token isn't on Four.meme at all. * * Returns the identification result so callers can avoid a second API call * (e.g. `trade buy` can reuse `result.raw` for future slippage estimates). * * Network failures (source=fallback-network) are NOT treated as hard errors: * we default to `standard` and let the downstream RPC layer (Helper3) be * the arbiter. This keeps the CLI usable when Four.meme's API is degraded. */ export declare function assertSupportedToken(ca: Address, options?: Parameters[1]): Promise; //# sourceMappingURL=guards.d.ts.map