@xmtp/node-sdk 6.1.0-rc1 → 6.2.0-dev.43f235e

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,39 +1,7 @@
1
1
  import { ContentCodec, ContentTypeId } from '@xmtp/content-type-primitives';
2
2
  import * as _xmtp_node_bindings 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, DeletedMessage, Backend, LogLevel, WorkerConfigOptions, VisibilityConfirmationOptions, XmtpEnv as XmtpEnv$1, Identifier, StreamCloser, Conversation as Conversation$1, Message, EncodedContent, SendMessageOpts, SendOpts, Reply, ListMessagesOptions, ConsentState, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, ConversationType, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, InboxState, ArchiveOptions, AvailableArchiveInfo, ArchiveMetadata, GroupSyncSummary } from '@xmtp/node-bindings';
4
- export { Action, ActionStyle, Actions, ApiStats, ArchiveMetadata, ArchiveOptions, Attachment, AvailableArchiveInfo, Backend, BackendBuilder, BackupElementSelectionOption, 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, Reply, SendMessageOpts, SendOpts, SignatureRequestHandle, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, VisibilityConfirmationOptions, WalletCall, WalletSendCalls, WorkerConfigOptions, WorkerIntervalOverride, WorkerJitterOverride, WorkerKind, 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, flushTelemetry, initLogging } from '@xmtp/node-bindings';
5
-
6
- /**
7
- * Pre-configured URLs for the XMTP network based on the environment
8
- *
9
- * @deprecated Use `createBackend()` instead.
10
- * @constant
11
- * @property {string} local - The local URL for the XMTP network
12
- * @property {string} dev - The development URL for the XMTP network
13
- * @property {string} production - The production URL for the XMTP network
14
- */
15
- declare const ApiUrls: {
16
- readonly local: "http://localhost:5556";
17
- readonly dev: "https://grpc.dev.xmtp.network:443";
18
- readonly production: "https://grpc.production.xmtp.network:443";
19
- };
20
- /**
21
- * Pre-configured URLs for the XMTP history sync service based on the environment
22
- *
23
- * @constant
24
- * @property {string} local - The local URL for the XMTP history sync service
25
- * @property {string} dev - The development URL for the XMTP history sync service
26
- * @property {string} production - The production URL for the XMTP history sync service
27
- */
28
- declare const HistorySyncUrls: {
29
- readonly local: "http://localhost:5558";
30
- readonly dev: "https://message-history.dev.ephemera.network";
31
- readonly production: "https://message-history.production.ephemera.network";
32
- readonly "testnet-staging": "https://message-history.dev.ephemera.network";
33
- readonly "testnet-dev": "https://message-history.dev.ephemera.network";
34
- readonly testnet: "https://message-history.dev.ephemera.network";
35
- readonly mainnet: "https://message-history.production.ephemera.network";
36
- };
3
+ import { DeliveryCursor, ContentTypeId as ContentTypeId$1, DeliveryStatus, GroupMessageKind, Reaction, DecodedMessage as DecodedMessage$1, LeaveRequest, ReadReceipt, Attachment, RemoteAttachment, TransactionReference, WalletSendCalls, Actions, Intent, MultiRemoteAttachment, GroupUpdated, DeletedMessage, Backend, LogLevel, WorkerConfigOptions, VisibilityConfirmationOptions, AppDataChange, Identifier, StreamCloser, ConversationType, ConsentState, MessageCatchUp, Conversation as Conversation$1, Message, EncodedContent, SendMessageOpts, SendOpts, Reply, ListMessagesOptions, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, ArchiveOptions, ArchiveMetadata, GroupSyncSummary, ServerConfiguration } from '@xmtp/node-bindings';
4
+ export { Action, ActionStyle, Actions, ApiStats, AppDataChange, ArchiveMetadata, ArchiveOptions, Attachment, AuthConfiguration, Backend, BackendBuilder, BackupElementSelectionOption, Consent, ConsentEntityType, ConsentState, ContentType, ConversationDebugInfo, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, Cursor, DeliveryCursor, DeliveryStatus, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupUpdated, HmacKey, Identifier, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, KeyPackageStatus, LeaveRequest, Lifetime, LimitsConfiguration, ListConversationsOptions, ListConversationsOrderBy, ListMessagesOptions, LogLevel, LogOptions, Message, MessageCatchUp, MessageCatchUpGeneration, MessageDisappearingSettings, MessageHistorySnapshot, MessageSortBy, MessageTopicStatus, MetadataField, MetadataFieldChange, MlsConfiguration, MultiRemoteAttachment, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, Reaction, ReactionAction, ReactionSchema, ReadReceipt, RemoteAttachment, Reply, RetentionConfiguration, SendMessageOpts, SendOpts, ServerConfiguration, SignatureRequestHandle, SigningKeyDescription, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, VisibilityConfirmationOptions, WalletCall, WalletSendCalls, WorkerConfigOptions, WorkerIntervalOverride, WorkerJitterOverride, WorkerKind, 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, flushTelemetry, initLogging } from '@xmtp/node-bindings';
37
5
 
