@xmtp/node-sdk 4.6.0 → 5.0.0

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 CHANGED
@@ -1,9 +1,7 @@
1
- import { ContentCodec, ContentTypeId, EncodedContent } from '@xmtp/content-type-primitives';
1
+ import { ContentCodec, ContentTypeId } from '@xmtp/content-type-primitives';
2
2
  import * as _xmtp_node_bindings from '@xmtp/node-bindings';
3
- import { LogLevel, Message, StreamCloser, Conversation as Conversation$1, ListMessagesOptions, ConsentState, PermissionUpdateType, PermissionPolicy, MetadataField, Identifier, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, ConversationType, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, SendMessageOpts } from '@xmtp/node-bindings';
4
- export { Consent, ConsentEntityType, ConsentState, ContentType, ContentTypeId, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, DeliveryStatus, EncodedContent, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, HmacKey, Identifier, IdentifierKind, InboxState, Installation, KeyPackageStatus, Lifetime, ListConversationsOptions, ListMessagesOptions, LogLevel, LogOptions, Message, MessageDisappearingSettings, MetadataField, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, SignatureRequestHandle, SortDirection, UserPreferenceUpdate } from '@xmtp/node-bindings';
5
- import { GroupUpdatedCodec } from '@xmtp/content-type-group-updated';
6
- import { TextCodec } from '@xmtp/content-type-text';
3
+ import { ContentTypeId as ContentTypeId$1, DeliveryStatus, GroupMessageKind, Reaction, DecodedMessage as DecodedMessage$1, LeaveRequest, ReadReceipt, Attachment, RemoteAttachment, TransactionReference, WalletSendCalls, Actions, Intent, MultiRemoteAttachment, GroupUpdated, EnrichedReply, LogLevel, Identifier, StreamCloser, Conversation as Conversation$1, Message, EncodedContent, SendMessageOpts, Reply as Reply$1, ListMessagesOptions, ConsentState, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, ConversationType, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle } from '@xmtp/node-bindings';
4
+ 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, SendMessageOpts, SignatureRequestHandle, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, WalletCall, WalletSendCalls, contentTypeActions, contentTypeAttachment, contentTypeGroupUpdated, contentTypeIntent, contentTypeLeaveRequest, contentTypeMarkdown, contentTypeMultiRemoteAttachment, contentTypeReaction, contentTypeReadReceipt, contentTypeRemoteAttachment, contentTypeReply, contentTypeText, contentTypeTransactionReference, contentTypeWalletSendCalls, decryptAttachment, encodeActions, encodeAttachment, encodeIntent, encodeMarkdown, encodeMultiRemoteAttachment, encodeReaction, encodeReadReceipt, encodeRemoteAttachment, encodeText, encodeTransactionReference, encodeWalletSendCalls, encryptAttachment } from '@xmtp/node-bindings';
7
5
 
8
6
  /**
9
7
  * Pre-configured URLs for the XMTP network based on the environment
@@ -32,6 +30,55 @@ declare const HistorySyncUrls: {
32
30
  readonly production: "https://message-history.production.ephemera.network";
33
31
  };
34
32
 
33
+ declare class CodecRegistry {
34
+ #private;
35
+ constructor(codecs: ContentCodec[]);
36
+ /**
37
+ * Gets the codec for a given content type
38
+ *
39
+ * @param contentType - The content type to get the codec for
40
+ * @returns The codec, if found
41
+ */
42
+ getCodec<ContentType = unknown>(contentType: ContentTypeId): ContentCodec<ContentType> | undefined;
43
+ }
44
+
45
+ /**
46
+ * Represents a decoded XMTP message
47
+ *
48
+ * @class
49
+ * @property {unknown} content - The decoded content of the message
50
+ * @property {ContentTypeId} contentType - The content type of the message content
51
+ * @property {string} conversationId - Unique identifier for the conversation
52
+ * @property {MessageDeliveryStatus} deliveryStatus - Current delivery status of the message ("unpublished" | "published" | "failed")
53
+ * @property {bigint} expiresAtNs - Timestamp when the message will expire (in nanoseconds)
54
+ * @property {Date} expiresAt - Timestamp when the message will expire
55
+ * @property {string} [fallback] - Optional fallback text for the message
56
+ * @property {string} id - Unique identifier for the message
57
+ * @property {MessageKind} kind - Type of message ("application" | "membership_change")
58
+ * @property {number} numReplies - Number of replies to the message
59
+ * @property {DecodedMessage<Reaction>[]} reactions - Reactions to the message
60
+ * @property {string} senderInboxId - Identifier for the sender's inbox
61
+ * @property {Date} sentAt - Timestamp when the message was sent
62
+ * @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
63
+ */
64
+ declare class DecodedMessage<ContentTypes = unknown> {
65
+ content: ContentTypes | undefined;
66
+ contentType: ContentTypeId$1;
67
+ conversationId: string;
68
+ deliveryStatus: DeliveryStatus;
69
+ expiresAtNs?: bigint;
70
+ expiresAt?: Date;
71
+ fallback?: string;
72
+ id: string;
73
+ kind: GroupMessageKind;
74
+ numReplies: number;
75
+ reactions: DecodedMessage<Reaction>[];
76
+ senderInboxId: string;
77
+ sentAt: Date;
78
+ sentAtNs: bigint;
79
+ constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
80
+ }
81
+
35
82
  type HexString = `0x${string}`;
