@xmtp/node-sdk 5.0.0-rc1 → 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,7 +1,7 @@
1
- import { ContentCodec, ContentTypeId as ContentTypeId$1 } 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, ContentTypeId, DecodedMessage as DecodedMessage$1, StreamCloser, Conversation as Conversation$1, Message, EncodedContent, SendMessageOpts, Reaction, Reply, TransactionReference, WalletSendCalls, Actions, Intent, Attachment, MultiRemoteAttachment, RemoteAttachment, ListMessagesOptions, ConsentState, PermissionUpdateType, PermissionPolicy, MetadataField, Identifier, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, ConversationType, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, LeaveRequest, ReadReceipt, GroupUpdated, SignatureRequestHandle } 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';
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';
5
5
 
6
6
  /**
7
7
  * Pre-configured URLs for the XMTP network based on the environment
@@ -30,6 +30,55 @@ declare const HistorySyncUrls: {
30
30
  readonly production: "https://message-history.production.ephemera.network";
31
31
  };
32
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
+
33
82
  type HexString = `0x${string}`;
34
83
  declare function isHexString(value: unknown): value is HexString;
35
84
  declare function validHex(value: unknown): HexString;
@@ -136,6 +185,60 @@ type OtherOptions = {
136
185
  nonce?: bigint;
137
186
  };
138
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
+ }>;
139
242
 
140
243
  type ResolveValue<T> = {
141
244
  value: T;
@@ -148,38 +251,6 @@ interface AsyncStreamProxy<T> extends AsyncIterable<T> {
148
251
  isDone: boolean;
149
252
  }
150
253
 
151
- type MessageKind = "application" | "membership_change";
152
- type MessageDeliveryStatus = "unpublished" | "published" | "failed";
153
- /**
154
- * Represents a decoded XMTP message
155
- *
156
- * @class
157
- * @property {unknown} content - The decoded content of the message
158
- * @property {ContentTypeId} contentType - The content type of the message content
159
- * @property {string} conversationId - Unique identifier for the conversation
160
- * @property {MessageDeliveryStatus} deliveryStatus - Current delivery status of the message ("unpublished" | "published" | "failed")
161
- * @property {string} [fallback] - Optional fallback text for the message
162
- * @property {string} id - Unique identifier for the message
163
- * @property {MessageKind} kind - Type of message ("application" | "membership_change")
164
- * @property {string} senderInboxId - Identifier for the sender's inbox
165
- * @property {Date} sentAt - Timestamp when the message was sent
166
- * @property {number} sentAtNs - Timestamp when the message was sent (in nanoseconds)
167
- */
168
- declare class DecodedMessage<ContentTypes = unknown> {
169
- #private;
170
- content: ContentTypes | undefined;
171
- contentType: ContentTypeId;
172
- conversationId: string;
173
- deliveryStatus: MessageDeliveryStatus;
174
- fallback?: string;
175
- id: string;
176
- kind: MessageKind;
177
- senderInboxId: string;
178
- sentAt: Date;
179
- sentAtNs: number;
180
- constructor(client: Client<ContentTypes>, message: DecodedMessage$1);
181
- }
182
-
183
254
  declare const DEFAULT_RETRY_DELAY = 60000;
184
255
  declare const DEFAULT_RETRY_ATTEMPTS = 10;
