import { Agent } from "@dfinity/agent"; import { Principal } from "@dfinity/principal"; import { AnnouncementCandid, AnnouncementInputCandid, EncryptedViewKeyRequestCandid, InvoiceSubmissionCandid } from "./candid.js"; import { Announcement, AnnouncementInput, AnnouncementPage, AnnouncementPageByTime, EncryptedViewKeyRequest, InvoiceSubmission } from "./types.js"; /** * Internet Computer canister client used for stealth announcements and invoices. * @remarks * This client: * - Creates and memoizes canister actors for the key manager and storage canisters. * - Unwraps `Result`-style canister responses (`Ok`/`ok`, `Err`/`err`) via `unwrapResult`. */ export declare class StealthCanisterClient { private readonly agent; private readonly storageCanisterId; private readonly keyManagerCanisterId; private keyManagerActor; private storageActor; /** * Create a canister client using a pre-configured {@link Agent} and canister principals. */ constructor(agent: Agent, storageCanisterId: Principal, keyManagerCanisterId: Principal); /** Return the configured agent. */ getAgent(): Agent; /** Return the configured storage canister id. */ getStorageCanisterId(): Principal; /** Return the configured key manager canister id. */ getKeyManagerCanisterId(): Principal; /** * Fetch the view public key for an EVM address (encoded as bytes). */ getViewPublicKey(address: Uint8Array): Promise; /** * Request an encrypted view key (vetKD flow). * @remarks See {@link EncryptedViewKeyRequest} for required signature/nonce/expiry fields. */ requestEncryptedViewKey(request: EncryptedViewKeyRequest): Promise; /** * Read the maximum nonce for the given address from the key manager canister. */ getMaxNonce(address: Uint8Array): Promise; /** * Submit an encrypted announcement to the storage canister. */ submitAnnouncement(input: AnnouncementInput): Promise; /** * Submit an invoice (signed pointer) to the storage canister. */ submitInvoice(submission: InvoiceSubmission): Promise; /** * List invoice ids for an address. * @param address - Address bytes used by the canister as the invoice owner key. * @param tag - Optional storage tag. Defaults to {@link DEFAULT_ZSTORAGE_TAG}. */ listInvoices(address: Uint8Array, tag?: string): Promise; /** * List announcements using an id-based cursor. * @param startAfter - If provided, results start strictly after this announcement id. * @param limit - Maximum number of announcements to return. * @param tag - Optional storage tag. Defaults to {@link DEFAULT_ZSTORAGE_TAG}. * @returns A page with announcements and `nextId` cursor (or null if no more pages). */ listAnnouncements(startAfter?: bigint, limit?: number, tag?: string): Promise; /** * List announcements filtered by time. * @param startAfterTs - Timestamp in nanoseconds. Only announcements created after this time will be returned. * @param limit - Maximum number of announcements to return. * @param tag - Storage tag to filter by. * @returns A page with announcements and `nextTs` cursor (or null if no more pages). */ listAnnouncementsByTime(startAfterTs?: bigint, limit?: number, tag?: string): Promise; /** * Fetch a single announcement by its id. * @returns The announcement if present, otherwise `null`. */ getAnnouncement(id: bigint): Promise; private getKeyManagerActor; private getStorageActor; } /** @internal */ export declare function mapAnnouncement(announcement: AnnouncementCandid): Announcement; /** @internal */ export declare function toCandidAnnouncementInput(input: AnnouncementInput): AnnouncementInputCandid; /** @internal */ export declare function toCandidEncryptedViewKeyRequest(request: EncryptedViewKeyRequest): EncryptedViewKeyRequestCandid; /** @internal */ export declare function toCandidInvoiceSubmission(submission: InvoiceSubmission): InvoiceSubmissionCandid; //# sourceMappingURL=client.d.ts.map