36
83
  declare function isHexString(value: unknown): value is HexString;
37
84
  declare function validHex(value: unknown): HexString;
@@ -131,11 +178,6 @@ type OtherOptions = {
131
178
  * Custom app version
132
179
  */
133
180
  appVersion?: string;
134
- /**
135
- * Should debug events be tracked
136
- * (default: false)
137
- */
138
- debugEventsEnabled?: boolean;
139
181
  /**
140
182
  * The nonce to use when generating an inbox ID
141
183
  * (default: undefined = 1)
@@ -143,6 +185,60 @@ type OtherOptions = {
143
185
  nonce?: bigint;
144
186
  };
145
187
  type ClientOptions = NetworkOptions & StorageOptions & ContentOptions & OtherOptions;
188
+ type Reply<T = unknown, U = unknown> = {
189
+ referenceId: EnrichedReply["referenceId"];
190
+ content: T;
191
+ inReplyTo: DecodedMessage<U> | null;
192
+ };
193
+ type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated;
194
+ type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes | Reply<T | BuiltInContentTypes, T | BuiltInContentTypes> : BuiltInContentTypes;
195
+
196
+ declare class InboxReassignError extends Error {
197
+ constructor();
198
+ }
199
+ declare class AccountAlreadyAssociatedError extends Error {
200
+ constructor(inboxId: string);
201
+ }
202
+ declare class MissingContentTypeError extends Error {
203
+ constructor();
204
+ }
205
+ declare class SignerUnavailableError extends Error {
206
+ constructor();
207
+ }
208
+ declare class ClientNotInitializedError extends Error {
209
+ constructor();
210
+ }
211
+ declare class StreamFailedError extends Error {
212
+ constructor(retryAttempts: number);
213
+ }
214
+ declare class StreamInvalidRetryAttemptsError extends Error {
215
+ constructor();
216
+ }
217
+
218
+ declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => string;
219
+ declare const getInboxIdForIdentifier: (identifier: Identifier, env?: XmtpEnv, gatewayHost?: string) => Promise<string | null>;
220
+
221
+ type SignMessage = (message: string) => Promise<Uint8Array> | Uint8Array;
222
+ type GetIdentifier = () => Promise<Identifier> | Identifier;
223
+ type GetChainId = () => bigint;
224
+ type GetBlockNumber = () => bigint;
225
+ type Signer = {
226
+ type: "EOA";
227
+ signMessage: SignMessage;
228
+ getIdentifier: GetIdentifier;
229
+ } | {
230
+ type: "SCW";
231
+ signMessage: SignMessage;
232
+ getIdentifier: GetIdentifier;
233
+ getBlockNumber?: GetBlockNumber;
234
+ getChainId: GetChainId;
235
+ };
236
+ type EOASigner = Extract<Signer, {
237
+ type: "EOA";
238
+ }>;
239
+ type SCWSigner = Extract<Signer, {
240
+ type: "SCW";
241
+ }>;
146
242
 
147
243
  type ResolveValue<T> = {
148
244
  value: T;
@@ -155,45 +251,6 @@ interface AsyncStreamProxy<T> extends AsyncIterable<T> {
155
251
  isDone: boolean;
156
252
  }
157
253
 
158
- type MessageKind = "application" | "membership_change";
159
- type MessageDeliveryStatus = "unpublished" | "published" | "failed";
160
- /**
161
- * Represents a decoded XMTP message
162
- *
163
- * This class transforms network messages into a structured format with
164
- * content decoding.
165
- *
166
- * @class
167
- * @property {any} content - The decoded content of the message
168
- * @property {ContentTypeId} contentType - The content type of the message content
169
- * @property {string} conversationId - Unique identifier for the conversation
170
- * @property {MessageDeliveryStatus} deliveryStatus - Current delivery status of the message ("unpublished" | "published" | "failed")
171
- * @property {string} [fallback] - Optional fallback text for the message
172
- * @property {number} [compression] - Optional compression level applied to the message
173
- * @property {string} id - Unique identifier for the message
174
- * @property {MessageKind} kind - Type of message ("application" | "membership_change")
175
- * @property {Record<string, string>} parameters - Additional parameters associated with the message
176
- * @property {string} senderInboxId - Identifier for the sender's inbox
177
- * @property {Date} sentAt - Timestamp when the message was sent
178
- * @property {number} sentAtNs - Timestamp when the message was sent (in nanoseconds)
179
- */
180
- declare class DecodedMessage<ContentTypes = unknown> {
181
- #private;
182
- content: ContentTypes | undefined;
183
- contentType: ContentTypeId | undefined;
184
- conversationId: string;
185
- deliveryStatus: MessageDeliveryStatus;
186
- fallback?: string;
187
- compression?: number;
188
- id: string;
189
- kind: MessageKind;
190
- parameters: Record<string, string>;
191
- senderInboxId: string;
192
- sentAt: Date;
193
- sentAtNs: number;
194
- constructor(client: Client<ContentTypes>, message: Message);
195
- }
196
-
197
254
  declare const DEFAULT_RETRY_DELAY = 60000;
198
255
  declare const DEFAULT_RETRY_ATTEMPTS = 10;
199
256
  type StreamOptions<T = unknown, V = T> = {
@@ -273,10 +330,10 @@ declare class Conversation<ContentTypes = unknown> {
273
330
  * Creates a new conversation instance
274
331
  *
275
332
  * @param client - The client instance managing the conversation
333
+ * @param codecRegistry - The codec registry instance
276
334
  * @param conversation - The underlying conversation instance
277
- * @param isCommitLogForked
278
335
  */
279
- constructor(client: Client<ContentTypes>, conversation: Conversation$1, isCommitLogForked?: boolean | null);
336
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
280
337
  /**
281
338
  * Gets the unique identifier for this conversation
282
339
  */
@@ -285,7 +342,6 @@ declare class Conversation<ContentTypes = unknown> {
285
342
  * Gets whether this conversation is currently active
286
343
  */
287
344
  get isActive(): boolean;
288
- get isCommitLogForked(): boolean | null;
289
345
  /**
290
346
  * Gets the inbox ID that added this client's inbox to the conversation
291
347
  */
@@ -293,11 +349,18 @@ declare class Conversation<ContentTypes = unknown> {
293
349
  /**
294
350
  * Gets the timestamp when the conversation was created in nanoseconds
295
351
  */
296
- get createdAtNs(): number;
352
+ get createdAtNs(): bigint;
297
353
  /**
298
354
  * Gets the date when the conversation was created
299
355
  */
300
356
  get createdAt(): Date;
357
+ pausedForVersion(): string | undefined;
358
+ /**
359
+ * Gets HMAC keys for this conversation
360
+ *
361
+ * @returns The HMAC keys for this conversation
362
+ */
363
+ hmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
301
364
  /**
302
365
  * Gets the metadata for this conversation
303
366
  *
@@ -305,7 +368,7 @@ declare class Conversation<ContentTypes = unknown> {
305
368
  */
306
369
  metadata(): Promise<{
307
370
  creatorInboxId: string;
308
- conversationType: string;
371
+ conversationType: _xmtp_node_bindings.ConversationType;
309
372
  }>;
310
373
  /**
311
374
  * Gets the members of this conversation
@@ -325,7 +388,7 @@ declare class Conversation<ContentTypes = unknown> {
325
388
  * @param options - Optional stream options
326
389
  * @returns Stream instance for new messages
327
390
  */
328
- stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes>>): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
391
+ stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes> | Message>): Promise<AsyncStreamProxy<Message | DecodedMessage<ContentTypes>>>;
329
392
  /**
330
393
  * Publishes pending messages that were sent optimistically
331
394
  *
@@ -333,23 +396,113 @@ declare class Conversation<ContentTypes = unknown> {
333
396
  */
334
397
  publishMessages(): Promise<void>;
335
398
  /**
336
- * Prepares a message to be published
399
+ * Sends a message with configurable delivery behavior
337
400
  *
338
- * @param content - The content to send
339
- * @param contentType - Optional content type of the message content
340
- * @returns Promise that resolves with the message ID
341
- * @throws {MissingContentTypeError} if content type is required but not provided
401
+ * @param encodedContent - The encoded content to send
402
+ * @param sendOptions - Options for sending the message
403
+ * @param sendOptions.shouldPush - Indicates whether this message should be
404
+ * included in push notifications
405
+ * @param sendOptions.isOptimistic - Indicates whether this message should be
406
+ * sent optimistically and published later via `publishMessages`
407
+ * @returns Promise that resolves with the message ID after it has been sent
342
408
  */
343
- sendOptimistic(content: ContentTypes, contentType?: ContentTypeId): string;
409
+ send(encodedContent: EncodedContent, sendOptions?: SendMessageOpts): Promise<string>;
344
410
  /**
345
- * Publishes a new message
411
+ * Sends a text message
346
412
  *
347
- * @param content - The content to send
348
- * @param contentType - Optional content type of the message content
413
+ * @param text - The text to send
414
+ * @param isOptimistic - Whether to send the message optimistically
349
415
  * @returns Promise that resolves with the message ID after it has been sent
350
- * @throws {MissingContentTypeError} if content type is required but not provided
351
416
  */
352
- send(content: ContentTypes, contentType?: ContentTypeId): Promise<string>;
417
+ sendText(text: string, isOptimistic?: boolean): Promise<string>;
418
+ /**
419
+ * Sends a markdown message
420
+ *
421
+ * @param markdown - The markdown to send
422
+ * @param isOptimistic - Whether to send the message optimistically
423
+ * @returns Promise that resolves with the message ID after it has been sent
424
+ */
425
+ sendMarkdown(markdown: string, isOptimistic?: boolean): Promise<string>;
426
+ /**
427
+ * Sends a reaction message
428
+ *
429
+ * @param reaction - The reaction to send
430
+ * @param isOptimistic - Whether to send the message optimistically
431
+ * @returns Promise that resolves with the message ID after it has been sent
432
+ */
433
+ sendReaction(reaction: Reaction, isOptimistic?: boolean): Promise<string>;
434
+ /**
435
+ * Sends a read receipt message
436
+ *
437
+ * @param readReceipt - The read receipt to send
438
+ * @param isOptimistic - Whether to send the message optimistically
439
+ * @returns Promise that resolves with the message ID after it has been sent
440
+ */
441
+ sendReadReceipt(isOptimistic?: boolean): Promise<string>;
442
+ /**
443
+ * Sends a reply message
444
+ *
445
+ * @param reply - The reply to send
446
+ * @param isOptimistic - Whether to send the message optimistically
447
+ * @returns Promise that resolves with the message ID after it has been sent
448
+ */
449
+ sendReply(reply: Reply$1, isOptimistic?: boolean): Promise<string>;
450
+ /**
451
+ * Sends a transaction reference message
452
+ *
453
+ * @param transactionReference - The transaction reference to send
454
+ * @param isOptimistic - Whether to send the message optimistically
455
+ * @returns Promise that resolves with the message ID after it has been sent
456
+ */
457
+ sendTransactionReference(transactionReference: TransactionReference, isOptimistic?: boolean): Promise<string>;
458
+ /**
459
+ * Sends a wallet send calls message
460
+ *
461
+ * @param walletSendCalls - The wallet send calls to send
462
+ * @param isOptimistic - Whether to send the message optimistically
463
+ * @returns Promise that resolves with the message ID after it has been sent
464
+ */
465
+ sendWalletSendCalls(walletSendCalls: WalletSendCalls, isOptimistic?: boolean): Promise<string>;
466
+ /**
467
+ * Sends a actions message
468
+ *
469
+ * @param actions - The actions to send
470
+ * @param isOptimistic - Whether to send the message optimistically
471
+ * @returns Promise that resolves with the message ID after it has been sent
472
+ */
473
+ sendActions(actions: Actions, isOptimistic?: boolean): Promise<string>;
474
+ /**
475
+ * Sends a intent message
476
+ *
477
+ * @param intent - The intent to send
478
+ * @param isOptimistic - Whether to send the message optimistically
479
+ * @returns Promise that resolves with the message ID after it has been sent
480
+ */
481
+ sendIntent(intent: Intent, isOptimistic?: boolean): Promise<string>;
482
+ /**
483
+ * Sends an attachment message
484
+ *
485
+ * @param attachment - The attachment to send
486
+ * @param isOptimistic - Whether to send the message optimistically
487
+ * @returns Promise that resolves with the message ID after it has been sent
488
+ */
489
+ sendAttachment(attachment: Attachment, isOptimistic?: boolean): Promise<string>;
490
+ /**
491
+ * Sends a multi remote attachment message
492
+ *
493
+ * @param multiRemoteAttachment - The multi remote attachment to send
494
+ * @param isOptimistic - Whether to send the message optimistically
495
+ * @returns Promise that resolves with the message ID after it has been sent
496
+ */
497
+ sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, isOptimistic?: boolean): Promise<string>;
498
+ /**
499
+ * Sends a remote attachment message
500
+ *
501
+ * @param remoteAttachment - The remote attachment to send
502
+ * @param isOptimistic - Whether to send the message optimistically
503
+ * @returns Promise that resolves with the message ID after it has been sent
504
+ */
505
+ sendRemoteAttachment(remoteAttachment: RemoteAttachment, isOptimistic?: boolean): Promise<string>;
353
506
  /**
354
507
  * Lists messages in this conversation
355
508
  *
@@ -373,7 +526,7 @@ declare class Conversation<ContentTypes = unknown> {
373
526
  /**
374
527
  * Gets the consent state for this conversation
375
528
  */
376
- get consentState(): ConsentState;
529
+ consentState(): ConsentState;
377
530
  /**
378
531
  * Updates the consent state for this conversation
379
532
  *
@@ -393,7 +546,7 @@ declare class Conversation<ContentTypes = unknown> {
393
546
  * @param inNs - The duration after which messages should disappear
394
547
  * @returns Promise that resolves when the update is complete
395
548
  */
396
- updateMessageDisappearingSettings(fromNs: number, inNs: number): Promise<void>;
549
+ updateMessageDisappearingSettings(fromNs: bigint, inNs: bigint): Promise<void>;
397
550
  /**
398
551
  * Removes message disappearing settings from this conversation
399
552
  *
@@ -406,19 +559,19 @@ declare class Conversation<ContentTypes = unknown> {
406
559
  * @returns Whether message disappearing is enabled
407
560
  */
408
561
  isMessageDisappearingEnabled(): boolean;
409
- pausedForVersion(): string | undefined;
410
- /**
411
- * Retrieves HMAC keys for this conversation
412
- *
413
- * @returns The HMAC keys for this conversation
414
- */
415
- getHmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
416
562
  /**
417
563
  * Retrieves information for this conversation to help with debugging
418
564
  *
419
565
  * @returns The debug information for this conversation
420
566
  */
421
567
  debugInfo(): Promise<_xmtp_node_bindings.ConversationDebugInfo>;
568
+ /**
569
+ * Retrieves the last read times for this conversation
570
+ *
571
+ * @returns A map keyed by inbox ID with the last read timestamp
572
+ * (nanoseconds since epoch)
573
+ */
574
+ lastReadTimes(): Promise<Record<string, number>>;
422
575
  }
423
576
 
424
577
  /**
@@ -432,17 +585,17 @@ declare class Dm<ContentTypes = unknown> extends Conversation<ContentTypes> {
432
585
  * Creates a new direct message conversation instance
433
586
  *
434
587
  * @param client - The client instance managing this direct message conversation
588
+ * @param codecRegistry - The codec registry instance
435
589
  * @param conversation - The underlying conversation instance
436
- * @param isCommitLogForked
437
590
  */
438
- constructor(client: Client<ContentTypes>, conversation: Conversation$1, isCommitLogForked?: boolean | null);
591
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
439
592
  /**
440
593
  * Retrieves the inbox ID of the other participant in the DM
441
594
  *
442
595
  * @returns Promise that resolves with the peer's inbox ID
443
596
  */
444
597
  get peerInboxId(): string;
445
- getDuplicateDms(): Promise<Dm<ContentTypes>[]>;
598
+ duplicateDms(): Promise<Dm<ContentTypes>[]>;
446
599
  }