185
256
  type StreamOptions<T = unknown, V = T> = {
@@ -259,10 +330,10 @@ declare class Conversation<ContentTypes = unknown> {
259
330
  * Creates a new conversation instance
260
331
  *
261
332
  * @param client - The client instance managing the conversation
333
+ * @param codecRegistry - The codec registry instance
262
334
  * @param conversation - The underlying conversation instance
263
- * @param isCommitLogForked
264
335
  */
265
- constructor(client: Client<ContentTypes>, conversation: Conversation$1, isCommitLogForked?: boolean | null);
336
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
266
337
  /**
267
338
  * Gets the unique identifier for this conversation
268
339
  */
@@ -271,7 +342,6 @@ declare class Conversation<ContentTypes = unknown> {
271
342
  * Gets whether this conversation is currently active
272
343
  */
273
344
  get isActive(): boolean;
274
- get isCommitLogForked(): boolean | null;
275
345
  /**
276
346
  * Gets the inbox ID that added this client's inbox to the conversation
277
347
  */
@@ -279,11 +349,18 @@ declare class Conversation<ContentTypes = unknown> {
279
349
  /**
280
350
  * Gets the timestamp when the conversation was created in nanoseconds
281
351
  */
282
- get createdAtNs(): number;
352
+ get createdAtNs(): bigint;
283
353
  /**
284
354
  * Gets the date when the conversation was created
285
355
  */
286
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[]>;
287
364
  /**
288
365
  * Gets the metadata for this conversation
289
366
  *
@@ -291,7 +368,7 @@ declare class Conversation<ContentTypes = unknown> {
291
368
  */
292
369
  metadata(): Promise<{
293
370
  creatorInboxId: string;
294
- conversationType: string;
371
+ conversationType: _xmtp_node_bindings.ConversationType;
295
372
  }>;
296
373
  /**
297
374
  * Gets the members of this conversation
@@ -325,7 +402,7 @@ declare class Conversation<ContentTypes = unknown> {
325
402
  * @param sendOptions - Options for sending the message
326
403
  * @param sendOptions.shouldPush - Indicates whether this message should be
327
404
  * included in push notifications
328
- * @param sendOptions.optimistic - Indicates whether this message should be
405
+ * @param sendOptions.isOptimistic - Indicates whether this message should be
329
406
  * sent optimistically and published later via `publishMessages`
330
407
  * @returns Promise that resolves with the message ID after it has been sent
331
408
  */
@@ -334,98 +411,98 @@ declare class Conversation<ContentTypes = unknown> {
334
411
  * Sends a text message
335
412
  *
336
413
  * @param text - The text to send
337
- * @param optimistic - Whether to send the message optimistically
414
+ * @param isOptimistic - Whether to send the message optimistically
338
415
  * @returns Promise that resolves with the message ID after it has been sent
339
416
  */
340
- sendText(text: string, optimistic?: boolean): Promise<string>;
417
+ sendText(text: string, isOptimistic?: boolean): Promise<string>;
341
418
  /**
342
419
  * Sends a markdown message
343
420
  *
344
421
  * @param markdown - The markdown to send
345
- * @param optimistic - Whether to send the message optimistically
422
+ * @param isOptimistic - Whether to send the message optimistically
346
423
  * @returns Promise that resolves with the message ID after it has been sent
347
424
  */
348
- sendMarkdown(markdown: string, optimistic?: boolean): Promise<string>;
425
+ sendMarkdown(markdown: string, isOptimistic?: boolean): Promise<string>;
349
426
  /**
350
427
  * Sends a reaction message
351
428
  *
352
429
  * @param reaction - The reaction to send
353
- * @param optimistic - Whether to send the message optimistically
430
+ * @param isOptimistic - Whether to send the message optimistically
354
431
  * @returns Promise that resolves with the message ID after it has been sent
355
432
  */
356
- sendReaction(reaction: Reaction, optimistic?: boolean): Promise<string>;
433
+ sendReaction(reaction: Reaction, isOptimistic?: boolean): Promise<string>;
357
434
  /**
358
435
  * Sends a read receipt message
359
436
  *
360
437
  * @param readReceipt - The read receipt to send
361
- * @param optimistic - Whether to send the message optimistically
438
+ * @param isOptimistic - Whether to send the message optimistically
362
439
  * @returns Promise that resolves with the message ID after it has been sent
363
440
  */
364
- sendReadReceipt(optimistic?: boolean): Promise<string>;
441
+ sendReadReceipt(isOptimistic?: boolean): Promise<string>;
365
442
  /**
366
443
  * Sends a reply message
367
444
  *
368
445
  * @param reply - The reply to send
369
- * @param optimistic - Whether to send the message optimistically
446
+ * @param isOptimistic - Whether to send the message optimistically
370
447
  * @returns Promise that resolves with the message ID after it has been sent
371
448
  */
372
- sendReply(reply: Reply, optimistic?: boolean): Promise<string>;
449
+ sendReply(reply: Reply$1, isOptimistic?: boolean): Promise<string>;
373
450
  /**
374
451
  * Sends a transaction reference message
375
452
  *
376
453
  * @param transactionReference - The transaction reference to send
377
- * @param optimistic - Whether to send the message optimistically
454
+ * @param isOptimistic - Whether to send the message optimistically
378
455
  * @returns Promise that resolves with the message ID after it has been sent
379
456
  */
380
- sendTransactionReference(transactionReference: TransactionReference, optimistic?: boolean): Promise<string>;
457
+ sendTransactionReference(transactionReference: TransactionReference, isOptimistic?: boolean): Promise<string>;
381
458
  /**
382
459
  * Sends a wallet send calls message
383
460
  *
384
461
  * @param walletSendCalls - The wallet send calls to send
385
- * @param optimistic - Whether to send the message optimistically
462
+ * @param isOptimistic - Whether to send the message optimistically
386
463
  * @returns Promise that resolves with the message ID after it has been sent
387
464
  */
388
- sendWalletSendCalls(walletSendCalls: WalletSendCalls, optimistic?: boolean): Promise<string>;
465
+ sendWalletSendCalls(walletSendCalls: WalletSendCalls, isOptimistic?: boolean): Promise<string>;
389
466
  /**
390
467
  * Sends a actions message
391
468
  *
392
469
  * @param actions - The actions to send
393
- * @param optimistic - Whether to send the message optimistically
470
+ * @param isOptimistic - Whether to send the message optimistically
394
471
  * @returns Promise that resolves with the message ID after it has been sent
395
472
  */
396
- sendActions(actions: Actions, optimistic?: boolean): Promise<string>;
473
+ sendActions(actions: Actions, isOptimistic?: boolean): Promise<string>;
397
474
  /**
398
475
  * Sends a intent message
399
476
  *
400
477
  * @param intent - The intent to send
401
- * @param optimistic - Whether to send the message optimistically
478
+ * @param isOptimistic - Whether to send the message optimistically
402
479
  * @returns Promise that resolves with the message ID after it has been sent
403
480
  */
404
- sendIntent(intent: Intent, optimistic?: boolean): Promise<string>;
481
+ sendIntent(intent: Intent, isOptimistic?: boolean): Promise<string>;
405
482
  /**
406
483
  * Sends an attachment message
407
484
  *
408
485
  * @param attachment - The attachment to send
409
- * @param optimistic - Whether to send the message optimistically
486
+ * @param isOptimistic - Whether to send the message optimistically
410
487
  * @returns Promise that resolves with the message ID after it has been sent
411
488
  */
412
- sendAttachment(attachment: Attachment, optimistic?: boolean): Promise<string>;
489
+ sendAttachment(attachment: Attachment, isOptimistic?: boolean): Promise<string>;
413
490
  /**
414
491
  * Sends a multi remote attachment message
415
492
  *
416
493
  * @param multiRemoteAttachment - The multi remote attachment to send
417
- * @param optimistic - Whether to send the message optimistically
494
+ * @param isOptimistic - Whether to send the message optimistically
418
495
  * @returns Promise that resolves with the message ID after it has been sent
419
496
  */
420
- sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, optimistic?: boolean): Promise<string>;
497
+ sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, isOptimistic?: boolean): Promise<string>;
421
498
  /**
422
499
  * Sends a remote attachment message
423
500
  *
424
501
  * @param remoteAttachment - The remote attachment to send
425
- * @param optimistic - Whether to send the message optimistically
502
+ * @param isOptimistic - Whether to send the message optimistically
426
503
  * @returns Promise that resolves with the message ID after it has been sent
427
504
  */
428
- sendRemoteAttachment(remoteAttachment: RemoteAttachment, optimistic?: boolean): Promise<string>;
505
+ sendRemoteAttachment(remoteAttachment: RemoteAttachment, isOptimistic?: boolean): Promise<string>;
429
506
  /**
430
507
  * Lists messages in this conversation
431
508
  *
@@ -449,7 +526,7 @@ declare class Conversation<ContentTypes = unknown> {
449
526
  /**
450
527
  * Gets the consent state for this conversation
451
528
  */
452
- get consentState(): ConsentState;
529
+ consentState(): ConsentState;
453
530
  /**
454
531
  * Updates the consent state for this conversation
455
532
  *
@@ -469,7 +546,7 @@ declare class Conversation<ContentTypes = unknown> {
469
546
  * @param inNs - The duration after which messages should disappear
470
547
  * @returns Promise that resolves when the update is complete
471
548
  */
472
- updateMessageDisappearingSettings(fromNs: number, inNs: number): Promise<void>;
549
+ updateMessageDisappearingSettings(fromNs: bigint, inNs: bigint): Promise<void>;
473
550
  /**
474
551
  * Removes message disappearing settings from this conversation
475
552
  *
@@ -482,19 +559,19 @@ declare class Conversation<ContentTypes = unknown> {
482
559
  * @returns Whether message disappearing is enabled
483
560
  */
484
561
  isMessageDisappearingEnabled(): boolean;
485
- pausedForVersion(): string | undefined;
486
- /**
487
- * Retrieves HMAC keys for this conversation
488
- *
489
- * @returns The HMAC keys for this conversation
490
- */
491
- getHmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
492
562
  /**
493
563
  * Retrieves information for this conversation to help with debugging
494
564
  *
495
565
  * @returns The debug information for this conversation
496
566
  */
497
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>>;
498
575
  }
499
576
 
500
577
  /**
@@ -508,17 +585,17 @@ declare class Dm<ContentTypes = unknown> extends Conversation<ContentTypes> {
508
585
  * Creates a new direct message conversation instance
509
586
  *
510
587
  * @param client - The client instance managing this direct message conversation
588
+ * @param codecRegistry - The codec registry instance
511
589
  * @param conversation - The underlying conversation instance
512
- * @param isCommitLogForked
513
590
  */
514
- constructor(client: Client<ContentTypes>, conversation: Conversation$1, isCommitLogForked?: boolean | null);
591
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
515
592
  /**
516
593
  * Retrieves the inbox ID of the other participant in the DM
517
594
  *
518
595
  * @returns Promise that resolves with the peer's inbox ID
519
596
  */
520
597
  get peerInboxId(): string;
521
- getDuplicateDms(): Promise<Dm<ContentTypes>[]>;
598
+ duplicateDms(): Promise<Dm<ContentTypes>[]>;
522
599
  }
523
600
 
524
601
  /**
@@ -532,10 +609,10 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
532
609
  * Creates a new group conversation instance
533
610
  *
534
611
  * @param client - The client instance managing this group conversation
612
+ * @param codecRegistry - The codec registry instance
535
613
  * @param conversation - The underlying conversation object
536
- * @param isCommitLogForked
537
614
  */
538
- constructor(client: Client<ContentTypes>, conversation: Conversation$1, isCommitLogForked?: boolean | null);
615
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
539
616
  /**
540
617
  * The name of the group
541
618
  */
@@ -579,7 +656,7 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
579
656
  /**
580
657
  * The permissions of the group
581
658
  */
582
- get permissions(): {
659
+ permissions(): {
583
660
  policyType: _xmtp_node_bindings.GroupPermissionsOptions;
584
661
  policySet: _xmtp_node_bindings.PermissionPolicySet;
585
662
  };
@@ -594,11 +671,11 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
594
671
  /**
595
672
  * The list of admins of the group
596
673
  */
597
- get admins(): string[];
674
+ listAdmins(): string[];
598
675
  /**
599
676
  * The list of super admins of the group
600
677
  */
601
- get superAdmins(): string[];
678
+ listSuperAdmins(): string[];
602
679
  /**
603
680
  * Checks if an inbox is an admin of the group
604
681
  *
@@ -670,7 +747,7 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
670
747
  *
671
748
  * @returns Boolean
672
749
  */
673
- get isPendingRemoval(): boolean;
750
+ isPendingRemoval(): boolean;
674
751
  }
675
752
 
676
753
  /**
@@ -684,9 +761,10 @@ declare class Conversations<ContentTypes = unknown> {
684
761
  * Creates a new conversations instance
685
762
  *
686
763
  * @param client - The client instance managing the conversations
764
+ * @param codecRegistry - The codec registry instance
687
765
  * @param conversations - The underlying conversations instance
688
766
  */
689
- constructor(client: Client<ContentTypes>, conversations: Conversations$1);
767
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversations: Conversations$1);
690
768
  /**
691
769
  * Retrieves a conversation by its ID
692
770
  *
@@ -710,7 +788,7 @@ declare class Conversations<ContentTypes = unknown> {
710
788
  * @returns Promise that resolves with the DM, if found
711
789
  * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
712
790
  */
