UNPKG

wowok

Version:

Wowok Blockchain TypeScript API

86 lines (85 loc) 4.09 kB
import { Messenger } from "./messenger.js"; import type { Message, MessageFilter, MessengerConfig, DecryptedMessage, SendMessageResult, ContactLists, ContactListsSyncResult, MessageListResult, ConversationInfo, WtsFileResult, ListOperationResponse, WtsRange, GetSettingsResponse, UpdateSettingsRequest } from "./types.js"; interface AccountInfo { address: string; messenger: Messenger; initialized: boolean; initializing?: Promise<void>; contactLists: ContactLists; } export interface MessengerManagerOptions { messengerConfig?: Partial<MessengerConfig>; enablePersistence?: boolean; instanceId?: string; } export declare class MessengerManager { private accounts; private config; private messageListeners; private isWatching; private persistStorage; private instanceId; private accountRefreshTimer; private pollingLockedAccounts; constructor(options?: MessengerManagerOptions); private findAccount; getConfig(): MessengerConfig; get_accounts(): string[]; refresh_accounts(): Promise<void>; start(): Promise<void>; stop(): void; ensureAccountReady(address: string): Promise<AccountInfo>; private initializeAccount; private doInitialize; private add_account_internal; private remove_account_internal; clear_accounts(): void; send(from: string, to: string, content: string, options?: { guardAddress?: string; passportAddress?: string; force?: boolean; new_messenger_name?: string; }): Promise<SendMessageResult>; send_file(from: string, to: string, filePath: string, options?: { fileName?: string; contentType?: "wts" | "wip" | "zip"; guardAddress?: string; passportAddress?: string; force?: boolean; new_messenger_name?: string; }): Promise<SendMessageResult>; watch(filter?: MessageFilter): Promise<Message[]>; private startPolling; private stopPolling; onMessage(listener: (messages: DecryptedMessage[]) => void): void; offMessage(listener: (messages: DecryptedMessage[]) => void): void; destroy(): void; syncContactLists(account: string): Promise<ContactListsSyncResult>; syncAllContactLists(): Promise<Map<string, ContactListsSyncResult>>; getContactLists(account: string): ContactLists | undefined; setContactLists(account: string, lists: Partial<ContactLists>): boolean; isStranger(account: string, senderAddress: string): boolean; recordGuardSender(account: string, guardAddress: string): boolean; private generateNonce; watch_paginated(filter?: MessageFilter & { account?: string; }): Promise<MessageListResult>; get_conversations(account?: string): Promise<ConversationInfo[]>; generate_wts(outputDir: string, myAccount: string, peerAccount: string, range?: WtsRange, excludePlaintext?: boolean): Promise<WtsFileResult>; addToBlacklist(account: string, addresses: string[]): Promise<ListOperationResponse>; removeFromBlacklist(account: string, addresses: string[]): Promise<ListOperationResponse>; clearBlacklist(account: string): Promise<ListOperationResponse>; getBlacklist(account: string): Promise<string[]>; existInBlacklist(account: string, addresses: string[]): Promise<ListOperationResponse>; addToFriendsList(account: string, addresses: string[]): Promise<ListOperationResponse>; removeFromFriendsList(account: string, addresses: string[]): Promise<ListOperationResponse>; clearFriendsList(account: string): Promise<ListOperationResponse>; getFriendsList(account: string): Promise<string[]>; existInFriendsList(account: string, addresses: string[]): Promise<ListOperationResponse>; addToGuardList(account: string, guards: any[]): Promise<any>; removeFromGuardList(account: string, addresses: string[]): Promise<any>; getGuardList(account: string): Promise<any>; getSettings(account: string): Promise<GetSettingsResponse>; setSettings(account: string, settings: Partial<UpdateSettingsRequest>): Promise<boolean>; } export {};