447
600
 
448
601
  /**
@@ -456,10 +609,10 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
456
609
  * Creates a new group conversation instance
457
610
  *
458
611
  * @param client - The client instance managing this group conversation
612
+ * @param codecRegistry - The codec registry instance
459
613
  * @param conversation - The underlying conversation object
460
- * @param isCommitLogForked
461
614
  */
462
- constructor(client: Client<ContentTypes>, conversation: Conversation$1, isCommitLogForked?: boolean | null);
615
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
463
616
  /**
464
617
  * The name of the group
465
618
  */
@@ -503,7 +656,7 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
503
656
  /**
504
657
  * The permissions of the group
505
658
  */
506
- get permissions(): {
659
+ permissions(): {
507
660
  policyType: _xmtp_node_bindings.GroupPermissionsOptions;
508
661
  policySet: _xmtp_node_bindings.PermissionPolicySet;
509
662
  };
@@ -518,11 +671,11 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
518
671
  /**
519
672
  * The list of admins of the group
520
673
  */
521
- get admins(): string[];
674
+ listAdmins(): string[];
522
675
  /**
523
676
  * The list of super admins of the group
524
677
  */
525
- get superAdmins(): string[];
678
+ listSuperAdmins(): string[];
526
679
  /**
527
680
  * Checks if an inbox is an admin of the group
528
681
  *
@@ -594,7 +747,7 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
594
747
  *
595
748
  * @returns Boolean
596
749
  */
597
- get isPendingRemoval(): boolean;
750
+ isPendingRemoval(): boolean;
598
751
  }