713
- getDmByIdentifier(identifier: Identifier): Promise<Dm<ContentTypes> | undefined>;
791
+ fetchDmByIdentifier(identifier: Identifier): Promise<Dm<ContentTypes> | undefined>;
714
792
  /**
715
793
  * Retrieves a message by its ID
716
794
  *
@@ -720,13 +798,13 @@ declare class Conversations<ContentTypes = unknown> {
720
798
  */
721
799
  getMessageById(id: string): DecodedMessage<ContentTypes> | undefined;
722
800
  /**
723
- * Creates a new group conversation without syncing to the network
801
+ * Creates a new group conversation without publishing to the network
724
802
  *
725
803
  * @param options - Optional group creation options
726
804
  * @returns The new group
727
805
  * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#optimistically-create-a-new-group-chat
728
806
  */
729
- newGroupOptimistic(options?: CreateGroupOptions): Group<ContentTypes>;
807
+ createGroupOptimistic(options?: CreateGroupOptions): Group<ContentTypes>;
730
808
  /**
731
809
  * Creates a new group conversation with the specified identifiers
732
810
  *
@@ -735,7 +813,7 @@ declare class Conversations<ContentTypes = unknown> {
735
813
  * @returns The new group
736
814
  * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#create-a-new-group-chat
737
815
  */
