@xmtp/browser-sdk 5.3.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +541 -671
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/workers/client.js +1 -1
- package/dist/workers/client.js.map +1 -1
- package/dist/workers/opfs.js +2 -0
- package/dist/workers/opfs.js.map +1 -0
- package/package.json +12 -16
- package/src/Client.ts +92 -219
- package/src/CodecRegistry.ts +27 -0
- package/src/Conversation.ts +275 -104
- package/src/Conversations.ts +188 -99
- package/src/DebugInformation.ts +10 -27
- package/src/DecodedMessage.ts +155 -58
- package/src/Dm.ts +25 -9
- package/src/Group.ts +30 -29
- package/src/Opfs.ts +63 -0
- package/src/Preferences.ts +68 -52
- package/src/WorkerClient.ts +5 -5
- package/src/WorkerConversation.ts +98 -45
- package/src/WorkerConversations.ts +35 -74
- package/src/WorkerDebugInformation.ts +1 -12
- package/src/WorkerPreferences.ts +6 -14
- package/src/index.ts +54 -24
- package/src/types/actions/client.ts +6 -17
- package/src/types/actions/conversation.ts +160 -31
- package/src/types/actions/conversations.ts +21 -24
- package/src/types/actions/debugInformation.ts +3 -11
- package/src/types/actions/dm.ts +1 -1
- package/src/types/actions/opfs.ts +66 -0
- package/src/types/actions/preferences.ts +6 -13
- package/src/types/actions/streams.ts +8 -8
- package/src/types/actions.ts +11 -9
- package/src/types/options.ts +46 -6
- package/src/{ClientWorkerClass.ts → utils/WorkerBridge.ts} +35 -45
- package/src/utils/contentTypes.ts +77 -0
- package/src/utils/conversions.ts +17 -590
- package/src/utils/createClient.ts +16 -11
- package/src/utils/errors.ts +13 -19
- package/src/utils/inboxId.ts +46 -0
- package/src/utils/inboxState.ts +23 -0
- package/src/utils/installations.ts +95 -0
- package/src/utils/metadata.ts +15 -0
- package/src/utils/signer.ts +4 -4
- package/src/utils/uuid.ts +8 -0
- package/src/workers/client.ts +176 -135
- package/src/workers/opfs.ts +127 -0
- package/dist/workers/utils.js +0 -2
- package/dist/workers/utils.js.map +0 -1
- package/src/Utils.ts +0 -143
- package/src/UtilsWorkerClass.ts +0 -121
- package/src/types/actions/utils.ts +0 -69
- package/src/workers/utils.ts +0 -155
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ContentCodec, ContentTypeId as ContentTypeId$1, EncodedContent as EncodedContent$1 } from '@xmtp/content-type-primitives';
|
|
2
1
|
import * as _xmtp_wasm_bindings from '@xmtp/wasm-bindings';
|
|
3
|
-
import {
|
|
4
|
-
export { Consent, ConsentEntityType, ConsentState, ContentType,
|
|
5
|
-
import {
|
|
6
|
-
import { TextCodec } from '@xmtp/content-type-text';
|
|
2
|
+
import { ContentTypeId as ContentTypeId$1, DeliveryStatus, GroupMessageKind, Reaction, DecodedMessage as DecodedMessage$1, LeaveRequest, ReadReceipt, Attachment, RemoteAttachment, TransactionReference, WalletSendCalls, Actions, Intent, MultiRemoteAttachment, GroupUpdated, LogLevel, Identifier, Conversations as Conversations$1, ConsentState, ListConversationsOptions, CreateGroupOptions, CreateDmOptions, Conversation as Conversation$1, ConversationType, Message, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, KeyPackageStatus, GroupMember, PermissionUpdateType, PermissionPolicy, MetadataField, EncodedContent, SendMessageOpts, Reply, ListMessagesOptions, MessageDisappearingSettings, HmacKey, ConversationDebugInfo, GroupPermissionsOptions, PermissionPolicySet, GroupMetadata, ApiStats, IdentityStats, InboxState, GroupSyncSummary } from '@xmtp/wasm-bindings';
|
|
3
|
+
export { Action, ActionStyle, Actions, ApiStats, Attachment, Consent, ConsentEntityType, ConsentState, ContentType, ConversationDebugInfo, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, Cursor, DeliveryStatus, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupUpdated, HmacKey, Identifier, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, KeyPackageStatus, LeaveRequest, Lifetime, ListConversationsOptions, ListConversationsOrderBy, ListMessagesOptions, LogLevel, LogOptions, Message, MessageDisappearingSettings, MessageSortBy, MetadataField, MetadataFieldChange, MultiRemoteAttachment, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, Reaction, ReactionAction, ReactionSchema, ReadReceipt, RemoteAttachment, RemoteAttachmentInfo, Reply, SendMessageOpts, SignatureRequestHandle, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, WalletCall, WalletSendCalls } from '@xmtp/wasm-bindings';
|
|
4
|
+
import { ContentCodec, ContentTypeId } from '@xmtp/content-type-primitives';
|
|
7
5
|
|
|
8
6
|
type ResolveValue<T> = {
|
|
9
7
|
value: T;
|
|
@@ -111,6 +109,55 @@ declare const HistorySyncUrls: {
|
|
|
111
109
|
readonly production: "https://message-history.production.ephemera.network";
|
|
112
110
|
};
|
|
113
111
|
|
|
112
|
+
declare class CodecRegistry {
|
|
113
|
+
#private;
|
|
114
|
+
constructor(codecs: ContentCodec[]);
|
|
115
|
+
/**
|
|
116
|
+
* Gets the codec for a given content type
|
|
117
|
+
*
|
|
118
|
+
* @param contentType - The content type to get the codec for
|
|
119
|
+
* @returns The codec, if found
|
|
120
|
+
*/
|
|
121
|
+
getCodec<ContentType = unknown>(contentType: ContentTypeId): ContentCodec<ContentType> | undefined;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Represents a decoded XMTP message
|
|
126
|
+
*
|
|
127
|
+
* @class
|
|
128
|
+
* @property {unknown} content - The decoded content of the message
|
|
129
|
+
* @property {ContentTypeId} contentType - The content type of the message content
|
|
130
|
+
* @property {string} conversationId - Unique identifier for the conversation
|
|
131
|
+
* @property {DeliveryStatus} deliveryStatus - Current delivery status of the message ("unpublished" | "published" | "failed")
|
|
132
|
+
* @property {bigint} expiresAtNs - Timestamp when the message will expire (in nanoseconds)
|
|
133
|
+
* @property {Date} expiresAt - Timestamp when the message will expire
|
|
134
|
+
* @property {string} fallback - Optional fallback text for the message
|
|
135
|
+
* @property {string} id - Unique identifier for the message
|
|
136
|
+
* @property {GroupMessageKind} kind - Type of message ("application" | "membership_change")
|
|
137
|
+
* @property {bigint} numReplies - Number of replies to the message
|
|
138
|
+
* @property {DecodedMessage<Reaction>[]} reactions - Reactions to the message
|
|
139
|
+
* @property {string} senderInboxId - Identifier for the sender's inbox
|
|
140
|
+
* @property {Date} sentAt - Timestamp when the message was sent
|
|
141
|
+
* @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
|
|
142
|
+
*/
|
|
143
|
+
declare class DecodedMessage<ContentTypes = unknown> {
|
|
144
|
+
content: ContentTypes | undefined;
|
|
145
|
+
contentType: ContentTypeId$1;
|
|
146
|
+
conversationId: string;
|
|
147
|
+
deliveryStatus: DeliveryStatus;
|
|
148
|
+
expiresAtNs?: bigint;
|
|
149
|
+
expiresAt?: Date;
|
|
150
|
+
fallback?: string;
|
|
151
|
+
id: string;
|
|
152
|
+
kind: GroupMessageKind;
|
|
153
|
+
numReplies: bigint;
|
|
154
|
+
reactions: DecodedMessage<Reaction>[];
|
|
155
|
+
senderInboxId: string;
|
|
156
|
+
sentAt: Date;
|
|
157
|
+
sentAtNs: bigint;
|
|
158
|
+
constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
|
|
159
|
+
}
|
|
160
|
+
|
|
114
161
|
type XmtpEnv = keyof typeof ApiUrls;
|
|
115
162
|
/**
|
|
116
163
|
* Network options
|
|
@@ -180,7 +227,7 @@ type OtherOptions = {
|
|
|
180
227
|
/**
|
|
181
228
|
* Logging level
|
|
182
229
|
*/
|
|
183
|
-
loggingLevel?:
|
|
230
|
+
loggingLevel?: LogLevel;
|
|
184
231
|
/**
|
|
185
232
|
* Disable automatic registration when creating a client
|
|
186
233
|
*/
|
|
@@ -193,13 +240,15 @@ type OtherOptions = {
|
|
|
193
240
|
* Custom app version
|
|
194
241
|
*/
|
|
195
242
|
appVersion?: string;
|
|
196
|
-
/**
|
|
197
|
-
* Should debug events be tracked
|
|
198
|
-
* (default: false)
|
|
199
|
-
*/
|
|
200
|
-
debugEventsEnabled?: boolean;
|
|
201
243
|
};
|
|
202
244
|
type ClientOptions = NetworkOptions & ContentOptions & StorageOptions & OtherOptions;
|
|
245
|
+
type EnrichedReply<T = unknown, U = unknown> = {
|
|
246
|
+
referenceId: string;
|
|
247
|
+
content: T;
|
|
248
|
+
inReplyTo: DecodedMessage<U> | null;
|
|
249
|
+
};
|
|
250
|
+
type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated;
|
|
251
|
+
type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes | EnrichedReply<T | BuiltInContentTypes, T | BuiltInContentTypes> : BuiltInContentTypes;
|
|
203
252
|
|
|
204
253
|
type SignMessage = (message: string) => Promise<Uint8Array> | Uint8Array;
|
|
205
254
|
type GetIdentifier = () => Promise<Identifier> | Identifier;
|
|
@@ -241,17 +290,17 @@ declare class WorkerConversations {
|
|
|
241
290
|
sync(): Promise<void>;
|
|
242
291
|
syncAll(consentStates?: ConsentState[]): Promise<_xmtp_wasm_bindings.GroupSyncSummary>;
|
|
243
292
|
getConversationById(id: string): WorkerConversation | undefined;
|
|
244
|
-
getMessageById(id: string):
|
|
293
|
+
getMessageById(id: string): Promise<DecodedMessage$1 | undefined>;
|
|
245
294
|
getDmByInboxId(inboxId: string): WorkerConversation | undefined;
|
|
246
|
-
list(options?:
|
|
247
|
-
listGroups(options?: Omit<
|
|
248
|
-
listDms(options?: Omit<
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
295
|
+
list(options?: ListConversationsOptions): WorkerConversation[];
|
|
296
|
+
listGroups(options?: Omit<ListConversationsOptions, "conversationType">): WorkerConversation[];
|
|
297
|
+
listDms(options?: Omit<ListConversationsOptions, "conversationType">): WorkerConversation[];
|
|
298
|
+
createGroupOptimistic(options?: CreateGroupOptions): WorkerConversation;
|
|
299
|
+
createGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<WorkerConversation>;
|
|
300
|
+
createGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<WorkerConversation>;
|
|
301
|
+
createDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<WorkerConversation>;
|
|
302
|
+
createDm(inboxId: string, options?: CreateDmOptions): Promise<WorkerConversation>;
|
|
303
|
+
hmacKeys(): HmacKeys;
|
|
255
304
|
stream(callback: StreamCallback<Conversation$1>, onFail: () => void, conversationType?: ConversationType): _xmtp_wasm_bindings.StreamCloser;
|
|
256
305
|
streamGroups(callback: StreamCallback<Conversation$1>, onFail: () => void): _xmtp_wasm_bindings.StreamCloser;
|
|
257
306
|
streamDms(callback: StreamCallback<Conversation$1>, onFail: () => void): _xmtp_wasm_bindings.StreamCloser;
|
|
@@ -266,12 +315,11 @@ declare class WorkerConversations {
|
|
|
266
315
|
*/
|
|
267
316
|
declare class WorkerDebugInformation {
|
|
268
317
|
#private;
|
|
269
|
-
constructor(client: Client$1
|
|
318
|
+
constructor(client: Client$1);
|
|
270
319
|
apiStatistics(): _xmtp_wasm_bindings.ApiStats;
|
|
271
320
|
apiIdentityStatistics(): _xmtp_wasm_bindings.IdentityStats;
|
|
272
321
|
apiAggregateStatistics(): string;
|
|
273
322
|
clearAllStatistics(): void;
|
|
274
|
-
uploadDebugArchive(serverUrl?: string): Promise<string>;
|
|
275
323
|
}
|
|
276
324
|
|
|
277
325
|
declare class WorkerPreferences {
|
|
@@ -279,17 +327,16 @@ declare class WorkerPreferences {
|
|
|
279
327
|
constructor(client: Client$1, conversations: Conversations$1);
|
|
280
328
|
sync(): Promise<_xmtp_wasm_bindings.GroupSyncSummary>;
|
|
281
329
|
inboxState(refreshFromNetwork: boolean): Promise<_xmtp_wasm_bindings.InboxState>;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
setConsentStates(records: SafeConsent[]): Promise<void>;
|
|
330
|
+
getInboxStates(inboxIds: string[], refreshFromNetwork?: boolean): Promise<_xmtp_wasm_bindings.InboxState[]>;
|
|
331
|
+
setConsentStates(records: Consent[]): Promise<void>;
|
|
285
332
|
getConsentState(entityType: ConsentEntityType, entity: string): Promise<_xmtp_wasm_bindings.ConsentState>;
|
|
286
333
|
streamConsent(callback: StreamCallback<Consent[]>, onFail: () => void): _xmtp_wasm_bindings.StreamCloser;
|
|
287
|
-
streamPreferences(callback: StreamCallback<
|
|
334
|
+
streamPreferences(callback: StreamCallback<UserPreferenceUpdate[]>, onFail: () => void): _xmtp_wasm_bindings.StreamCloser;
|
|
288
335
|
}
|
|
289
336
|
|
|
290
337
|
declare class WorkerClient {
|
|
291
338
|
#private;
|
|
292
|
-
constructor(client: Client$1
|
|
339
|
+
constructor(client: Client$1);
|
|
293
340
|
static create(identifier: Identifier, options?: Omit<ClientOptions, "codecs">): Promise<WorkerClient>;
|
|
294
341
|
get libxmtpVersion(): string;
|
|
295
342
|
get appVersion(): string;
|
|
@@ -312,16 +359,16 @@ declare class WorkerClient {
|
|
|
312
359
|
revokeInstallationsSignatureRequest(installationIds: Uint8Array[]): Promise<SignatureRequestHandle>;
|
|
313
360
|
changeRecoveryIdentifierSignatureRequest(identifier: Identifier): Promise<SignatureRequestHandle>;
|
|
314
361
|
registerIdentity(signer: SafeSigner, signatureRequest: SignatureRequestHandle): Promise<void>;
|
|
315
|
-
|
|
362
|
+
getInboxIdByIdentifier(identifier: Identifier): Promise<string | undefined>;
|
|
316
363
|
signWithInstallationKey(signatureText: string): Uint8Array<ArrayBufferLike>;
|
|
317
364
|
verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
|
|
318
365
|
verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
|
|
319
|
-
|
|
366
|
+
fetchKeyPackageStatuses(installationIds: string[]): Promise<Map<string, KeyPackageStatus>>;
|
|
320
367
|
}
|
|
321
368
|
|
|
322
369
|
declare class WorkerConversation {
|
|
323
370
|
#private;
|
|
324
|
-
constructor(client: WorkerClient, group: Conversation$1
|
|
371
|
+
constructor(client: WorkerClient, group: Conversation$1);
|
|
325
372
|
get id(): string;
|
|
326
373
|
get name(): string;
|
|
327
374
|
updateName(name: string): Promise<void>;
|
|
@@ -332,18 +379,14 @@ declare class WorkerConversation {
|
|
|
332
379
|
get appData(): string;
|
|
333
380
|
updateAppData(appData: string): Promise<void>;
|
|
334
381
|
get isActive(): boolean;
|
|
335
|
-
get isCommitLogForked(): boolean | undefined;
|
|
336
382
|
get addedByInboxId(): string;
|
|
337
383
|
get createdAtNs(): bigint;
|
|
338
|
-
lastMessage(): Promise<
|
|
339
|
-
metadata(): Promise<
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
get admins(): string[];
|
|
345
|
-
get superAdmins(): string[];
|
|
346
|
-
get permissions(): {
|
|
384
|
+
lastMessage(): Promise<DecodedMessage$1 | undefined>;
|
|
385
|
+
metadata(): Promise<_xmtp_wasm_bindings.GroupMetadata>;
|
|
386
|
+
members(): Promise<GroupMember[]>;
|
|
387
|
+
listAdmins(): string[];
|
|
388
|
+
listSuperAdmins(): string[];
|
|
389
|
+
permissions(): {
|
|
347
390
|
policyType: _xmtp_wasm_bindings.GroupPermissionsOptions;
|
|
348
391
|
policySet: _xmtp_wasm_bindings.PermissionPolicySet;
|
|
349
392
|
};
|
|
@@ -360,11 +403,22 @@ declare class WorkerConversation {
|
|
|
360
403
|
addSuperAdmin(inboxId: string): Promise<void>;
|
|
361
404
|
removeSuperAdmin(inboxId: string): Promise<void>;
|
|
362
405
|
publishMessages(): Promise<void>;
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
406
|
+
send(encodedContent: EncodedContent, opts?: SendMessageOpts): Promise<string>;
|
|
407
|
+
sendText(text: string, isOptimistic?: boolean): Promise<string>;
|
|
408
|
+
sendMarkdown(markdown: string, isOptimistic?: boolean): Promise<string>;
|
|
409
|
+
sendReaction(reaction: Reaction, isOptimistic?: boolean): Promise<string>;
|
|
410
|
+
sendReadReceipt(isOptimistic?: boolean): Promise<string>;
|
|
411
|
+
sendReply(reply: Reply, isOptimistic?: boolean): Promise<string>;
|
|
412
|
+
sendTransactionReference(transactionReference: TransactionReference, isOptimistic?: boolean): Promise<string>;
|
|
413
|
+
sendWalletSendCalls(walletSendCalls: WalletSendCalls, isOptimistic?: boolean): Promise<string>;
|
|
414
|
+
sendActions(actions: Actions, isOptimistic?: boolean): Promise<string>;
|
|
415
|
+
sendIntent(intent: Intent, isOptimistic?: boolean): Promise<string>;
|
|
416
|
+
sendAttachment(attachment: Attachment, isOptimistic?: boolean): Promise<string>;
|
|
417
|
+
sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, isOptimistic?: boolean): Promise<string>;
|
|
418
|
+
sendRemoteAttachment(remoteAttachment: RemoteAttachment, isOptimistic?: boolean): Promise<string>;
|
|
419
|
+
messages(options?: ListMessagesOptions): Promise<DecodedMessage$1[]>;
|
|
420
|
+
countMessages(options?: ListMessagesOptions): Promise<bigint>;
|
|
421
|
+
consentState(): ConsentState;
|
|
368
422
|
updateConsentState(state: ConsentState): void;
|
|
369
423
|
dmPeerInboxId(): string;
|
|
370
424
|
messageDisappearingSettings(): MessageDisappearingSettings | undefined;
|
|
@@ -373,103 +427,14 @@ declare class WorkerConversation {
|
|
|
373
427
|
isMessageDisappearingEnabled(): boolean;
|
|
374
428
|
stream(callback: StreamCallback<Message>, onFail: () => void): _xmtp_wasm_bindings.StreamCloser;
|
|
375
429
|
pausedForVersion(): string | undefined;
|
|
376
|
-
|
|
430
|
+
hmacKeys(): Map<string, HmacKey[]>;
|
|
377
431
|
debugInfo(): Promise<ConversationDebugInfo>;
|
|
378
|
-
|
|
432
|
+
duplicateDms(): Promise<WorkerConversation[]>;
|
|
379
433
|
requestRemoval(): Promise<void>;
|
|
380
|
-
|
|
434
|
+
isPendingRemoval(): boolean;
|
|
435
|
+
lastReadTimes(): Promise<LastReadTimes>;
|
|
381
436
|
}
|
|
382
437
|
|
|
383
|
-
declare const toContentTypeId: (contentTypeId: ContentTypeId) => ContentTypeId$1;
|
|
384
|
-
declare const fromContentTypeId: (contentTypeId: ContentTypeId$1) => ContentTypeId;
|
|
385
|
-
type SafeContentTypeId = {
|
|
386
|
-
authorityId: string;
|
|
387
|
-
typeId: string;
|
|
388
|
-
versionMajor: number;
|
|
389
|
-
versionMinor: number;
|
|
390
|
-
};
|
|
391
|
-
declare const toSafeContentTypeId: (contentTypeId: ContentTypeId$1) => SafeContentTypeId;
|
|
392
|
-
declare const fromSafeContentTypeId: (contentTypeId: SafeContentTypeId) => ContentTypeId$1;
|
|
393
|
-
declare const toEncodedContent: (content: EncodedContent) => EncodedContent$1;
|
|
394
|
-
declare const fromEncodedContent: (content: EncodedContent$1) => EncodedContent;
|
|
395
|
-
type SafeEncodedContent = {
|
|
396
|
-
type: SafeContentTypeId;
|
|
397
|
-
parameters: Record<string, string>;
|
|
398
|
-
fallback?: string;
|
|
399
|
-
compression?: number;
|
|
400
|
-
content: Uint8Array;
|
|
401
|
-
};
|
|
402
|
-
declare const toSafeEncodedContent: (content: EncodedContent$1) => SafeEncodedContent;
|
|
403
|
-
declare const fromSafeEncodedContent: (content: SafeEncodedContent) => EncodedContent$1;
|
|
404
|
-
type SafeMessage = {
|
|
405
|
-
content: SafeEncodedContent;
|
|
406
|
-
convoId: string;
|
|
407
|
-
deliveryStatus: DeliveryStatus;
|
|
408
|
-
id: string;
|
|
409
|
-
kind: GroupMessageKind;
|
|
410
|
-
senderInboxId: string;
|
|
411
|
-
sentAtNs: bigint;
|
|
412
|
-
};
|
|
413
|
-
declare const toSafeMessage: (message: Message) => SafeMessage;
|
|
414
|
-
type SafeListMessagesOptions = {
|
|
415
|
-
contentTypes?: ContentType[];
|
|
416
|
-
deliveryStatus?: DeliveryStatus;
|
|
417
|
-
direction?: SortDirection;
|
|
418
|
-
excludeContentTypes?: ContentType[];
|
|
419
|
-
excludeSenderInboxIds?: string[];
|
|
420
|
-
insertedAfterNs?: bigint;
|
|
421
|
-
insertedBeforeNs?: bigint;
|
|
422
|
-
kind?: GroupMessageKind;
|
|
423
|
-
limit?: bigint;
|
|
424
|
-
sentAfterNs?: bigint;
|
|
425
|
-
sentBeforeNs?: bigint;
|
|
426
|
-
sortBy?: MessageSortBy;
|
|
427
|
-
};
|
|
428
|
-
declare const toSafeListMessagesOptions: (options: ListMessagesOptions) => SafeListMessagesOptions;
|
|
429
|
-
declare const fromSafeListMessagesOptions: (options: SafeListMessagesOptions) => ListMessagesOptions;
|
|
430
|
-
type SafeSendMessageOpts = {
|
|
431
|
-
shouldPush: boolean;
|
|
432
|
-
};
|
|
433
|
-
declare const toSafeSendMessageOpts: (opts: SendMessageOpts) => SafeSendMessageOpts;
|
|
434
|
-
declare const fromSafeSendMessageOpts: (opts: SafeSendMessageOpts) => SendMessageOpts;
|
|
435
|
-
type SafeListConversationsOptions = {
|
|
436
|
-
consentStates?: ConsentState[];
|
|
437
|
-
conversationType?: ConversationType;
|
|
438
|
-
createdAfterNs?: bigint;
|
|
439
|
-
createdBeforeNs?: bigint;
|
|
440
|
-
includeDuplicateDms?: boolean;
|
|
441
|
-
limit?: bigint;
|
|
442
|
-
orderBy?: ListConversationsOrderBy;
|
|
443
|
-
};
|
|
444
|
-
declare const toSafeListConversationsOptions: (options: ListConversationsOptions) => SafeListConversationsOptions;
|
|
445
|
-
declare const fromSafeListConversationsOptions: (options: SafeListConversationsOptions) => ListConversationsOptions;
|
|
446
|
-
type SafePermissionPolicySet = {
|
|
447
|
-
addAdminPolicy: PermissionPolicy;
|
|
448
|
-
addMemberPolicy: PermissionPolicy;
|
|
449
|
-
removeAdminPolicy: PermissionPolicy;
|
|
450
|
-
removeMemberPolicy: PermissionPolicy;
|
|
451
|
-
updateGroupDescriptionPolicy: PermissionPolicy;
|
|
452
|
-
updateGroupImageUrlSquarePolicy: PermissionPolicy;
|
|
453
|
-
updateGroupNamePolicy: PermissionPolicy;
|
|
454
|
-
updateMessageDisappearingPolicy: PermissionPolicy;
|
|
455
|
-
};
|
|
456
|
-
declare const toSafePermissionPolicySet: (policySet: PermissionPolicySet) => SafePermissionPolicySet;
|
|
457
|
-
declare const fromSafePermissionPolicySet: (policySet: SafePermissionPolicySet) => PermissionPolicySet;
|
|
458
|
-
type SafeCreateGroupOptions = {
|
|
459
|
-
customPermissionPolicySet?: SafePermissionPolicySet;
|
|
460
|
-
description?: string;
|
|
461
|
-
imageUrlSquare?: string;
|
|
462
|
-
messageDisappearingSettings?: SafeMessageDisappearingSettings;
|
|
463
|
-
name?: string;
|
|
464
|
-
permissions?: GroupPermissionsOptions;
|
|
465
|
-
};
|
|
466
|
-
declare const toSafeCreateGroupOptions: (options: CreateGroupOptions) => SafeCreateGroupOptions;
|
|
467
|
-
declare const fromSafeCreateGroupOptions: (options: SafeCreateGroupOptions) => CreateGroupOptions;
|
|
468
|
-
type SafeCreateDmOptions = {
|
|
469
|
-
messageDisappearingSettings?: SafeMessageDisappearingSettings;
|
|
470
|
-
};
|
|
471
|
-
declare const toSafeCreateDmOptions: (options: CreateDMOptions) => SafeCreateDmOptions;
|
|
472
|
-
declare const fromSafeCreateDmOptions: (options: SafeCreateDmOptions) => CreateDMOptions;
|
|
473
438
|
type SafeConversation = {
|
|
474
439
|
id: string;
|
|
475
440
|
name: string;
|
|
@@ -478,118 +443,27 @@ type SafeConversation = {
|
|
|
478
443
|
appData: string;
|
|
479
444
|
permissions: {
|
|
480
445
|
policyType: GroupPermissionsOptions;
|
|
481
|
-
policySet:
|
|
482
|
-
addAdminPolicy: PermissionPolicy;
|
|
483
|
-
addMemberPolicy: PermissionPolicy;
|
|
484
|
-
removeAdminPolicy: PermissionPolicy;
|
|
485
|
-
removeMemberPolicy: PermissionPolicy;
|
|
486
|
-
updateGroupDescriptionPolicy: PermissionPolicy;
|
|
487
|
-
updateGroupImageUrlSquarePolicy: PermissionPolicy;
|
|
488
|
-
updateGroupNamePolicy: PermissionPolicy;
|
|
489
|
-
updateMessageDisappearingPolicy: PermissionPolicy;
|
|
490
|
-
};
|
|
446
|
+
policySet: PermissionPolicySet;
|
|
491
447
|
};
|
|
492
448
|
addedByInboxId: string;
|
|
493
|
-
metadata:
|
|
494
|
-
creatorInboxId: string;
|
|
495
|
-
conversationType: string;
|
|
496
|
-
};
|
|
449
|
+
metadata: GroupMetadata;
|
|
497
450
|
admins: string[];
|
|
498
451
|
superAdmins: string[];
|
|
499
452
|
createdAtNs: bigint;
|
|
500
|
-
isCommitLogForked?: boolean;
|
|
501
453
|
};
|
|
502
454
|
declare const toSafeConversation: (conversation: WorkerConversation) => Promise<SafeConversation>;
|
|
503
|
-
type SafeInstallation = {
|
|
504
|
-
bytes: Uint8Array;
|
|
505
|
-
clientTimestampNs?: bigint;
|
|
506
|
-
id: string;
|
|
507
|
-
};
|
|
508
|
-
declare const toSafeInstallation: (installation: Installation) => SafeInstallation;
|
|
509
|
-
type SafeInboxState = {
|
|
510
|
-
identifiers: Identifier[];
|
|
511
|
-
inboxId: string;
|
|
512
|
-
installations: SafeInstallation[];
|
|
513
|
-
recoveryIdentifier: Identifier;
|
|
514
|
-
};
|
|
515
|
-
declare const toSafeInboxState: (inboxState: InboxState) => SafeInboxState;
|
|
516
|
-
type SafeConsent = {
|
|
517
|
-
entity: string;
|
|
518
|
-
entityType: ConsentEntityType;
|
|
519
|
-
state: ConsentState;
|
|
520
|
-
};
|
|
521
|
-
declare const toSafeConsent: (consent: Consent) => SafeConsent;
|
|
522
|
-
declare const fromSafeConsent: (consent: SafeConsent) => Consent;
|
|
523
|
-
type SafeGroupMember = {
|
|
524
|
-
accountIdentifiers: Identifier[];
|
|
525
|
-
consentState: ConsentState;
|
|
526
|
-
inboxId: string;
|
|
527
|
-
installationIds: string[];
|
|
528
|
-
permissionLevel: PermissionLevel;
|
|
529
|
-
};
|
|
530
|
-
declare const toSafeGroupMember: (member: GroupMember) => SafeGroupMember;
|
|
531
|
-
declare const fromSafeGroupMember: (member: SafeGroupMember) => GroupMember;
|
|
532
|
-
type SafeHmacKey = {
|
|
533
|
-
key: Uint8Array;
|
|
534
|
-
epoch: bigint;
|
|
535
|
-
};
|
|
536
|
-
declare const toSafeHmacKey: (hmacKey: HmacKey) => SafeHmacKey;
|
|
537
455
|
type HmacKeys = Map<string, HmacKey[]>;
|
|
538
|
-
type
|
|
539
|
-
type SafeMessageDisappearingSettings = {
|
|
540
|
-
fromNs: bigint;
|
|
541
|
-
inNs: bigint;
|
|
542
|
-
};
|
|
543
|
-
declare const toSafeMessageDisappearingSettings: (settings: MessageDisappearingSettings) => SafeMessageDisappearingSettings;
|
|
544
|
-
declare const fromSafeMessageDisappearingSettings: (settings: SafeMessageDisappearingSettings) => MessageDisappearingSettings;
|
|
545
|
-
type SafeKeyPackageStatus = {
|
|
546
|
-
lifetime?: {
|
|
547
|
-
notBefore: bigint;
|
|
548
|
-
notAfter: bigint;
|
|
549
|
-
};
|
|
550
|
-
validationError?: string;
|
|
551
|
-
};
|
|
552
|
-
declare const toSafeKeyPackageStatus: (status: KeyPackageStatus) => SafeKeyPackageStatus;
|
|
553
|
-
type SafeXMTPCursor = {
|
|
554
|
-
originatorID: number;
|
|
555
|
-
sequenceID: bigint;
|
|
556
|
-
};
|
|
557
|
-
type SafeConversationDebugInfo = {
|
|
558
|
-
epoch: bigint;
|
|
559
|
-
maybeForked: boolean;
|
|
560
|
-
forkDetails: string;
|
|
561
|
-
isCommitLogForked?: boolean;
|
|
562
|
-
localCommitLog: string;
|
|
563
|
-
remoteCommitLog: string;
|
|
564
|
-
cursor: SafeXMTPCursor[];
|
|
565
|
-
};
|
|
566
|
-
declare const toSafeConversationDebugInfo: (debugInfo: ConversationDebugInfo) => SafeConversationDebugInfo;
|
|
567
|
-
type SafeApiStats = {
|
|
568
|
-
fetchKeyPackage: bigint;
|
|
569
|
-
queryGroupMessages: bigint;
|
|
570
|
-
queryWelcomeMessages: bigint;
|
|
571
|
-
sendGroupMessages: bigint;
|
|
572
|
-
sendWelcomeMessages: bigint;
|
|
573
|
-
subscribeMessages: bigint;
|
|
574
|
-
subscribeWelcomes: bigint;
|
|
575
|
-
uploadKeyPackage: bigint;
|
|
576
|
-
};
|
|
577
|
-
declare const toSafeApiStats: (stats: ApiStats) => SafeApiStats;
|
|
578
|
-
type SafeIdentityStats = {
|
|
579
|
-
getIdentityUpdatesV2: bigint;
|
|
580
|
-
getInboxIds: bigint;
|
|
581
|
-
publishIdentityUpdate: bigint;
|
|
582
|
-
verifySmartContractWalletSignature: bigint;
|
|
583
|
-
};
|
|
584
|
-
declare const toSafeIdentityStats: (stats: IdentityStats) => SafeIdentityStats;
|
|
456
|
+
type LastReadTimes = Map<string, bigint>;
|
|
585
457
|
|
|
586
458
|
type ClientAction = {
|
|
587
459
|
action: "client.init";
|
|
588
460
|
id: string;
|
|
589
461
|
result: {
|
|
462
|
+
appVersion: string;
|
|
590
463
|
inboxId: string;
|
|
591
464
|
installationId: string;
|
|
592
465
|
installationIdBytes: Uint8Array;
|
|
466
|
+
libxmtpVersion: string;
|
|
593
467
|
};
|
|
594
468
|
data: {
|
|
595
469
|
identifier: Identifier;
|
|
@@ -732,7 +606,7 @@ type ClientAction = {
|
|
|
732
606
|
identifiers: Identifier[];
|
|
733
607
|
};
|
|
734
608
|
} | {
|
|
735
|
-
action: "client.
|
|
609
|
+
action: "client.getInboxIdByIdentifier";
|
|
736
610
|
id: string;
|
|
737
611
|
result: string | undefined;
|
|
738
612
|
data: {
|
|
@@ -763,22 +637,12 @@ type ClientAction = {
|
|
|
763
637
|
publicKey: Uint8Array;
|
|
764
638
|
};
|
|
765
639
|
} | {
|
|
766
|
-
action: "client.
|
|
640
|
+
action: "client.fetchKeyPackageStatuses";
|
|
767
641
|
id: string;
|
|
768
|
-
result: Map<string,
|
|
642
|
+
result: Map<string, KeyPackageStatus>;
|
|
769
643
|
data: {
|
|
770
644
|
installationIds: string[];
|
|
771
645
|
};
|
|
772
|
-
} | {
|
|
773
|
-
action: "client.libxmtpVersion";
|
|
774
|
-
id: string;
|
|
775
|
-
result: string;
|
|
776
|
-
data: undefined;
|
|
777
|
-
} | {
|
|
778
|
-
action: "client.appVersion";
|
|
779
|
-
id: string;
|
|
780
|
-
result: string;
|
|
781
|
-
data: undefined;
|
|
782
646
|
};
|
|
783
647
|
|
|
784
648
|
type ConversationAction = {
|
|
@@ -794,17 +658,8 @@ type ConversationAction = {
|
|
|
794
658
|
result: string;
|
|
795
659
|
data: {
|
|
796
660
|
id: string;
|
|
797
|
-
content:
|
|
798
|
-
|
|
799
|
-
};
|
|
800
|
-
} | {
|
|
801
|
-
action: "conversation.sendOptimistic";
|
|
802
|
-
id: string;
|
|
803
|
-
result: string;
|
|
804
|
-
data: {
|
|
805
|
-
id: string;
|
|
806
|
-
content: SafeEncodedContent;
|
|
807
|
-
sendOptions: SafeSendMessageOpts;
|
|
661
|
+
content: EncodedContent;
|
|
662
|
+
options?: SendMessageOpts;
|
|
808
663
|
};
|
|
809
664
|
} | {
|
|
810
665
|
action: "conversation.publishMessages";
|
|
@@ -816,10 +671,10 @@ type ConversationAction = {
|
|
|
816
671
|
} | {
|
|
817
672
|
action: "conversation.messages";
|
|
818
673
|
id: string;
|
|
819
|
-
result:
|
|
674
|
+
result: DecodedMessage$1[];
|
|
820
675
|
data: {
|
|
821
676
|
id: string;
|
|
822
|
-
options?:
|
|
677
|
+
options?: ListMessagesOptions;
|
|
823
678
|
};
|
|
824
679
|
} | {
|
|
825
680
|
action: "conversation.countMessages";
|
|
@@ -827,19 +682,19 @@ type ConversationAction = {
|
|
|
827
682
|
result: bigint;
|
|
828
683
|
data: {
|
|
829
684
|
id: string;
|
|
830
|
-
options?: Omit<
|
|
685
|
+
options?: Omit<ListMessagesOptions, "limit" | "direction">;
|
|
831
686
|
};
|
|
832
687
|
} | {
|
|
833
688
|
action: "conversation.members";
|
|
834
689
|
id: string;
|
|
835
|
-
result:
|
|
690
|
+
result: GroupMember[];
|
|
836
691
|
data: {
|
|
837
692
|
id: string;
|
|
838
693
|
};
|
|
839
694
|
} | {
|
|
840
695
|
action: "conversation.messageDisappearingSettings";
|
|
841
696
|
id: string;
|
|
842
|
-
result:
|
|
697
|
+
result: MessageDisappearingSettings | undefined;
|
|
843
698
|
data: {
|
|
844
699
|
id: string;
|
|
845
700
|
};
|
|
@@ -847,7 +702,7 @@ type ConversationAction = {
|
|
|
847
702
|
action: "conversation.updateMessageDisappearingSettings";
|
|
848
703
|
id: string;
|
|
849
704
|
result: undefined;
|
|
850
|
-
data:
|
|
705
|
+
data: MessageDisappearingSettings & {
|
|
851
706
|
id: string;
|
|
852
707
|
};
|
|
853
708
|
} | {
|
|
@@ -880,16 +735,16 @@ type ConversationAction = {
|
|
|
880
735
|
id: string;
|
|
881
736
|
};
|
|
882
737
|
} | {
|
|
883
|
-
action: "conversation.
|
|
738
|
+
action: "conversation.hmacKeys";
|
|
884
739
|
id: string;
|
|
885
|
-
result:
|
|
740
|
+
result: HmacKeys;
|
|
886
741
|
data: {
|
|
887
742
|
id: string;
|
|
888
743
|
};
|
|
889
744
|
} | {
|
|
890
745
|
action: "conversation.debugInfo";
|
|
891
746
|
id: string;
|
|
892
|
-
result:
|
|
747
|
+
result: ConversationDebugInfo;
|
|
893
748
|
data: {
|
|
894
749
|
id: string;
|
|
895
750
|
};
|
|
@@ -911,7 +766,7 @@ type ConversationAction = {
|
|
|
911
766
|
} | {
|
|
912
767
|
action: "conversation.lastMessage";
|
|
913
768
|
id: string;
|
|
914
|
-
result:
|
|
769
|
+
result: DecodedMessage$1 | undefined;
|
|
915
770
|
data: {
|
|
916
771
|
id: string;
|
|
917
772
|
};
|
|
@@ -922,6 +777,120 @@ type ConversationAction = {
|
|
|
922
777
|
data: {
|
|
923
778
|
id: string;
|
|
924
779
|
};
|
|
780
|
+
} | {
|
|
781
|
+
action: "conversation.lastReadTimes";
|
|
782
|
+
id: string;
|
|
783
|
+
result: LastReadTimes;
|
|
784
|
+
data: {
|
|
785
|
+
id: string;
|
|
786
|
+
};
|
|
787
|
+
} | {
|
|
788
|
+
action: "conversation.sendText";
|
|
789
|
+
id: string;
|
|
790
|
+
result: string;
|
|
791
|
+
data: {
|
|
792
|
+
id: string;
|
|
793
|
+
text: string;
|
|
794
|
+
isOptimistic?: boolean;
|
|
795
|
+
};
|
|
796
|
+
} | {
|
|
797
|
+
action: "conversation.sendMarkdown";
|
|
798
|
+
id: string;
|
|
799
|
+
result: string;
|
|
800
|
+
data: {
|
|
801
|
+
id: string;
|
|
802
|
+
markdown: string;
|
|
803
|
+
isOptimistic?: boolean;
|
|
804
|
+
};
|
|
805
|
+
} | {
|
|
806
|
+
action: "conversation.sendReaction";
|
|
807
|
+
id: string;
|
|
808
|
+
result: string;
|
|
809
|
+
data: {
|
|
810
|
+
id: string;
|
|
811
|
+
reaction: Reaction;
|
|
812
|
+
isOptimistic?: boolean;
|
|
813
|
+
};
|
|
814
|
+
} | {
|
|
815
|
+
action: "conversation.sendReadReceipt";
|
|
816
|
+
id: string;
|
|
817
|
+
result: string;
|
|
818
|
+
data: {
|
|
819
|
+
id: string;
|
|
820
|
+
isOptimistic?: boolean;
|
|
821
|
+
};
|
|
822
|
+
} | {
|
|
823
|
+
action: "conversation.sendReply";
|
|
824
|
+
id: string;
|
|
825
|
+
result: string;
|
|
826
|
+
data: {
|
|
827
|
+
id: string;
|
|
828
|
+
reply: Reply;
|
|
829
|
+
isOptimistic?: boolean;
|
|
830
|
+
};
|
|
831
|
+
} | {
|
|
832
|
+
action: "conversation.sendTransactionReference";
|
|
833
|
+
id: string;
|
|
834
|
+
result: string;
|
|
835
|
+
data: {
|
|
836
|
+
id: string;
|
|
837
|
+
transactionReference: TransactionReference;
|
|
838
|
+
isOptimistic?: boolean;
|
|
839
|
+
};
|
|
840
|
+
} | {
|
|
841
|
+
action: "conversation.sendWalletSendCalls";
|
|
842
|
+
id: string;
|
|
843
|
+
result: string;
|
|
844
|
+
data: {
|
|
845
|
+
id: string;
|
|
846
|
+
walletSendCalls: WalletSendCalls;
|
|
847
|
+
isOptimistic?: boolean;
|
|
848
|
+
};
|
|
849
|
+
} | {
|
|
850
|
+
action: "conversation.sendActions";
|
|
851
|
+
id: string;
|
|
852
|
+
result: string;
|
|
853
|
+
data: {
|
|
854
|
+
id: string;
|
|
855
|
+
actions: Actions;
|
|
856
|
+
isOptimistic?: boolean;
|
|
857
|
+
};
|
|
858
|
+
} | {
|
|
859
|
+
action: "conversation.sendIntent";
|
|
860
|
+
id: string;
|
|
861
|
+
result: string;
|
|
862
|
+
data: {
|
|
863
|
+
id: string;
|
|
864
|
+
intent: Intent;
|
|
865
|
+
isOptimistic?: boolean;
|
|
866
|
+
};
|
|
867
|
+
} | {
|
|
868
|
+
action: "conversation.sendAttachment";
|
|
869
|
+
id: string;
|
|
870
|
+
result: string;
|
|
871
|
+
data: {
|
|
872
|
+
id: string;
|
|
873
|
+
attachment: Attachment;
|
|
874
|
+
isOptimistic?: boolean;
|
|
875
|
+
};
|
|
876
|
+
} | {
|
|
877
|
+
action: "conversation.sendMultiRemoteAttachment";
|
|
878
|
+
id: string;
|
|
879
|
+
result: string;
|
|
880
|
+
data: {
|
|
881
|
+
id: string;
|
|
882
|
+
multiRemoteAttachment: MultiRemoteAttachment;
|
|
883
|
+
isOptimistic?: boolean;
|
|
884
|
+
};
|
|
885
|
+
} | {
|
|
886
|
+
action: "conversation.sendRemoteAttachment";
|
|
887
|
+
id: string;
|
|
888
|
+
result: string;
|
|
889
|
+
data: {
|
|
890
|
+
id: string;
|
|
891
|
+
remoteAttachment: RemoteAttachment;
|
|
892
|
+
isOptimistic?: boolean;
|
|
893
|
+
};
|
|
925
894
|
};
|
|
926
895
|
|
|
927
896
|
type ConversationsAction = {
|
|
@@ -934,7 +903,7 @@ type ConversationsAction = {
|
|
|
934
903
|
} | {
|
|
935
904
|
action: "conversations.getMessageById";
|
|
936
905
|
id: string;
|
|
937
|
-
result:
|
|
906
|
+
result: DecodedMessage$1 | undefined;
|
|
938
907
|
data: {
|
|
939
908
|
id: string;
|
|
940
909
|
};
|
|
@@ -950,60 +919,60 @@ type ConversationsAction = {
|
|
|
950
919
|
id: string;
|
|
951
920
|
result: SafeConversation[];
|
|
952
921
|
data: {
|
|
953
|
-
options?:
|
|
922
|
+
options?: ListConversationsOptions;
|
|
954
923
|
};
|
|
955
924
|
} | {
|
|
956
925
|
action: "conversations.listGroups";
|
|
957
926
|
id: string;
|
|
958
927
|
result: SafeConversation[];
|
|
959
928
|
data: {
|
|
960
|
-
options?: Omit<
|
|
929
|
+
options?: Omit<ListConversationsOptions, "conversationType">;
|
|
961
930
|
};
|
|
962
931
|
} | {
|
|
963
932
|
action: "conversations.listDms";
|
|
964
933
|
id: string;
|
|
965
934
|
result: SafeConversation[];
|
|
966
935
|
data: {
|
|
967
|
-
options?: Omit<
|
|
936
|
+
options?: Omit<ListConversationsOptions, "conversationType">;
|
|
968
937
|
};
|
|
969
938
|
} | {
|
|
970
|
-
action: "conversations.
|
|
939
|
+
action: "conversations.createGroupOptimistic";
|
|
971
940
|
id: string;
|
|
972
941
|
result: SafeConversation;
|
|
973
942
|
data: {
|
|
974
|
-
options?:
|
|
943
|
+
options?: CreateGroupOptions;
|
|
975
944
|
};
|
|
976
945
|
} | {
|
|
977
|
-
action: "conversations.
|
|
946
|
+
action: "conversations.createGroupWithIdentifiers";
|
|
978
947
|
id: string;
|
|
979
948
|
result: SafeConversation;
|
|
980
949
|
data: {
|
|
981
950
|
identifiers: Identifier[];
|
|
982
|
-
options?:
|
|
951
|
+
options?: CreateGroupOptions;
|
|
983
952
|
};
|
|
984
953
|
} | {
|
|
985
|
-
action: "conversations.
|
|
954
|
+
action: "conversations.createGroup";
|
|
986
955
|
id: string;
|
|
987
956
|
result: SafeConversation;
|
|
988
957
|
data: {
|
|
989
958
|
inboxIds: string[];
|
|
990
|
-
options?:
|
|
959
|
+
options?: CreateGroupOptions;
|
|
991
960
|
};
|
|
992
961
|
} | {
|
|
993
|
-
action: "conversations.
|
|
962
|
+
action: "conversations.createDmWithIdentifier";
|
|
994
963
|
id: string;
|
|
995
964
|
result: SafeConversation;
|
|
996
965
|
data: {
|
|
997
966
|
identifier: Identifier;
|
|
998
|
-
options?:
|
|
967
|
+
options?: CreateDmOptions;
|
|
999
968
|
};
|
|
1000
969
|
} | {
|
|
1001
|
-
action: "conversations.
|
|
970
|
+
action: "conversations.createDm";
|
|
1002
971
|
id: string;
|
|
1003
972
|
result: SafeConversation;
|
|
1004
973
|
data: {
|
|
1005
974
|
inboxId: string;
|
|
1006
|
-
options?:
|
|
975
|
+
options?: CreateDmOptions;
|
|
1007
976
|
};
|
|
1008
977
|
} | {
|
|
1009
978
|
action: "conversations.sync";
|
|
@@ -1018,9 +987,9 @@ type ConversationsAction = {
|
|
|
1018
987
|
consentStates?: ConsentState[];
|
|
1019
988
|
};
|
|
1020
989
|
} | {
|
|
1021
|
-
action: "conversations.
|
|
990
|
+
action: "conversations.hmacKeys";
|
|
1022
991
|
id: string;
|
|
1023
|
-
result:
|
|
992
|
+
result: HmacKeys;
|
|
1024
993
|
data: undefined;
|
|
1025
994
|
} | {
|
|
1026
995
|
action: "conversations.stream";
|
|
@@ -1051,12 +1020,12 @@ type ConversationsAction = {
|
|
|
1051
1020
|
type DebugInformationAction = {
|
|
1052
1021
|
action: "debugInformation.apiStatistics";
|
|
1053
1022
|
id: string;
|
|
1054
|
-
result:
|
|
1023
|
+
result: ApiStats;
|
|
1055
1024
|
data: undefined;
|
|
1056
1025
|
} | {
|
|
1057
1026
|
action: "debugInformation.apiIdentityStatistics";
|
|
1058
1027
|
id: string;
|
|
1059
|
-
result:
|
|
1028
|
+
result: IdentityStats;
|
|
1060
1029
|
data: undefined;
|
|
1061
1030
|
} | {
|
|
1062
1031
|
action: "debugInformation.apiAggregateStatistics";
|
|
@@ -1068,13 +1037,6 @@ type DebugInformationAction = {
|
|
|
1068
1037
|
id: string;
|
|
1069
1038
|
result: undefined;
|
|
1070
1039
|
data: undefined;
|
|
1071
|
-
} | {
|
|
1072
|
-
action: "debugInformation.uploadDebugArchive";
|
|
1073
|
-
id: string;
|
|
1074
|
-
result: string;
|
|
1075
|
-
data: {
|
|
1076
|
-
serverUrl?: string;
|
|
1077
|
-
};
|
|
1078
1040
|
};
|
|
1079
1041
|
|
|
1080
1042
|
type DmAction = {
|
|
@@ -1085,7 +1047,7 @@ type DmAction = {
|
|
|
1085
1047
|
id: string;
|
|
1086
1048
|
};
|
|
1087
1049
|
} | {
|
|
1088
|
-
action: "dm.
|
|
1050
|
+
action: "dm.duplicateDms";
|
|
1089
1051
|
id: string;
|
|
1090
1052
|
result: SafeConversation[];
|
|
1091
1053
|
data: {
|
|
@@ -1255,31 +1217,24 @@ type GroupAction = {
|
|
|
1255
1217
|
type PreferencesAction = {
|
|
1256
1218
|
action: "preferences.inboxState";
|
|
1257
1219
|
id: string;
|
|
1258
|
-
result:
|
|
1220
|
+
result: InboxState;
|
|
1259
1221
|
data: {
|
|
1260
1222
|
refreshFromNetwork: boolean;
|
|
1261
1223
|
};
|
|
1262
1224
|
} | {
|
|
1263
|
-
action: "preferences.
|
|
1225
|
+
action: "preferences.getInboxStates";
|
|
1264
1226
|
id: string;
|
|
1265
|
-
result:
|
|
1227
|
+
result: InboxState[];
|
|
1266
1228
|
data: {
|
|
1267
1229
|
inboxIds: string[];
|
|
1268
1230
|
refreshFromNetwork: boolean;
|
|
1269
1231
|
};
|
|
1270
|
-
} | {
|
|
1271
|
-
action: "preferences.getLatestInboxState";
|
|
1272
|
-
id: string;
|
|
1273
|
-
result: SafeInboxState;
|
|
1274
|
-
data: {
|
|
1275
|
-
inboxId: string;
|
|
1276
|
-
};
|
|
1277
1232
|
} | {
|
|
1278
1233
|
action: "preferences.setConsentStates";
|
|
1279
1234
|
id: string;
|
|
1280
1235
|
result: undefined;
|
|
1281
1236
|
data: {
|
|
1282
|
-
records:
|
|
1237
|
+
records: Consent[];
|
|
1283
1238
|
};
|
|
1284
1239
|
} | {
|
|
1285
1240
|
action: "preferences.getConsentState";
|
|
@@ -1316,14 +1271,15 @@ type UnknownAction = {
|
|
|
1316
1271
|
result: unknown;
|
|
1317
1272
|
data: unknown;
|
|
1318
1273
|
};
|
|
1319
|
-
type
|
|
1274
|
+
type EndStreamAction = {
|
|
1320
1275
|
action: "endStream";
|
|
1321
1276
|
id: string;
|
|
1322
1277
|
result: undefined;
|
|
1323
1278
|
data: {
|
|
1324
1279
|
streamId: string;
|
|
1325
1280
|
};
|
|
1326
|
-
}
|
|
1281
|
+
};
|
|
1282
|
+
type ClientWorkerAction = EndStreamAction | ClientAction | ConversationAction | ConversationsAction | DmAction | GroupAction | PreferencesAction | DebugInformationAction;
|
|
1327
1283
|
type ActionName<T extends UnknownAction> = T["action"];
|
|
1328
1284
|
type ExtractAction<T extends UnknownAction, A extends ActionName<T>> = Extract<T, {
|
|
1329
1285
|
action: A;
|
|
@@ -1344,7 +1300,7 @@ type ActionErrorData<T extends UnknownAction> = {
|
|
|
1344
1300
|
type StreamAction = {
|
|
1345
1301
|
action: "stream.message";
|
|
1346
1302
|
streamId: string;
|
|
1347
|
-
result:
|
|
1303
|
+
result: DecodedMessage$1 | undefined;
|
|
1348
1304
|
} | {
|
|
1349
1305
|
action: "stream.conversation";
|
|
1350
1306
|
streamId: string;
|
|
@@ -1352,11 +1308,11 @@ type StreamAction = {
|
|
|
1352
1308
|
} | {
|
|
1353
1309
|
action: "stream.consent";
|
|
1354
1310
|
streamId: string;
|
|
1355
|
-
result:
|
|
1311
|
+
result: Consent[] | undefined;
|
|
1356
1312
|
} | {
|
|
1357
1313
|
action: "stream.preferences";
|
|
1358
1314
|
streamId: string;
|
|
1359
|
-
result:
|
|
1315
|
+
result: UserPreferenceUpdate[] | undefined;
|
|
1360
1316
|
} | {
|
|
1361
1317
|
action: "stream.messageDeleted";
|
|
1362
1318
|
streamId: string;
|
|
@@ -1368,85 +1324,45 @@ type StreamAction = {
|
|
|
1368
1324
|
};
|
|
1369
1325
|
|
|
1370
1326
|
/**
|
|
1371
|
-
* Class that sets up a
|
|
1327
|
+
* Class that sets up a bridge for worker communications
|
|
1372
1328
|
*
|
|
1373
|
-
* This class is not meant to be used directly
|
|
1374
|
-
* to provide an interface to the worker.
|
|
1329
|
+
* This class is not meant to be used directly.
|
|
1375
1330
|
*
|
|
1376
|
-
* @param worker - The worker to use for
|
|
1331
|
+
* @param worker - The worker to use for communications
|
|
1377
1332
|
* @param enableLogging - Whether to enable logging in the worker
|
|
1378
|
-
* @returns A new
|
|
1333
|
+
* @returns A new WorkerBridge instance
|
|
1379
1334
|
*/
|
|
1380
|
-
declare class
|
|
1335
|
+
declare class WorkerBridge<T extends UnknownAction> {
|
|
1381
1336
|
#private;
|
|
1382
|
-
constructor(worker: Worker, enableLogging
|
|
1337
|
+
constructor(worker: Worker, enableLogging?: boolean);
|
|
1383
1338
|
/**
|
|
1384
|
-
* Sends an action message to the
|
|
1339
|
+
* Sends an action message to the worker
|
|
1385
1340
|
*
|
|
1386
1341
|
* @param action - The action to send to the worker
|
|
1387
1342
|
* @param data - The data to send to the worker
|
|
1388
1343
|
* @returns A promise that resolves when the action is completed
|
|
1389
1344
|
*/
|
|
1390
|
-
|
|
1345
|
+
action<A extends ActionName<T>, D = ExtractActionData<T, A>, R = ExtractActionResult<T, A>>(action: A, ...args: D extends undefined ? [] : [data: D]): [R] extends [undefined] ? Promise<void> : Promise<R>;
|
|
1391
1346
|
/**
|
|
1392
|
-
* Handles a message from the
|
|
1347
|
+
* Handles a message from the worker
|
|
1393
1348
|
*
|
|
1394
1349
|
* @param event - The event to handle
|
|
1395
1350
|
*/
|
|
1396
|
-
handleMessage: (event: MessageEvent<ActionWithoutData<
|
|
1351
|
+
handleMessage: (event: MessageEvent<ActionWithoutData<T> | ActionErrorData<T>>) => void;
|
|
1397
1352
|
/**
|
|
1398
|
-
* Handles a stream message from the
|
|
1353
|
+
* Handles a stream message from the worker
|
|
1399
1354
|
*
|
|
1400
1355
|
* @param streamId - The ID of the stream to handle
|
|
1401
1356
|
* @param callback - The callback to handle the stream message
|
|
1402
1357
|
* @returns A function to remove the stream handler
|
|
1403
1358
|
*/
|
|
1404
|
-
handleStreamMessage: <
|
|
1359
|
+
handleStreamMessage: <R extends StreamAction["result"], V = R>(streamId: string, callback: (error: Error | null, value: R | undefined) => void, options?: StreamOptions<R, V>) => () => Promise<void>;
|
|
1405
1360
|
/**
|
|
1406
1361
|
* Removes all event listeners and terminates the worker
|
|
1407
1362
|
*/
|
|
1408
1363
|
close(): void;
|
|
1409
1364
|
}
|
|
1410
1365
|
|
|
1411
|
-
type MessageKind = "application" | "membership_change";
|
|
1412
|
-
type MessageDeliveryStatus = "unpublished" | "published" | "failed";
|
|
1413
|
-
/**
|
|
1414
|
-
* Represents a decoded XMTP message
|
|
1415
|
-
*
|
|
1416
|
-
* This class transforms network messages into a structured format with
|
|
1417
|
-
* content decoding.
|
|
1418
|
-
*
|
|
1419
|
-
* @class
|
|
1420
|
-
* @property {any} content - The decoded content of the message
|
|
1421
|
-
* @property {ContentTypeId} contentType - The content type of the message content
|
|
1422
|
-
* @property {string} conversationId - Unique identifier for the conversation
|
|
1423
|
-
* @property {MessageDeliveryStatus} deliveryStatus - Current delivery status of the message ("unpublished" | "published" | "failed")
|
|
1424
|
-
* @property {string} [fallback] - Optional fallback text for the message
|
|
1425
|
-
* @property {number} [compression] - Optional compression level applied to the message
|
|
1426
|
-
* @property {string} id - Unique identifier for the message
|
|
1427
|
-
* @property {MessageKind} kind - Type of message ("application" | "membership_change")
|
|
1428
|
-
* @property {Map<string, string>} parameters - Additional parameters associated with the message
|
|
1429
|
-
* @property {SafeMessage["content"]} encodedContent - Raw encoded content of the message
|
|
1430
|
-
* @property {string} senderInboxId - Identifier for the sender's inbox
|
|
1431
|
-
* @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
|
|
1432
|
-
*/
|
|
1433
|
-
declare class DecodedMessage<ContentTypes = unknown> {
|
|
1434
|
-
#private;
|
|
1435
|
-
content: ContentTypes | undefined;
|
|
1436
|
-
contentType: ContentTypeId$1;
|
|
1437
|
-
conversationId: string;
|
|
1438
|
-
deliveryStatus: MessageDeliveryStatus;
|
|
1439
|
-
fallback?: string;
|
|
1440
|
-
compression?: number;
|
|
1441
|
-
id: string;
|
|
1442
|
-
kind: MessageKind;
|
|
1443
|
-
parameters: Map<string, string>;
|
|
1444
|
-
encodedContent: SafeMessage["content"];
|
|
1445
|
-
senderInboxId: string;
|
|
1446
|
-
sentAtNs: bigint;
|
|
1447
|
-
constructor(client: Client<ContentTypes>, message: SafeMessage);
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
1366
|
/**
|
|
1451
1367
|
* Represents a conversation
|
|
1452
1368
|
*
|
|
@@ -1457,20 +1373,17 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
1457
1373
|
/**
|
|
1458
1374
|
* Creates a new conversation instance
|
|
1459
1375
|
*
|
|
1460
|
-
* @param
|
|
1376
|
+
* @param worker - The worker bridge instance for client communication
|
|
1377
|
+
* @param codecRegistry - The codec registry instance
|
|
1461
1378
|
* @param id - The unique identifier for this conversation
|
|
1462
1379
|
* @param data - Optional conversation data to initialize with
|
|
1463
1380
|
*/
|
|
1464
|
-
constructor(
|
|
1381
|
+
constructor(worker: WorkerBridge<ClientWorkerAction>, codecRegistry: CodecRegistry, id: string, data?: SafeConversation);
|
|
1465
1382
|
get id(): string;
|
|
1466
|
-
get isCommitLogForked(): boolean | undefined;
|
|
1467
1383
|
get addedByInboxId(): string | undefined;
|
|
1468
1384
|
get createdAtNs(): bigint | undefined;
|
|
1469
1385
|
get createdAt(): Date | undefined;
|
|
1470
|
-
get metadata():
|
|
1471
|
-
creatorInboxId: string;
|
|
1472
|
-
conversationType: string;
|
|
1473
|
-
} | undefined;
|
|
1386
|
+
get metadata(): _xmtp_wasm_bindings.GroupMetadata | undefined;
|
|
1474
1387
|
lastMessage(): Promise<DecodedMessage<ContentTypes> | undefined>;
|
|
1475
1388
|
isActive(): Promise<boolean>;
|
|
1476
1389
|
/**
|
|
@@ -1478,7 +1391,7 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
1478
1391
|
*
|
|
1479
1392
|
* @returns Promise that resolves with the conversation members
|
|
1480
1393
|
*/
|
|
1481
|
-
members(): Promise<
|
|
1394
|
+
members(): Promise<_xmtp_wasm_bindings.GroupMember[]>;
|
|
1482
1395
|
/**
|
|
1483
1396
|
* Synchronizes conversation data from the network
|
|
1484
1397
|
*
|
|
@@ -1492,37 +1405,126 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
1492
1405
|
*/
|
|
1493
1406
|
publishMessages(): Promise<void>;
|
|
1494
1407
|
/**
|
|
1495
|
-
*
|
|
1408
|
+
* Sends a message
|
|
1409
|
+
*
|
|
1410
|
+
* @param content - The encoded content to send
|
|
1411
|
+
* @param options - Optional send options
|
|
1412
|
+
* @param options.shouldPush - Indicates whether this message should be
|
|
1413
|
+
* included in push notifications
|
|
1414
|
+
* @param options.isOptimistic - Indicates whether this message should be
|
|
1415
|
+
* sent optimistically and published later via `publishMessages`
|
|
1416
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1417
|
+
*/
|
|
1418
|
+
send(content: EncodedContent, options?: SendMessageOpts): Promise<string>;
|
|
1419
|
+
/**
|
|
1420
|
+
* Sends a text message
|
|
1421
|
+
*
|
|
1422
|
+
* @param text - The text to send
|
|
1423
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1424
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1425
|
+
*/
|
|
1426
|
+
sendText(text: string, isOptimistic?: boolean): Promise<string>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Sends a markdown message
|
|
1429
|
+
*
|
|
1430
|
+
* @param markdown - The markdown to send
|
|
1431
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1432
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1433
|
+
*/
|
|
1434
|
+
sendMarkdown(markdown: string, isOptimistic?: boolean): Promise<string>;
|
|
1435
|
+
/**
|
|
1436
|
+
* Sends a reaction message
|
|
1437
|
+
*
|
|
1438
|
+
* @param reaction - The reaction to send
|
|
1439
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1440
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1441
|
+
*/
|
|
1442
|
+
sendReaction(reaction: Reaction, isOptimistic?: boolean): Promise<string>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Sends a read receipt message
|
|
1445
|
+
*
|
|
1446
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1447
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1448
|
+
*/
|
|
1449
|
+
sendReadReceipt(isOptimistic?: boolean): Promise<string>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Sends a reply message
|
|
1452
|
+
*
|
|
1453
|
+
* @param reply - The reply to send
|
|
1454
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1455
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1456
|
+
*/
|
|
1457
|
+
sendReply(reply: Reply, isOptimistic?: boolean): Promise<string>;
|
|
1458
|
+
/**
|
|
1459
|
+
* Sends a transaction reference message
|
|
1460
|
+
*
|
|
1461
|
+
* @param transactionReference - The transaction reference to send
|
|
1462
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1463
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1464
|
+
*/
|
|
1465
|
+
sendTransactionReference(transactionReference: TransactionReference, isOptimistic?: boolean): Promise<string>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Sends a wallet send calls message
|
|
1468
|
+
*
|
|
1469
|
+
* @param walletSendCalls - The wallet send calls to send
|
|
1470
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1471
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1472
|
+
*/
|
|
1473
|
+
sendWalletSendCalls(walletSendCalls: WalletSendCalls, isOptimistic?: boolean): Promise<string>;
|
|
1474
|
+
/**
|
|
1475
|
+
* Sends an actions message
|
|
1476
|
+
*
|
|
1477
|
+
* @param actions - The actions to send
|
|
1478
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1479
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1480
|
+
*/
|
|
1481
|
+
sendActions(actions: Actions, isOptimistic?: boolean): Promise<string>;
|
|
1482
|
+
/**
|
|
1483
|
+
* Sends an intent message
|
|
1484
|
+
*
|
|
1485
|
+
* @param intent - The intent to send
|
|
1486
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1487
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1488
|
+
*/
|
|
1489
|
+
sendIntent(intent: Intent, isOptimistic?: boolean): Promise<string>;
|
|
1490
|
+
/**
|
|
1491
|
+
* Sends an attachment message
|
|
1492
|
+
*
|
|
1493
|
+
* @param attachment - The attachment to send
|
|
1494
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1495
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1496
|
+
*/
|
|
1497
|
+
sendAttachment(attachment: Attachment, isOptimistic?: boolean): Promise<string>;
|
|
1498
|
+
/**
|
|
1499
|
+
* Sends a multi remote attachment message
|
|
1496
1500
|
*
|
|
1497
|
-
* @param
|
|
1498
|
-
* @param
|
|
1499
|
-
* @returns Promise that resolves with the message ID
|
|
1500
|
-
* @throws {MissingContentTypeError} if content type is required but not provided
|
|
1501
|
+
* @param multiRemoteAttachment - The multi remote attachment to send
|
|
1502
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1503
|
+
* @returns Promise that resolves with the message ID after it has been sent
|
|
1501
1504
|
*/
|
|
1502
|
-
|
|
1505
|
+
sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, isOptimistic?: boolean): Promise<string>;
|
|
1503
1506
|
/**
|
|
1504
|
-
*
|
|
1507
|
+
* Sends a remote attachment message
|
|
1505
1508
|
*
|
|
1506
|
-
* @param
|
|
1507
|
-
* @param
|
|
1509
|
+
* @param remoteAttachment - The remote attachment to send
|
|
1510
|
+
* @param isOptimistic - Whether to send the message optimistically
|
|
1508
1511
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
1509
|
-
* @throws {MissingContentTypeError} if content type is required but not provided
|
|
1510
1512
|
*/
|
|
1511
|
-
|
|
1513
|
+
sendRemoteAttachment(remoteAttachment: RemoteAttachment, isOptimistic?: boolean): Promise<string>;
|
|
1512
1514
|
/**
|
|
1513
1515
|
* Lists messages in this conversation
|
|
1514
1516
|
*
|
|
1515
1517
|
* @param options - Optional filtering and pagination options
|
|
1516
1518
|
* @returns Promise that resolves with an array of decoded messages
|
|
1517
1519
|
*/
|
|
1518
|
-
messages(options?:
|
|
1520
|
+
messages(options?: ListMessagesOptions): Promise<DecodedMessage<ContentTypes>[]>;
|
|
1519
1521
|
/**
|
|
1520
1522
|
* Counts messages in this conversation
|
|
1521
1523
|
*
|
|
1522
1524
|
* @param options - Optional filtering options
|
|
1523
1525
|
* @returns Promise that resolves with the count of messages
|
|
1524
1526
|
*/
|
|
1525
|
-
countMessages(options?: Omit<
|
|
1527
|
+
countMessages(options?: Omit<ListMessagesOptions, "limit" | "direction">): Promise<bigint>;
|
|
1526
1528
|
/**
|
|
1527
1529
|
* Gets the consent state for this conversation
|
|
1528
1530
|
*
|
|
@@ -1541,7 +1543,7 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
1541
1543
|
*
|
|
1542
1544
|
* @returns Promise that resolves with the current message disappearing settings
|
|
1543
1545
|
*/
|
|
1544
|
-
messageDisappearingSettings(): Promise<
|
|
1546
|
+
messageDisappearingSettings(): Promise<_xmtp_wasm_bindings.MessageDisappearingSettings | undefined>;
|
|
1545
1547
|
/**
|
|
1546
1548
|
* Updates message disappearing settings for this conversation
|
|
1547
1549
|
*
|
|
@@ -1568,20 +1570,27 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
1568
1570
|
* @param callback - Optional callback function for handling new stream values
|
|
1569
1571
|
* @returns Stream instance for new messages
|
|
1570
1572
|
*/
|
|
1571
|
-
stream(options?: StreamOptions<
|
|
1573
|
+
stream(options?: StreamOptions<DecodedMessage$1, DecodedMessage<ContentTypes>>): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
|
|
1572
1574
|
pausedForVersion(): Promise<string | undefined>;
|
|
1573
1575
|
/**
|
|
1574
|
-
*
|
|
1576
|
+
* Gets HMAC keys for this conversation
|
|
1575
1577
|
*
|
|
1576
1578
|
* @returns Promise that resolves with the HMAC keys
|
|
1577
1579
|
*/
|
|
1578
|
-
|
|
1580
|
+
hmacKeys(): Promise<HmacKeys>;
|
|
1579
1581
|
/**
|
|
1580
1582
|
* Retrieves information for this conversation to help with debugging
|
|
1581
1583
|
*
|
|
1582
1584
|
* @returns The debug information for this conversation
|
|
1583
1585
|
*/
|
|
1584
|
-
debugInfo(): Promise<
|
|
1586
|
+
debugInfo(): Promise<_xmtp_wasm_bindings.ConversationDebugInfo>;
|
|
1587
|
+
/**
|
|
1588
|
+
* Retrieves the last read times for this conversation
|
|
1589
|
+
*
|
|
1590
|
+
* @returns A map keyed by inbox ID with the last read timestamp
|
|
1591
|
+
* (nanoseconds since epoch)
|
|
1592
|
+
*/
|
|
1593
|
+
lastReadTimes(): Promise<LastReadTimes>;
|
|
1585
1594
|
}
|
|
1586
1595
|
|
|
1587
1596
|
/**
|
|
@@ -1594,18 +1603,19 @@ declare class Dm<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
|
1594
1603
|
/**
|
|
1595
1604
|
* Creates a new direct message conversation instance
|
|
1596
1605
|
*
|
|
1597
|
-
* @param
|
|
1606
|
+
* @param worker - The worker bridge instance for client communication
|
|
1607
|
+
* @param codecRegistry - The codec registry instance
|
|
1598
1608
|
* @param id - Identifier for the direct message conversation
|
|
1599
1609
|
* @param data - Optional conversation data to initialize with
|
|
1600
1610
|
*/
|
|
1601
|
-
constructor(
|
|
1611
|
+
constructor(worker: WorkerBridge<ClientWorkerAction>, codecRegistry: CodecRegistry, id: string, data?: SafeConversation);
|
|
1602
1612
|
/**
|
|
1603
1613
|
* Retrieves the inbox ID of the other participant in the DM
|
|
1604
1614
|
*
|
|
1605
1615
|
* @returns Promise that resolves with the peer's inbox ID
|
|
1606
1616
|
*/
|
|
1607
1617
|
peerInboxId(): Promise<string>;
|
|
1608
|
-
|
|
1618
|
+
duplicateDms(): Promise<Dm<ContentTypes>[]>;
|
|
1609
1619
|
}
|
|
1610
1620
|
|
|
1611
1621
|
/**
|
|
@@ -1618,11 +1628,12 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
|
1618
1628
|
/**
|
|
1619
1629
|
* Creates a new group conversation instance
|
|
1620
1630
|
*
|
|
1621
|
-
* @param
|
|
1631
|
+
* @param worker - The worker bridge instance for client communication
|
|
1632
|
+
* @param codecRegistry - The codec registry instance
|
|
1622
1633
|
* @param id - Identifier for the group conversation
|
|
1623
1634
|
* @param data - Optional conversation data to initialize with
|
|
1624
1635
|
*/
|
|
1625
|
-
constructor(
|
|
1636
|
+
constructor(worker: WorkerBridge<ClientWorkerAction>, codecRegistry: CodecRegistry, id: string, data?: SafeConversation);
|
|
1626
1637
|
/**
|
|
1627
1638
|
* Synchronizes the group's data with the network
|
|
1628
1639
|
*
|
|
@@ -1696,16 +1707,7 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
|
|
|
1696
1707
|
*/
|
|
1697
1708
|
permissions(): Promise<{
|
|
1698
1709
|
policyType: _xmtp_wasm_bindings.GroupPermissionsOptions;
|
|
1699
|
-
policySet:
|
|
1700
|
-
addAdminPolicy: PermissionPolicy;
|
|
1701
|
-
addMemberPolicy: PermissionPolicy;
|
|
1702
|
-
removeAdminPolicy: PermissionPolicy;
|
|
1703
|
-
removeMemberPolicy: PermissionPolicy;
|
|
1704
|
-
updateGroupDescriptionPolicy: PermissionPolicy;
|
|
1705
|
-
updateGroupImageUrlSquarePolicy: PermissionPolicy;
|
|
1706
|
-
updateGroupNamePolicy: PermissionPolicy;
|
|
1707
|
-
updateMessageDisappearingPolicy: PermissionPolicy;
|
|
1708
|
-
};
|
|
1710
|
+
policySet: _xmtp_wasm_bindings.PermissionPolicySet;
|
|
1709
1711
|
}>;
|
|
1710
1712
|
/**
|
|
1711
1713
|
* Updates a specific permission policy for the group
|
|
@@ -1799,9 +1801,10 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1799
1801
|
/**
|
|
1800
1802
|
* Creates a new conversations instance
|
|
1801
1803
|
*
|
|
1802
|
-
* @param
|
|
1804
|
+
* @param worker - The worker bridge instance for client communication
|
|
1805
|
+
* @param codecRegistry - The codec registry instance
|
|
1803
1806
|
*/
|
|
1804
|
-
constructor(
|
|
1807
|
+
constructor(worker: WorkerBridge<ClientWorkerAction>, codecRegistry: CodecRegistry);
|
|
1805
1808
|
/**
|
|
1806
1809
|
* Synchronizes conversations for the current client from the network
|
|
1807
1810
|
*
|
|
@@ -1837,42 +1840,42 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1837
1840
|
* @param inboxId - The inbox ID to look up
|
|
1838
1841
|
* @returns Promise that resolves with the DM, if found
|
|
1839
1842
|
*/
|
|
1840
|
-
getDmByInboxId(inboxId: string): Promise<Dm<
|
|
1843
|
+
getDmByInboxId(inboxId: string): Promise<Dm<unknown> | undefined>;
|
|
1841
1844
|
/**
|
|
1842
|
-
*
|
|
1845
|
+
* Fetches a DM by identifier
|
|
1843
1846
|
*
|
|
1844
1847
|
* @param identifier - The identifier to look up
|
|
1845
1848
|
* @returns Promise that resolves with the DM, if found
|
|
1846
1849
|
*/
|
|
1847
|
-
|
|
1850
|
+
fetchDmByIdentifier(identifier: Identifier): Promise<Dm<unknown> | undefined>;
|
|
1848
1851
|
/**
|
|
1849
1852
|
* Lists all conversations with optional filtering
|
|
1850
1853
|
*
|
|
1851
1854
|
* @param options - Optional filtering and pagination options
|
|
1852
1855
|
* @returns Promise that resolves with an array of conversations
|
|
1853
1856
|
*/
|
|
1854
|
-
list(options?:
|
|
1857
|
+
list(options?: ListConversationsOptions): Promise<(Group<ContentTypes> | Dm<ContentTypes>)[]>;
|
|
1855
1858
|
/**
|
|
1856
1859
|
* Lists all group conversations with optional filtering
|
|
1857
1860
|
*
|
|
1858
1861
|
* @param options - Optional filtering and pagination options
|
|
1859
1862
|
* @returns Promise that resolves with an array of groups
|
|
1860
1863
|
*/
|
|
1861
|
-
listGroups(options?: Omit<
|
|
1864
|
+
listGroups(options?: Omit<ListConversationsOptions, "conversationType">): Promise<Group<ContentTypes>[]>;
|
|
1862
1865
|
/**
|
|
1863
1866
|
* Lists all DM conversations with optional filtering
|
|
1864
1867
|
*
|
|
1865
1868
|
* @param options - Optional filtering and pagination options
|
|
1866
1869
|
* @returns Promise that resolves with an array of DMs
|
|
1867
1870
|
*/
|
|
1868
|
-
listDms(options?: Omit<
|
|
1871
|
+
listDms(options?: Omit<ListConversationsOptions, "conversationType">): Promise<Dm<ContentTypes>[]>;
|
|
1869
1872
|
/**
|
|
1870
|
-
* Creates a new group without
|
|
1873
|
+
* Creates a new group conversation without publishing to the network
|
|
1871
1874
|
*
|
|
1872
1875
|
* @param options - Optional group creation options
|
|
1873
1876
|
* @returns Promise that resolves with the new group
|
|
1874
1877
|
*/
|
|
1875
|
-
|
|
1878
|
+
createGroupOptimistic(options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
|
|
1876
1879
|
/**
|
|
1877
1880
|
* Creates a new group conversation with the specified identifiers
|
|
1878
1881
|
*
|
|
@@ -1880,7 +1883,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1880
1883
|
* @param options - Optional group creation options
|
|
1881
1884
|
* @returns Promise that resolves with the new group
|
|
1882
1885
|
*/
|
|
1883
|
-
|
|
1886
|
+
createGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
|
|
1884
1887
|
/**
|
|
1885
1888
|
* Creates a new group conversation with the specified inbox IDs
|
|
1886
1889
|
*
|
|
@@ -1888,7 +1891,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1888
1891
|
* @param options - Optional group creation options
|
|
1889
1892
|
* @returns Promise that resolves with the new group
|
|
1890
1893
|
*/
|
|
1891
|
-
|
|
1894
|
+
createGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
|
|
1892
1895
|
/**
|
|
1893
1896
|
* Creates a new DM conversation with the specified identifier
|
|
1894
1897
|
*
|
|
@@ -1896,7 +1899,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1896
1899
|
* @param options - Optional DM creation options
|
|
1897
1900
|
* @returns Promise that resolves with the new DM
|
|
1898
1901
|
*/
|
|
1899
|
-
|
|
1902
|
+
createDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
|
|
1900
1903
|
/**
|
|
1901
1904
|
* Creates a new DM conversation with the specified inbox ID
|
|
1902
1905
|
*
|
|
@@ -1904,13 +1907,13 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1904
1907
|
* @param options - Optional DM creation options
|
|
1905
1908
|
* @returns Promise that resolves with the new DM
|
|
1906
1909
|
*/
|
|
1907
|
-
|
|
1910
|
+
createDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
|
|
1908
1911
|
/**
|
|
1909
|
-
*
|
|
1912
|
+
* Gets the HMAC keys for all conversations
|
|
1910
1913
|
*
|
|
1911
1914
|
* @returns Promise that resolves with the HMAC keys for all conversations
|
|
1912
1915
|
*/
|
|
1913
|
-
|
|
1916
|
+
hmacKeys(): Promise<HmacKeys>;
|
|
1914
1917
|
/**
|
|
1915
1918
|
* Creates a stream for new conversations
|
|
1916
1919
|
*
|
|
@@ -1943,7 +1946,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1943
1946
|
* @param options.consentStates - Optional consent states to filter messages
|
|
1944
1947
|
* @returns Stream instance for new messages
|
|
1945
1948
|
*/
|
|
1946
|
-
streamAllMessages(options?: StreamOptions<
|
|
1949
|
+
streamAllMessages(options?: StreamOptions<DecodedMessage$1, DecodedMessage<ContentTypes>> & {
|
|
1947
1950
|
conversationType?: ConversationType;
|
|
1948
1951
|
consentStates?: ConsentState[];
|
|
1949
1952
|
}): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
|
|
@@ -1954,7 +1957,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1954
1957
|
* @param options.consentStates - Optional consent states to filter messages
|
|
1955
1958
|
* @returns Stream instance for new group messages
|
|
1956
1959
|
*/
|
|
1957
|
-
streamAllGroupMessages(options?: StreamOptions<
|
|
1960
|
+
streamAllGroupMessages(options?: StreamOptions<DecodedMessage$1, DecodedMessage<ContentTypes>> & {
|
|
1958
1961
|
consentStates?: ConsentState[];
|
|
1959
1962
|
}): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
|
|
1960
1963
|
/**
|
|
@@ -1964,7 +1967,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1964
1967
|
* @param options.consentStates - Optional consent states to filter messages
|
|
1965
1968
|
* @returns Stream instance for new DM messages
|
|
1966
1969
|
*/
|
|
1967
|
-
streamAllDmMessages(options?: StreamOptions<
|
|
1970
|
+
streamAllDmMessages(options?: StreamOptions<DecodedMessage$1, DecodedMessage<ContentTypes>> & {
|
|
1968
1971
|
consentStates?: ConsentState[];
|
|
1969
1972
|
}): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
|
|
1970
1973
|
/**
|
|
@@ -1981,14 +1984,13 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1981
1984
|
*
|
|
1982
1985
|
* This class is not intended to be initialized directly.
|
|
1983
1986
|
*/
|
|
1984
|
-
declare class DebugInformation
|
|
1987
|
+
declare class DebugInformation {
|
|
1985
1988
|
#private;
|
|
1986
|
-
constructor(
|
|
1987
|
-
apiStatistics(): Promise<
|
|
1988
|
-
apiIdentityStatistics(): Promise<
|
|
1989
|
+
constructor(worker: WorkerBridge<ClientWorkerAction>);
|
|
1990
|
+
apiStatistics(): Promise<_xmtp_wasm_bindings.ApiStats>;
|
|
1991
|
+
apiIdentityStatistics(): Promise<_xmtp_wasm_bindings.IdentityStats>;
|
|
1989
1992
|
apiAggregateStatistics(): Promise<string>;
|
|
1990
1993
|
clearAllStatistics(): Promise<void>;
|
|
1991
|
-
uploadDebugArchive(serverUrl?: string): Promise<string>;
|
|
1992
1994
|
}
|
|
1993
1995
|
|
|
1994
1996
|
/**
|
|
@@ -1996,44 +1998,49 @@ declare class DebugInformation<ContentTypes = unknown> {
|
|
|
1996
1998
|
*
|
|
1997
1999
|
* This class is not intended to be initialized directly.
|
|
1998
2000
|
*/
|
|
1999
|
-
declare class Preferences
|
|
2001
|
+
declare class Preferences {
|
|
2000
2002
|
#private;
|
|
2001
2003
|
/**
|
|
2002
2004
|
* Creates a new preferences instance
|
|
2003
2005
|
*
|
|
2004
2006
|
* @param client - The client instance managing preferences
|
|
2005
2007
|
*/
|
|
2006
|
-
constructor(
|
|
2008
|
+
constructor(worker: WorkerBridge<ClientWorkerAction>);
|
|
2007
2009
|
sync(): Promise<_xmtp_wasm_bindings.GroupSyncSummary>;
|
|
2008
2010
|
/**
|
|
2009
|
-
* Retrieves the current inbox state
|
|
2011
|
+
* Retrieves the current inbox state of this client from the local database
|
|
2010
2012
|
*
|
|
2011
|
-
* @param refreshFromNetwork - Optional flag to force refresh from network
|
|
2012
2013
|
* @returns Promise that resolves with the inbox state
|
|
2013
2014
|
*/
|
|
2014
|
-
inboxState(
|
|
2015
|
+
inboxState(): Promise<_xmtp_wasm_bindings.InboxState>;
|
|
2015
2016
|
/**
|
|
2016
|
-
* Retrieves inbox state
|
|
2017
|
+
* Retrieves the latest inbox state of this client from the network
|
|
2018
|
+
*
|
|
2019
|
+
* @returns Promise that resolves with the inbox state
|
|
2020
|
+
*/
|
|
2021
|
+
fetchInboxState(): Promise<_xmtp_wasm_bindings.InboxState>;
|
|
2022
|
+
/**
|
|
2023
|
+
* Retrieves the current inbox states for specified inbox IDs from the local
|
|
2024
|
+
* database
|
|
2017
2025
|
*
|
|
2018
2026
|
* @param inboxIds - Array of inbox IDs to get state for
|
|
2019
|
-
* @
|
|
2020
|
-
* @returns Promise that resolves with the inbox state for the inbox IDs
|
|
2027
|
+
* @returns Promise that resolves with the inbox states for the inbox IDs
|
|
2021
2028
|
*/
|
|
2022
|
-
|
|
2029
|
+
getInboxStates(inboxIds: string[]): Promise<_xmtp_wasm_bindings.InboxState[]>;
|
|
2023
2030
|
/**
|
|
2024
|
-
*
|
|
2031
|
+
* Retrieves the latest inbox states for specified inbox IDs from the network
|
|
2025
2032
|
*
|
|
2026
|
-
* @param
|
|
2027
|
-
* @returns Promise that resolves with the
|
|
2033
|
+
* @param inboxIds - Array of inbox IDs to get state for
|
|
2034
|
+
* @returns Promise that resolves with the inbox states for the inbox IDs
|
|
2028
2035
|
*/
|
|
2029
|
-
|
|
2036
|
+
fetchInboxStates(inboxIds: string[]): Promise<_xmtp_wasm_bindings.InboxState[]>;
|
|
2030
2037
|
/**
|
|
2031
2038
|
* Updates consent states for multiple records
|
|
2032
2039
|
*
|
|
2033
2040
|
* @param records - Array of consent records to update
|
|
2034
2041
|
* @returns Promise that resolves when consent states are updated
|
|
2035
2042
|
*/
|
|
2036
|
-
setConsentStates(records:
|
|
2043
|
+
setConsentStates(records: Consent[]): Promise<void>;
|
|
2037
2044
|
/**
|
|
2038
2045
|
* Retrieves consent state for a specific entity
|
|
2039
2046
|
*
|
|
@@ -2041,32 +2048,27 @@ declare class Preferences<ContentTypes = unknown> {
|
|
|
2041
2048
|
* @param entity - Entity identifier
|
|
2042
2049
|
* @returns Promise that resolves with the consent state
|
|
2043
2050
|
*/
|
|
2044
|
-
getConsentState(entityType: ConsentEntityType, entity: string): Promise<
|
|
2051
|
+
getConsentState(entityType: ConsentEntityType, entity: string): Promise<ConsentState>;
|
|
2045
2052
|
/**
|
|
2046
2053
|
* Creates a stream of consent state updates
|
|
2047
2054
|
*
|
|
2048
2055
|
* @param options - Optional stream options
|
|
2049
2056
|
* @returns Stream instance for consent updates
|
|
2050
2057
|
*/
|
|
2051
|
-
streamConsent(options?: StreamOptions<
|
|
2058
|
+
streamConsent(options?: StreamOptions<Consent[]>): Promise<AsyncStreamProxy<Consent[]>>;
|
|
2052
2059
|
/**
|
|
2053
2060
|
* Creates a stream of user preference updates
|
|
2054
2061
|
*
|
|
2055
2062
|
* @param options - Optional stream options
|
|
2056
2063
|
* @returns Stream instance for preference updates
|
|
2057
2064
|
*/
|
|
2058
|
-
streamPreferences(options?: StreamOptions<
|
|
2065
|
+
streamPreferences(options?: StreamOptions<UserPreferenceUpdate[]>): Promise<AsyncStreamProxy<UserPreferenceUpdate[]>>;
|
|
2059
2066
|
}
|
|
2060
2067
|
|
|
2061
|
-
type ExtractCodecContentTypes<C extends ContentCodec[] = []> = [
|
|
2062
|
-
...C,
|
|
2063
|
-
GroupUpdatedCodec,
|
|
2064
|
-
TextCodec
|
|
2065
|
-
][number] extends ContentCodec<infer T> ? T : never;
|
|
2066
2068
|
/**
|
|
2067
2069
|
* Client for interacting with the XMTP network
|
|
2068
2070
|
*/
|
|
2069
|
-
declare class Client<ContentTypes = ExtractCodecContentTypes>
|
|
2071
|
+
declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
2070
2072
|
#private;
|
|
2071
2073
|
/**
|
|
2072
2074
|
* Creates a new XMTP client instance
|
|
@@ -2086,6 +2088,10 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> extends ClientWork
|
|
|
2086
2088
|
* @param identifier - The identifier to initialize the client with
|
|
2087
2089
|
*/
|
|
2088
2090
|
init(identifier: Identifier): Promise<void>;
|
|
2091
|
+
/**
|
|
2092
|
+
* Shutdown the client
|
|
2093
|
+
*/
|
|
2094
|
+
close(): void;
|
|
2089
2095
|
/**
|
|
2090
2096
|
* Creates a new client instance with a signer
|
|
2091
2097
|
*
|
|
@@ -2144,19 +2150,19 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> extends ClientWork
|
|
|
2144
2150
|
/**
|
|
2145
2151
|
* Gets the debug information helpers for this client
|
|
2146
2152
|
*/
|
|
2147
|
-
get debugInformation(): DebugInformation
|
|
2153
|
+
get debugInformation(): DebugInformation;
|
|
2148
2154
|
/**
|
|
2149
2155
|
* Gets the preferences manager for this client
|
|
2150
2156
|
*/
|
|
2151
|
-
get preferences(): Preferences
|
|
2157
|
+
get preferences(): Preferences;
|
|
2152
2158
|
/**
|
|
2153
2159
|
* Gets the version of libxmtp used in the bindings
|
|
2154
2160
|
*/
|
|
2155
|
-
libxmtpVersion():
|
|
2161
|
+
get libxmtpVersion(): string | undefined;
|
|
2156
2162
|
/**
|
|
2157
2163
|
* Gets the app version used by the client
|
|
2158
2164
|
*/
|
|
2159
|
-
appVersion():
|
|
2165
|
+
get appVersion(): string | undefined;
|
|
2160
2166
|
/**
|
|
2161
2167
|
* Creates signature text for creating a new inbox
|
|
2162
2168
|
*
|
|
@@ -2332,15 +2338,16 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> extends ClientWork
|
|
|
2332
2338
|
* @param inboxId - The inbox ID to revoke installations for
|
|
2333
2339
|
* @param installationIds - The installation IDs to revoke
|
|
2334
2340
|
*/
|
|
2335
|
-
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string
|
|
2341
|
+
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
|
|
2336
2342
|
/**
|
|
2337
|
-
*
|
|
2343
|
+
* Fetches the inbox states for the specified inbox IDs from the network
|
|
2344
|
+
* without a client
|
|
2338
2345
|
*
|
|
2339
2346
|
* @param inboxIds - The inbox IDs to get the state for
|
|
2340
2347
|
* @param env - The environment to use
|
|
2341
|
-
* @returns The inbox
|
|
2348
|
+
* @returns The inbox states for the specified inbox IDs
|
|
2342
2349
|
*/
|
|
2343
|
-
static
|
|
2350
|
+
static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<_xmtp_wasm_bindings.InboxState[]>;
|
|
2344
2351
|
/**
|
|
2345
2352
|
* Changes the recovery identifier for the client's inbox
|
|
2346
2353
|
*
|
|
@@ -2372,52 +2379,13 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> extends ClientWork
|
|
|
2372
2379
|
*/
|
|
2373
2380
|
static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
|
|
2374
2381
|
/**
|
|
2375
|
-
*
|
|
2382
|
+
* Fetches the inbox ID for a given identifier from the local database
|
|
2383
|
+
* If not found, fetches from the network
|
|
2376
2384
|
*
|
|
2377
2385
|
* @param identifier - The identifier to look up
|
|
2378
2386
|
* @returns The inbox ID, if found
|
|
2379
2387
|
*/
|
|
2380
|
-
|
|
2381
|
-
/**
|
|
2382
|
-
* Gets the codec for a given content type
|
|
2383
|
-
*
|
|
2384
|
-
* @param contentType - The content type to get the codec for
|
|
2385
|
-
* @returns The codec, if found
|
|
2386
|
-
*/
|
|
2387
|
-
codecFor<ContentType = unknown>(contentType: ContentTypeId$1): ContentCodec<ContentType> | undefined;
|
|
2388
|
-
/**
|
|
2389
|
-
* Encodes content for a given content type
|
|
2390
|
-
*
|
|
2391
|
-
* @param content - The content to encode
|
|
2392
|
-
* @param contentType - The content type to encode for
|
|
2393
|
-
* @returns The encoded content
|
|
2394
|
-
* @throws {CodecNotFoundError} if no codec is found for the content type
|
|
2395
|
-
*/
|
|
2396
|
-
encodeContent(content: ContentTypes, contentType: ContentTypeId$1): SafeEncodedContent;
|
|
2397
|
-
/**
|
|
2398
|
-
* Prepares content for sending by encoding it and generating send options from the codec
|
|
2399
|
-
*
|
|
2400
|
-
* @param content - The message content to prepare for sending
|
|
2401
|
-
* @param contentType - The content type identifier for the appropriate codec
|
|
2402
|
-
* @returns An object containing the encoded content and send options
|
|
2403
|
-
* @throws {CodecNotFoundError} When no codec is registered for the specified content type
|
|
2404
|
-
*/
|
|
2405
|
-
prepareForSend(content: ContentTypes, contentType: ContentTypeId$1): {
|
|
2406
|
-
encodedContent: SafeEncodedContent;
|
|
2407
|
-
sendOptions: {
|
|
2408
|
-
shouldPush: boolean;
|
|
2409
|
-
};
|
|
2410
|
-
};
|
|
2411
|
-
/**
|
|
2412
|
-
* Decodes a message for a given content type
|
|
2413
|
-
*
|
|
2414
|
-
* @param message - The message to decode
|
|
2415
|
-
* @param contentType - The content type to decode for
|
|
2416
|
-
* @returns The decoded content
|
|
2417
|
-
* @throws {CodecNotFoundError} if no codec is found for the content type
|
|
2418
|
-
* @throws {InvalidGroupMembershipChangeError} if the message is an invalid group membership change
|
|
2419
|
-
*/
|
|
2420
|
-
decodeContent<ContentType = unknown>(message: SafeMessage, contentType: ContentTypeId$1): ContentType;
|
|
2388
|
+
fetchInboxIdByIdentifier(identifier: Identifier): Promise<string | undefined>;
|
|
2421
2389
|
/**
|
|
2422
2390
|
* Signs a message with the installation key
|
|
2423
2391
|
*
|
|
@@ -2443,179 +2411,84 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> extends ClientWork
|
|
|
2443
2411
|
*/
|
|
2444
2412
|
verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): Promise<boolean>;
|
|
2445
2413
|
/**
|
|
2446
|
-
*
|
|
2414
|
+
* Fetches the key package statuses from the network for the specified
|
|
2415
|
+
* installation IDs
|
|
2447
2416
|
*
|
|
2448
2417
|
* @param installationIds - The installation IDs to check
|
|
2449
2418
|
* @returns The key package statuses
|
|
2450
2419
|
*/
|
|
2451
|
-
|
|
2420
|
+
fetchKeyPackageStatuses(installationIds: string[]): Promise<Map<string, _xmtp_wasm_bindings.KeyPackageStatus>>;
|
|
2452
2421
|
}
|
|
2453
2422
|
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
}
|
|
2469
|
-
action: "utils.getInboxIdForIdentifier";
|
|
2470
|
-
id: string;
|
|
2471
|
-
result: string | undefined;
|
|
2472
|
-
data: {
|
|
2473
|
-
identifier: Identifier;
|
|
2474
|
-
env?: XmtpEnv;
|
|
2475
|
-
gatewayHost?: string;
|
|
2476
|
-
};
|
|
2477
|
-
} | {
|
|
2478
|
-
action: "utils.revokeInstallationsSignatureText";
|
|
2479
|
-
id: string;
|
|
2480
|
-
result: {
|
|
2481
|
-
signatureText: string;
|
|
2482
|
-
signatureRequestId: string;
|
|
2483
|
-
};
|
|
2484
|
-
data: {
|
|
2485
|
-
env?: XmtpEnv;
|
|
2486
|
-
identifier: Identifier;
|
|
2487
|
-
inboxId: string;
|
|
2488
|
-
gatewayHost?: string;
|
|
2489
|
-
installationIds: Uint8Array[];
|
|
2490
|
-
signatureRequestId: string;
|
|
2491
|
-
};
|
|
2492
|
-
} | {
|
|
2493
|
-
action: "utils.revokeInstallations";
|
|
2494
|
-
id: string;
|
|
2495
|
-
result: undefined;
|
|
2496
|
-
data: {
|
|
2497
|
-
env?: XmtpEnv;
|
|
2498
|
-
signer: SafeSigner;
|
|
2499
|
-
signatureRequestId: string;
|
|
2500
|
-
gatewayHost?: string;
|
|
2501
|
-
};
|
|
2502
|
-
} | {
|
|
2503
|
-
action: "utils.inboxStateFromInboxIds";
|
|
2504
|
-
id: string;
|
|
2505
|
-
result: SafeInboxState[];
|
|
2506
|
-
data: {
|
|
2507
|
-
inboxIds: string[];
|
|
2508
|
-
env?: XmtpEnv;
|
|
2509
|
-
gatewayHost?: string;
|
|
2510
|
-
};
|
|
2511
|
-
};
|
|
2423
|
+
declare class Opfs {
|
|
2424
|
+
#private;
|
|
2425
|
+
constructor(enableLogging?: boolean);
|
|
2426
|
+
init(): Promise<void>;
|
|
2427
|
+
close(): void;
|
|
2428
|
+
static create(enableLogging?: boolean): Promise<Opfs>;
|
|
2429
|
+
listFiles(): Promise<string[]>;
|
|
2430
|
+
fileCount(): Promise<number>;
|
|
2431
|
+
poolCapacity(): Promise<number>;
|
|
2432
|
+
fileExists(path: string): Promise<boolean>;
|
|
2433
|
+
deleteFile(path: string): Promise<boolean>;
|
|
2434
|
+
exportDb(path: string): Promise<Uint8Array<ArrayBufferLike>>;
|
|
2435
|
+
importDb(path: string, data: Uint8Array): Promise<void>;
|
|
2436
|
+
clearAll(): Promise<void>;
|
|
2437
|
+
}
|
|
2512
2438
|
|
|
2513
2439
|
/**
|
|
2514
|
-
*
|
|
2440
|
+
* Generates an inbox ID for a given identifier
|
|
2515
2441
|
*
|
|
2516
|
-
*
|
|
2517
|
-
*
|
|
2442
|
+
* @param identifier - The identifier to generate an inbox ID for
|
|
2443
|
+
* @param nonce - Optional nonce to use for generating the inbox ID
|
|
2444
|
+
* @returns Promise that resolves with the generated inbox ID
|
|
2445
|
+
*/
|
|
2446
|
+
declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => Promise<string>;
|
|
2447
|
+
/**
|
|
2448
|
+
* Gets the inbox ID for a specific identifier and optional environment
|
|
2518
2449
|
*
|
|
2519
|
-
* @param
|
|
2520
|
-
* @param
|
|
2521
|
-
* @
|
|
2450
|
+
* @param identifier - The identifier to get the inbox ID for
|
|
2451
|
+
* @param env - Optional XMTP environment configuration (default: "dev")
|
|
2452
|
+
* @param gatewayHost - Optional gateway host override
|
|
2453
|
+
* @returns Promise that resolves with the inbox ID for the identifier
|
|
2522
2454
|
*/
|
|
2523
|
-
declare
|
|
2524
|
-
#private;
|
|
2525
|
-
constructor(worker: Worker, enableLogging: boolean);
|
|
2526
|
-
/**
|
|
2527
|
-
* Initializes the utils worker
|
|
2528
|
-
*
|
|
2529
|
-
* @param enableLogging - Whether to enable logging in the worker
|
|
2530
|
-
* @returns A promise that resolves when the worker is initialized
|
|
2531
|
-
*/
|
|
2532
|
-
init(): Promise<void>;
|
|
2533
|
-
/**
|
|
2534
|
-
* Sends an action message to the utils worker
|
|
2535
|
-
*
|
|
2536
|
-
* @param action - The action to send to the worker
|
|
2537
|
-
* @param data - The data to send to the worker
|
|
2538
|
-
* @returns A promise that resolves when the action is completed
|
|
2539
|
-
*/
|
|
2540
|
-
sendMessage<A extends ActionName<UtilsWorkerAction>>(action: A, data: ExtractActionData<UtilsWorkerAction, A>): [ExtractActionResult<UtilsWorkerAction, A>] extends [undefined] ? Promise<void> : Promise<ExtractActionResult<UtilsWorkerAction, A>>;
|
|
2541
|
-
/**
|
|
2542
|
-
* Handles a message from the utils worker
|
|
2543
|
-
*
|
|
2544
|
-
* @param event - The event to handle
|
|
2545
|
-
*/
|
|
2546
|
-
handleMessage: (event: MessageEvent<ActionWithoutData<UtilsWorkerAction> | ActionErrorData<UtilsWorkerAction>>) => void;
|
|
2547
|
-
/**
|
|
2548
|
-
* Removes all event listeners and terminates the worker
|
|
2549
|
-
*/
|
|
2550
|
-
close(): void;
|
|
2551
|
-
}
|
|
2455
|
+
declare const getInboxIdForIdentifier: (identifier: Identifier, env?: XmtpEnv, gatewayHost?: string) => Promise<string | undefined>;
|
|
2552
2456
|
|
|
2553
2457
|
/**
|
|
2554
|
-
*
|
|
2458
|
+
* Gets the name of a metadata field
|
|
2459
|
+
*
|
|
2460
|
+
* @param field - The metadata field to get the name for
|
|
2461
|
+
* @returns The name of the metadata field
|
|
2555
2462
|
*/
|
|
2556
|
-
declare
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
*
|
|
2586
|
-
* It is highly recommended to use the `revokeInstallations` method instead.
|
|
2587
|
-
*
|
|
2588
|
-
* @param env - The environment to use
|
|
2589
|
-
* @param identifier - The identifier to revoke installations for
|
|
2590
|
-
* @param inboxId - The inbox ID to revoke installations for
|
|
2591
|
-
* @param installationIds - The installation IDs to revoke
|
|
2592
|
-
* @param gatewayHost - Optional gateway host override
|
|
2593
|
-
* @returns The signature text and signature request ID
|
|
2594
|
-
*/
|
|
2595
|
-
revokeInstallationsSignatureText(identifier: Identifier, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<{
|
|
2596
|
-
signatureText: string;
|
|
2597
|
-
signatureRequestId: string;
|
|
2598
|
-
}>;
|
|
2599
|
-
/**
|
|
2600
|
-
* Revokes installations for a given inbox ID
|
|
2601
|
-
*
|
|
2602
|
-
* @param env - The environment to use
|
|
2603
|
-
* @param signer - The signer to use
|
|
2604
|
-
* @param inboxId - The inbox ID to revoke installations for
|
|
2605
|
-
* @param installationIds - The installation IDs to revoke
|
|
2606
|
-
* @param gatewayHost - Optional gateway host override
|
|
2607
|
-
* @returns Promise that resolves with the result of the revoke installations operation
|
|
2608
|
-
*/
|
|
2609
|
-
revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
|
|
2610
|
-
/**
|
|
2611
|
-
* Gets the inbox state for the specified inbox IDs without a client
|
|
2612
|
-
*
|
|
2613
|
-
* @param inboxIds - The inbox IDs to get the state for
|
|
2614
|
-
* @param env - The environment to use
|
|
2615
|
-
* @returns The inbox state for the specified inbox IDs
|
|
2616
|
-
*/
|
|
2617
|
-
inboxStateFromInboxIds(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<SafeInboxState[]>;
|
|
2618
|
-
}
|
|
2463
|
+
declare const metadataFieldName: (field: MetadataField) => Promise<string>;
|
|
2464
|
+
|
|
2465
|
+
declare const encodeActions: (actions: _xmtp_wasm_bindings.Actions) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2466
|
+
declare const encodeAttachment: (attachment: _xmtp_wasm_bindings.Attachment) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2467
|
+
declare const encodeIntent: (intent: _xmtp_wasm_bindings.Intent) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2468
|
+
declare const encodeMarkdown: (text: string) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2469
|
+
declare const encodeMultiRemoteAttachment: (multi_remote_attachment: _xmtp_wasm_bindings.MultiRemoteAttachment) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2470
|
+
declare const encodeReaction: (reaction: _xmtp_wasm_bindings.Reaction) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2471
|
+
declare const encodeReadReceipt: (read_receipt: _xmtp_wasm_bindings.ReadReceipt) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2472
|
+
declare const encodeRemoteAttachment: (remote_attachment: _xmtp_wasm_bindings.RemoteAttachment) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2473
|
+
declare const encodeText: (text: string) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2474
|
+
declare const encodeTransactionReference: (transaction_reference: _xmtp_wasm_bindings.TransactionReference) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2475
|
+
declare const encodeWalletSendCalls: (wallet_send_calls: _xmtp_wasm_bindings.WalletSendCalls) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2476
|
+
declare const contentTypeActions: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2477
|
+
declare const contentTypeAttachment: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2478
|
+
declare const contentTypeGroupUpdated: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2479
|
+
declare const contentTypeIntent: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2480
|
+
declare const contentTypeLeaveRequest: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2481
|
+
declare const contentTypeMarkdown: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2482
|
+
declare const contentTypeMultiRemoteAttachment: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2483
|
+
declare const contentTypeReaction: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2484
|
+
declare const contentTypeReadReceipt: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2485
|
+
declare const contentTypeRemoteAttachment: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2486
|
+
declare const contentTypeReply: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2487
|
+
declare const contentTypeText: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2488
|
+
declare const contentTypeTransactionReference: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2489
|
+
declare const contentTypeWalletSendCalls: () => Promise<_xmtp_wasm_bindings.ContentTypeId>;
|
|
2490
|
+
declare const encryptAttachment: (attachment: _xmtp_wasm_bindings.Attachment) => Promise<_xmtp_wasm_bindings.EncryptedAttachment>;
|
|
2491
|
+
declare const decryptAttachment: (encryptedBytes: Uint8Array<ArrayBufferLike>, remoteAttachment: _xmtp_wasm_bindings.RemoteAttachment) => Promise<_xmtp_wasm_bindings.Attachment>;
|
|
2619
2492
|
|
|
2620
2493
|
declare class ClientNotInitializedError extends Error {
|
|
2621
2494
|
constructor();
|
|
@@ -2623,9 +2496,6 @@ declare class ClientNotInitializedError extends Error {
|
|
|
2623
2496
|
declare class SignerUnavailableError extends Error {
|
|
2624
2497
|
constructor();
|
|
2625
2498
|
}
|
|
2626
|
-
declare class CodecNotFoundError extends Error {
|
|
2627
|
-
constructor(contentType: ContentTypeId$1);
|
|
2628
|
-
}
|
|
2629
2499
|
declare class InboxReassignError extends Error {
|
|
2630
2500
|
constructor();
|
|
2631
2501
|
}
|
|
@@ -2638,18 +2508,18 @@ declare class GroupNotFoundError extends Error {
|
|
|
2638
2508
|
declare class StreamNotFoundError extends Error {
|
|
2639
2509
|
constructor(streamId: string);
|
|
2640
2510
|
}
|
|
2641
|
-
declare class InvalidGroupMembershipChangeError extends Error {
|
|
2642
|
-
constructor(messageId: string);
|
|
2643
|
-
}
|
|
2644
|
-
declare class MissingContentTypeError extends Error {
|
|
2645
|
-
constructor();
|
|
2646
|
-
}
|
|
2647
2511
|
declare class StreamFailedError extends Error {
|
|
2648
2512
|
constructor(retryAttempts: number);
|
|
2649
2513
|
}
|
|
2650
2514
|
declare class StreamInvalidRetryAttemptsError extends Error {
|
|
2651
2515
|
constructor();
|
|
2652
2516
|
}
|
|
2517
|
+
declare class OpfsNotInitializedError extends Error {
|
|
2518
|
+
constructor();
|
|
2519
|
+
}
|
|
2520
|
+
declare class OpfsInitializationError extends Error {
|
|
2521
|
+
constructor();
|
|
2522
|
+
}
|
|
2653
2523
|
|
|
2654
|
-
export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError,
|
|
2655
|
-
export type { AsyncStreamProxy, ClientOptions, ContentOptions, EOASigner, ExtractCodecContentTypes, HmacKeys,
|
|
2524
|
+
export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DecodedMessage, Dm, Group, GroupNotFoundError, HistorySyncUrls, InboxReassignError, Opfs, OpfsInitializationError, OpfsNotInitializedError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, StreamNotFoundError, contentTypeActions, contentTypeAttachment, contentTypeGroupUpdated, contentTypeIntent, contentTypeLeaveRequest, contentTypeMarkdown, contentTypeMultiRemoteAttachment, contentTypeReaction, contentTypeReadReceipt, contentTypeRemoteAttachment, contentTypeReply, contentTypeText, contentTypeTransactionReference, contentTypeWalletSendCalls, createStream, decryptAttachment, encodeActions, encodeAttachment, encodeIntent, encodeMarkdown, encodeMultiRemoteAttachment, encodeReaction, encodeReadReceipt, encodeRemoteAttachment, encodeText, encodeTransactionReference, encodeWalletSendCalls, encryptAttachment, generateInboxId, getInboxIdForIdentifier, metadataFieldName, toSafeConversation, toSafeSigner };
|
|
2525
|
+
export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, EOASigner, EnrichedReply, ExtractCodecContentTypes, HmacKeys, LastReadTimes, NetworkOptions, OtherOptions, SCWSigner, SafeConversation, SafeSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
|