599
752
 
600
753
  /**
@@ -608,9 +761,10 @@ declare class Conversations<ContentTypes = unknown> {
608
761
  * Creates a new conversations instance
609
762
  *
610
763
  * @param client - The client instance managing the conversations
764
+ * @param codecRegistry - The codec registry instance
611
765
  * @param conversations - The underlying conversations instance
612
766
  */
613
- constructor(client: Client<ContentTypes>, conversations: Conversations$1);
767
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversations: Conversations$1);
614
768
  /**
615
769
  * Retrieves a conversation by its ID
616
770
  *
@@ -634,7 +788,7 @@ declare class Conversations<ContentTypes = unknown> {
634
788
  * @returns Promise that resolves with the DM, if found
635
789
  * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
636
790
  */
637
- getDmByIdentifier(identifier: Identifier): Promise<Dm<ContentTypes> | undefined>;
791
+ fetchDmByIdentifier(identifier: Identifier): Promise<Dm<ContentTypes> | undefined>;
638
792
  /**
639
793
  * Retrieves a message by its ID
640
794
  *
@@ -644,13 +798,13 @@ declare class Conversations<ContentTypes = unknown> {
644
798
  */
645
799
  getMessageById(id: string): DecodedMessage<ContentTypes> | undefined;
646
800
  /**
647
- * Creates a new group conversation without syncing to the network
801
+ * Creates a new group conversation without publishing to the network
648
802
  *
649
803
  * @param options - Optional group creation options
650
804
  * @returns The new group
651
805
  * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#optimistically-create-a-new-group-chat
652
806
  */