738
- newGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
816
+ createGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
739
817
  /**
740
818
  * Creates a new group conversation with the specified inbox IDs
741
819
  *
@@ -744,7 +822,7 @@ declare class Conversations<ContentTypes = unknown> {
744
822
  * @returns The new group
745
823
  * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#create-a-new-group-chat
746
824
  */
747
- newGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
825
+ createGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
748
826
  /**
749
827
  * Creates a new DM conversation with the specified identifier
750
828
  *
@@ -753,7 +831,7 @@ declare class Conversations<ContentTypes = unknown> {
753
831
  * @returns The new DM
754
832
  * @see https://docs.xmtp.org/agents/build-agents/create-conversations#by-ethereum-address-1
755
833
  */
756
- newDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
834
+ createDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
757
835
  /**
758
836
  * Creates a new DM conversation with the specified inbox ID
759
837
  *
@@ -762,7 +840,7 @@ declare class Conversations<ContentTypes = unknown> {
762
840
  * @returns The new DM
763
841
  * @see https://docs.xmtp.org/agents/build-agents/create-conversations#by-inbox-id-1
764
842
  */
765
- newDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
843
+ createDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
766
844
  /**
767
845
  * Lists all conversations with optional filtering
768
846
  *
@@ -876,7 +954,7 @@ declare class Conversations<ContentTypes = unknown> {
876
954
  */
