/** * Limitless Exchange — Prediction markets on Base * * Direct ethers v6 integration — no SDK dependency. * Limitless is a Polymarket fork using Gnosis Conditional Tokens Framework (CTF). * * Architecture: * - CTF Exchange: order book settlement (EIP-712 signed orders) * - Conditional Tokens: ERC-1155 outcome tokens (YES/NO) * - REST API for order submission + market browsing * - On-chain: split/merge/redeem positions, verify holdings * * Flow to BUY YES shares: * 1. Approve USDC → CTF Exchange * 2. Sign EIP-712 order (BUY, tokenId=YES, price, amount) * 3. Submit to API (FOK for market order, GTC for limit) * 4. Exchange matches + settles on-chain * 5. You now hold YES tokens (ERC-1155) * * Flow when market resolves: * - If YES wins → redeem YES tokens → get $1/share USDC * - If NO wins → YES tokens worth $0 * * Contracts (Base mainnet): * CTF Exchange v3: 0x05c748E2f4DcDe0ec9Fa8DDc40DE6b867f923fa5 * Conditional Tokens: 0xC9c98965297Bc527861c898329Ee280632B76e18 * NegRisk Exchange v3: 0xe3E00BA3a9888d1DE4834269f62ac008b4BB5C47 * NegRisk Adapter v3: 0x6151EF8368b6316c1aa3C68453EF083ad31E712D * USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 */ import { ethers } from 'ethers'; export declare const LIMITLESS_CONTRACTS: { readonly CTF_EXCHANGE: "0x05c748E2f4DcDe0ec9Fa8DDc40DE6b867f923fa5"; readonly CONDITIONAL_TOKENS: "0xC9c98965297Bc527861c898329Ee280632B76e18"; readonly NEGRISK_EXCHANGE: "0xe3E00BA3a9888d1DE4834269f62ac008b4BB5C47"; readonly NEGRISK_ADAPTER: "0x6151EF8368b6316c1aa3C68453EF083ad31E712D"; readonly WRAPPED_COLLATERAL: "0xBd8Ff5Ac78A3739037FEaA18278cC157C4798B01"; readonly USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; }; export interface LimitlessMarket { slug: string; title: string; conditionId: string; status: string; /** [yesPrice, noPrice] — each 0 to 1 */ prices: [number, number]; /** YES and NO ERC-1155 token IDs */ tokens: { yes: string; no: string; }; /** Volume in USDC (formatted) */ volume: string; /** Venue exchange contract address */ exchange: string; /** NegRisk adapter address (null for simple markets) */ adapter: string | null; /** Expiration date */ expirationDate: string; /** Market type: 'single' or 'group' */ marketType: string; /** Collateral token info */ collateral: { address: string; decimals: number; symbol: string; }; } export interface LimitlessOrder { /** Market slug */ market: string; /** Buy YES or NO outcome */ outcome: 'yes' | 'no'; /** Amount in USDC to spend */ amount: string; /** Price per share (0.01 to 0.99) — for limit orders */ price?: number; /** 'FOK' for market order, 'GTC' for limit order (default: 'FOK') */ orderType?: 'FOK' | 'GTC'; } export interface LimitlessPosition { market: string; outcome: string; shares: string; tokenId: string; currentPrice: number; value: string; } export interface LimitlessBuyResult { market: string; outcome: string; amount: string; price: number; shares: string; orderSubmitted: boolean; } /** * Fetch active markets from Limitless API. * No API key required. */ export declare function fetchMarkets(limit?: number): Promise>; /** * Fetch full market details by slug. * No API key required. */ export declare function fetchMarket(slug: string): Promise; /** * Search markets by query. */ export declare function searchMarkets(query: string): Promise; /** * Get the fee rate (in bps) for a wallet address from their Limitless profile. * Default is 300 bps (3%) for Bronze rank. */ export declare function getFeeRate(account: string): Promise; /** * Build and sign a Limitless order using EIP-712. * * @param wallet - ethers Wallet (must have signing capability) * @param market - Market data from fetchMarket() * @param params - Order parameters * @param nonce - Current nonce from exchange contract */ export declare function buildSignedOrder(wallet: ethers.Wallet, market: LimitlessMarket, params: LimitlessOrder, nonce: bigint): Promise<{ signedOrder: Record; price: number; shares: string; }>; /** * Submit a signed order to the Limitless API. * * @param apiKey - Limitless API key (starts with 'lmts_') * @param marketSlug - Market slug * @param signedOrder - The signed order from buildSignedOrder() * @param orderType - 'FOK' for market order, 'GTC' for limit order */ /** * Get the Limitless user ID for a wallet address. * Uses the public profile endpoint — no auth needed. */ export declare function getOwnerId(account: string): Promise; export declare function submitOrder(apiKey: string, marketSlug: string, signedOrder: Record, orderType?: 'FOK' | 'GTC'): Promise<{ success: boolean; data?: any; error?: string; }>; /** * Build the USDC approval call for the CTF Exchange. */ export declare function buildApprovalCalls(usdcAmount: bigint, exchange?: string): Array<{ to: string; data: string; value: string; }>; /** * Build the setApprovalForAll call for conditional tokens. * Required before selling positions. */ export declare function buildCtfApprovalCalls(exchange?: string): Array<{ to: string; data: string; value: string; }>; /** * Build calls to redeem winning positions after market resolution. */ export declare function buildRedeemCalls(conditionId: string): Array<{ to: string; data: string; value: string; }>; /** * Get the user's nonce from the CTF Exchange contract. */ export declare function getNonce(wallet: string, provider: ethers.JsonRpcProvider, exchange?: string): Promise; /** * Get the user's position (YES/NO token balances) for a market. */ export declare function getPositions(wallet: string, market: LimitlessMarket, provider: ethers.JsonRpcProvider): Promise<{ yes: string; no: string; yesValue: string; noValue: string; }>; /** * Check if a market has been resolved. */ export declare function isResolved(conditionId: string, provider: ethers.JsonRpcProvider): Promise;