import { Simnet } from "@stacks/clarinet-sdk"; /** Full chain descriptor used by clients and transports for network-aware operations. */ type StacksChain = { /** Chain ID (e.g. 0x00000001 for mainnet) */ id: number /** Human-readable name */ name: string /** Network type */ network: "mainnet" | "testnet" /** Transaction version byte for serialization */ transactionVersion: number /** Peer network ID for P2P broadcasting */ peerNetworkId: number /** Address version bytes */ addressVersion: { singleSig: number multiSig: number } /** Magic bytes for network identification */ magicBytes: string /** Boot address (system contracts deployer) */ bootAddress: string /** Native currency info */ nativeCurrency: { name: string symbol: string decimals: number } /** Default RPC URLs */ rpcUrls: { default: { http: string[] ws?: string[] } } /** Block explorer URLs */ blockExplorers?: { default: { name: string url: string } } }; /** Function that sends an HTTP request to a Stacks node API path. */ type RequestFn = (path: string, options?: RequestOptions) => Promise; /** Options for a transport-level HTTP request. */ type RequestOptions = { method?: "GET" | "POST" | "PUT" | "DELETE" body?: unknown headers?: Record /** * Cancel the request from the caller's side. An aborted signal rejects * with the signal's reason immediately and never retries; it is combined * with the transport's own per-attempt timeout. */ signal?: AbortSignal /** * Override the transport's retry budget for this one request. Broadcasts * pass `0`: re-sending a transaction the node may already hold trades a * transient failure for a confusing nonce conflict. */ retryCount?: number }; /** Shared configuration for all transport types. */ type TransportConfig = { url?: string /** * Per-attempt deadline in ms covering headers AND body. A stalled body * rejects with `TimeoutError` instead of hanging. Default 30_000. */ timeout?: number retryCount?: number retryDelay?: number fetchOptions?: RequestInit /** Sent as `x-api-key`. Held in the request closure and stripped from * `Transport.config` so it never prints with the client. */ apiKey?: string }; /** A resolved transport instance with a bound request function. */ type Transport = { type: string request: RequestFn config: TransportConfig destroy?: () => void }; /** Factory that creates a {@link Transport} given an optional chain context. */ type TransportFactory = (params?: { chain?: StacksChain }) => Transport; /** * Map Hiro/stacks-node REST paths onto an in-process Clarinet `Simnet`. * `getContract` / public+wallet actions then work unchanged against simnet. */ declare function simnet(session: Simnet): TransportFactory; /** * Chain descriptor for a Clarinet simnet session. Address versions match * Clarinet's testnet-style accounts (`ST…`). Boot contracts (pox-5, …) still * live at their mainnet principals inside the VM. */ declare const simnetChain: StacksChain; declare class BaseError extends Error { private; name: string; shortMessage: string; details?: string; constructor(shortMessage: string, options?: { cause?: Error details?: string code?: string }); /** * Stable identifier for programmatic handling; survives message * rewording and minification. An explicit `code` option wins, else it * is derived from `name` (`TimeoutError` gives `TIMEOUT_ERROR`). */ get code(): string; set code(value: string); toJSON(): { name: string code: string message: string shortMessage: string details: string | undefined cause: string | undefined }; } /** The simnet transport does not implement this node/API route. */ declare class SimnetUnsupportedError extends BaseError { name: string; path: string; constructor(path: string); } export { simnetChain, simnet, SimnetUnsupportedError };