import { Agent } from './agent'; import * as IDL from './idl'; import { Principal } from './principal'; import { BinaryBlob } from './types'; /** * Configuration to make calls to the Replica. */ export interface CallConfig { agent?: Agent; maxAttempts?: number; throttleDurationInMSecs?: number; } /** * Configuration that can be passed to customize the Actor behaviour. */ export interface ActorConfig extends CallConfig { canisterId: string | Principal; } /** * A subclass of an actor. Actor class itself is meant to be a based class. */ export declare type ActorSubclass Promise>> = Actor & T; /** * The mode used when installing a canister. */ export declare enum CanisterInstallMode { Install = "install", Reinstall = "reinstall", Upgrade = "upgrade" } /** * Internal metadata for actors. It's an enhanced version of ActorConfig with * some fields marked as required (as they are defaulted) and canisterId as * a Principal type. */ interface ActorMetadata { canisterId: Principal; service: IDL.ServiceClass; agent?: Agent; maxAttempts: number; throttleDurationInMSecs: number; } declare const metadataSymbol: unique symbol; /** * An actor base class. An actor is an object containing only functions that will * return a promise. These functions are derived from the IDL definition. */ export declare class Actor { /** * Get the interface of an actor, in the form of an instance of a Service. * @param actor The actor to get the interface of. */ static interfaceOf(actor: Actor): IDL.ServiceClass; static canisterIdOf(actor: Actor): Principal; static install(fields: { module: BinaryBlob; mode?: CanisterInstallMode; arg?: BinaryBlob; computerAllocation?: number; memoryAllocation?: number; }, config: ActorConfig): Promise; static createCanister(config?: CallConfig): Promise; static createAndInstallCanister(interfaceFactory: IDL.InterfaceFactory, fields: { module: BinaryBlob; arg?: BinaryBlob; }, config?: CallConfig): Promise; static createActorClass(interfaceFactory: IDL.InterfaceFactory): ActorConstructor; static createActor Promise>>>(interfaceFactory: IDL.InterfaceFactory, configuration: ActorConfig): ActorSubclass; private [metadataSymbol]; protected constructor(metadata: ActorMetadata); } export declare type ActorConstructor = new (config: ActorConfig) => ActorSubclass; export declare type ActorFactory = (config: ActorConfig) => ActorSubclass; export declare function makeActorFactory(actorInterfaceFactory: IDL.InterfaceFactory): ActorFactory; export {};