38
6
  declare class CodecRegistry {
39
7
  #private;
@@ -67,6 +35,8 @@ declare class CodecRegistry {
67
35
  * @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
68
36
  */
69
37
  declare class DecodedMessage<ContentTypes = unknown> {
38
+ /** Database-local position of this delivery. Absent for ordinary history reads. */
39
+ deliveryCursor?: DeliveryCursor;
70
40
  content: ContentTypes | undefined;
71
41
  contentType: ContentTypeId$1;
72
42
  conversationId: string;
@@ -88,49 +58,21 @@ type HexString = `0x${string}`;
88
58
  declare function isHexString(value: unknown): value is HexString;
89
59
  declare function validHex(value: unknown): HexString;
90
60
 
91
- /**
92
- * XMTP environment
93
- */
94
- type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
95
61
  /**
96
62
  * Network options
97
63
  */
98
64
  type NetworkOptions = {
99
- /**
100
- * Specify which XMTP environment to connect to. (default: `dev`)
101
- *
102
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-a-client#xmtp-network-environments
103
- */
104
- env?: XmtpEnv;
105
- /**
106
- * apiUrl can be used to override the `env` flag and connect to a
107
- * specific endpoint
108
- */
109
- apiUrl?: string;
110
- /**
111
- * The host of the XMTP Gateway for your application
112
- *
113
- * Only valid for `dev` and `production` environments
114
- *
115
- * @see https://docs.xmtp.org/fund-agents-apps/run-gateway
116
- */
117
- gatewayHost?: string;
118
- /**
119
- * Custom app version
120
- */
65
+ /** Backend URL, including the HTTP or HTTPS scheme. */
66
+ backendUrl: string;
67
+ /** Label used only for the default database file name. */
68
+ env?: string;
69
+ /** Custom app version. */
121
70
  appVersion?: string;
122
71
  };
123
72
  /**
124
73
  * Device sync options
125
74
  */
126
75
  type DeviceSyncOptions = {
127
- /**
128
- * historySyncUrl can be used to override the `env` flag and connect to a
129
- * specific endpoint for syncing history
130
- *
131
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/history-sync
132
- */
133
- historySyncUrl?: string | null;
134
76
  /**
135
77
  * Disable device sync
136
78
  */
@@ -147,8 +89,8 @@ type StorageOptions = {
147
89
  *
148
90
  * - `undefined` (or excluded from the client options)
149
91
  * The database will be created in the current working directory and is based on
150
- * the XMTP environment and client inbox ID.
151
- * Example: `xmtp-dev-<inbox-id>.db3`
92
+ * the environment label and client inbox ID.
93
+ * Example: `xmtp-default-<inbox-id>.db3`
152
94
  *
153
95
  * - `null`
154
96
  * No database will be created and all data will be lost once the client disconnects.
@@ -165,7 +107,7 @@ type StorageOptions = {
165
107
  /**
166
108
  * Encryption key for the local DB (32 bytes, hex)
167
109
  *
168
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-a-client#view-an-encrypted-database
110
+ * @see https://docs.xmtp.org/sdk/client/#view-an-encrypted-database
169
111
  */
170
112
  dbEncryptionKey?: Uint8Array | HexString;
171
113
  /**
@@ -220,6 +162,10 @@ type OtherOptions = {
220
162
  * Call {@link flushTelemetry} on graceful shutdown to flush buffered spans.
221
163
  */
222
164
  otelEndpoint?: string;
165
+ /** Service name attached to exported telemetry. */
166
+ otelServiceName?: string;
167
+ /** Fraction of root spans sampled, from 0 to 1. */
168
+ otelSampleRatio?: number;
223
169
  /**
224
170
  * Resource attributes attached to all exported telemetry spans
225
171
  * (e.g. `{ "service.instance.id": "herald-7", "deployment.environment": "prod" }`).
@@ -246,10 +192,26 @@ type OtherOptions = {
246
192
  /**
247
193
  * Options for waiting until client registration is visible on the network.
248
194
  *
249
- * When set, `registerIdentity` will wait for the specified quorum of nodes
250
- * to confirm the registration before resolving.
195
+ * When set, `registerIdentity` waits until the backend can read the registration.
251
196
  */
252
197
  waitForRegistrationVisible?: VisibilityConfirmationOptions;
198
+ /**
199
+ * Unstable: notifications for group state changes, for clients that
200
+ * reconcile a group's `appData` themselves.
201
+ *
202
+ * Only `appData` exists today; callbacks for the other mutable fields will
203
+ * be added as further optional properties. Registered at client creation
204
+ * because the changes they report arrive from the stream and sync paths,
205
+ * where no SDK call is on the stack to carry them.
206
+ *
207
+ * The `appData` callback is awaited before message processing continues, so
208
+ * a semantic merge — including republishing via `updateAppData` — can finish
209
+ * first. It fires for changes this client made as well as remote ones, so
210
+ * the merge must be idempotent.
211
+ */
212
+ unstableChangeCallbacks?: {
213
+ appData?: (change: AppDataChange) => Promise<void>;
214
+ };
253
215
  };
254
216
  type ClientOptions = (NetworkOptions | {
255
217
  backend: Backend;
@@ -270,8 +232,7 @@ type EnrichedReply<T = unknown, U = unknown> = {
270
232
  type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated | DeletedMessage;
271
233
  type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes | EnrichedReply<T | BuiltInContentTypes, T | BuiltInContentTypes> : BuiltInContentTypes;
272
234
 
273
- declare const envToString: (env: XmtpEnv$1) => XmtpEnv;
274
- declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
235
+ declare const createBackend: (options: NetworkOptions) => Promise<Backend>;
275
236
 
276
237
  declare class InboxReassignError extends Error {
277
238
  constructor();
@@ -333,6 +294,11 @@ interface AsyncStreamProxy<T> extends AsyncIterable<T> {
333
294
 
334
295
  declare const DEFAULT_RETRY_DELAY = 60000;
335
296
  declare const DEFAULT_RETRY_ATTEMPTS = 10;
297
+ /**
298
+ * Notification streams created by createStream use the retry settings and hooks.
299
+ * Durable message streams use onValue, onError, and onEnd. Core handles their
300
+ * network recovery; notification retry settings and hooks do not apply.
301
+ */
336
302
  type StreamOptions<T = unknown, V = T> = {
337
303
  /**
338
304
  * Called when the stream ends
@@ -343,38 +309,41 @@ type StreamOptions<T = unknown, V = T> = {
343
309
  */
344
310
  onError?: (error: Error) => void;
345
311
  /**
346
- * Called when the stream fails
312
+ * Called when a notification stream fails
347
313
  */
348
314
  onFail?: () => void;
349
315
  /**
350
- * Called when the stream is restarted
316
+ * Called when a notification stream is restarted
351
317
  */
352
318
  onRestart?: () => void;
353
319
  /**
354
- * Called when the stream is retried
320
+ * Called when a notification stream is retried
355
321
  */
356
322
  onRetry?: (attempts: number, maxAttempts: number) => void;
357
323
  /**
358
- * Called when a value is emitted from the stream
324
+ * Called when a value is emitted from the stream.
325
+ * For message streams, this selects callback mode. Do not also iterate that stream.
326
+ * Message delivery is acknowledged after this callback returns successfully.
359
327
  */
360
- onValue?: (value: V) => void;
328
+ onValue?: (value: V) => void | Promise<void>;
361
329
  /**
362
- * The number of times to retry the stream
330
+ * The number of times to retry a notification stream
363
331
  * (default: 10)
364
332
  */
365
333
  retryAttempts?: number;
366
334
  /**
367
- * The delay between retries (in milliseconds)
335
+ * The delay between notification stream retries (in milliseconds)
368
336
  * (default: 60000)
369
337
  */
370
338
  retryDelay?: number;
371
339
  /**
372
- * Whether to retry the stream if it fails
340
+ * Whether to retry a notification stream if it fails
373
341
  * (default: true)
374
342
  */
375
343
  retryOnFail?: boolean;
376
344
  /**
377
- * Whether to disable network sync before starting the stream
345
+ * Whether to skip pre-sync for notification streams.
346
+ * Durable message readers start receipt without a separate pre-sync.
378
347
  * (default: false)
379
348
  */
380
349
  disableSync?: boolean;
@@ -387,12 +356,14 @@ type StreamValueMutator<T = unknown, V = T> = (value: T) => V | Promise<V>;
387
356
  *
388
357
  * If the stream fails, an attempt will be made to restart it.
389
358
  *
359
+ * Ending the stream is terminal: no callbacks are invoked and no native
360
+ * stream is created after the stream ends.
361
+ *
390
362
  * This function is not intended to be used directly.
391
363
  *
392
364
  * @param streamFunction - The stream function to create a stream from
393
365
  * @param streamValueMutator - An optional function to mutate the value emitted from the stream
394
366
  * @param options - The options for the stream
395
- * @param args - Additional arguments to pass to the stream function
396
367
  * @returns An async iterable stream proxy
397
368
  * @throws {StreamInvalidRetryAttemptsError} if the retryAttempts option is less than 0 and retryOnFail is true
398
369
  * @throws {StreamFailedError} if the stream fails and can't be restarted
@@ -415,6 +386,81 @@ declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent>;
415
386
  declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions>;
416
387
  declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
417
388
 
389
+ type MessageAcknowledgement = {
390
+ checkOwner(): boolean | Promise<boolean>;
391
+ acknowledge(): void | Promise<void>;
392
+ reject(): void | Promise<void>;
393
+ };
394
+ type MessageDelivery<T> = {
395
+ message: T;
396
+ cursor: DeliveryCursor;
397
+ acknowledgement: MessageAcknowledgement;
398
+ };
399
+ type MessageReaderSource<T> = {
400
+ nextDelivery(): Promise<MessageDelivery<T> | null | undefined>;
401
+ close(): void | Promise<void>;
402
+ updateScope(groupIds?: string[]): void | Promise<void>;
403
+ updateFilter(conversationType?: ConversationType, consentStates?: ConsentState[]): void | Promise<void>;
404
+ catchUpSnapshot(): MessageCatchUp | Promise<MessageCatchUp>;
405
+ catchUpChanged(): Promise<MessageCatchUp>;
406
+ };
407
+ /** One pending item. Construction selects callback mode or next-request acknowledgement. */
408
+ declare class MessageStream<T, V> implements AsyncIterable<V> {
409
+ #private;
410
+ constructor(reader: MessageReaderSource<T>, convert: (message: T, cursor: DeliveryCursor) => V | undefined | Promise<V | undefined>, options?: StreamOptions<T, V>);
411
+ get isDone(): boolean;
412
+ get deliveredCursor(): DeliveryCursor | undefined;
413
+ next: () => Promise<IteratorResult<V, undefined>>;
414
+ return: () => Promise<IteratorReturnResult<undefined>>;
415
+ end: () => Promise<IteratorReturnResult<undefined>>;
416
+ updateScope: (groupIds?: string[]) => void | Promise<void>;
417
+ updateFilter: (conversationType?: ConversationType, consentStates?: ConsentState[]) => void | Promise<void>;
418
+ catchUpSnapshot: () => MessageCatchUp | Promise<MessageCatchUp>;
419
+ catchUpChanged: () => Promise<MessageCatchUp>;
420
+ [Symbol.asyncIterator](): this;
421
+ }
422
+
423
+ /** Delivery channel for this installation. */
424
+ type NotificationChannel = {
425
+ type: "apns";
426
+ token: string;
427
+ } | {
428
+ type: "fcm";
429
+ token: string;
430
+ } | {
431
+ type: "http";
432
+ url: string;
433
+ signingKey: Uint8Array;
434
+ };
435
+ /** Notification delivery and conversation rules. */
436
+ type NotificationConfig = {
437
+ channel: NotificationChannel;
438
+ /** Defaults to Allowed. An empty list selects no consent states. */
439
+ consentStates?: ConsentState[];
440
+ /** Defaults to true. */
441
+ includeWelcomes?: boolean;
442
+ /** Defaults to false. */
443
+ includeSyncGroups?: boolean;
444
+ /** Defaults to false. */
445
+ includeCommits?: boolean;
446
+ };
447
+ /** Reset to the configured consent rules with "default". */
448
+ type NotificationOverride = "enabled" | "disabled" | "default";
449
+ /** A notification failure with a stable error code. */
450
+ declare class NotificationError extends Error {
451
+ readonly code: string;
452
+ constructor(code: string, options?: ErrorOptions);
453
+ }
454
+ /** Local notification state. Reading it makes no backend request. */
455
+ type NotificationState = {
456
+ state: "disabled";
457
+ } | {
458
+ state: "enabled";
459
+ } | {
460
+ state: "failed";
461
+ error: NotificationError;
462
+ };
463
+
418
464
  /**
419
465
  * Represents a conversation
420
466
  *
@@ -438,6 +484,10 @@ declare class Conversation<ContentTypes = unknown> {
438
484
  * Gets whether this conversation is currently active
439
485
  */
440
486
  get isActive(): boolean;
487
+ /** Override notification rules, or reset the override with "default". */
488
+ setNotifications(value: NotificationOverride): Promise<void>;
489
+ /** Read the effective notification value for this conversation. */
490
+ notificationsEnabled(): Promise<boolean>;
441
491
  /**
442
492
  * Gets the inbox ID that added this client's inbox to the conversation
443
493
  */
@@ -480,12 +530,19 @@ declare class Conversation<ContentTypes = unknown> {
480
530
  */
481
531
  sync(): Promise<void>;
482
532
  /**
483
- * Creates a stream for new messages in this conversation
533
+ * Reads retained messages after the default acknowledgement position.
534
+ * Set `from` to replay after a cursor without changing default progress.
535
+ * Set `onValue` for callback mode, or request items with the iterator.
536
+ * Core owns network recovery. Legacy retry options and `disableSync` do not apply.
484
537
  *
485
- * @param options - Optional stream options
538
+ * @param options - Optional delivery callbacks and replay cursor
486
539
  * @returns Stream instance for new messages
487
540
  */
488
- stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes>>): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
541
+ stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
542
+ from?: DeliveryCursor;
543
+ }): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
544
+ messageHistorySnapshot(limit: number): _xmtp_node_bindings.MessageHistorySnapshot;
545
+ beginningDeliveryCursor(): DeliveryCursor;
489
546
  /**
490
547
  * Decodes, decrypts, and persists a raw envelope from a group message stream.
491
548
  *
@@ -756,8 +813,15 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
756
813
  * Updates the group's app data (max 8192 bytes)
757
814
  *
758
815
  * @param appData The new app data for the group
816
+ * @param expectedAppData Optional compare-and-swap guard. When provided, the
817
+ * update is abandoned — rather than overwriting — if the committed value is
818
+ * no longer this, including when another member's commit wins the race after
819
+ * this update was published. Callers reconciling structured state should
820
+ * pass the value they merged against, so a concurrent write surfaces as an
821
+ * error instead of silently discarding someone else's change. Omit for
822
+ * last-writer-wins.
759
823
  */
760
- updateAppData(appData: string): Promise<void>;
824
+ updateAppData(appData: string, expectedAppData?: string): Promise<void>;
761
825
  /**
762
826
  * The permissions of the group
763
827
  */
@@ -800,13 +864,13 @@ declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
800
864
  *
801
865
  * @param identifiers Array of member identifiers to add
802
866
  */
803
- addMembersByIdentifiers(identifiers: Identifier[]): Promise<void>;
867
+ addMembersByIdentifiers(identifiers: Identifier[]): Promise<_xmtp_node_bindings.UpdateGroupMembershipResult>;
804
868
  /**
805
869
  * Adds members to the group using inbox IDs
806
870
  *
807
871
  * @param inboxIds Array of inbox IDs to add
808
872
  */
809
- addMembers(inboxIds: string[]): Promise<void>;
873
+ addMembers(inboxIds: string[]): Promise<_xmtp_node_bindings.UpdateGroupMembershipResult>;
810
874
  /**
811
875
  * Removes members from the group using identifiers
812
876
  *
@@ -876,7 +940,7 @@ declare class Conversations<ContentTypes = unknown> {
876
940
  *
877
941
  * @param id - The conversation ID to look up
878
942
  * @returns The conversation if found, undefined otherwise
879
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
943
+ * @see https://docs.xmtp.org/sdk/conversations/
880
944
  */
881
945
  getConversationById(id: string): Promise<Group<ContentTypes> | Dm<ContentTypes> | undefined>;
882
946
  /**
@@ -884,7 +948,7 @@ declare class Conversations<ContentTypes = unknown> {
884
948
  *
885
949
  * @param inboxId - The inbox ID to look up
886
950
  * @returns The DM if found, undefined otherwise
887
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
951
+ * @see https://docs.xmtp.org/sdk/conversations/
888
952
  */
889
953
  getDmByInboxId(inboxId: string): Dm<ContentTypes> | undefined;
890
954
  /**
@@ -892,7 +956,7 @@ declare class Conversations<ContentTypes = unknown> {
892
956
  *
893
957
  * @param identifier - The identifier to look up
894
958
  * @returns Promise that resolves with the DM, if found
895
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
959
+ * @see https://docs.xmtp.org/sdk/conversations/
896
960
  */
897
961
  fetchDmByIdentifier(identifier: Identifier): Promise<Dm<ContentTypes> | undefined>;
898
962
  /**
@@ -900,7 +964,7 @@ declare class Conversations<ContentTypes = unknown> {
900
964
  *
901
965
  * @param id - The message ID to look up
902
966
  * @returns The decoded message if found, undefined otherwise
903
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
967
+ * @see https://docs.xmtp.org/sdk/conversations/
904
968
  */
905
969
  getMessageById(id: string): DecodedMessage<ContentTypes> | undefined;
906
970
  /**
@@ -908,7 +972,7 @@ declare class Conversations<ContentTypes = unknown> {
908
972
  *
909
973
  * @param options - Optional group creation options
910
974
  * @returns The new group
911
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#optimistically-create-a-new-group-chat
975
+ * @see https://docs.xmtp.org/sdk/conversations/#optimistically-create-a-group
912
976
  */
913
977
  createGroupOptimistic(options?: CreateGroupOptions): Group<ContentTypes>;
914
978
  /**
@@ -917,7 +981,7 @@ declare class Conversations<ContentTypes = unknown> {
917
981
  * @param identifiers - Array of identifiers for group members
918
982
  * @param options - Optional group creation options
919
983
  * @returns The new group
920
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#create-a-new-group-chat
984
+ * @see https://docs.xmtp.org/sdk/conversations/#create-a-group
921
985
  */
922
986
  createGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
923
987
  /**
@@ -926,7 +990,7 @@ declare class Conversations<ContentTypes = unknown> {
926
990
  * @param inboxIds - Array of inbox IDs for group members
927
991
  * @param options - Optional group creation options
928
992
  * @returns The new group
929
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#create-a-new-group-chat
993
+ * @see https://docs.xmtp.org/sdk/conversations/#create-a-group
930
994
  */
931
995
  createGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
932
996
  /**
@@ -935,7 +999,7 @@ declare class Conversations<ContentTypes = unknown> {
935
999
  * @param identifier - Identifier for the DM recipient
936
1000
  * @param options - Optional DM creation options
937
1001
  * @returns The new DM
938
- * @see https://docs.xmtp.org/agents/build-agents/create-conversations#by-ethereum-address-1
1002
+ * @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
939
1003
  */
940
1004
  createDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
941
1005
  /**
@@ -944,7 +1008,7 @@ declare class Conversations<ContentTypes = unknown> {
944
1008
  * @param inboxId - Inbox ID for the DM recipient
945
1009
  * @param options - Optional DM creation options
946
1010
  * @returns The new DM
947
- * @see https://docs.xmtp.org/agents/build-agents/create-conversations#by-inbox-id-1
1011
+ * @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
948
1012
  */
949
1013
  createDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
950
1014
  /**
@@ -952,7 +1016,7 @@ declare class Conversations<ContentTypes = unknown> {
952
1016
  *
953
1017
  * @param options - Optional filtering and pagination options
954
1018
  * @returns Array of conversations
955
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/list
1019
+ * @see https://docs.xmtp.org/sdk/conversations/
956
1020
  */
957
1021
  list(options?: ListConversationsOptions): Promise<(Group<ContentTypes> | Dm<ContentTypes>)[]>;
958
1022
  /**
@@ -960,7 +1024,7 @@ declare class Conversations<ContentTypes = unknown> {
960
1024
  *
961
1025
  * @param options - Optional filtering and pagination options
962
1026
  * @returns Array of groups
963
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/list#list-existing-conversations
1027
+ * @see https://docs.xmtp.org/sdk/conversations/
964
1028
  */
965
1029
  listGroups(options?: Omit<ListConversationsOptions, "conversationType">): Group<ContentTypes>[];
966
1030
  /**
@@ -968,14 +1032,14 @@ declare class Conversations<ContentTypes = unknown> {
968
1032
  *
969
1033
  * @param options - Optional filtering and pagination options
970
1034
  * @returns Array of DMs
971
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/list#list-existing-conversations
1035
+ * @see https://docs.xmtp.org/sdk/conversations/
972
1036
  */
973
1037
  listDms(options?: Omit<ListConversationsOptions, "conversationType">): Dm<ContentTypes>[];
974
1038
  /**
975
1039
  * Synchronizes conversations for the current client from the network
976
1040
  *
977
1041
  * @returns Promise that resolves when sync is complete
978
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/sync-and-syncall
1042
+ * @see https://docs.xmtp.org/sdk/sync/
979
1043
  */
980
1044
  sync(): Promise<void>;
981
1045
  /**
@@ -984,7 +1048,7 @@ declare class Conversations<ContentTypes = unknown> {
984
1048
  *
985
1049
  * @param consentStates - Optional array of consent states to filter by
986
1050
  * @returns Promise that resolves when sync is complete
987
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/sync-and-syncall#sync-all-new-welcomes-conversations-messages-and-preferences
1051
+ * @see https://docs.xmtp.org/sdk/sync/
988
1052
  */
989
1053
  syncAll(consentStates?: ConsentState[]): Promise<_xmtp_node_bindings.GroupSyncSummary>;
990
1054
  /**
@@ -993,7 +1057,7 @@ declare class Conversations<ContentTypes = unknown> {
993
1057
  * @param options - Optional stream options
994
1058
  * @param options.conversationType - Optional conversation type to filter by
995
1059
  * @returns Stream instance for new conversations
996
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-conversations
1060
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
997
1061
  */
998
1062
  stream(options?: StreamOptions<Conversation$1, Group<ContentTypes> | Dm<ContentTypes> | undefined> & {
999
1063
  conversationType?: ConversationType;
@@ -1003,7 +1067,7 @@ declare class Conversations<ContentTypes = unknown> {
1003
1067
  *
1004
1068
  * @param options - Optional stream options
1005
1069
  * @returns Stream instance for new group conversations
1006
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-conversations
1070
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1007
1071
  */
1008
1072
  streamGroups(options?: StreamOptions<Conversation$1, Group<ContentTypes>>): Promise<AsyncStreamProxy<Group<ContentTypes>>>;
1009
1073
  /**
@@ -1011,44 +1075,59 @@ declare class Conversations<ContentTypes = unknown> {
1011
1075
  *
1012
1076
  * @param options - Optional stream options
1013
1077
  * @returns Stream instance for new DM conversations
1014
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-conversations
1078
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1015
1079
  */
1016
1080
  streamDms(options?: StreamOptions<Conversation$1, Dm<ContentTypes>>): Promise<AsyncStreamProxy<Dm<ContentTypes>>>;
1017
1081
  /**
1018
- * Creates a stream for all new messages
1082
+ * Reads retained messages after each group's default acknowledgement position.
1083
+ * Set `from` to replay after a cursor without changing default progress.
1084
+ * Set `onValue` for callback mode, or request items with the iterator.
1085
+ * Core owns network recovery. Legacy retry options and `disableSync` do not apply.
1019
1086
  *
1020
1087
  * @param options - Optional stream options
1021
1088
  * @param options.conversationType - Optional conversation type to filter by
1022
1089
  * @param options.consentStates - Optional array of consent states to filter by
1023
1090
  * @returns Stream instance for new messages
1024
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
1091
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1025
1092
  */
1026
1093
  streamAllMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
1027
1094
  conversationType?: ConversationType;
1028
1095
  consentStates?: ConsentState[];
1029
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
1096
+ groupIds?: string[];
1097
+ from?: DeliveryCursor;
1098
+ }): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
1099
+ messageHistorySnapshot(limit: number, options?: {
1100
+ groupIds?: string[];
1101
+ conversationType?: ConversationType;
1102
+ consentStates?: ConsentState[];
1103
+ }): _xmtp_node_bindings.MessageHistorySnapshot;
1104
+ beginningDeliveryCursor(): DeliveryCursor;
1030
1105
  /**
1031
- * Creates a stream for all new group messages
1106
+ * Reads retained group messages with default progress or an explicit replay cursor.
1032
1107
  *
1033
1108
  * @param options - Optional stream options
1034
1109
  * @param options.consentStates - Optional array of consent states to filter by
1035
1110
  * @returns Stream instance for new group messages
1036
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
1111
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1037
1112
  */
1038
1113
  streamAllGroupMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
1039
1114
  consentStates?: ConsentState[];
1040
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
1115
+ groupIds?: string[];
1116
+ from?: DeliveryCursor;
1117
+ }): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
1041
1118
  /**
1042
- * Creates a stream for all new DM messages
1119
+ * Reads retained DM messages with default progress or an explicit replay cursor.
1043
1120
  *
1044
1121
  * @param options - Optional stream options
1045
1122
  * @param options.consentStates - Optional array of consent states to filter by
1046
1123
  * @returns Stream instance for new DM messages
1047
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
1124
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1048
1125
  */
1049
1126
  streamAllDmMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
1050
1127
  consentStates?: ConsentState[];
1051
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
1128
+ groupIds?: string[];
1129
+ from?: DeliveryCursor;
1130
+ }): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
1052
1131
  /**
1053
1132
  * Creates a stream for message deletions that streams the message IDs of
1054
1133
  * deleted messages
@@ -1075,7 +1154,7 @@ declare class Conversations<ContentTypes = unknown> {
1075
1154
  * Gets the HMAC keys for all conversations
1076
1155
  *
1077
1156
  * @returns The HMAC keys for all conversations
1078
- * @see https://docs.xmtp.org/chat-apps/push-notifs/push-notifs#get-hmac-keys-for-a-conversation
1157
+ * @see https://docs.xmtp.org/sdk/push-notifications/
1079
1158
  */
1080
1159
  hmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
1081
1160
  }
@@ -1197,7 +1276,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1197
1276
  * @param options - Optional configuration for the client
1198
1277
  * @returns A new client instance
1199
1278
  */
1200
- static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options?: DistributiveOmit<ClientOptions, "codecs"> & {
1279
+ static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options: DistributiveOmit<ClientOptions, "codecs"> & {
1201
1280
  codecs?: ContentCodecs;
1202
1281
  }): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
1203
1282
  /**
@@ -1210,7 +1289,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1210
1289
  * @param options - Optional configuration for the client
1211
1290
  * @returns A new client instance
1212
1291
  */
1213
- static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options?: DistributiveOmit<ClientOptions, "codecs"> & {
1292
+ static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options: DistributiveOmit<ClientOptions, "codecs"> & {
1214
1293
  codecs?: ContentCodecs;
1215
1294
  }): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
1216
1295
  /**
@@ -1222,11 +1301,11 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1222
1301
  */
1223
1302
  get appVersion(): string | undefined;
1224
1303
  /**
1225
- * Gets the XMTP environment the client is connected to
1304
+ * Gets the label used for the default database file name
1226
1305
  *
1227
1306
  * @throws {ClientNotInitializedError} if the client is not initialized
1228
1307
  */
1229
- get env(): XmtpEnv;
1308
+ get env(): string;
1230
1309
  /**
1231
1310
  * Gets the client options
1232
1311
  */
@@ -1467,27 +1546,8 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1467
1546
  * @throws {SignerUnavailableError} if no signer is available
1468
1547
  */
1469
1548
  revokeInstallations(installationIds: Uint8Array[]): Promise<void>;
1470
- /**
1471
- * Revokes specific installations of the client's inbox without a client
1472
- *
1473
- * @param signer - The signer to use
1474
- * @param inboxId - The inbox ID to revoke installations for
1475
- * @param installationIds - The installation IDs to revoke
1476
- * @param backend - Optional `Backend` instance created with `createBackend()`
1477
- */
1478
- static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], backend?: Backend): Promise<void>;
1479
- /**
1480
- * Revokes specific installations of the client's inbox without a client
1481
- *
1482
- * @param signer - The signer to use
1483
- * @param inboxId - The inbox ID to revoke installations for
1484
- * @param installationIds - The installation IDs to revoke
1485
- * @param env - The environment to use
1486
- * @param gatewayHost - Optional gateway host
1487
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1488
- * of `XmtpEnv` and `gatewayHost`.
1489
- */
1490
- static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
1549
+ /** Revoke installations with an explicit backend or network options. */
1550
+ static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], optionsOrBackend: NetworkOptions | Backend): Promise<void>;
1491
1551
  /**
1492
1552
  * Changes the recovery identifier for the client's inbox
1493
1553
  *
@@ -1556,66 +1616,12 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1556
1616
  * @throws {ClientNotInitializedError} if the client is not initialized
1557
1617
  */
1558
1618
  verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
1559
- /**
1560
- * Fetches the inbox states for the specified inbox IDs from the network
1561
- * without a client
1562
- *
1563
- * @param inboxIds - The inbox IDs to get the state for
1564
- * @param backend - Optional `Backend` instance created with `createBackend()`
1565
- * @returns The inbox states for the specified inbox IDs
1566
- */
1567
- static fetchInboxStates(inboxIds: string[], backend?: Backend): Promise<InboxState[]>;
1568
- /**
1569
- * Fetches the inbox states for the specified inbox IDs from the network
1570
- * without a client
1571
- *
1572
- * @param inboxIds - The inbox IDs to get the state for
1573
- * @param env - The environment to use
1574
- * @param gatewayHost - Optional gateway host
1575
- * @returns The inbox states for the specified inbox IDs
1576
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1577
- * of `XmtpEnv` and `gatewayHost`.
1578
- */
1579
- static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<InboxState[]>;
1580
- /**
1581
- * Fetches the latest inbox updates count for the specified inbox IDs
1582
- * without a client
1583
- *
1584
- * @param inboxIds - The inbox IDs to check
1585
- * @param backend - Optional `Backend` instance created with `createBackend()`
1586
- * @returns Map of inbox IDs to their updates count
1587
- */
1588
- static fetchLatestInboxUpdatesCount(inboxIds: string[], backendOrEnv?: Backend | XmtpEnv): Promise<Map<string, number>>;
1589
- /**
1590
- * Fetches the latest inbox updates count for the specified inbox IDs
1591
- * without a client
1592
- *
1593
- * @param inboxIds - The inbox IDs to check
1594
- * @param env - The environment to use
1595
- * @param gatewayHost - Optional gateway host
1596
- * @returns Map of inbox IDs to their updates count
1597
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1598
- * of `XmtpEnv` and `gatewayHost`.
1599
- */
1600
- static fetchLatestInboxUpdatesCount(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<Map<string, number>>;
1601
- /**
1602
- * Checks if the specified identifiers can be messaged
1603
- *
1604
- * @param identifiers - The identifiers to check
1605
- * @param backend - Optional `Backend` instance created with `createBackend()`
1606
- * @returns Map of identifiers to whether they can be messaged
1607
- */
1608
- static canMessage(identifiers: Identifier[], backend?: Backend): Promise<Map<string, boolean>>;
1609
- /**
1610
- * Checks if the specified identifiers can be messaged
1611
- *
1612
- * @param identifiers - The identifiers to check
1613
- * @param env - Optional XMTP environment
1614
- * @returns Map of identifiers to whether they can be messaged
1615
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1616
- * of `XmtpEnv`.
1617
- */
1618
- static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
1619
+ /** Fetch inbox states with an explicit backend or network options. */
1620
+ static fetchInboxStates(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend): Promise<_xmtp_node_bindings.InboxState[]>;
1621
+ /** Fetch inbox update counts with an explicit backend or network options. */
1622
+ static fetchLatestInboxUpdatesCount(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend): Promise<Map<string, number>>;
1623
+ /** Check identifiers with an explicit backend or network options. */
1624
+ static canMessage(identifiers: Identifier[], optionsOrBackend: NetworkOptions | Backend): Promise<Map<string, boolean>>;
1619
1625
  /**
1620
1626
  * Verifies a signature was made with a public key
1621
1627
  *
@@ -1625,82 +1631,10 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1625
1631
  * @returns Whether the signature is valid
1626
1632
  */
1627
1633
  static verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
1628
- /**
1629
- * Checks if an address is authorized for an inbox
1630
- *
1631
- * @param inboxId - The inbox ID to check
1632
- * @param address - The address to check
1633
- * @param backend - Optional `Backend` instance created with `createBackend()`
1634
- * @returns Whether the address is authorized
1635
- */
1636
- static isAddressAuthorized(inboxId: string, address: string, backend?: Backend): Promise<boolean>;
1637
- /**
1638
- * Checks if an address is authorized for an inbox
1639
- *
1640
- * @param inboxId - The inbox ID to check
1641
- * @param address - The address to check
1642
- * @param env - The environment to use
1643
- * @param gatewayHost - Optional gateway host
1644
- * @returns Whether the address is authorized
1645
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1646
- * of `XmtpEnv` and `gatewayHost`.
1647
- */
1648
- static isAddressAuthorized(inboxId: string, address: string, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
1649
- /**
1650
- * Checks if an installation is authorized for an inbox
1651
- *
1652
- * @param inboxId - The inbox ID to check
1653
- * @param installation - The installation to check
1654
- * @param backend - Optional `Backend` instance created with `createBackend()`
1655
- * @returns Whether the installation is authorized
1656
- */
1657
- static isInstallationAuthorized(inboxId: string, installation: Uint8Array, backend?: Backend): Promise<boolean>;
1658
- /**
1659
- * Checks if an installation is authorized for an inbox
1660
- *
1661
- * @param inboxId - The inbox ID to check
1662
- * @param installation - The installation to check
1663
- * @param env - The environment to use
1664
- * @param gatewayHost - Optional gateway host
1665
- * @returns Whether the installation is authorized
1666
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1667
- * of `XmtpEnv` and `gatewayHost`.
1668
- */
1669
- static isInstallationAuthorized(inboxId: string, installation: Uint8Array, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
1670
- /**
1671
- * Send a sync request to other devices on the network
1672
- *
1673
- * @param options - Archive options specifying what to sync (defaults to consent and messages)
1674
- * @param serverUrl - The server URL for the sync request (defaults to environment-specific URL)
1675
- * @returns Promise that resolves when the sync request is sent
1676
- */
1677
- sendSyncRequest(options?: ArchiveOptions, serverUrl?: string): Promise<void>;
1678
- /**
1679
- * Send a sync archive to the sync group
1680
- *
1681
- * @param pin - The pin used for reference when importing
1682
- * @param options - Archive options specifying what to sync (defaults to consent and messages)
1683
- * @param serverUrl - The server URL for the sync archive (defaults to environment-specific URL)
1684
- * @returns Promise that resolves when the sync archive is sent
1685
- */
1686
- sendSyncArchive(pin: string, options?: ArchiveOptions, serverUrl?: string): Promise<void>;
1687
- /**
1688
- * Process a sync archive that matches the pin given
1689
- *
1690
- * @param archivePin - Optional pin to match. If not provided, processes the last archive sent
1691
- * @returns Promise that resolves when the archive is processed
1692
- */
1693
- processSyncArchive(archivePin?: string | null): Promise<void>;
1694
- /**
1695
- * List the archives available for import in the sync group
1696
- *
1697
- * You may need to manually sync the sync group before calling
1698
- * this function to see recently uploaded archives.
1699
- *
1700
- * @param daysCutoff - Number of days to look back for archives
1701
- * @returns Array of available archive information
1702
- */
1703
- listAvailableArchives(daysCutoff: number): AvailableArchiveInfo[];
1634
+ /** Check address authorization with an explicit backend or network options. */
1635
+ static isAddressAuthorized(inboxId: string, address: string, optionsOrBackend: NetworkOptions | Backend): Promise<boolean>;
1636
+ /** Check installation authorization with an explicit backend or network options. */
1637
+ static isInstallationAuthorized(inboxId: string, installation: Uint8Array, optionsOrBackend: NetworkOptions | Backend): Promise<boolean>;
1704
1638
  /**
1705
1639
  * Archive application elements to file for later restoration
1706
1640
  *
@@ -1734,7 +1668,176 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
1734
1668
  * @returns Promise that resolves with a summary of the sync operation
1735
1669
  */
1736
1670
  syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
1671
+ /** Enable notifications and register the delivery channel. */
1672
+ enableNotifications(config: NotificationConfig): Promise<NotificationState>;
1673
+ /** Disable notifications. Per-conversation overrides remain stored. */
1674
+ disableNotifications(): Promise<void>;
1675
+ /** Read the local state without a backend request. */
1676
+ notificationState(): Promise<NotificationState>;
1677
+ /**
1678
+ * What the deployment published about itself, as this client resolved it
1679
+ * when it was built (spec 006 CFG-030, CFG-080).
1680
+ *
1681
+ * Reads memory and makes no backend request. The value never changes for the
1682
+ * life of the client: a background refresh rewrites the stored copy, and a
1683
+ * new value takes effect at the next build.
1684
+ *
1685
+ * @throws {ClientNotInitializedError} if the client is not initialized
1686
+ */
1687
+ serverConfiguration(): ServerConfiguration;
1688
+ /**
1689
+ * Fetch the deployment configuration now, rewrite the stored copy, and
1690
+ * return what was fetched (spec 006 CFG-082).
1691
+ *
1692
+ * The snapshot this client holds is unchanged; use it to observe a change an
1693
+ * operator has made without restarting.
1694
+ *
1695
+ * @throws {ClientNotInitializedError} if the client is not initialized
1696
+ * @throws {ConfigurationUnavailableError} if the deployment did not answer
1697
+ * @throws {ConfigurationInvalidError} if it published an unusable configuration
1698
+ * @throws {BackendMismatchError} if it published a different identifier
1699
+ * @throws {ClientVersionTooOldError} if it now requires a newer libxmtp
1700
+ */
1701
+ refreshServerConfiguration(): Promise<ServerConfiguration>;
1702
+ /**
1703
+ * Read what a deployment publishes about itself with no database, no client,
1704
+ * and no credential (spec 006 CFG-081, CFG-045).
1705
+ *
1706
+ * Lets an app learn `auth.enabled`, `auth.requiredScopes`, and the accepted
1707
+ * smart contract wallet chains before it decides how to build a client.
1708
+ * Nothing is stored and no identifier binding is applied.
1709
+ *
1710
+ * @param target - A backend URL, network options, or an existing backend
1711
+ * @throws {ConfigurationUnavailableError} if the deployment did not answer
1712
+ * @throws {ConfigurationInvalidError} if it published an unusable configuration
1713
+ */
1714
+ static fetchServerConfiguration(target: string | NetworkOptions | Backend): Promise<ServerConfiguration>;
1715
+ }
1716
+
1717
+ type StreamFailureCause = {
1718
+ kind: "target_pending" | "receipt_pending" | "processing_pending" | "blocked" | "storage" | "receiver" | "invalid_topic";
1719
+ code: string | null;
1720
+ message: string;
1721
+ retryable: boolean;
1722
+ };
1723
+ type UnfinishedStreamTopic = {
1724
+ topic: Uint8Array;
1725
+ /** Null means that target capture did not complete. */
1726
+ target: bigint | null;
1727
+ received: bigint;
1728
+ processed: bigint;
1729
+ unresolvedWelcomes: bigint[];
1730
+ inactive: boolean;
1731
+ cause: StreamFailureCause | null;
1732
+ };
1733
+ type StreamBarrierFailure = {
1734
+ reason: "blocked" | "deadline" | "cancelled";
1735
+ unfinished: UnfinishedStreamTopic[];
1736
+ };
1737
+ type StreamFailureDetails = {
1738
+ kind: "barrier" | "published_but_unconfirmed" | "catch_up";
1739
+ code: string;
1740
+ message: string;
1741
+ retryable: boolean;
1742
+ intentId: number | null;
1743
+ publishedIntentIds: number[];
1744
+ summary: {
1745
+ messages: bigint;
1746
+ conversations: bigint;
1747
+ failed: bigint;
1748
+ completed: boolean;
1749
+ } | null;
1750
+ barriers: StreamBarrierFailure[];
1751
+ };
1752
+ /**
1753
+ * Reads structured progress from a stream, sync, or publication error.
1754
+ * All sequence values are exact bigints. Invalid or absent details return undefined.
1755
+ * A published-but-unconfirmed error does not mean that publication failed.
1756
+ */
1757
+ declare const getStreamFailureDetails: (error: unknown) => StreamFailureDetails | undefined;
1758
+
1759
+ /**
1760
+ * Typed failures for the deployment configuration a backend publishes
1761
+ * (spec 006 §7, CFG-083).
1762
+ *
1763
+ * The bindings report every one of these as an `Error` whose message begins
1764
+ * with `[ClientError::<Variant>]`. Matching on that string is what this module
1765
+ * removes: each of the six documented codes becomes its own class, so an app
1766
+ * writes `error instanceof BackendMismatchError` instead of a regular
1767
+ * expression over a message that may be reworded.
1768
+ *
1769
+ * Every class keeps the binding's message and the original error as `cause`,
1770
+ * so the identifiers, versions, scopes, or chain the core reported are still
1771
+ * readable for diagnostics.
1772
+ */
1773
+ /**
1774
+ * Base class of the six configuration failures. Catch this to handle any of
1775
+ * them; catch a subclass to handle one.
1776
+ */
1777
+ declare class ServerConfigurationError extends Error {
1778
+ /** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
1779
+ readonly code: string;
1780
+ constructor(
1781
+ /** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
1782
+ code: string, message: string, options?: ErrorOptions);
1783
+ }
1784
+ /**
1785
+ * The configuration could not be read: the deployment did not answer, answered
1786
+ * `UNIMPLEMENTED` because it predates spec 006, or the copy could not be
1787
+ * stored.
1788
+ */
1789
+ declare class ConfigurationUnavailableError extends ServerConfigurationError {
1790
+ constructor(message: string, options?: ErrorOptions);
1791
+ }
1792
+ /**
1793
+ * The deployment answered with a configuration no client can use: an empty or
1794
+ * malformed identifier, an unparseable minimum version, or a chain that is not
1795
+ * a CAIP-2 identifier. Nothing is stored.
1796
+ */
1797
+ declare class ConfigurationInvalidError extends ServerConfigurationError {
1798
+ constructor(message: string, options?: ErrorOptions);
1799
+ }
1800
+ /**
1801
+ * This database is bound to a different deployment. The identifier the backend
1802
+ * published is not the one the database was created against. Recovery is a
1803
+ * database created for the deployment the app now uses.
1804
+ */
1805
+ declare class BackendMismatchError extends ServerConfigurationError {
1806
+ constructor(message: string, options?: ErrorOptions);
1807
+ }
1808
+ /** The deployment requires a newer libxmtp than this SDK is built on. */
1809
+ declare class ClientVersionTooOldError extends ServerConfigurationError {
1810
+ constructor(message: string, options?: ErrorOptions);
1811
+ }
1812
+ /**
1813
+ * The deployment requires authentication and no credential source was
1814
+ * configured. The message carries the scopes it requires.
1815
+ */
1816
+ declare class AuthRequiredError extends ServerConfigurationError {
1817
+ constructor(message: string, options?: ErrorOptions);
1818
+ }
1819
+ /**
1820
+ * A smart contract wallet signature names a chain the deployment does not
1821
+ * verify on. Raised before any network call, and only for signatures the app
1822
+ * supplied.
1823
+ */
1824
+ declare class ChainNotAcceptedError extends ServerConfigurationError {
1825
+ constructor(message: string, options?: ErrorOptions);
1737
1826
  }
1827
+ /**
1828
+ * Classifies an error from any SDK call as one of the six configuration
1829
+ * failures, or `undefined` when it is something else.
1830
+ *
1831
+ * Use this where the SDK hands back the raw error, for instance a
1832
+ * `ChainNotAcceptedError` raised deep inside a call that supplies a smart
1833
+ * contract wallet signature.
1834
+ */
1835
+ declare const toServerConfigurationError: (error: unknown) => ServerConfigurationError | undefined;
1836
+ /**
1837
+ * Rethrows an error as its typed configuration failure, or unchanged when it
1838
+ * is not one.
1839
+ */
1840
+ declare const throwServerConfigurationError: (error: unknown) => never;
1738
1841
 
1739
- export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DecodedMessage, Dm, Group, HistorySyncUrls, InboxReassignError, MissingContentTypeError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, createBackend, createStream, envToString, generateInboxId, getInboxIdForIdentifier, isActions, isAttachment, isGroupUpdated, isHexString, isIntent, isLeaveRequest, isMarkdown, isMultiRemoteAttachment, isReaction, isReadReceipt, isRemoteAttachment, isReply, isText, isTextReply, isTransactionReference, isWalletSendCalls, validHex };
1740
- export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, DeviceSyncOptions, DistributiveOmit, EOASigner, EnrichedReply, ExtractCodecContentTypes, HexString, NetworkOptions, OtherOptions, SCWSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
1842
+ export { AccountAlreadyAssociatedError, AuthRequiredError, BackendMismatchError, ChainNotAcceptedError, Client, ClientNotInitializedError, ClientVersionTooOldError, CodecRegistry, ConfigurationInvalidError, ConfigurationUnavailableError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DebugInformation, DecodedMessage, Dm, Group, InboxReassignError, MessageStream, MissingContentTypeError, NotificationError, Preferences, ServerConfigurationError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, createBackend, createStream, generateInboxId, getInboxIdForIdentifier, getStreamFailureDetails, isActions, isAttachment, isGroupUpdated, isHexString, isIntent, isLeaveRequest, isMarkdown, isMultiRemoteAttachment, isReaction, isReadReceipt, isRemoteAttachment, isReply, isText, isTextReply, isTransactionReference, isWalletSendCalls, throwServerConfigurationError, toServerConfigurationError, validHex };
1843
+ export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, DeviceSyncOptions, DistributiveOmit, EOASigner, EnrichedReply, ExtractCodecContentTypes, GetBlockNumber, GetChainId, GetIdentifier, HexString, MessageAcknowledgement, MessageDelivery, MessageReaderSource, NetworkOptions, NotificationChannel, NotificationConfig, NotificationOverride, NotificationState, OtherOptions, ResolveValue, SCWSigner, SignMessage, Signer, StorageOptions, StreamBarrierFailure, StreamCallback, StreamFailureCause, StreamFailureDetails, StreamFunction, StreamOptions, StreamValueMutator, UnfinishedStreamTopic };