import { Actor, ActorSubclass, Agent, HttpAgent } from '@dfinity/agent'; import { IDL } from '@dfinity/candid'; /** * @internal * Adapter responsible for creating actors. * It can receive a provider to identify the actor like a wallet provider (e.g. Plug). */ export declare class ActorAdapter { private provider?; private options; static readonly actors: ActorAdapter.Actors; constructor(provider?: ActorAdapter.Provider | undefined, options?: ActorAdapter.Options); /** * Creates a new actor or use from memory if is already created. * @internal * @param {string} canisterId The canister id of the actor * @param {IDL.InterfaceFactory} interfaceFactory The interface factory of the actor * @returns {Promise>} The actor */ createActor(canisterId: string, interfaceFactory: IDL.InterfaceFactory): Promise>; /** * Creates the agent from provider. * @internal * @param {string[]} extraWhitelist Extra whitelist to add to the ICNSConstants whitelist * @returns {Promise} Return void promise */ private createAgent; /** * Gets the adapter from an actor. * @param {Actor} actor The actor * @returns {ActorAdapter | undefined} The adapter or undefined if is not existent */ static adapterOf(actor: Actor): ActorAdapter | undefined; /** * Create an anonymous actor. * @param {string} canisterId The canister id of the actor * @param {IDL.InterfaceFactory} interfaceFactory The interface factory of the actor * @param {string=Constants.IC_HOST} host The IC host to connect to * @returns {ActorAdapter.Actor} The anonymous actor */ static createAnonymousActor(canisterId: string, interfaceFactory: IDL.InterfaceFactory, host?: string): ActorAdapter.Actor; } /** * @internal * Type definition for the ActorAdapter. */ export declare namespace ActorAdapter { /** * Agent provider interface. */ type Provider = { agent: Agent | null; createActor(params: CreateActorParams): Promise>; createAgent(params: CreateAgentParams): Promise; }; /** * Options for the ActorAdapter. */ type Options = { whitelist: string[]; host?: string; }; /** * Parameters for creating an actor using the provider. */ interface CreateActorParams { agent?: HttpAgent; actor?: ActorSubclass>; canisterId: string; interfaceFactory: IDL.InterfaceFactory; } /** * Parameters for creating an agent using the provider. */ interface CreateAgentParams { whitelist?: string[]; host?: string; } /** * Parameters for creating an actor using the ActorAdapter. */ type ActorParams = { canisterId?: string; interfaceFactory: IDL.InterfaceFactory; }; /** * Interface for static stored actors. */ type Actors = Record; adapter: ActorAdapter; }>; /** * Return for the createActor function of the ActorAdapter. */ type Actor = ActorSubclass; }