/** * @name tools/sunrise/sunrise-client * @description Typed REST client for the public Sunrise swap API * (https://api.sunrise.xyz). No authentication: the API is open and signing * happens at the Solana transaction level in the user's wallet. Implements * the token list, quote, and execute/poll state machine exactly as verified * against the live API on 2026-09-14 (see profile skill `sunrise-protocol`). * * @module tools/sunrise/sunrise-client */ /** Default Sunrise API base URL (public, no auth, CORS enabled). */ export declare const SUNRISE_API_BASE_URL = "https://api.sunrise.xyz"; /** * Core assets that are quotable on Sunrise but absent from `GET /v1/tokens` * (verified live). SOL is native and not wrapped through this list. */ export declare const SUNRISE_CORE_MINTS: { readonly USDC: { readonly address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; readonly decimals: 6; readonly symbol: "USDC"; }; readonly USDT: { readonly address: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"; readonly decimals: 6; readonly symbol: "USDT"; }; readonly WETH: { readonly address: "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"; readonly decimals: 8; readonly symbol: "WETH"; }; readonly WBTC: { readonly address: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh"; readonly decimals: 8; readonly symbol: "WBTC"; }; }; /** * @name SunriseApiError * @description Typed error for every non-2xx Sunrise response, carrying the * upstream error-envelope fields when available. */ export declare class SunriseApiError extends Error { readonly status: number; readonly code: string; readonly requestId?: string; constructor(status: number, code: string, message: string, requestId?: string); } /** Sunrise token entry as returned by GET /v1/tokens. */ export interface SunriseToken { readonly chain: 'solana'; readonly address: string; readonly symbol: string; readonly name: string; readonly decimals: number; readonly platform: string; readonly assetClass: 'stock' | 'crypto' | 'commodity'; readonly issuer: string | null; readonly icon: string | null; readonly tokenProgram: string | null; readonly stock: { readonly ticker: string; readonly currency: string | null; readonly exchange: { readonly marketIdentifierCode: string; readonly name: string; } | null; } | null; } /** Quote request body. All amounts are STRINGS in base units. */ export interface SunriseQuoteBody { readonly fromToken: string; readonly toToken: string; readonly fromAmount: string; readonly fromAddress?: string; readonly toAddress?: string; } /** Quote entry returned by POST /v1/quotes. */ export interface SunriseQuote { readonly quoteId: string; readonly routeName: string; readonly fromToken: string; readonly toToken: string; readonly fromAmount: string; readonly toAmount: string; readonly fromAmountUSD?: number; readonly toAmountUSD?: number; readonly unsignedTransaction?: string; readonly providerRequestId?: string; readonly slippageBps?: number; } /** Execute body accepted by POST /v1/execute. */ export interface SunriseExecuteBody { readonly signedTransaction: string; readonly quoteId: string; readonly routeName: string; readonly providerRequestId?: string; } /** Execute response data — poll while SUBMITTED. */ export interface SunriseExecuteResult { readonly txHash: string; readonly status: 'CONFIRMED' | 'SUBMITTED'; } /** Options for executeQuoteAndWait polling. */ export interface SunrisePollOptions { readonly maxAttempts?: number; readonly intervalMs?: number; } /** Options accepted by the SunriseApiClient constructor. */ export interface SunriseClientOptions { readonly baseUrl?: string; } /** * @name stripUnknownKeys * @description Returns a copy of the object containing only the listed keys. * Sunrise POST bodies use `additionalProperties: false` upstream — extra * fields are rejected outright, so clients must strip them. */ export declare function stripUnknownKeys(body: T, allowedKeys: readonly string[]): Partial; /** * @name assertBaseUnitAmount * @description Validates that an amount is a string of digits (optionally * decimal) — Sunrise amounts are base-unit strings and numbers are * rejected. Floats would silently lose precision, so they are refused. */ export declare function assertBaseUnitAmount(value: unknown, fieldName: string): string; /** * @name SunriseApiClient * @description REST client for the Sunrise public swap API: token listing, * quotes, and execute/poll. */ export declare class SunriseApiClient { private readonly baseUrl; constructor(options?: SunriseClientOptions); private post; /** Lists Sunrise-supported tokens (paginated). */ listTokens(options?: { readonly cursor?: string; readonly limit?: number; }): Promise<{ readonly count: number; readonly tokens: readonly SunriseToken[]; readonly nextCursor: string | null; }>; /** Fetches swap quotes. Wallet addresses are optional — with them the first quote carries an unsignedTransaction. */ getQuote(body: SunriseQuoteBody): Promise; /** * Submits a signed transaction. The SAME body must be re-posted while the * status is 'SUBMITTED' — this endpoint doubles as the status poll. */ executeQuote(body: SunriseExecuteBody): Promise<{ readonly txHash: string; readonly status: 'CONFIRMED' | 'SUBMITTED'; }>; /** * Executes and polls with the identical body until CONFIRMED. On timeout it * throws `sunrise_poll_timeout` with the duplicate-swap warning — callers * must check wallet activity before any retry. */ executeQuoteAndWait(body: SunriseExecuteBody, options?: { readonly maxAttempts?: number; readonly intervalMs?: number; }): Promise<{ readonly txHash: string; readonly status: 'CONFIRMED' | 'SUBMITTED'; }>; } //# sourceMappingURL=sunrise-client.d.ts.map