653
- newGroupOptimistic(options?: CreateGroupOptions): Group<ContentTypes>;
807
+ createGroupOptimistic(options?: CreateGroupOptions): Group<ContentTypes>;
654
808
  /**
655
809
  * Creates a new group conversation with the specified identifiers
656
810
  *
@@ -659,7 +813,7 @@ declare class Conversations<ContentTypes = unknown> {
659
813
  * @returns The new group
660
814
  * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#create-a-new-group-chat
661
815
  */
662
- newGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
816
+ createGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
663
817
  /**
664
818
  * Creates a new group conversation with the specified inbox IDs
665
819
  *
@@ -668,7 +822,7 @@ declare class Conversations<ContentTypes = unknown> {
668
822
  * @returns The new group
669
823
  * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#create-a-new-group-chat
670
824
  */
671
- newGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
825
+ createGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
672
826
  /**
673
827
  * Creates a new DM conversation with the specified identifier
674
828
  *
@@ -677,7 +831,7 @@ declare class Conversations<ContentTypes = unknown> {
677
831
  * @returns The new DM
678
832
  * @see https://docs.xmtp.org/agents/build-agents/create-conversations#by-ethereum-address-1
679
833
  */
680
- newDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
834
+ createDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
681
835
  /**
682
836
  * Creates a new DM conversation with the specified inbox ID
683
837
  *
@@ -686,7 +840,7 @@ declare class Conversations<ContentTypes = unknown> {
686
840
  * @returns The new DM
687
841
  * @see https://docs.xmtp.org/agents/build-agents/create-conversations#by-inbox-id-1
688
842
  */
