import type { BaseActor, TransformArgsRegistry, TransformKey } from "@ic-reactor/core"; import type { CandidReactorParameters, DynamicMethodOptions } from "./types.js"; import { Reactor } from "@ic-reactor/core"; import { CandidAdapter } from "./adapter.js"; export declare class CandidReactor extends Reactor { transform: keyof TransformArgsRegistry; adapter: CandidAdapter; private candidSource?; constructor(config: CandidReactorParameters); /** * Initializes the reactor by parsing the provided Candid string or fetching it from the network. * This updates the internal service definition with the actual canister interface. * * After initialization, all standard Reactor methods (callMethod, fetchQuery, etc.) work. */ initialize(): Promise; /** * Register a dynamic method by its Candid signature. * After registration, all standard Reactor methods work with this method name. * * @example * ```typescript * // Register a method * await reactor.registerMethod({ * functionName: "icrc1_balance_of", * candid: "(record { owner : principal }) -> (nat) query" * }) * * // Now use standard Reactor methods! * const balance = await reactor.callMethod({ * functionName: "icrc1_balance_of", * args: [{ owner }] * }) * * // Or with caching * const cachedBalance = await reactor.fetchQuery({ * functionName: "icrc1_balance_of", * args: [{ owner }] * }) * ``` */ registerMethod(options: DynamicMethodOptions): Promise; /** * Register multiple methods at once. */ registerMethods(methods: DynamicMethodOptions[]): Promise; /** * Check if a method is registered (either from initialize or registerMethod). */ hasMethod(functionName: string): boolean; /** * Get all registered method names. */ getMethodNames(): string[]; /** * Perform a dynamic update call in one step. * Registers the method if not already registered, then calls it. * * @example * ```typescript * const result = await reactor.callDynamic({ * functionName: "transfer", * candid: "(record { to : principal; amount : nat }) -> (variant { Ok : nat; Err : text })", * args: [{ to: Principal.fromText("..."), amount: 100n }] * }) * ``` */ callDynamic(options: DynamicMethodOptions & { args?: unknown[]; }): Promise; /** * Perform a dynamic query call in one step. * Registers the method if not already registered, then calls it. * * @example * ```typescript * const balance = await reactor.queryDynamic({ * functionName: "icrc1_balance_of", * candid: "(record { owner : principal }) -> (nat) query", * args: [{ owner: Principal.fromText("...") }] * }) * ``` */ queryDynamic(options: DynamicMethodOptions & { args?: unknown[]; }): Promise; /** * Fetch with dynamic Candid and TanStack Query caching. * Registers the method if not already registered, then fetches with caching. * * @example * ```typescript * const balance = await reactor.fetchQueryDynamic({ * functionName: "icrc1_balance_of", * candid: "(record { owner : principal }) -> (nat) query", * args: [{ owner }] * }) * ``` */ fetchQueryDynamic(options: DynamicMethodOptions & { args?: unknown[]; }): Promise; } //# sourceMappingURL=reactor.d.ts.map