877
955
  streamMessageDeletions(options?: Omit<StreamOptions<string>, "disableSync" | "onFail" | "onRetry" | "onRestart" | "retryAttempts" | "retryDelay" | "retryOnFail">): Promise<AsyncStreamProxy<string>>;
878
956
  /**
879
- * Retrieves HMAC keys for all conversations
957
+ * Gets the HMAC keys for all conversations
880
958
  *
881
959
  * @returns The HMAC keys for all conversations
882
960
  * @see https://docs.xmtp.org/chat-apps/push-notifs/push-notifs#get-hmac-keys-for-a-conversation
@@ -914,27 +992,32 @@ declare class Preferences {
914
992
  constructor(client: Client$1, conversations: Conversations$1);
915
993
  sync(): Promise<_xmtp_node_bindings.GroupSyncSummary>;
916
994
  /**
917
- * 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
918
1002
  *
919
- * @param refreshFromNetwork - Optional flag to force refresh from network
920
1003
  * @returns Promise that resolves with the inbox state
921
1004
  */
922
- inboxState(refreshFromNetwork?: boolean): Promise<_xmtp_node_bindings.InboxState>;
1005
+ fetchInboxState(): Promise<_xmtp_node_bindings.InboxState>;
923
1006
  /**
924
- * Gets the latest inbox state for a specific inbox
1007
+ * Retrieves the current inbox states for specified inbox IDs from the local
1008
+ * database
925
1009
  *
926
- * @param inboxId - The inbox ID to get state for
927
- * @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
928
1012
  */