689
- newDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
843
+ createDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
690
844
  /**
691
845
  * Lists all conversations with optional filtering
692
846
  *
@@ -763,10 +917,10 @@ declare class Conversations<ContentTypes = unknown> {
763
917
  * @returns Stream instance for new messages
764
918
  * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
765
919
  */
766
- streamAllMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
920
+ streamAllMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes> | Message> & {
767
921
  conversationType?: ConversationType;
768
922
  consentStates?: ConsentState[];
769
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
923
+ }): Promise<AsyncStreamProxy<Message | DecodedMessage<ContentTypes>>>;
770
924
  /**
771
925
  * Creates a stream for all new group messages
772
926
  *
@@ -775,9 +929,9 @@ declare class Conversations<ContentTypes = unknown> {
775
929
  * @returns Stream instance for new group messages
776
930
  * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
777
931
  */
778
- streamAllGroupMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
932
+ streamAllGroupMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes> | Message> & {
779
933
  consentStates?: ConsentState[];
780
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
934
+ }): Promise<AsyncStreamProxy<Message | DecodedMessage<ContentTypes>>>;
781
935
  /**
782
936
  * Creates a stream for all new DM messages
783
937
  *
@@ -786,9 +940,9 @@ declare class Conversations<ContentTypes = unknown> {
786
940
  * @returns Stream instance for new DM messages
787
941
  * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
788
942
  */
789
- streamAllDmMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
943
+ streamAllDmMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes> | Message> & {
790
944
  consentStates?: ConsentState[];
791
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
945
+ }): Promise<AsyncStreamProxy<Message | DecodedMessage<ContentTypes>>>;
792
946
  /**
793
947
  * Creates a stream for message deletions
794
948
  *
@@ -800,7 +954,7 @@ declare class Conversations<ContentTypes = unknown> {
800
954
  */
801
955
  streamMessageDeletions(options?: Omit<StreamOptions<string>, "disableSync" | "onFail" | "onRetry" | "onRestart" | "retryAttempts" | "retryDelay" | "retryOnFail">): Promise<AsyncStreamProxy<string>>;
802
956
  /**
803
- * Retrieves HMAC keys for all conversations
957
+ * Gets the HMAC keys for all conversations
804
958
  *
805
959
  * @returns The HMAC keys for all conversations
806
960
  * @see https://docs.xmtp.org/chat-apps/push-notifs/push-notifs#get-hmac-keys-for-a-conversation
@@ -815,12 +969,11 @@ declare class Conversations<ContentTypes = unknown> {
815
969
  */
816
970
  declare class DebugInformation {
817
971
  #private;
818
- constructor(client: Client$1, options?: ClientOptions);
972
+ constructor(client: Client$1);
819
973
  apiStatistics(): _xmtp_node_bindings.ApiStats;
820
974
  apiIdentityStatistics(): _xmtp_node_bindings.IdentityStats;
821
975
  apiAggregateStatistics(): string;
822
976
  clearAllStatistics(): void;
823
- uploadDebugArchive(serverUrl?: string): Promise<string>;
824
977
  }
825
978
 
826
979
  /**
@@ -839,27 +992,32 @@ declare class Preferences {
839
992
  constructor(client: Client$1, conversations: Conversations$1);
840
993
  sync(): Promise<_xmtp_node_bindings.GroupSyncSummary>;
841
994
  /**
842
- * Retrieves the current inbox state
995
+ * Retrieves the current inbox state of this client from the local database
996
+ *
997
+ * @returns Promise that resolves with the inbox state
998
+ */
999
+ inboxState(): Promise<_xmtp_node_bindings.InboxState>;
1000
+ /**
1001
+ * Retrieves the latest inbox state of this clientfrom the network
843
1002
  *
844
- * @param refreshFromNetwork - Optional flag to force refresh from network
845
1003
  * @returns Promise that resolves with the inbox state
846
1004
  */