929
- getLatestInboxState(inboxId: string): Promise<_xmtp_node_bindings.InboxState>;
1013
+ getInboxStates(inboxIds: string[]): Promise<_xmtp_node_bindings.InboxState[]>;
930
1014
  /**
931
- * Retrieves inbox state for specific inbox IDs
1015
+ * Retrieves the latest inbox states for specified inbox IDs from the network
932
1016
  *
933
1017
  * @param inboxIds - Array of inbox IDs to get state for
934
- * @param refreshFromNetwork - Optional flag to force refresh from network
935
- * @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
936
1019
  */
937
- inboxStateFromInboxIds(inboxIds: string[], refreshFromNetwork?: boolean): Promise<_xmtp_node_bindings.InboxState[]>;
1020
+ fetchInboxStates(inboxIds: string[]): Promise<_xmtp_node_bindings.InboxState[]>;
938
1021
  /**
939
1022
  * Updates consent states for multiple records
940
1023
  *
@@ -966,24 +1049,6 @@ declare class Preferences {
966
1049
  streamPreferences(options?: StreamOptions<UserPreferenceUpdate[]>): Promise<AsyncStreamProxy<UserPreferenceUpdate[]>>;
967
1050
  }
968
1051
 
969
- type SignMessage = (message: string) => Promise<Uint8Array> | Uint8Array;
970
- type GetIdentifier = () => Promise<Identifier> | Identifier;
971
- type GetChainId = () => bigint;
972
- type GetBlockNumber = () => bigint;
973
- type Signer = {
974
- type: "EOA";
975
- signMessage: SignMessage;
976
- getIdentifier: GetIdentifier;
977
- } | {
978
- type: "SCW";
979
- signMessage: SignMessage;
980
- getIdentifier: GetIdentifier;
981
- getBlockNumber?: GetBlockNumber;
982
- getChainId: GetChainId;
983
- };
984
-
985
- type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | Reply | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated;
986
- type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes : BuiltInContentTypes;
987
1052
  /**
988
1053
  * Client for interacting with the XMTP network
989
1054
  */
@@ -1274,14 +1339,6 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1274
1339
  * @param installationIds - The installation IDs to revoke
1275
1340
  */
1276
1341
  static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
1277
- /**
1278
- * Gets the inbox state for the specified inbox IDs without a client
1279
- *
1280
- * @param env - The environment to use
1281
- * @param inboxIds - The inbox IDs to get the state for
1282
- * @returns The inbox state for the specified inbox IDs
1283
- */
1284
- static inboxStateFromInboxIds(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<_xmtp_node_bindings.InboxState[]>;
1285
1342
  /**
1286
1343
  * Changes the recovery identifier for the client's inbox
1287
1344
  *
@@ -1301,67 +1358,23 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1301
1358
  */
1302
1359
  canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
1303
1360
  /**
1304
- * Checks if the specified identifiers can be messaged
1305
- *
1306
- * @param identifiers - The identifiers to check
1307
- * @param env - Optional XMTP environment
1308
- * @returns Map of identifiers to whether they can be messaged
1309
- */
1310
- static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
1311
- /**
1312
- * 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
1313
1363
  *
1314
1364
  * @param installationIds - The installation IDs to check
1315
1365
  * @returns The key package statuses
1316
1366
  * @throws {ClientNotInitializedError} if the client is not initialized
1317
1367
  */
1318
- getKeyPackageStatusesForInstallationIds(installationIds: string[]): Promise<Record<string, _xmtp_node_bindings.KeyPackageStatus>>;
1319
- /**
1320
- * Gets the codec for a given content type
1321
- *
1322
- * @param contentType - The content type to get the codec for
1323
- * @returns The codec, if found
1324
- */
1325
- codecFor<ContentType = unknown>(contentType: ContentTypeId$1): ContentCodec<ContentType> | undefined;
1326
- /**
1327
- * Encodes content for a given content type
1328
- *
1329
- * @param content - The content to encode
1330
- * @param contentType - The content type to encode for
1331
- * @returns The encoded content
1332
- * @throws {CodecNotFoundError} if no codec is found for the content type
1333
- */
1334
- encodeContent(content: ContentTypes, contentType: ContentTypeId$1): _xmtp_node_bindings.EncodedContent;
1368
+ fetchKeyPackageStatuses(installationIds: string[]): Promise<Record<string, _xmtp_node_bindings.KeyPackageStatus>>;
1335
1369
  /**
1336
- * Prepares content for sending by encoding it and generating send options from the codec
1337
- *
1338
- * @param content - The message content to prepare for sending
1339
- * @param contentType - The content type identifier for the appropriate codec
1340
- * @returns An object containing the encoded content and send options
1341
- * @throws {CodecNotFoundError} When no codec is registered for the specified content type
1342
- */
1343
- prepareForSend(content: ContentTypes, contentType: ContentTypeId$1): {
1344
- encodedContent: _xmtp_node_bindings.EncodedContent;
1345
- sendOptions: SendMessageOpts;
1346
- };
1347
- /**
1348
- * Decodes a message for a given content type
1349
- *
1350
- * @param message - The message to decode
1351
- * @param contentType - The content type to decode for
1352
- * @returns The decoded content
1353
- * @throws {CodecNotFoundError} if no codec is found for the content type
1354
- * @throws {InvalidGroupMembershipChangeError} if the message is an invalid group membership change
1355
- */
1356
- decodeContent<ContentType = unknown>(message: Message, contentType: ContentTypeId$1): ContentType;
1357
- /**
1358
- * 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
1359
1372
  *
1360
1373
  * @param identifier - The identifier to look up
1361
1374
  * @returns The inbox ID, if found
1362
1375
  * @throws {ClientNotInitializedError} if the client is not initialized
1363
1376
  */
1364
- getInboxIdByIdentifier(identifier: Identifier): Promise<string | null>;
1377
+ fetchInboxIdByIdentifier(identifier: Identifier): Promise<string | null>;
1365
1378
  /**
1366
1379
  * Signs a message with the installation key
1367
1380
  *
@@ -1379,6 +1392,23 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1379
1392
  * @throws {ClientNotInitializedError} if the client is not initialized
1380
1393
  */
1381
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>>;
1382
1412
  /**
1383
1413
  * Verifies a signature was made with a public key
1384
1414
  *
@@ -1408,36 +1438,5 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1408
1438
  static isInstallationAuthorized(inboxId: string, installation: Uint8Array, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
1409
1439
  }
1410
1440
 
1411
- declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => string;
1412
- declare const getInboxIdForIdentifier: (identifier: Identifier, env?: XmtpEnv, gatewayHost?: string) => Promise<string | null>;
1413
-
1414
- declare class CodecNotFoundError extends Error {
1415
- constructor(contentType: ContentTypeId$1);
1416
- }
1417
- declare class InboxReassignError extends Error {
1418
- constructor();
1419
- }
1420
- declare class AccountAlreadyAssociatedError extends Error {
1421
- constructor(inboxId: string);
1422
- }
1423
- declare class InvalidGroupMembershipChangeError extends Error {
1424
- constructor(messageId: string);
1425
- }
1426
- declare class MissingContentTypeError extends Error {
1427
- constructor();
1428
- }
1429
- declare class SignerUnavailableError extends Error {
1430
- constructor();
1431
- }
1432
- declare class ClientNotInitializedError extends Error {
1433
- constructor();
1434
- }
1435
- declare class StreamFailedError extends Error {
1436
- constructor(retryAttempts: number);
1437
- }
1438
- declare class StreamInvalidRetryAttemptsError extends Error {
1439
- constructor();
1440
- }
1441
-
1442
- 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 };
1443
- 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 };