847
- inboxState(refreshFromNetwork?: boolean): Promise<_xmtp_node_bindings.InboxState>;
1005
+ fetchInboxState(): Promise<_xmtp_node_bindings.InboxState>;
848
1006
  /**
849
- * Gets the latest inbox state for a specific inbox
1007
+ * Retrieves the current inbox states for specified inbox IDs from the local
1008
+ * database
850
1009
  *
851
- * @param inboxId - The inbox ID to get state for
852
- * @returns Promise that resolves with the latest inbox state
1010
+ * @param inboxIds - Array of inbox IDs to get state for
1011
+ * @returns Promise that resolves with the inbox states for the inbox IDs
853
1012
  */
854
- getLatestInboxState(inboxId: string): Promise<_xmtp_node_bindings.InboxState>;
1013
+ getInboxStates(inboxIds: string[]): Promise<_xmtp_node_bindings.InboxState[]>;
855
1014
  /**
856
- * Retrieves inbox state for specific inbox IDs
1015
+ * Retrieves the latest inbox states for specified inbox IDs from the network
857
1016
  *
858
1017
  * @param inboxIds - Array of inbox IDs to get state for
859
- * @param refreshFromNetwork - Optional flag to force refresh from network
860
- * @returns Promise that resolves with the inbox state for the inbox IDs
1018
+ * @returns Promise that resolves with the inbox states for the inbox IDs
861
1019
  */
862
- inboxStateFromInboxIds(inboxIds: string[], refreshFromNetwork?: boolean): Promise<_xmtp_node_bindings.InboxState[]>;
1020
+ fetchInboxStates(inboxIds: string[]): Promise<_xmtp_node_bindings.InboxState[]>;
863
1021
  /**
864
1022
  * Updates consent states for multiple records
865
1023
  *
@@ -891,27 +1049,6 @@ declare class Preferences {
891
1049
  streamPreferences(options?: StreamOptions<UserPreferenceUpdate[]>): Promise<AsyncStreamProxy<UserPreferenceUpdate[]>>;
892
1050
  }
893
1051
 
894
- type SignMessage = (message: string) => Promise<Uint8Array> | Uint8Array;
895
- type GetIdentifier = () => Promise<Identifier> | Identifier;
896
- type GetChainId = () => bigint;
897
- type GetBlockNumber = () => bigint;
898
- type Signer = {
899
- type: "EOA";
900
- signMessage: SignMessage;
901
- getIdentifier: GetIdentifier;
902
- } | {
903
- type: "SCW";
904
- signMessage: SignMessage;
905
- getIdentifier: GetIdentifier;
906
- getBlockNumber?: GetBlockNumber;
907
- getChainId: GetChainId;
908
- };
909
-
910
- type ExtractCodecContentTypes<C extends ContentCodec[] = []> = [
911
- ...C,
912
- GroupUpdatedCodec,
913
- TextCodec
914
- ][number] extends ContentCodec<infer T> ? T : never;
915
1052
  /**
916
1053
  * Client for interacting with the XMTP network
917
1054
  */
@@ -1202,14 +1339,6 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1202
1339
  * @param installationIds - The installation IDs to revoke
1203
1340
  */
1204
1341
  static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
1205
- /**
1206
- * Gets the inbox state for the specified inbox IDs without a client
1207
- *
1208
- * @param env - The environment to use
1209
- * @param inboxIds - The inbox IDs to get the state for
1210
- * @returns The inbox state for the specified inbox IDs
1211
- */
1212
- static inboxStateFromInboxIds(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<_xmtp_node_bindings.InboxState[]>;
1213
1342
  /**
1214
1343
  * Changes the recovery identifier for the client's inbox
1215
1344
  *
@@ -1229,67 +1358,23 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1229
1358
  */
1230
1359
  canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
1231
1360
  /**
1232
- * Checks if the specified identifiers can be messaged
1233
- *
1234
- * @param identifiers - The identifiers to check
1235
- * @param env - Optional XMTP environment
1236
- * @returns Map of identifiers to whether they can be messaged
1237
- */
1238
- static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
1239
- /**
1240
- * Gets the key package statuses for the specified installation IDs
1361
+ * Fetches the key package statuses from the network for the specified
1362
+ * installation IDs
1241
1363
  *
1242
1364
  * @param installationIds - The installation IDs to check
1243
1365
  * @returns The key package statuses
1244
1366
  * @throws {ClientNotInitializedError} if the client is not initialized
1245
1367
  */
1246
- getKeyPackageStatusesForInstallationIds(installationIds: string[]): Promise<Record<string, _xmtp_node_bindings.KeyPackageStatus>>;
1247
- /**
1248
- * Gets the codec for a given content type
1249
- *
1250
- * @param contentType - The content type to get the codec for
1251
- * @returns The codec, if found
1252
- */
1253
- codecFor<ContentType = unknown>(contentType: ContentTypeId): ContentCodec<ContentType> | undefined;
1254
- /**
1255
- * Encodes content for a given content type
1256
- *
1257
- * @param content - The content to encode
1258
- * @param contentType - The content type to encode for
1259
- * @returns The encoded content
1260
- * @throws {CodecNotFoundError} if no codec is found for the content type
1261
- */
1262
- encodeContent(content: ContentTypes, contentType: ContentTypeId): EncodedContent<Record<string, string>>;
1263
- /**
1264
- * Prepares content for sending by encoding it and generating send options from the codec
1265
- *
1266
- * @param content - The message content to prepare for sending
1267
- * @param contentType - The content type identifier for the appropriate codec
1268
- * @returns An object containing the encoded content and send options
1269
- * @throws {CodecNotFoundError} When no codec is registered for the specified content type
1270
- */
1271
- prepareForSend(content: ContentTypes, contentType: ContentTypeId): {
1272
- encodedContent: EncodedContent<Record<string, string>>;
1273
- sendOptions: SendMessageOpts;
1274
- };
1275
- /**
1276
- * Decodes a message for a given content type
1277
- *
1278
- * @param message - The message to decode
1279
- * @param contentType - The content type to decode for
1280
- * @returns The decoded content
1281
- * @throws {CodecNotFoundError} if no codec is found for the content type
1282
- * @throws {InvalidGroupMembershipChangeError} if the message is an invalid group membership change
1283
- */
1284
- decodeContent<ContentType = unknown>(message: Message, contentType: ContentTypeId): ContentType;
1368
+ fetchKeyPackageStatuses(installationIds: string[]): Promise<Record<string, _xmtp_node_bindings.KeyPackageStatus>>;
1285
1369
  /**
1286
- * Finds the inbox ID for a given identifier
1370
+ * Fetches the inbox ID for a given identifier from the local database
1371
+ * If not found, fetches from the network
1287
1372
  *
1288
1373
  * @param identifier - The identifier to look up
1289
1374
  * @returns The inbox ID, if found
1290
1375
  * @throws {ClientNotInitializedError} if the client is not initialized
1291
1376
  */
1292
- getInboxIdByIdentifier(identifier: Identifier): Promise<string | null>;
1377
+ fetchInboxIdByIdentifier(identifier: Identifier): Promise<string | null>;
1293
1378
  /**
1294
1379
  * Signs a message with the installation key
1295
1380
  *
@@ -1307,6 +1392,23 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1307
1392
  * @throws {ClientNotInitializedError} if the client is not initialized
1308
1393
  */
1309
1394
  verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
1395
+ /**
1396
+ * Fetches the inbox states for the specified inbox IDs from the network
1397
+ * without a client
1398
+ *
1399
+ * @param env - The environment to use
1400
+ * @param inboxIds - The inbox IDs to get the state for
1401
+ * @returns The inbox states for the specified inbox IDs
1402
+ */
1403
+ static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<_xmtp_node_bindings.InboxState[]>;
1404
+ /**
1405
+ * Checks if the specified identifiers can be messaged
1406
+ *
1407
+ * @param identifiers - The identifiers to check
1408
+ * @param env - Optional XMTP environment
1409
+ * @returns Map of identifiers to whether they can be messaged
1410
+ */
1411
+ static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
1310
1412
  /**
1311
1413
  * Verifies a signature was made with a public key
1312
1414
  *
@@ -1334,43 +1436,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1334
1436
  * @returns Whether the installation is authorized
1335
1437
  */
1336
1438
  static isInstallationAuthorized(inboxId: string, installation: Uint8Array, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
1337
- /**
1338
- * Gets the version of the Node bindings
1339
- * @deprecated
1340
- */
1341
- static get version(): undefined;
1342
- }
1343
-
1344
- declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => string;
1345
- declare const getInboxIdForIdentifier: (identifier: Identifier, env?: XmtpEnv, gatewayHost?: string) => Promise<string | null>;
1346
-
1347
- declare class CodecNotFoundError extends Error {
1348
- constructor(contentType: ContentTypeId);
1349
- }
1350
- declare class InboxReassignError extends Error {
1351
- constructor();
1352
- }
1353
- declare class AccountAlreadyAssociatedError extends Error {
1354
- constructor(inboxId: string);
1355
- }
1356
- declare class InvalidGroupMembershipChangeError extends Error {
1357
- constructor(messageId: string);
1358
- }
1359
- declare class MissingContentTypeError extends Error {
1360
- constructor();
1361
- }
1362
- declare class SignerUnavailableError extends Error {
1363
- constructor();
1364
- }
1365
- declare class ClientNotInitializedError extends Error {
1366
- constructor();
1367
- }
1368
- declare class StreamFailedError extends Error {
1369
- constructor(retryAttempts: number);
1370
- }
1371
- declare class StreamInvalidRetryAttemptsError extends Error {
1372
- constructor();
1373
1439
  }
1374
1440
 
1375
- export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError, CodecNotFoundError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DecodedMessage, Dm, Group, HistorySyncUrls, InboxReassignError, InvalidGroupMembershipChangeError, MissingContentTypeError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, createStream, generateInboxId, getInboxIdForIdentifier, isHexString, validHex };
1376
- export type { AsyncStreamProxy, ClientOptions, ExtractCodecContentTypes, HexString, NetworkOptions, OtherOptions, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
1441
+ export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DecodedMessage, Dm, Group, HistorySyncUrls, InboxReassignError, MissingContentTypeError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, createStream, generateInboxId, getInboxIdForIdentifier, isHexString, validHex };
1442
+ export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, EOASigner, ExtractCodecContentTypes, HexString, NetworkOptions, OtherOptions, Reply, SCWSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };