@xmtp/node-sdk 6.2.0-dev.999b077 → 6.2.0-dev.9f72722

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,52 +1,19 @@
1
- import { ContentCodec, ContentTypeId } from '@xmtp/content-type-primitives';
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, AppDataChange, 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, AppDataChange, 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
- };
37
-
38
- declare class CodecRegistry {
39
- #private;
40
- constructor(codecs: ContentCodec[]);
41
- /**
42
- * Gets the codec for a given content type
43
- *
44
- * @param contentType - The content type to get the codec for
45
- * @returns The codec, if found
46
- */
47
- getCodec<ContentType = unknown>(contentType: ContentTypeId): ContentCodec<ContentType> | undefined;
1
+ import { Action, ActionStyle, Actions, Actions as Actions$1, ApiStats, AppDataChange, AppDataChange as AppDataChange$1, ArchiveMetadata, ArchiveMetadata as ArchiveMetadata$1, ArchiveOptions, ArchiveOptions as ArchiveOptions$1, Attachment, Attachment as Attachment$1, AuthConfiguration, Backend, Backend as Backend$1, BackendBuilder, BackupElementSelectionOption, Client as Client$1, Consent, Consent as Consent$1, ConsentEntityType, ConsentEntityType as ConsentEntityType$1, ConsentState, ConsentState as ConsentState$1, ContentType, ContentTypeId, Conversation as Conversation$1, ConversationDebugInfo, ConversationListItem, ConversationType, ConversationType as ConversationType$1, Conversations as Conversations$1, CreateDmOptions, CreateDmOptions as CreateDmOptions$1, CreateGroupOptions, CreateGroupOptions as CreateGroupOptions$1, Cursor, DecodedMessage as DecodedMessage$1, DeletedMessage, DeliveryCursor, DeliveryCursor as DeliveryCursor$1, DeliveryStatus, DeliveryStatus as DeliveryStatus$1, EncodedContent, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMessageKind as GroupMessageKind$1, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupSyncSummary as GroupSyncSummary$1, GroupUpdated, GroupUpdated as GroupUpdated$1, HmacKey, Identifier, Identifier as Identifier$1, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, Intent as Intent$1, KeyPackageStatus, LeaveRequest, LeaveRequest as LeaveRequest$1, Lifetime, LimitsConfiguration, ListConversationsOptions, ListConversationsOptions as ListConversationsOptions$1, ListConversationsOrderBy, ListMessagesOptions, ListMessagesOptions as ListMessagesOptions$1, LogLevel, LogLevel as LogLevel$1, LogOptions, Message, Message as Message$1, MessageCatchUp, MessageCatchUp as MessageCatchUp$1, MessageCatchUpGeneration, MessageDisappearingSettings, MessageHistorySnapshot, MessageSortBy, MessageTopicStatus, MetadataField, MetadataField as MetadataField$1, MetadataFieldChange, MlsConfiguration, MultiRemoteAttachment, MultiRemoteAttachment as MultiRemoteAttachment$1, NotificationOverride as NotificationOverride$1, PermissionLevel, PermissionPolicy, PermissionPolicy as PermissionPolicy$1, PermissionPolicySet, PermissionUpdateType, PermissionUpdateType as PermissionUpdateType$1, Reaction, Reaction as Reaction$1, ReactionAction, ReactionSchema, ReadReceipt, ReadReceipt as ReadReceipt$1, RemoteAttachment, RemoteAttachment as RemoteAttachment$1, Reply, Reply as Reply$1, RetentionConfiguration, SendMessageOpts, SendMessageOpts as SendMessageOpts$1, SendOpts, SendOpts as SendOpts$1, ServerConfiguration, ServerConfiguration as ServerConfiguration$1, SignatureRequestHandle, SignatureRequestHandle as SignatureRequestHandle$1, SigningKeyDescription, SortDirection, StreamCloser, TransactionMetadata, TransactionReference, TransactionReference as TransactionReference$1, UserPreferenceUpdate, UserPreferenceUpdate as UserPreferenceUpdate$1, VisibilityConfirmationOptions, VisibilityConfirmationOptions as VisibilityConfirmationOptions$1, WalletCall, WalletSendCalls, WalletSendCalls as WalletSendCalls$1, WorkerConfigOptions, WorkerConfigOptions as WorkerConfigOptions$1, 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";
2
+ import { ContentCodec, ContentTypeId as ContentTypeId$1 } from "@xmtp/content-type-primitives";
3
+ //#region src/CodecRegistry.d.ts
4
+ export declare class CodecRegistry {
5
+ #private;
6
+ constructor(codecs: ContentCodec[]);
7
+ /**
8
+ * Gets the codec for a given content type
9
+ *
10
+ * @param contentType - The content type to get the codec for
11
+ * @returns The codec, if found
12
+ */
13
+ getCodec<ContentType = unknown>(contentType: ContentTypeId$1): ContentCodec<ContentType> | undefined;
48
14
  }
49
-
15
+ //#endregion
16
+ //#region src/DecodedMessage.d.ts
50
17
  /**
51
18
  * Represents a decoded XMTP message
52
19
  *
@@ -66,210 +33,201 @@ declare class CodecRegistry {
66
33
  * @property {Date} sentAt - Timestamp when the message was sent
67
34
  * @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
68
35
  */
69
- declare class DecodedMessage<ContentTypes = unknown> {
70
- content: ContentTypes | undefined;
71
- contentType: ContentTypeId$1;
72
- conversationId: string;
73
- deliveryStatus: DeliveryStatus;
74
- expiresAtNs?: bigint;
75
- expiresAt?: Date;
76
- fallback?: string;
77
- id: string;
78
- kind: GroupMessageKind;
79
- numReplies: number;
80
- reactions: DecodedMessage<Reaction>[];
81
- senderInboxId: string;
82
- sentAt: Date;
83
- sentAtNs: bigint;
84
- constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
36
+ export declare class DecodedMessage<ContentTypes = unknown> {
37
+ /** Database-local position of this delivery. Absent for ordinary history reads. */
38
+ deliveryCursor?: DeliveryCursor$1;
39
+ content: ContentTypes | undefined;
40
+ contentType: ContentTypeId;
41
+ conversationId: string;
42
+ deliveryStatus: DeliveryStatus$1;
43
+ expiresAtNs?: bigint;
44
+ expiresAt?: Date;
45
+ fallback?: string;
46
+ id: string;
47
+ kind: GroupMessageKind$1;
48
+ numReplies: number;
49
+ reactions: DecodedMessage<Reaction$1>[];
50
+ senderInboxId: string;
51
+ sentAt: Date;
52
+ sentAtNs: bigint;
53
+ constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
85
54
  }
86
-
87
- type HexString = `0x${string}`;
88
- declare function isHexString(value: unknown): value is HexString;
89
- declare function validHex(value: unknown): HexString;
90
-
91
- /**
92
- * XMTP environment
93
- */
94
- type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
55
+ //#endregion
56
+ //#region src/utils/validation.d.ts
57
+ export type HexString = `0x${string}`;
58
+ export declare function isHexString(value: unknown): value is HexString;
59
+ export declare function validHex(value: unknown): HexString;
60
+ //#endregion
61
+ //#region src/types.d.ts
95
62
  /**
96
63
  * Network options
97
64
  */
65
+ /** A backend credential. Include the `Bearer ` prefix when required. */
66
+ type Credential = {
67
+ /** Header name. Defaults to `authorization`. */
68
+ name?: string;
69
+ value: string;
70
+ /** Expiration as Unix seconds. Must be a safe integer. */
71
+ expiresAtSeconds: number;
72
+ };
73
+ /** Called when the backend needs a credential, including credential refresh. */
74
+ type AuthCallback = () => Promise<Credential>;
98
75
  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
- */
121
- appVersion?: string;
76
+ /** Backend URL, including the HTTP or HTTPS scheme. */
77
+ backendUrl: string;
78
+ /** Label used only for the default database file name. */
79
+ env?: string;
80
+ /** Custom app version. */
81
+ appVersion?: string;
82
+ /** Supply backend credentials. Separate from the XMTP identity signer. */
83
+ authCallback?: AuthCallback;
122
84
  };
123
85
  /**
124
86
  * Device sync options
125
87
  */
126
88
  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
- /**
135
- * Disable device sync
136
- */
137
- disableDeviceSync?: boolean;
89
+ /**
90
+ * Disable device sync
91
+ */
92
+ disableDeviceSync?: boolean;
138
93
  };
139
94
  /**
140
95
  * Storage options
141
96
  */
142
97
  type StorageOptions = {
143
- /**
144
- * Path to the local DB
145
- *
146
- * There are 4 value types that can be used to specify the database path:
147
- *
148
- * - `undefined` (or excluded from the client options)
149
- * 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`
152
- *
153
- * - `null`
154
- * No database will be created and all data will be lost once the client disconnects.
155
- *
156
- * - `string`
157
- * The given path will be used to create the database.
158
- * Example: `./my-db.db3`
159
- *
160
- * - `function`
161
- * A callback function that receives the inbox ID and returns a string path.
162
- * Example: `(inboxId) => string`
163
- */
164
- dbPath?: string | null | ((inboxId: string) => string);
165
- /**
166
- * Encryption key for the local DB (32 bytes, hex)
167
- *
168
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-a-client#view-an-encrypted-database
169
- */
170
- dbEncryptionKey?: Uint8Array | HexString;
171
- /**
172
- * Maximum number of connections in the local DB connection pool.
173
- *
174
- * Defaults to 25 when unset. Ignored when `useSingleConnection` is `true`.
175
- */
176
- maxDbPoolSize?: number;
177
- /**
178
- * Minimum number of connections kept warm in the local DB connection pool.
179
- *
180
- * Defaults to 5 when unset. Ignored when `useSingleConnection` is `true`.
181
- */
182
- minDbPoolSize?: number;
183
- /**
184
- * When `true`, the native DB uses a single connection (one file descriptor)
185
- * instead of a pool. The pool-size options above are ignored. Intended for
186
- * services running many clients in one process.
187
- *
188
- * Defaults to `false` (pooled).
189
- */
190
- useSingleConnection?: boolean;
98
+ /**
99
+ * Path to the local DB
100
+ *
101
+ * There are 4 value types that can be used to specify the database path:
102
+ *
103
+ * - `undefined` (or excluded from the client options)
104
+ * The database will be created in the current working directory and is based on
105
+ * the environment label and client inbox ID.
106
+ * Example: `xmtp-default-<inbox-id>.db3`
107
+ *
108
+ * - `null`
109
+ * No database will be created and all data will be lost once the client disconnects.
110
+ *
111
+ * - `string`
112
+ * The given path will be used to create the database.
113
+ * Example: `./my-db.db3`
114
+ *
115
+ * - `function`
116
+ * A callback function that receives the inbox ID and returns a string path.
117
+ * Example: `(inboxId) => string`
118
+ */
119
+ dbPath?: string | null | ((inboxId: string) => string);
120
+ /**
121
+ * Encryption key for the local DB (32 bytes, hex)
122
+ *
123
+ * @see https://docs.xmtp.org/sdk/client/#view-an-encrypted-database
124
+ */
125
+ dbEncryptionKey?: Uint8Array | HexString;
126
+ /**
127
+ * Maximum number of connections in the local DB connection pool.
128
+ *
129
+ * Defaults to 25 when unset. Ignored when `useSingleConnection` is `true`.
130
+ */
131
+ maxDbPoolSize?: number;
132
+ /**
133
+ * Minimum number of connections kept warm in the local DB connection pool.
134
+ *
135
+ * Defaults to 5 when unset. Ignored when `useSingleConnection` is `true`.
136
+ */
137
+ minDbPoolSize?: number;
138
+ /**
139
+ * When `true`, the native DB uses a single connection (one file descriptor)
140
+ * instead of a pool. The pool-size options above are ignored. Intended for
141
+ * services running many clients in one process.
142
+ *
143
+ * Defaults to `false` (pooled).
144
+ */
145
+ useSingleConnection?: boolean;
191
146
  };
192
147
  type ContentOptions = {
193
- /**
194
- * Allow configuring codecs for additional content types
195
- */
196
- codecs?: ContentCodec[];
148
+ /**
149
+ * Allow configuring codecs for additional content types
150
+ */
151
+ codecs?: ContentCodec[];
197
152
  };
198
153
  type OtherOptions = {
199
- /**
200
- * Enable structured JSON logging
201
- */
202
- structuredLogging?: boolean;
203
- /**
204
- * Logging level. Also the level exported to OTLP when `otelEndpoint` is set.
205
- */
206
- loggingLevel?: LogLevel;
207
- /**
208
- * Level for the stdout console layer only. Defaults to `loggingLevel`. Set to
209
- * `LogLevel.Warn` to quiet stdout below the OTLP export level — e.g. so a log
210
- * shipper does not duplicate logs already exported via OTLP, while OTLP still
211
- * receives `loggingLevel`.
212
- */
213
- stdoutLoggingLevel?: LogLevel;
214
- /**
215
- * OTLP endpoint (e.g. `"http://collector:4317"`) for exporting telemetry
216
- * spans and logs. When set, spans (and `tracing` events as correlated logs)
217
- * are exported via OTLP to this endpoint, where a downstream OpenTelemetry
218
- * Collector can derive metrics from the spans and forward the logs.
219
- *
220
- * Call {@link flushTelemetry} on graceful shutdown to flush buffered spans.
221
- */
222
- otelEndpoint?: string;
223
- /**
224
- * Resource attributes attached to all exported telemetry spans
225
- * (e.g. `{ "service.instance.id": "herald-7", "deployment.environment": "prod" }`).
226
- * Use these to attribute telemetry to its source.
227
- */
228
- resourceAttributes?: Record<string, string>;
229
- /**
230
- * Tuning for the background worker scheduler (intervals, jitter, per-worker
231
- * overrides, and disabled workers). All fields are optional; omitting this
232
- * object preserves the default worker behavior.
233
- *
234
- * Intervals are specified in nanoseconds.
235
- */
236
- workerConfig?: WorkerConfigOptions;
237
- /**
238
- * Disable automatic registration when creating a client
239
- */
240
- disableAutoRegister?: boolean;
241
- /**
242
- * The nonce to use when generating an inbox ID
243
- * (default: undefined = 1)
244
- */
245
- nonce?: bigint;
246
- /**
247
- * Options for waiting until client registration is visible on the network.
248
- *
249
- * When set, `registerIdentity` will wait for the specified quorum of nodes
250
- * to confirm the registration before resolving.
251
- */
252
- waitForRegistrationVisible?: VisibilityConfirmationOptions;
253
- /**
254
- * Unstable: notifications for group state changes, for clients that
255
- * reconcile a group's `appData` themselves.
256
- *
257
- * Only `appData` exists today; callbacks for the other mutable fields will
258
- * be added as further optional properties. Registered at client creation
259
- * because the changes they report arrive from the stream and sync paths,
260
- * where no SDK call is on the stack to carry them.
261
- *
262
- * The `appData` callback is awaited before message processing continues, so
263
- * a semantic merge — including republishing via `updateAppData` — can finish
264
- * first. It fires for changes this client made as well as remote ones, so
265
- * the merge must be idempotent.
266
- */
267
- unstableChangeCallbacks?: {
268
- appData?: (change: AppDataChange) => Promise<void>;
269
- };
154
+ /**
155
+ * Enable structured JSON logging
156
+ */
157
+ structuredLogging?: boolean;
158
+ /**
159
+ * Logging level. Also the level exported to OTLP when `otelEndpoint` is set.
160
+ */
161
+ loggingLevel?: LogLevel$1;
162
+ /**
163
+ * Level for the stdout console layer only. Defaults to `loggingLevel`. Set to
164
+ * `LogLevel.Warn` to quiet stdout below the OTLP export level — e.g. so a log
165
+ * shipper does not duplicate logs already exported via OTLP, while OTLP still
166
+ * receives `loggingLevel`.
167
+ */
168
+ stdoutLoggingLevel?: LogLevel$1;
169
+ /**
170
+ * OTLP endpoint (e.g. `"http://collector:4317"`) for exporting telemetry
171
+ * spans and logs. When set, spans (and `tracing` events as correlated logs)
172
+ * are exported via OTLP to this endpoint, where a downstream OpenTelemetry
173
+ * Collector can derive metrics from the spans and forward the logs.
174
+ *
175
+ * Call {@link flushTelemetry} on graceful shutdown to flush buffered spans.
176
+ */
177
+ otelEndpoint?: string;
178
+ /** Service name attached to exported telemetry. */
179
+ otelServiceName?: string;
180
+ /** Fraction of root spans sampled, from 0 to 1. */
181
+ otelSampleRatio?: number;
182
+ /**
183
+ * Resource attributes attached to all exported telemetry spans
184
+ * (e.g. `{ "service.instance.id": "herald-7", "deployment.environment": "prod" }`).
185
+ * Use these to attribute telemetry to its source.
186
+ */
187
+ resourceAttributes?: Record<string, string>;
188
+ /**
189
+ * Tuning for the background worker scheduler (intervals, jitter, per-worker
190
+ * overrides, and disabled workers). All fields are optional; omitting this
191
+ * object preserves the default worker behavior.
192
+ *
193
+ * Intervals are specified in nanoseconds.
194
+ */
195
+ workerConfig?: WorkerConfigOptions$1;
196
+ /**
197
+ * Disable automatic registration when creating a client
198
+ */
199
+ disableAutoRegister?: boolean;
200
+ /**
201
+ * The nonce to use when generating an inbox ID
202
+ * (default: undefined = 1)
203
+ */
204
+ nonce?: bigint;
205
+ /**
206
+ * Options for waiting until client registration is visible on the network.
207
+ *
208
+ * When set, `registerIdentity` waits until the backend can read the registration.
209
+ */
210
+ waitForRegistrationVisible?: VisibilityConfirmationOptions$1;
211
+ /**
212
+ * Unstable: notifications for group state changes, for clients that
213
+ * reconcile a group's `appData` themselves.
214
+ *
215
+ * Only `appData` exists today; callbacks for the other mutable fields will
216
+ * be added as further optional properties. Registered at client creation
217
+ * because the changes they report arrive from the stream and sync paths,
218
+ * where no SDK call is on the stack to carry them.
219
+ *
220
+ * The `appData` callback is awaited before message processing continues, so
221
+ * a semantic merge — including republishing via `updateAppData` — can finish
222
+ * first. It fires for changes this client made as well as remote ones, so
223
+ * the merge must be idempotent.
224
+ */
225
+ unstableChangeCallbacks?: {
226
+ appData?: (change: AppDataChange$1) => Promise<void>;
227
+ };
270
228
  };
271
229
  type ClientOptions = (NetworkOptions | {
272
- backend: Backend;
230
+ backend: Backend$1;
273
231
  }) & DeviceSyncOptions & StorageOptions & ContentOptions & OtherOptions;
274
232
  /**
275
233
  * `Omit` that distributes over unions. The built-in `Omit` collapses a union
@@ -279,122 +237,136 @@ type ClientOptions = (NetworkOptions | {
279
237
  */
280
238
  type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
281
239
  type EnrichedReply<T = unknown, U = unknown> = {
282
- referenceId: string;
283
- content: T;
284
- contentType: ContentTypeId$1 | undefined;
285
- inReplyTo: DecodedMessage<U> | null;
240
+ referenceId: string;
241
+ content: T;
242
+ contentType: ContentTypeId | undefined;
243
+ inReplyTo: DecodedMessage<U> | null;
286
244
  };
287
- type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated | DeletedMessage;
245
+ type BuiltInContentTypes = string | LeaveRequest$1 | Reaction$1 | ReadReceipt$1 | Attachment$1 | RemoteAttachment$1 | TransactionReference$1 | WalletSendCalls$1 | Actions$1 | Intent$1 | MultiRemoteAttachment$1 | GroupUpdated$1 | DeletedMessage;
288
246
  type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes | EnrichedReply<T | BuiltInContentTypes, T | BuiltInContentTypes> : BuiltInContentTypes;
289
-
290
- declare const envToString: (env: XmtpEnv$1) => XmtpEnv;
291
- declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
292
-
293
- declare class InboxReassignError extends Error {
294
- constructor();
247
+ //#endregion
248
+ //#region src/utils/createBackend.d.ts
249
+ export declare const createBackend: (options: NetworkOptions) => Promise<Backend$1>;
250
+ //#endregion
251
+ //#region src/utils/errors.d.ts
252
+ export declare class InboxReassignError extends Error {
253
+ constructor();
295
254
  }
296
- declare class AccountAlreadyAssociatedError extends Error {
297
- constructor(inboxId: string);
255
+ export declare class AccountAlreadyAssociatedError extends Error {
256
+ constructor(inboxId: string);
298
257
  }
299
- declare class MissingContentTypeError extends Error {
300
- constructor();
258
+ export declare class MissingContentTypeError extends Error {
259
+ constructor();
301
260
  }
302
- declare class SignerUnavailableError extends Error {
303
- constructor();
261
+ export declare class SignerUnavailableError extends Error {
262
+ constructor();
304
263
  }
305
- declare class ClientNotInitializedError extends Error {
306
- constructor();
264
+ export declare class ClientNotInitializedError extends Error {
265
+ constructor();
307
266
  }
308
- declare class StreamFailedError extends Error {
309
- constructor(retryAttempts: number);
267
+ export declare class StreamFailedError extends Error {
268
+ constructor(retryAttempts: number);
310
269
  }
311
- declare class StreamInvalidRetryAttemptsError extends Error {
312
- constructor();
270
+ export declare class StreamInvalidRetryAttemptsError extends Error {
271
+ constructor();
313
272
  }
314
-
315
- declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => string;
316
- declare const getInboxIdForIdentifier: (backend: Backend, identifier: Identifier) => Promise<string | null>;
317
-
273
+ //#endregion
274
+ //#region src/utils/inboxId.d.ts
275
+ export declare const generateInboxId: (identifier: Identifier$1, nonce?: bigint) => string;
276
+ export declare const getInboxIdForIdentifier: (backend: Backend$1, identifier: Identifier$1) => Promise<string | null>;
277
+ //#endregion
278
+ //#region src/utils/signer.d.ts
318
279
  type SignMessage = (message: string) => Promise<Uint8Array> | Uint8Array;
319
- type GetIdentifier = () => Promise<Identifier> | Identifier;
280
+ type GetIdentifier = () => Promise<Identifier$1> | Identifier$1;
320
281
  type GetChainId = () => bigint;
321
282
  type GetBlockNumber = () => bigint;
322
283
  type Signer = {
323
- type: "EOA";
324
- signMessage: SignMessage;
325
- getIdentifier: GetIdentifier;
284
+ type: "EOA";
285
+ signMessage: SignMessage;
286
+ getIdentifier: GetIdentifier;
326
287
  } | {
327
- type: "SCW";
328
- signMessage: SignMessage;
329
- getIdentifier: GetIdentifier;
330
- getBlockNumber?: GetBlockNumber;
331
- getChainId: GetChainId;
288
+ type: "SCW";
289
+ signMessage: SignMessage;
290
+ getIdentifier: GetIdentifier;
291
+ getBlockNumber?: GetBlockNumber;
292
+ getChainId: GetChainId;
332
293
  };
333
294
  type EOASigner = Extract<Signer, {
334
- type: "EOA";
295
+ type: "EOA";
335
296
  }>;
336
297
  type SCWSigner = Extract<Signer, {
337
- type: "SCW";
298
+ type: "SCW";
338
299
  }>;
339
-
300
+ //#endregion
301
+ //#region src/AsyncStream.d.ts
340
302
  type ResolveValue<T> = {
341
- value: T;
342
- done: boolean;
303
+ value: T;
304
+ done: boolean;
343
305
  };
344
306
  interface AsyncStreamProxy<T> extends AsyncIterable<T> {
345
- next(): Promise<ResolveValue<T>>;
346
- return(): Promise<ResolveValue<undefined>>;
347
- end(): Promise<ResolveValue<undefined>>;
348
- isDone: boolean;
307
+ next(): Promise<ResolveValue<T>>;
308
+ return(): Promise<ResolveValue<undefined>>;
309
+ end(): Promise<ResolveValue<undefined>>;
310
+ isDone: boolean;
349
311
  }
350
-
312
+ //#endregion
313
+ //#region src/utils/streams.d.ts
351
314
  declare const DEFAULT_RETRY_DELAY = 60000;
352
315
  declare const DEFAULT_RETRY_ATTEMPTS = 10;
316
+ /**
317
+ * Notification streams created by createStream use the retry settings and hooks.
318
+ * Durable message streams use onValue, onError, and onEnd. Core handles their
319
+ * network recovery; notification retry settings and hooks do not apply.
320
+ */
353
321
  type StreamOptions<T = unknown, V = T> = {
354
- /**
355
- * Called when the stream ends
356
- */
357
- onEnd?: () => void;
358
- /**
359
- * Called when a stream error occurs
360
- */
361
- onError?: (error: Error) => void;
362
- /**
363
- * Called when the stream fails
364
- */
365
- onFail?: () => void;
366
- /**
367
- * Called when the stream is restarted
368
- */
369
- onRestart?: () => void;
370
- /**
371
- * Called when the stream is retried
372
- */
373
- onRetry?: (attempts: number, maxAttempts: number) => void;
374
- /**
375
- * Called when a value is emitted from the stream
376
- */
377
- onValue?: (value: V) => void;
378
- /**
379
- * The number of times to retry the stream
380
- * (default: 10)
381
- */
382
- retryAttempts?: number;
383
- /**
384
- * The delay between retries (in milliseconds)
385
- * (default: 60000)
386
- */
387
- retryDelay?: number;
388
- /**
389
- * Whether to retry the stream if it fails
390
- * (default: true)
391
- */
392
- retryOnFail?: boolean;
393
- /**
394
- * Whether to disable network sync before starting the stream
395
- * (default: false)
396
- */
397
- disableSync?: boolean;
322
+ /**
323
+ * Called when the stream ends
324
+ */
325
+ onEnd?: () => void;
326
+ /**
327
+ * Called when a stream error occurs
328
+ */
329
+ onError?: (error: Error) => void;
330
+ /**
331
+ * Called when a notification stream fails
332
+ */
333
+ onFail?: () => void;
334
+ /**
335
+ * Called when a notification stream is restarted
336
+ */
337
+ onRestart?: () => void;
338
+ /**
339
+ * Called when a notification stream is retried
340
+ */
341
+ onRetry?: (attempts: number, maxAttempts: number) => void;
342
+ /**
343
+ * Called when a value is emitted from the stream.
344
+ * For message streams, this selects callback mode. Do not also iterate that stream.
345
+ * Message delivery is acknowledged after this callback returns successfully.
346
+ */
347
+ onValue?: (value: V) => void | Promise<void>;
348
+ /**
349
+ * The number of times to retry an unexpected notification stream closure.
350
+ * Terminal native storage and network errors are not retried.
351
+ * (default: 10)
352
+ */
353
+ retryAttempts?: number;
354
+ /**
355
+ * The delay between notification stream retries (in milliseconds)
356
+ * (default: 60000)
357
+ */
358
+ retryDelay?: number;
359
+ /**
360
+ * Whether to retry a notification stream if it fails
361
+ * (default: true)
362
+ */
363
+ retryOnFail?: boolean;
364
+ /**
365
+ * Whether to skip pre-sync for notification streams.
366
+ * Durable message readers start receipt without a separate pre-sync.
367
+ * (default: false)
368
+ */
369
+ disableSync?: boolean;
398
370
  };
399
371
  type StreamCallback<T = unknown> = (error: Error | null, value: T | undefined) => void;
400
372
  type StreamFunction<T = unknown> = (callback: StreamCallback<T>, onFail: () => void) => Promise<StreamCloser>;
@@ -402,7 +374,8 @@ type StreamValueMutator<T = unknown, V = T> = (value: T) => V | Promise<V>;
402
374
  /**
403
375
  * Creates a stream from a stream function
404
376
  *
405
- * If the stream fails, an attempt will be made to restart it.
377
+ * Unexpected native closures can be retried. Terminal native storage and
378
+ * network errors end the stream and reject iteration with the original cause.
406
379
  *
407
380
  * Ending the stream is terminal: no callbacks are invoked and no native
408
381
  * stream is created after the stream ends.
@@ -412,1356 +385,1493 @@ type StreamValueMutator<T = unknown, V = T> = (value: T) => V | Promise<V>;
412
385
  * @param streamFunction - The stream function to create a stream from
413
386
  * @param streamValueMutator - An optional function to mutate the value emitted from the stream
414
387
  * @param options - The options for the stream
415
- * @param args - Additional arguments to pass to the stream function
416
388
  * @returns An async iterable stream proxy
417
389
  * @throws {StreamInvalidRetryAttemptsError} if the retryAttempts option is less than 0 and retryOnFail is true
418
390
  * @throws {StreamFailedError} if the stream fails and can't be restarted
419
391
  */
420
392
  declare const createStream: <T = unknown, V = T>(streamFunction: StreamFunction<T>, streamValueMutator?: StreamValueMutator<T, V | undefined>, options?: StreamOptions<T, V>) => Promise<AsyncStreamProxy<V>>;
421
-
422
- declare const isReaction: (m: DecodedMessage) => m is DecodedMessage<Reaction>;
423
- declare const isReply: (m: DecodedMessage) => m is DecodedMessage<EnrichedReply>;
424
- declare const isTextReply: (m: DecodedMessage) => m is DecodedMessage<EnrichedReply<string>>;
425
- declare const isText: (m: DecodedMessage) => m is DecodedMessage<string>;
426
- declare const isRemoteAttachment: (m: DecodedMessage) => m is DecodedMessage<RemoteAttachment>;
427
- declare const isAttachment: (m: DecodedMessage) => m is DecodedMessage<Attachment>;
428
- declare const isMultiRemoteAttachment: (m: DecodedMessage) => m is DecodedMessage<MultiRemoteAttachment>;
429
- declare const isTransactionReference: (m: DecodedMessage) => m is DecodedMessage<TransactionReference>;
430
- declare const isGroupUpdated: (m: DecodedMessage) => m is DecodedMessage<GroupUpdated>;
431
- declare const isReadReceipt: (m: DecodedMessage) => m is DecodedMessage<ReadReceipt>;
432
- declare const isLeaveRequest: (m: DecodedMessage) => m is DecodedMessage<LeaveRequest>;
433
- declare const isWalletSendCalls: (m: DecodedMessage) => m is DecodedMessage<WalletSendCalls>;
434
- declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent>;
435
- declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions>;
436
- declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
437
-
393
+ //#endregion
394
+ //#region src/utils/messages.d.ts
395
+ export declare const isReaction: (m: DecodedMessage) => m is DecodedMessage<Reaction$1>;
396
+ export declare const isReply: (m: DecodedMessage) => m is DecodedMessage<EnrichedReply>;
397
+ export declare const isTextReply: (m: DecodedMessage) => m is DecodedMessage<EnrichedReply<string>>;
398
+ export declare const isText: (m: DecodedMessage) => m is DecodedMessage<string>;
399
+ export declare const isRemoteAttachment: (m: DecodedMessage) => m is DecodedMessage<RemoteAttachment$1>;
400
+ export declare const isAttachment: (m: DecodedMessage) => m is DecodedMessage<Attachment$1>;
401
+ export declare const isMultiRemoteAttachment: (m: DecodedMessage) => m is DecodedMessage<MultiRemoteAttachment$1>;
402
+ export declare const isTransactionReference: (m: DecodedMessage) => m is DecodedMessage<TransactionReference$1>;
403
+ export declare const isGroupUpdated: (m: DecodedMessage) => m is DecodedMessage<GroupUpdated$1>;
404
+ export declare const isReadReceipt: (m: DecodedMessage) => m is DecodedMessage<ReadReceipt$1>;
405
+ export declare const isLeaveRequest: (m: DecodedMessage) => m is DecodedMessage<LeaveRequest$1>;
406
+ export declare const isWalletSendCalls: (m: DecodedMessage) => m is DecodedMessage<WalletSendCalls$1>;
407
+ export declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent$1>;
408
+ export declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions$1>;
409
+ export declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
410
+ //#endregion
411
+ //#region src/MessageStream.d.ts
412
+ type MessageAcknowledgement = {
413
+ checkOwner(): boolean | Promise<boolean>;
414
+ acknowledge(): void | Promise<void>;
415
+ enrichedMessage(): DecodedMessage$1 | null;
416
+ reject(): void | Promise<void>;
417
+ };
418
+ type MessageDelivery<T> = {
419
+ message: T;
420
+ cursor: DeliveryCursor$1;
421
+ acknowledgement: MessageAcknowledgement;
422
+ };
423
+ type MessageReaderSource<T> = {
424
+ nextDelivery(): Promise<MessageDelivery<T> | null | undefined>;
425
+ close(): void | Promise<void>;
426
+ updateScope(groupIds?: string[]): void | Promise<void>;
427
+ updateFilter(conversationType?: ConversationType$1, consentStates?: ConsentState$1[]): void | Promise<void>;
428
+ catchUpSnapshot(): MessageCatchUp$1 | Promise<MessageCatchUp$1>;
429
+ catchUpChanged(): Promise<MessageCatchUp$1>;
430
+ };
431
+ /** One pending item. Construction selects callback mode or next-request acknowledgement. */
432
+ export declare class MessageStream<T, V> implements AsyncIterable<V> {
433
+ #private;
434
+ constructor(reader: MessageReaderSource<T>, convert: (message: T, cursor: DeliveryCursor$1, acknowledgement: MessageAcknowledgement) => V | undefined | Promise<V | undefined>, options?: StreamOptions<T, V>);
435
+ get isDone(): boolean;
436
+ get deliveredCursor(): DeliveryCursor$1 | undefined;
437
+ next: () => Promise<IteratorResult<V, undefined>>;
438
+ return: () => Promise<IteratorReturnResult<undefined>>;
439
+ end: () => Promise<IteratorReturnResult<undefined>>;
440
+ updateScope: (groupIds?: string[]) => void | Promise<void>;
441
+ updateFilter: (conversationType?: ConversationType$1, consentStates?: ConsentState$1[]) => void | Promise<void>;
442
+ catchUpSnapshot: () => MessageCatchUp$1 | Promise<MessageCatchUp$1>;
443
+ catchUpChanged: () => Promise<MessageCatchUp$1>;
444
+ [Symbol.asyncIterator](): this;
445
+ }
446
+ //#endregion
447
+ //#region src/Notifications.d.ts
448
+ /** Delivery channel for this installation. */
449
+ type NotificationChannel = {
450
+ type: "apns";
451
+ token: string;
452
+ } | {
453
+ type: "fcm";
454
+ token: string;
455
+ } | {
456
+ type: "http";
457
+ url: string;
458
+ signingKey: Uint8Array;
459
+ };
460
+ /** Notification delivery and conversation rules. */
461
+ type NotificationConfig = {
462
+ channel: NotificationChannel;
463
+ /** Defaults to Allowed. An empty list selects no consent states. */
464
+ consentStates?: ConsentState$1[];
465
+ /** Defaults to true. */
466
+ includeWelcomes?: boolean;
467
+ /** Defaults to false. */
468
+ includeSyncGroups?: boolean;
469
+ /** Defaults to false. */
470
+ includeCommits?: boolean;
471
+ };
472
+ /** Reset to the configured consent rules with "default". */
473
+ type NotificationOverride = "enabled" | "disabled" | "default";
474
+ /** A notification failure with a stable error code. */
475
+ export declare class NotificationError extends Error {
476
+ readonly code: string;
477
+ constructor(code: string, options?: ErrorOptions);
478
+ }
479
+ /** Local notification state. Reading it makes no backend request. */
480
+ type NotificationState = {
481
+ state: "disabled";
482
+ } | {
483
+ state: "enabled";
484
+ } | {
485
+ state: "failed";
486
+ error: NotificationError;
487
+ };
488
+ //#endregion
489
+ //#region src/Conversation.d.ts
438
490
  /**
439
491
  * Represents a conversation
440
492
  *
441
493
  * This class is not intended to be initialized directly.
442
494
  */
443
- declare class Conversation<ContentTypes = unknown> {
444
- #private;
445
- /**
446
- * Creates a new conversation instance
447
- *
448
- * @param client - The client instance managing the conversation
449
- * @param codecRegistry - The codec registry instance
450
- * @param conversation - The underlying conversation instance
451
- */
452
- constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
453
- /**
454
- * Gets the unique identifier for this conversation
455
- */
456
- get id(): string;
457
- /**
458
- * Gets whether this conversation is currently active
459
- */
460
- get isActive(): boolean;
461
- /**
462
- * Gets the inbox ID that added this client's inbox to the conversation
463
- */
464
- get addedByInboxId(): string;
465
- /**
466
- * Gets the timestamp when the conversation was created in nanoseconds
467
- */
468
- get createdAtNs(): bigint;
469
- /**
470
- * Gets the date when the conversation was created
471
- */
472
- get createdAt(): Date;
473
- get topic(): string;
474
- pausedForVersion(): string | undefined;
475
- /**
476
- * Gets HMAC keys for this conversation
477
- *
478
- * @returns The HMAC keys for this conversation
479
- */
480
- hmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
481
- /**
482
- * Gets the metadata for this conversation
483
- *
484
- * @returns Promise that resolves with the conversation metadata
485
- */
486
- metadata(): Promise<{
487
- creatorInboxId: string;
488
- conversationType: _xmtp_node_bindings.ConversationType;
489
- }>;
490
- /**
491
- * Gets the members of this conversation
492
- *
493
- * @returns Promise that resolves with the conversation members
494
- */
495
- members(): Promise<_xmtp_node_bindings.GroupMember[]>;
496
- /**
497
- * Synchronizes conversation data from the network
498
- *
499
- * @returns Promise that resolves when synchronization is complete
500
- */
501
- sync(): Promise<void>;
502
- /**
503
- * Creates a stream for new messages in this conversation
504
- *
505
- * @param options - Optional stream options
506
- * @returns Stream instance for new messages
507
- */
508
- stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes>>): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
509
- /**
510
- * Decodes, decrypts, and persists a raw envelope from a group message stream.
511
- *
512
- * @param envelopeBytes - Raw protobuf-encoded envelope bytes from the stream
513
- * @returns The processed and stored messages
514
- */
515
- processStreamedMessage(envelopeBytes: Uint8Array): Promise<Message[]>;
516
- /**
517
- * Publishes pending messages that were sent optimistically
518
- *
519
- * @returns Promise that resolves when publishing is complete
520
- */
521
- publishMessages(): Promise<void>;
522
- /**
523
- * Sends a message with configurable delivery behavior
524
- *
525
- * @param encodedContent - The encoded content to send
526
- * @param sendOptions - Options for sending the message
527
- * @param sendOptions.shouldPush - Indicates whether this message should be
528
- * included in push notifications
529
- * @param sendOptions.optimistic - Indicates whether this message should be
530
- * sent optimistically and published later via `publishMessages`
531
- * @param sendOptions.idempotencyKey - Optional idempotency key; re-sending
532
- * identical content with the same key produces the same deduplicated message id
533
- * @returns Promise that resolves with the message ID after it has been sent
534
- */
535
- send(encodedContent: EncodedContent, sendOptions?: SendMessageOpts): Promise<string>;
536
- /**
537
- * Sends a text message
538
- *
539
- * @param text - The text to send
540
- * @param opts - Send options (optimistic delivery, idempotency key)
541
- * @returns Promise that resolves with the message ID after it has been sent
542
- */
543
- sendText(text: string, opts?: SendOpts): Promise<string>;
544
- /**
545
- * Sends a markdown message
546
- *
547
- * @param markdown - The markdown to send
548
- * @param opts - Send options (optimistic delivery, idempotency key)
549
- * @returns Promise that resolves with the message ID after it has been sent
550
- */
551
- sendMarkdown(markdown: string, opts?: SendOpts): Promise<string>;
552
- /**
553
- * Sends a reaction message
554
- *
555
- * @param reaction - The reaction to send
556
- * @param opts - Send options (optimistic delivery, idempotency key)
557
- * @returns Promise that resolves with the message ID after it has been sent
558
- */
559
- sendReaction(reaction: Reaction, opts?: SendOpts): Promise<string>;
560
- /**
561
- * Sends a read receipt message
562
- *
563
- * @param opts - Send options (optimistic delivery, idempotency key)
564
- * @returns Promise that resolves with the message ID after it has been sent
565
- */
566
- sendReadReceipt(opts?: SendOpts): Promise<string>;
567
- /**
568
- * Sends a reply message
569
- *
570
- * @param reply - The reply to send
571
- * @param opts - Send options (optimistic delivery, idempotency key)
572
- * @returns Promise that resolves with the message ID after it has been sent
573
- */
574
- sendReply(reply: Reply, opts?: SendOpts): Promise<string>;
575
- /**
576
- * Sends a transaction reference message
577
- *
578
- * @param transactionReference - The transaction reference to send
579
- * @param opts - Send options (optimistic delivery, idempotency key)
580
- * @returns Promise that resolves with the message ID after it has been sent
581
- */
582
- sendTransactionReference(transactionReference: TransactionReference, opts?: SendOpts): Promise<string>;
583
- /**
584
- * Sends a wallet send calls message
585
- *
586
- * @param walletSendCalls - The wallet send calls to send
587
- * @param opts - Send options (optimistic delivery, idempotency key)
588
- * @returns Promise that resolves with the message ID after it has been sent
589
- */
590
- sendWalletSendCalls(walletSendCalls: WalletSendCalls, opts?: SendOpts): Promise<string>;
591
- /**
592
- * Sends a actions message
593
- *
594
- * @param actions - The actions to send
595
- * @param opts - Send options (optimistic delivery, idempotency key)
596
- * @returns Promise that resolves with the message ID after it has been sent
597
- */
598
- sendActions(actions: Actions, opts?: SendOpts): Promise<string>;
599
- /**
600
- * Sends a intent message
601
- *
602
- * @param intent - The intent to send
603
- * @param opts - Send options (optimistic delivery, idempotency key)
604
- * @returns Promise that resolves with the message ID after it has been sent
605
- */
606
- sendIntent(intent: Intent, opts?: SendOpts): Promise<string>;
607
- /**
608
- * Sends an attachment message
609
- *
610
- * @param attachment - The attachment to send
611
- * @param opts - Send options (optimistic delivery, idempotency key)
612
- * @returns Promise that resolves with the message ID after it has been sent
613
- */
614
- sendAttachment(attachment: Attachment, opts?: SendOpts): Promise<string>;
615
- /**
616
- * Sends a multi remote attachment message
617
- *
618
- * @param multiRemoteAttachment - The multi remote attachment to send
619
- * @param opts - Send options (optimistic delivery, idempotency key)
620
- * @returns Promise that resolves with the message ID after it has been sent
621
- */
622
- sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, opts?: SendOpts): Promise<string>;
623
- /**
624
- * Sends a remote attachment message
625
- *
626
- * @param remoteAttachment - The remote attachment to send
627
- * @param opts - Send options (optimistic delivery, idempotency key)
628
- * @returns Promise that resolves with the message ID after it has been sent
629
- */
630
- sendRemoteAttachment(remoteAttachment: RemoteAttachment, opts?: SendOpts): Promise<string>;
631
- /**
632
- * Lists messages in this conversation
633
- *
634
- * @param options - Optional filtering and pagination options
635
- * @returns Promise that resolves with an array of decoded messages
636
- */
637
- messages(options?: ListMessagesOptions): Promise<DecodedMessage<ContentTypes>[]>;
638
- /**
639
- * Counts messages in this conversation
640
- *
641
- * @param options - Optional filtering options
642
- * @returns Promise that resolves with the count of messages
643
- */
644
- countMessages(options?: Omit<ListMessagesOptions, "limit" | "direction">): Promise<number>;
645
- /**
646
- * Gets the last message in this conversation
647
- *
648
- * @returns Promise that resolves with the last message or undefined if none exists
649
- */
650
- lastMessage(): Promise<DecodedMessage<ContentTypes> | undefined>;
651
- /**
652
- * Gets the consent state for this conversation
653
- */
654
- consentState(): ConsentState;
655
- /**
656
- * Updates the consent state for this conversation
657
- *
658
- * @param consentState - The new consent state to set
659
- */
660
- updateConsentState(consentState: ConsentState): void;
661
- /**
662
- * Gets the message disappearing settings for this conversation
663
- *
664
- * @returns The current message disappearing settings or undefined if not set
665
- */
666
- messageDisappearingSettings(): _xmtp_node_bindings.MessageDisappearingSettings | undefined;
667
- /**
668
- * Updates message disappearing settings for this conversation
669
- *
670
- * @param fromNs - The timestamp from which messages should start disappearing
671
- * @param inNs - The duration after which messages should disappear
672
- * @returns Promise that resolves when the update is complete
673
- */
674
- updateMessageDisappearingSettings(fromNs: bigint, inNs: bigint): Promise<void>;
675
- /**
676
- * Removes message disappearing settings from this conversation
677
- *
678
- * @returns Promise that resolves when the settings are removed
679
- */
680
- removeMessageDisappearingSettings(): Promise<void>;
681
- /**
682
- * Checks if message disappearing is enabled for this conversation
683
- *
684
- * @returns Whether message disappearing is enabled
685
- */
686
- isMessageDisappearingEnabled(): boolean;
687
- /**
688
- * Retrieves information for this conversation to help with debugging
689
- *
690
- * @returns The debug information for this conversation
691
- */
692
- debugInfo(): Promise<_xmtp_node_bindings.ConversationDebugInfo>;
693
- /**
694
- * Retrieves the last read times for this conversation
695
- *
696
- * @returns A map keyed by inbox ID with the last read timestamp
697
- * (nanoseconds since epoch)
698
- */
699
- lastReadTimes(): Promise<Record<string, number>>;
495
+ export declare class Conversation<ContentTypes = unknown> {
496
+ #private;
497
+ /**
498
+ * Creates a new conversation instance
499
+ *
500
+ * @param _client - The client instance managing the conversation
501
+ * @param codecRegistry - The codec registry instance
502
+ * @param conversation - The underlying conversation instance
503
+ */
504
+ constructor(_client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
505
+ /**
506
+ * Gets the unique identifier for this conversation
507
+ */
508
+ get id(): string;
509
+ /**
510
+ * Gets whether this conversation is currently active
511
+ */
512
+ get isActive(): boolean;
513
+ /** Override notification rules, or reset the override with "default". */
514
+ setNotifications(value: NotificationOverride): Promise<void>;
515
+ /** Read the effective notification value for this conversation. */
516
+ notificationsEnabled(): Promise<boolean>;
517
+ /**
518
+ * Gets the inbox ID that added this client's inbox to the conversation
519
+ */
520
+ get addedByInboxId(): string;
521
+ /**
522
+ * Gets the timestamp when the conversation was created in nanoseconds
523
+ */
524
+ get createdAtNs(): bigint;
525
+ /**
526
+ * Gets the date when the conversation was created
527
+ */
528
+ get createdAt(): Date;
529
+ get topic(): string;
530
+ pausedForVersion(): string | undefined;
531
+ /**
532
+ * Gets HMAC keys for this conversation
533
+ *
534
+ * @returns The HMAC keys for this conversation
535
+ */
536
+ hmacKeys(): Record<string, import("@xmtp/node-bindings").HmacKey[]>;
537
+ /**
538
+ * Gets the metadata for this conversation
539
+ *
540
+ * @returns Promise that resolves with the conversation metadata
541
+ */
542
+ metadata(): Promise<{
543
+ creatorInboxId: string;
544
+ conversationType: import("@xmtp/node-bindings").ConversationType;
545
+ }>;
546
+ /**
547
+ * Gets the members of this conversation
548
+ *
549
+ * @returns Promise that resolves with the conversation members
550
+ */
551
+ members(): Promise<import("@xmtp/node-bindings").GroupMember[]>;
552
+ /**
553
+ * Synchronizes conversation data from the network
554
+ *
555
+ * @returns Promise that resolves when synchronization is complete
556
+ */
557
+ sync(): Promise<void>;
558
+ /**
559
+ * Reads retained messages after the default acknowledgement position.
560
+ * Set `from` to replay after a cursor without changing default progress.
561
+ * Set `onValue` for callback mode, or request items with the iterator.
562
+ * Core owns network recovery. Legacy retry options and `disableSync` do not apply.
563
+ *
564
+ * @param options - Optional delivery callbacks and replay cursor
565
+ * @returns Stream instance for new messages
566
+ */
567
+ stream(options?: StreamOptions<Message$1, DecodedMessage<ContentTypes>> & {
568
+ from?: DeliveryCursor$1;
569
+ }): Promise<MessageStream<Message$1, DecodedMessage<ContentTypes>>>;
570
+ messageHistorySnapshot(limit: number): import("@xmtp/node-bindings").MessageHistorySnapshot;
571
+ beginningDeliveryCursor(): DeliveryCursor$1;
572
+ /**
573
+ * Decodes, decrypts, and persists a raw envelope from a group message stream.
574
+ *
575
+ * @param envelopeBytes - Raw protobuf-encoded envelope bytes from the stream
576
+ * @returns The processed and stored messages
577
+ */
578
+ processStreamedMessage(envelopeBytes: Uint8Array): Promise<Message$1[]>;
579
+ /**
580
+ * Publishes pending messages that were sent optimistically
581
+ *
582
+ * @returns Promise that resolves when publishing is complete
583
+ */
584
+ publishMessages(): Promise<void>;
585
+ /**
586
+ * Sends a message with configurable delivery behavior
587
+ *
588
+ * @param encodedContent - The encoded content to send
589
+ * @param sendOptions - Options for sending the message
590
+ * @param sendOptions.shouldPush - Indicates whether this message should be
591
+ * included in push notifications
592
+ * @param sendOptions.optimistic - Indicates whether this message should be
593
+ * sent optimistically and published later via `publishMessages`
594
+ * @param sendOptions.idempotencyKey - Optional idempotency key; re-sending
595
+ * identical content with the same key produces the same deduplicated message id
596
+ * @returns Promise that resolves with the message ID after it has been sent
597
+ */
598
+ send(encodedContent: EncodedContent, sendOptions?: SendMessageOpts$1): Promise<string>;
599
+ /**
600
+ * Sends a text message
601
+ *
602
+ * @param text - The text to send
603
+ * @param opts - Send options (optimistic delivery, idempotency key)
604
+ * @returns Promise that resolves with the message ID after it has been sent
605
+ */
606
+ sendText(text: string, opts?: SendOpts$1): Promise<string>;
607
+ /**
608
+ * Sends a markdown message
609
+ *
610
+ * @param markdown - The markdown to send
611
+ * @param opts - Send options (optimistic delivery, idempotency key)
612
+ * @returns Promise that resolves with the message ID after it has been sent
613
+ */
614
+ sendMarkdown(markdown: string, opts?: SendOpts$1): Promise<string>;
615
+ /**
616
+ * Sends a reaction message
617
+ *
618
+ * @param reaction - The reaction to send
619
+ * @param opts - Send options (optimistic delivery, idempotency key)
620
+ * @returns Promise that resolves with the message ID after it has been sent
621
+ */
622
+ sendReaction(reaction: Reaction$1, opts?: SendOpts$1): Promise<string>;
623
+ /**
624
+ * Sends a read receipt message
625
+ *
626
+ * @param opts - Send options (optimistic delivery, idempotency key)
627
+ * @returns Promise that resolves with the message ID after it has been sent
628
+ */
629
+ sendReadReceipt(opts?: SendOpts$1): Promise<string>;
630
+ /**
631
+ * Sends a reply message
632
+ *
633
+ * @param reply - The reply to send
634
+ * @param opts - Send options (optimistic delivery, idempotency key)
635
+ * @returns Promise that resolves with the message ID after it has been sent
636
+ */
637
+ sendReply(reply: Reply$1, opts?: SendOpts$1): Promise<string>;
638
+ /**
639
+ * Sends a transaction reference message
640
+ *
641
+ * @param transactionReference - The transaction reference to send
642
+ * @param opts - Send options (optimistic delivery, idempotency key)
643
+ * @returns Promise that resolves with the message ID after it has been sent
644
+ */
645
+ sendTransactionReference(transactionReference: TransactionReference$1, opts?: SendOpts$1): Promise<string>;
646
+ /**
647
+ * Sends a wallet send calls message
648
+ *
649
+ * @param walletSendCalls - The wallet send calls to send
650
+ * @param opts - Send options (optimistic delivery, idempotency key)
651
+ * @returns Promise that resolves with the message ID after it has been sent
652
+ */
653
+ sendWalletSendCalls(walletSendCalls: WalletSendCalls$1, opts?: SendOpts$1): Promise<string>;
654
+ /**
655
+ * Sends a actions message
656
+ *
657
+ * @param actions - The actions to send
658
+ * @param opts - Send options (optimistic delivery, idempotency key)
659
+ * @returns Promise that resolves with the message ID after it has been sent
660
+ */
661
+ sendActions(actions: Actions$1, opts?: SendOpts$1): Promise<string>;
662
+ /**
663
+ * Sends a intent message
664
+ *
665
+ * @param intent - The intent to send
666
+ * @param opts - Send options (optimistic delivery, idempotency key)
667
+ * @returns Promise that resolves with the message ID after it has been sent
668
+ */
669
+ sendIntent(intent: Intent$1, opts?: SendOpts$1): Promise<string>;
670
+ /**
671
+ * Sends an attachment message
672
+ *
673
+ * @param attachment - The attachment to send
674
+ * @param opts - Send options (optimistic delivery, idempotency key)
675
+ * @returns Promise that resolves with the message ID after it has been sent
676
+ */
677
+ sendAttachment(attachment: Attachment$1, opts?: SendOpts$1): Promise<string>;
678
+ /**
679
+ * Sends a multi remote attachment message
680
+ *
681
+ * @param multiRemoteAttachment - The multi remote attachment to send
682
+ * @param opts - Send options (optimistic delivery, idempotency key)
683
+ * @returns Promise that resolves with the message ID after it has been sent
684
+ */
685
+ sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment$1, opts?: SendOpts$1): Promise<string>;
686
+ /**
687
+ * Sends a remote attachment message
688
+ *
689
+ * @param remoteAttachment - The remote attachment to send
690
+ * @param opts - Send options (optimistic delivery, idempotency key)
691
+ * @returns Promise that resolves with the message ID after it has been sent
692
+ */
693
+ sendRemoteAttachment(remoteAttachment: RemoteAttachment$1, opts?: SendOpts$1): Promise<string>;
694
+ /**
695
+ * Lists messages in this conversation
696
+ *
697
+ * @param options - Optional filtering and pagination options
698
+ * @returns Promise that resolves with an array of decoded messages
699
+ */
700
+ messages(options?: ListMessagesOptions$1): Promise<DecodedMessage<ContentTypes>[]>;
701
+ /**
702
+ * Counts messages in this conversation
703
+ *
704
+ * @param options - Optional filtering options
705
+ * @returns Promise that resolves with the count of messages
706
+ */
707
+ countMessages(options?: Omit<ListMessagesOptions$1, "limit" | "direction">): Promise<number>;
708
+ /**
709
+ * Gets the last message in this conversation
710
+ *
711
+ * @returns Promise that resolves with the last message or undefined if none exists
712
+ */
713
+ lastMessage(): Promise<DecodedMessage<ContentTypes> | undefined>;
714
+ /**
715
+ * Gets the consent state for this conversation
716
+ */
717
+ consentState(): ConsentState$1;
718
+ /**
719
+ * Updates the consent state for this conversation
720
+ *
721
+ * @param consentState - The new consent state to set
722
+ */
723
+ updateConsentState(consentState: ConsentState$1): void;
724
+ /**
725
+ * Gets the message disappearing settings for this conversation
726
+ *
727
+ * @returns The current message disappearing settings or undefined if not set
728
+ */
729
+ messageDisappearingSettings(): import("@xmtp/node-bindings").MessageDisappearingSettings | undefined;
730
+ /**
731
+ * Updates message disappearing settings for this conversation
732
+ *
733
+ * @param fromNs - The timestamp from which messages should start disappearing
734
+ * @param inNs - The duration after which messages should disappear
735
+ * @returns Promise that resolves when the update is complete
736
+ */
737
+ updateMessageDisappearingSettings(fromNs: bigint, inNs: bigint): Promise<void>;
738
+ /**
739
+ * Removes message disappearing settings from this conversation
740
+ *
741
+ * @returns Promise that resolves when the settings are removed
742
+ */
743
+ removeMessageDisappearingSettings(): Promise<void>;
744
+ /**
745
+ * Checks if message disappearing is enabled for this conversation
746
+ *
747
+ * @returns Whether message disappearing is enabled
748
+ */
749
+ isMessageDisappearingEnabled(): boolean;
750
+ /**
751
+ * Retrieves information for this conversation to help with debugging
752
+ *
753
+ * @returns The debug information for this conversation
754
+ */
755
+ debugInfo(): Promise<import("@xmtp/node-bindings").ConversationDebugInfo>;
756
+ /**
757
+ * Retrieves the last read times for this conversation
758
+ *
759
+ * @returns A map keyed by inbox ID with the last read timestamp
760
+ * (nanoseconds since epoch)
761
+ */
762
+ lastReadTimes(): Promise<Record<string, number>>;
700
763
  }
701
-
764
+ //#endregion
765
+ //#region src/Dm.d.ts
702
766
  /**
703
767
  * Represents a direct message conversation between two inboxes
704
768
  *
705
769
  * This class is not intended to be initialized directly.
706
770
  */
707
- declare class Dm<ContentTypes = unknown> extends Conversation<ContentTypes> {
708
- #private;
709
- /**
710
- * Creates a new direct message conversation instance
711
- *
712
- * @param client - The client instance managing this direct message conversation
713
- * @param codecRegistry - The codec registry instance
714
- * @param conversation - The underlying conversation instance
715
- */
716
- constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
717
- /**
718
- * Retrieves the inbox ID of the other participant in the DM
719
- *
720
- * @returns Promise that resolves with the peer's inbox ID
721
- */
722
- get peerInboxId(): string;
723
- duplicateDms(): Promise<Dm<ContentTypes>[]>;
771
+ export declare class Dm<ContentTypes = unknown> extends Conversation<ContentTypes> {
772
+ #private;
773
+ /**
774
+ * Creates a new direct message conversation instance
775
+ *
776
+ * @param client - The client instance managing this direct message conversation
777
+ * @param codecRegistry - The codec registry instance
778
+ * @param conversation - The underlying conversation instance
779
+ */
780
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
781
+ /**
782
+ * Retrieves the inbox ID of the other participant in the DM
783
+ *
784
+ * @returns Promise that resolves with the peer's inbox ID
785
+ */
786
+ get peerInboxId(): string;
787
+ duplicateDms(): Promise<Dm<ContentTypes>[]>;
724
788
  }
725
-
789
+ //#endregion
790
+ //#region src/Group.d.ts
726
791
  /**
727
792
  * Represents a group conversation between multiple inboxes
728
793
  *
729
794
  * This class is not intended to be initialized directly.
730
795
  */
731
- declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
732
- #private;
733
- /**
734
- * Creates a new group conversation instance
735
- *
736
- * @param client - The client instance managing this group conversation
737
- * @param codecRegistry - The codec registry instance
738
- * @param conversation - The underlying conversation object
739
- */
740
- constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
741
- /**
742
- * The name of the group
743
- */
744
- get name(): string;
745
- /**
746
- * Updates the group's name
747
- *
748
- * @param name The new name for the group
749
- */
750
- updateName(name: string): Promise<void>;
751
- /**
752
- * The image URL of the group
753
- */
754
- get imageUrl(): string;
755
- /**
756
- * Updates the group's image URL
757
- *
758
- * @param imageUrl The new image URL for the group
759
- */
760
- updateImageUrl(imageUrl: string): Promise<void>;
761
- /**
762
- * The description of the group
763
- */
764
- get description(): string;
765
- /**
766
- * Updates the group's description
767
- *
768
- * @param description The new description for the group
769
- */
770
- updateDescription(description: string): Promise<void>;
771
- /**
772
- * The app data of the group
773
- */
774
- get appData(): string;
775
- /**
776
- * Updates the group's app data (max 8192 bytes)
777
- *
778
- * @param appData The new app data for the group
779
- * @param expectedAppData Optional compare-and-swap guard. When provided, the
780
- * update is abandoned — rather than overwriting — if the committed value is
781
- * no longer this, including when another member's commit wins the race after
782
- * this update was published. Callers reconciling structured state should
783
- * pass the value they merged against, so a concurrent write surfaces as an
784
- * error instead of silently discarding someone else's change. Omit for
785
- * last-writer-wins.
786
- */
787
- updateAppData(appData: string, expectedAppData?: string): Promise<void>;
788
- /**
789
- * The permissions of the group
790
- */
791
- permissions(): {
792
- policyType: _xmtp_node_bindings.GroupPermissionsOptions;
793
- policySet: _xmtp_node_bindings.PermissionPolicySet;
794
- };
795
- /**
796
- * Updates a specific permission policy for the group
797
- *
798
- * @param permissionType The type of permission to update
799
- * @param policy The new permission policy
800
- * @param metadataField Optional metadata field for the permission
801
- */
802
- updatePermission(permissionType: PermissionUpdateType, policy: PermissionPolicy, metadataField?: MetadataField): Promise<void>;
803
- /**
804
- * The list of admins of the group
805
- */
806
- listAdmins(): string[];
807
- /**
808
- * The list of super admins of the group
809
- */
810
- listSuperAdmins(): string[];
811
- /**
812
- * Checks if an inbox is an admin of the group
813
- *
814
- * @param inboxId The inbox ID to check
815
- * @returns Boolean indicating if the inbox is an admin
816
- */
817
- isAdmin(inboxId: string): boolean;
818
- /**
819
- * Checks if an inbox is a super admin of the group
820
- *
821
- * @param inboxId The inbox ID to check
822
- * @returns Boolean indicating if the inbox is a super admin
823
- */
824
- isSuperAdmin(inboxId: string): boolean;
825
- /**
826
- * Adds members to the group using identifiers
827
- *
828
- * @param identifiers Array of member identifiers to add
829
- */
830
- addMembersByIdentifiers(identifiers: Identifier[]): Promise<_xmtp_node_bindings.UpdateGroupMembershipResult>;
831
- /**
832
- * Adds members to the group using inbox IDs
833
- *
834
- * @param inboxIds Array of inbox IDs to add
835
- */
836
- addMembers(inboxIds: string[]): Promise<_xmtp_node_bindings.UpdateGroupMembershipResult>;
837
- /**
838
- * Removes members from the group using identifiers
839
- *
840
- * @param identifiers Array of member identifiers to remove
841
- */
842
- removeMembersByIdentifiers(identifiers: Identifier[]): Promise<void>;
843
- /**
844
- * Removes members from the group using inbox IDs
845
- *
846
- * @param inboxIds Array of inbox IDs to remove
847
- */
848
- removeMembers(inboxIds: string[]): Promise<void>;
849
- /**
850
- * Promotes a group member to admin status
851
- *
852
- * @param inboxId The inbox ID of the member to promote
853
- */
854
- addAdmin(inboxId: string): Promise<void>;
855
- /**
856
- * Removes admin status from a group member
857
- *
858
- * @param inboxId The inbox ID of the admin to demote
859
- */
860
- removeAdmin(inboxId: string): Promise<void>;
861
- /**
862
- * Promotes a group member to super admin status
863
- *
864
- * @param inboxId The inbox ID of the member to promote
865
- */
866
- addSuperAdmin(inboxId: string): Promise<void>;
867
- /**
868
- * Removes super admin status from a group member
869
- *
870
- * @param inboxId The inbox ID of the super admin to demote
871
- */
872
- removeSuperAdmin(inboxId: string): Promise<void>;
873
- /**
874
- * Request to leave the group
875
- */
876
- requestRemoval(): Promise<void>;
877
- /**
878
- * Checks if the current user has requested to leave the group
879
- *
880
- * @returns Boolean
881
- */
882
- isPendingRemoval(): boolean;
796
+ export declare class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {
797
+ #private;
798
+ /**
799
+ * Creates a new group conversation instance
800
+ *
801
+ * @param client - The client instance managing this group conversation
802
+ * @param codecRegistry - The codec registry instance
803
+ * @param conversation - The underlying conversation object
804
+ */
805
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversation: Conversation$1);
806
+ /**
807
+ * The name of the group
808
+ */
809
+ get name(): string;
810
+ /**
811
+ * Updates the group's name
812
+ *
813
+ * @param name The new name for the group
814
+ */
815
+ updateName(name: string): Promise<void>;
816
+ /**
817
+ * The image URL of the group
818
+ */
819
+ get imageUrl(): string;
820
+ /**
821
+ * Updates the group's image URL
822
+ *
823
+ * @param imageUrl The new image URL for the group
824
+ */
825
+ updateImageUrl(imageUrl: string): Promise<void>;
826
+ /**
827
+ * The description of the group
828
+ */
829
+ get description(): string;
830
+ /**
831
+ * Updates the group's description
832
+ *
833
+ * @param description The new description for the group
834
+ */
835
+ updateDescription(description: string): Promise<void>;
836
+ /**
837
+ * The app data of the group
838
+ */
839
+ get appData(): string;
840
+ /**
841
+ * Updates the group's app data (max 8192 bytes)
842
+ *
843
+ * @param appData The new app data for the group
844
+ * @param expectedAppData Optional compare-and-swap guard. When provided, the
845
+ * update is abandoned — rather than overwriting — if the committed value is
846
+ * no longer this, including when another member's commit wins the race after
847
+ * this update was published. Callers reconciling structured state should
848
+ * pass the value they merged against, so a concurrent write surfaces as an
849
+ * error instead of silently discarding someone else's change. Omit for
850
+ * last-writer-wins.
851
+ */
852
+ updateAppData(appData: string, expectedAppData?: string): Promise<void>;
853
+ /**
854
+ * The permissions of the group
855
+ */
856
+ permissions(): {
857
+ policyType: import("@xmtp/node-bindings").GroupPermissionsOptions;
858
+ policySet: import("@xmtp/node-bindings").PermissionPolicySet;
859
+ };
860
+ /**
861
+ * Updates a specific permission policy for the group
862
+ *
863
+ * @param permissionType The type of permission to update
864
+ * @param policy The new permission policy
865
+ * @param metadataField Optional metadata field for the permission
866
+ */
867
+ updatePermission(permissionType: PermissionUpdateType$1, policy: PermissionPolicy$1, metadataField?: MetadataField$1): Promise<void>;
868
+ /**
869
+ * The list of admins of the group
870
+ */
871
+ listAdmins(): string[];
872
+ /**
873
+ * The list of super admins of the group
874
+ */
875
+ listSuperAdmins(): string[];
876
+ /**
877
+ * Checks if an inbox is an admin of the group
878
+ *
879
+ * @param inboxId The inbox ID to check
880
+ * @returns Boolean indicating if the inbox is an admin
881
+ */
882
+ isAdmin(inboxId: string): boolean;
883
+ /**
884
+ * Checks if an inbox is a super admin of the group
885
+ *
886
+ * @param inboxId The inbox ID to check
887
+ * @returns Boolean indicating if the inbox is a super admin
888
+ */
889
+ isSuperAdmin(inboxId: string): boolean;
890
+ /**
891
+ * Adds members to the group using identifiers
892
+ *
893
+ * @param identifiers Array of member identifiers to add
894
+ */
895
+ addMembersByIdentifiers(identifiers: Identifier$1[]): Promise<import("@xmtp/node-bindings").UpdateGroupMembershipResult>;
896
+ /**
897
+ * Adds members to the group using inbox IDs
898
+ *
899
+ * @param inboxIds Array of inbox IDs to add
900
+ */
901
+ addMembers(inboxIds: string[]): Promise<import("@xmtp/node-bindings").UpdateGroupMembershipResult>;
902
+ /**
903
+ * Removes members from the group using identifiers
904
+ *
905
+ * @param identifiers Array of member identifiers to remove
906
+ */
907
+ removeMembersByIdentifiers(identifiers: Identifier$1[]): Promise<void>;
908
+ /**
909
+ * Removes members from the group using inbox IDs
910
+ *
911
+ * @param inboxIds Array of inbox IDs to remove
912
+ */
913
+ removeMembers(inboxIds: string[]): Promise<void>;
914
+ /**
915
+ * Promotes a group member to admin status
916
+ *
917
+ * @param inboxId The inbox ID of the member to promote
918
+ */
919
+ addAdmin(inboxId: string): Promise<void>;
920
+ /**
921
+ * Removes admin status from a group member
922
+ *
923
+ * @param inboxId The inbox ID of the admin to demote
924
+ */
925
+ removeAdmin(inboxId: string): Promise<void>;
926
+ /**
927
+ * Promotes a group member to super admin status
928
+ *
929
+ * @param inboxId The inbox ID of the member to promote
930
+ */
931
+ addSuperAdmin(inboxId: string): Promise<void>;
932
+ /**
933
+ * Removes super admin status from a group member
934
+ *
935
+ * @param inboxId The inbox ID of the super admin to demote
936
+ */
937
+ removeSuperAdmin(inboxId: string): Promise<void>;
938
+ /**
939
+ * Request to leave the group
940
+ */
941
+ requestRemoval(): Promise<void>;
942
+ /**
943
+ * Checks if the current user has requested to leave the group
944
+ *
945
+ * @returns Boolean
946
+ */
947
+ isPendingRemoval(): boolean;
883
948
  }
884
-
949
+ //#endregion
950
+ //#region src/Conversations.d.ts
885
951
  /**
886
952
  * Manages conversations
887
953
  *
888
954
  * This class is not intended to be initialized directly.
889
955
  */
890
- declare class Conversations<ContentTypes = unknown> {
891
- #private;
892
- /**
893
- * Creates a new conversations instance
894
- *
895
- * @param client - The client instance managing the conversations
896
- * @param codecRegistry - The codec registry instance
897
- * @param conversations - The underlying conversations instance
898
- */
899
- constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversations: Conversations$1);
900
- get topic(): string;
901
- /**
902
- * Retrieves a conversation by its ID
903
- *
904
- * @param id - The conversation ID to look up
905
- * @returns The conversation if found, undefined otherwise
906
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
907
- */
908
- getConversationById(id: string): Promise<Group<ContentTypes> | Dm<ContentTypes> | undefined>;
909
- /**
910
- * Retrieves a DM by inbox ID
911
- *
912
- * @param inboxId - The inbox ID to look up
913
- * @returns The DM if found, undefined otherwise
914
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
915
- */
916
- getDmByInboxId(inboxId: string): Dm<ContentTypes> | undefined;
917
- /**
918
- * Retrieves a DM by identifier
919
- *
920
- * @param identifier - The identifier to look up
921
- * @returns Promise that resolves with the DM, if found
922
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
923
- */
924
- fetchDmByIdentifier(identifier: Identifier): Promise<Dm<ContentTypes> | undefined>;
925
- /**
926
- * Retrieves a message by its ID
927
- *
928
- * @param id - The message ID to look up
929
- * @returns The decoded message if found, undefined otherwise
930
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#conversation-helper-methods
931
- */
932
- getMessageById(id: string): DecodedMessage<ContentTypes> | undefined;
933
- /**
934
- * Creates a new group conversation without publishing to the network
935
- *
936
- * @param options - Optional group creation options
937
- * @returns The new group
938
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#optimistically-create-a-new-group-chat
939
- */
940
- createGroupOptimistic(options?: CreateGroupOptions): Group<ContentTypes>;
941
- /**
942
- * Creates a new group conversation with the specified identifiers
943
- *
944
- * @param identifiers - Array of identifiers for group members
945
- * @param options - Optional group creation options
946
- * @returns The new group
947
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#create-a-new-group-chat
948
- */
949
- createGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
950
- /**
951
- * Creates a new group conversation with the specified inbox IDs
952
- *
953
- * @param inboxIds - Array of inbox IDs for group members
954
- * @param options - Optional group creation options
955
- * @returns The new group
956
- * @see https://docs.xmtp.org/chat-apps/core-messaging/create-conversations#create-a-new-group-chat
957
- */
958
- createGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
959
- /**
960
- * Creates a new DM conversation with the specified identifier
961
- *
962
- * @param identifier - Identifier for the DM recipient
963
- * @param options - Optional DM creation options
964
- * @returns The new DM
965
- * @see https://docs.xmtp.org/agents/build-agents/create-conversations#by-ethereum-address-1
966
- */
967
- createDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
968
- /**
969
- * Creates a new DM conversation with the specified inbox ID
970
- *
971
- * @param inboxId - Inbox ID for the DM recipient
972
- * @param options - Optional DM creation options
973
- * @returns The new DM
974
- * @see https://docs.xmtp.org/agents/build-agents/create-conversations#by-inbox-id-1
975
- */
976
- createDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
977
- /**
978
- * Lists all conversations with optional filtering
979
- *
980
- * @param options - Optional filtering and pagination options
981
- * @returns Array of conversations
982
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/list
983
- */
984
- list(options?: ListConversationsOptions): Promise<(Group<ContentTypes> | Dm<ContentTypes>)[]>;
985
- /**
986
- * Lists all groups with optional filtering
987
- *
988
- * @param options - Optional filtering and pagination options
989
- * @returns Array of groups
990
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/list#list-existing-conversations
991
- */
992
- listGroups(options?: Omit<ListConversationsOptions, "conversationType">): Group<ContentTypes>[];
993
- /**
994
- * Lists all DMs with optional filtering
995
- *
996
- * @param options - Optional filtering and pagination options
997
- * @returns Array of DMs
998
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/list#list-existing-conversations
999
- */
1000
- listDms(options?: Omit<ListConversationsOptions, "conversationType">): Dm<ContentTypes>[];
1001
- /**
1002
- * Synchronizes conversations for the current client from the network
1003
- *
1004
- * @returns Promise that resolves when sync is complete
1005
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/sync-and-syncall
1006
- */
1007
- sync(): Promise<void>;
1008
- /**
1009
- * Synchronizes all conversations and messages from the network with optional
1010
- * consent state filtering
1011
- *
1012
- * @param consentStates - Optional array of consent states to filter by
1013
- * @returns Promise that resolves when sync is complete
1014
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/sync-and-syncall#sync-all-new-welcomes-conversations-messages-and-preferences
1015
- */
1016
- syncAll(consentStates?: ConsentState[]): Promise<_xmtp_node_bindings.GroupSyncSummary>;
1017
- /**
1018
- * Creates a stream for new conversations
1019
- *
1020
- * @param options - Optional stream options
1021
- * @param options.conversationType - Optional conversation type to filter by
1022
- * @returns Stream instance for new conversations
1023
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-conversations
1024
- */
1025
- stream(options?: StreamOptions<Conversation$1, Group<ContentTypes> | Dm<ContentTypes> | undefined> & {
1026
- conversationType?: ConversationType;
1027
- }): Promise<AsyncStreamProxy<Group<ContentTypes> | Dm<ContentTypes>>>;
1028
- /**
1029
- * Creates a stream for new group conversations
1030
- *
1031
- * @param options - Optional stream options
1032
- * @returns Stream instance for new group conversations
1033
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-conversations
1034
- */
1035
- streamGroups(options?: StreamOptions<Conversation$1, Group<ContentTypes>>): Promise<AsyncStreamProxy<Group<ContentTypes>>>;
1036
- /**
1037
- * Creates a stream for new DM conversations
1038
- *
1039
- * @param options - Optional stream options
1040
- * @returns Stream instance for new DM conversations
1041
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-conversations
1042
- */
1043
- streamDms(options?: StreamOptions<Conversation$1, Dm<ContentTypes>>): Promise<AsyncStreamProxy<Dm<ContentTypes>>>;
1044
- /**
1045
- * Creates a stream for all new messages
1046
- *
1047
- * @param options - Optional stream options
1048
- * @param options.conversationType - Optional conversation type to filter by
1049
- * @param options.consentStates - Optional array of consent states to filter by
1050
- * @returns Stream instance for new messages
1051
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
1052
- */
1053
- streamAllMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
1054
- conversationType?: ConversationType;
1055
- consentStates?: ConsentState[];
1056
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
1057
- /**
1058
- * Creates a stream for all new group messages
1059
- *
1060
- * @param options - Optional stream options
1061
- * @param options.consentStates - Optional array of consent states to filter by
1062
- * @returns Stream instance for new group messages
1063
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
1064
- */
1065
- streamAllGroupMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
1066
- consentStates?: ConsentState[];
1067
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
1068
- /**
1069
- * Creates a stream for all new DM messages
1070
- *
1071
- * @param options - Optional stream options
1072
- * @param options.consentStates - Optional array of consent states to filter by
1073
- * @returns Stream instance for new DM messages
1074
- * @see https://docs.xmtp.org/chat-apps/list-stream-sync/stream#stream-new-group-chat-and-dm-messages
1075
- */
1076
- streamAllDmMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
1077
- consentStates?: ConsentState[];
1078
- }): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
1079
- /**
1080
- * Creates a stream for message deletions that streams the message IDs of
1081
- * deleted messages
1082
- *
1083
- * This is a local stream, does not require network sync, and will not fail
1084
- * like other streams.
1085
- *
1086
- * @param options - Optional stream options
1087
- * @returns Stream instance for message deletions
1088
- * @deprecated Use streamDeletedMessages instead
1089
- */
1090
- streamMessageDeletions(options?: Omit<StreamOptions<DecodedMessage$1, string>, "disableSync" | "onFail" | "onRetry" | "onRestart" | "retryAttempts" | "retryDelay" | "retryOnFail">): Promise<AsyncStreamProxy<string>>;
1091
- /**
1092
- * Creates a stream for message deletions that streams the deleted messages
1093
- *
1094
- * This is a local stream, does not require network sync, and will not fail
1095
- * like other streams.
1096
- *
1097
- * @param options - Optional stream options
1098
- * @returns Stream instance for message deletions
1099
- */
1100
- streamDeletedMessages(options?: Omit<StreamOptions<DecodedMessage$1, DecodedMessage<ContentTypes>>, "disableSync" | "onFail" | "onRetry" | "onRestart" | "retryAttempts" | "retryDelay" | "retryOnFail">): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
1101
- /**
1102
- * Gets the HMAC keys for all conversations
1103
- *
1104
- * @returns The HMAC keys for all conversations
1105
- * @see https://docs.xmtp.org/chat-apps/push-notifs/push-notifs#get-hmac-keys-for-a-conversation
1106
- */
1107
- hmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
956
+ export declare class Conversations<ContentTypes = unknown> {
957
+ #private;
958
+ /**
959
+ * Creates a new conversations instance
960
+ *
961
+ * @param client - The client instance managing the conversations
962
+ * @param codecRegistry - The codec registry instance
963
+ * @param conversations - The underlying conversations instance
964
+ */
965
+ constructor(client: Client<ContentTypes>, codecRegistry: CodecRegistry, conversations: Conversations$1);
966
+ get topic(): string;
967
+ /**
968
+ * Retrieves a conversation by its ID
969
+ *
970
+ * @param id - The conversation ID to look up
971
+ * @returns The conversation if found, undefined otherwise
972
+ * @see https://docs.xmtp.org/sdk/conversations/
973
+ */
974
+ getConversationById(id: string): Promise<Dm<ContentTypes> | Group<ContentTypes> | undefined>;
975
+ /**
976
+ * Retrieves a DM by inbox ID
977
+ *
978
+ * @param inboxId - The inbox ID to look up
979
+ * @returns The DM if found, undefined otherwise
980
+ * @see https://docs.xmtp.org/sdk/conversations/
981
+ */
982
+ getDmByInboxId(inboxId: string): Dm<ContentTypes> | undefined;
983
+ /**
984
+ * Retrieves a DM by identifier
985
+ *
986
+ * @param identifier - The identifier to look up
987
+ * @returns Promise that resolves with the DM, if found
988
+ * @see https://docs.xmtp.org/sdk/conversations/
989
+ */
990
+ fetchDmByIdentifier(identifier: Identifier$1): Promise<Dm<ContentTypes> | undefined>;
991
+ /**
992
+ * Retrieves a message by its ID
993
+ *
994
+ * @param id - The message ID to look up
995
+ * @returns The decoded message if found, undefined otherwise
996
+ * @see https://docs.xmtp.org/sdk/conversations/
997
+ */
998
+ getMessageById(id: string): DecodedMessage<ContentTypes> | undefined;
999
+ /**
1000
+ * Creates a new group conversation without publishing to the network
1001
+ *
1002
+ * @param options - Optional group creation options
1003
+ * @returns The new group
1004
+ * @see https://docs.xmtp.org/sdk/conversations/#optimistically-create-a-group
1005
+ */
1006
+ createGroupOptimistic(options?: CreateGroupOptions$1): Group<ContentTypes>;
1007
+ /**
1008
+ * Creates a new group conversation with the specified identifiers
1009
+ *
1010
+ * @param identifiers - Array of identifiers for group members
1011
+ * @param options - Optional group creation options
1012
+ * @returns The new group
1013
+ * @see https://docs.xmtp.org/sdk/conversations/#create-a-group
1014
+ */
1015
+ createGroupWithIdentifiers(identifiers: Identifier$1[], options?: CreateGroupOptions$1): Promise<Group<ContentTypes>>;
1016
+ /**
1017
+ * Creates a new group conversation with the specified inbox IDs
1018
+ *
1019
+ * @param inboxIds - Array of inbox IDs for group members
1020
+ * @param options - Optional group creation options
1021
+ * @returns The new group
1022
+ * @see https://docs.xmtp.org/sdk/conversations/#create-a-group
1023
+ */
1024
+ createGroup(inboxIds: string[], options?: CreateGroupOptions$1): Promise<Group<ContentTypes>>;
1025
+ /**
1026
+ * Creates a new DM conversation with the specified identifier
1027
+ *
1028
+ * @param identifier - Identifier for the DM recipient
1029
+ * @param options - Optional DM creation options
1030
+ * @returns The new DM
1031
+ * @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
1032
+ */
1033
+ createDmWithIdentifier(identifier: Identifier$1, options?: CreateDmOptions$1): Promise<Dm<ContentTypes>>;
1034
+ /**
1035
+ * Creates a new DM conversation with the specified inbox ID
1036
+ *
1037
+ * @param inboxId - Inbox ID for the DM recipient
1038
+ * @param options - Optional DM creation options
1039
+ * @returns The new DM
1040
+ * @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
1041
+ */
1042
+ createDm(inboxId: string, options?: CreateDmOptions$1): Promise<Dm<ContentTypes>>;
1043
+ /**
1044
+ * Lists all conversations with optional filtering
1045
+ *
1046
+ * @param options - Optional filtering and pagination options
1047
+ * @returns Array of conversations
1048
+ * @see https://docs.xmtp.org/sdk/conversations/
1049
+ */
1050
+ list(options?: ListConversationsOptions$1): Promise<(Dm<ContentTypes> | Group<ContentTypes>)[]>;
1051
+ /**
1052
+ * Lists all groups with optional filtering
1053
+ *
1054
+ * @param options - Optional filtering and pagination options
1055
+ * @returns Array of groups
1056
+ * @see https://docs.xmtp.org/sdk/conversations/
1057
+ */
1058
+ listGroups(options?: Omit<ListConversationsOptions$1, "conversationType">): Group<ContentTypes>[];
1059
+ /**
1060
+ * Lists all DMs with optional filtering
1061
+ *
1062
+ * @param options - Optional filtering and pagination options
1063
+ * @returns Array of DMs
1064
+ * @see https://docs.xmtp.org/sdk/conversations/
1065
+ */
1066
+ listDms(options?: Omit<ListConversationsOptions$1, "conversationType">): Dm<ContentTypes>[];
1067
+ /**
1068
+ * Synchronizes conversations for the current client from the network
1069
+ *
1070
+ * @returns Promise that resolves when sync is complete
1071
+ * @see https://docs.xmtp.org/sdk/sync/
1072
+ */
1073
+ sync(): Promise<void>;
1074
+ /**
1075
+ * Synchronizes all conversations and messages from the network with optional
1076
+ * consent state filtering
1077
+ *
1078
+ * @param consentStates - Optional array of consent states to filter by
1079
+ * @returns Promise that resolves when sync is complete
1080
+ * @see https://docs.xmtp.org/sdk/sync/
1081
+ */
1082
+ syncAll(consentStates?: ConsentState$1[]): Promise<import("@xmtp/node-bindings").GroupSyncSummary>;
1083
+ /**
1084
+ * Creates a stream for new conversations
1085
+ *
1086
+ * @param options - Optional stream options
1087
+ * @param options.conversationType - Optional conversation type to filter by
1088
+ * @returns Stream instance for new conversations
1089
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1090
+ */
1091
+ stream(options?: StreamOptions<Conversation$1, Group<ContentTypes> | Dm<ContentTypes> | undefined> & {
1092
+ conversationType?: ConversationType$1;
1093
+ }): Promise<AsyncStreamProxy<Dm<ContentTypes> | Group<ContentTypes>>>;
1094
+ /**
1095
+ * Creates a stream for new group conversations
1096
+ *
1097
+ * @param options - Optional stream options
1098
+ * @returns Stream instance for new group conversations
1099
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1100
+ */
1101
+ streamGroups(options?: StreamOptions<Conversation$1, Group<ContentTypes>>): Promise<AsyncStreamProxy<Group<ContentTypes>>>;
1102
+ /**
1103
+ * Creates a stream for new DM conversations
1104
+ *
1105
+ * @param options - Optional stream options
1106
+ * @returns Stream instance for new DM conversations
1107
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1108
+ */
1109
+ streamDms(options?: StreamOptions<Conversation$1, Dm<ContentTypes>>): Promise<AsyncStreamProxy<Dm<ContentTypes>>>;
1110
+ /**
1111
+ * Reads retained messages after each group's default acknowledgement position.
1112
+ * Set `from` to replay after a cursor without changing default progress.
1113
+ * Set `onValue` for callback mode, or request items with the iterator.
1114
+ * Core owns network recovery. Legacy retry options and `disableSync` do not apply.
1115
+ *
1116
+ * @param options - Optional stream options
1117
+ * @param options.conversationType - Optional conversation type to filter by
1118
+ * @param options.consentStates - Optional array of consent states to filter by
1119
+ * @returns Stream instance for new messages
1120
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1121
+ */
1122
+ streamAllMessages(options?: StreamOptions<Message$1, DecodedMessage<ContentTypes>> & {
1123
+ conversationType?: ConversationType$1;
1124
+ consentStates?: ConsentState$1[];
1125
+ groupIds?: string[];
1126
+ from?: DeliveryCursor$1;
1127
+ }): Promise<MessageStream<Message$1, DecodedMessage<ContentTypes>>>;
1128
+ messageHistorySnapshot(limit: number, options?: {
1129
+ groupIds?: string[];
1130
+ conversationType?: ConversationType$1;
1131
+ consentStates?: ConsentState$1[];
1132
+ }): import("@xmtp/node-bindings").MessageHistorySnapshot;
1133
+ beginningDeliveryCursor(): DeliveryCursor$1;
1134
+ /**
1135
+ * Reads retained group messages with default progress or an explicit replay cursor.
1136
+ *
1137
+ * @param options - Optional stream options
1138
+ * @param options.consentStates - Optional array of consent states to filter by
1139
+ * @returns Stream instance for new group messages
1140
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1141
+ */
1142
+ streamAllGroupMessages(options?: StreamOptions<Message$1, DecodedMessage<ContentTypes>> & {
1143
+ consentStates?: ConsentState$1[];
1144
+ groupIds?: string[];
1145
+ from?: DeliveryCursor$1;
1146
+ }): Promise<MessageStream<Message$1, DecodedMessage<ContentTypes>>>;
1147
+ /**
1148
+ * Reads retained DM messages with default progress or an explicit replay cursor.
1149
+ *
1150
+ * @param options - Optional stream options
1151
+ * @param options.consentStates - Optional array of consent states to filter by
1152
+ * @returns Stream instance for new DM messages
1153
+ * @see https://docs.xmtp.org/sdk/stream/#stream-methods
1154
+ */
1155
+ streamAllDmMessages(options?: StreamOptions<Message$1, DecodedMessage<ContentTypes>> & {
1156
+ consentStates?: ConsentState$1[];
1157
+ groupIds?: string[];
1158
+ from?: DeliveryCursor$1;
1159
+ }): Promise<MessageStream<Message$1, DecodedMessage<ContentTypes>>>;
1160
+ /**
1161
+ * Creates a stream for message deletions that streams the message IDs of
1162
+ * deleted messages
1163
+ *
1164
+ * This is a local stream, does not require network sync, and will not fail
1165
+ * like other streams.
1166
+ *
1167
+ * @param options - Optional stream options
1168
+ * @returns Stream instance for message deletions
1169
+ * @deprecated Use streamDeletedMessages instead
1170
+ */
1171
+ streamMessageDeletions(options?: Omit<StreamOptions<DecodedMessage$1, string>, "disableSync" | "onFail" | "onRetry" | "onRestart" | "retryAttempts" | "retryDelay" | "retryOnFail">): Promise<AsyncStreamProxy<string>>;
1172
+ /**
1173
+ * Creates a stream for message deletions that streams the deleted messages
1174
+ *
1175
+ * This is a local stream, does not require network sync, and will not fail
1176
+ * like other streams.
1177
+ *
1178
+ * @param options - Optional stream options
1179
+ * @returns Stream instance for message deletions
1180
+ */
1181
+ streamDeletedMessages(options?: Omit<StreamOptions<DecodedMessage$1, DecodedMessage<ContentTypes>>, "disableSync" | "onFail" | "onRetry" | "onRestart" | "retryAttempts" | "retryDelay" | "retryOnFail">): Promise<AsyncStreamProxy<DecodedMessage<ContentTypes>>>;
1182
+ /**
1183
+ * Gets the HMAC keys for all conversations
1184
+ *
1185
+ * @returns The HMAC keys for all conversations
1186
+ * @see https://docs.xmtp.org/sdk/push-notifications/
1187
+ */
1188
+ hmacKeys(): Record<string, import("@xmtp/node-bindings").HmacKey[]>;
1108
1189
  }
1109
-
1190
+ //#endregion
1191
+ //#region src/DebugInformation.d.ts
1110
1192
  /**
1111
1193
  * Debug information helpers for the client
1112
1194
  *
1113
1195
  * This class is not intended to be initialized directly.
1114
1196
  */
1115
- declare class DebugInformation {
1116
- #private;
1117
- constructor(client: Client$1);
1118
- apiStatistics(): _xmtp_node_bindings.ApiStats;
1119
- apiIdentityStatistics(): _xmtp_node_bindings.IdentityStats;
1120
- apiAggregateStatistics(): string;
1121
- clearAllStatistics(): void;
1197
+ export declare class DebugInformation {
1198
+ #private;
1199
+ constructor(client: Client$1);
1200
+ apiStatistics(): import("@xmtp/node-bindings").ApiStats;
1201
+ apiIdentityStatistics(): import("@xmtp/node-bindings").IdentityStats;
1202
+ apiAggregateStatistics(): string;
1203
+ clearAllStatistics(): void;
1122
1204
  }
1123
-
1205
+ //#endregion
1206
+ //#region src/Preferences.d.ts
1124
1207
  /**
1125
1208
  * Manages user preferences and consent states
1126
1209
  *
1127
1210
  * This class is not intended to be initialized directly.
1128
1211
  */
1129
- declare class Preferences {
1130
- #private;
1131
- /**
1132
- * Creates a new preferences instance
1133
- *
1134
- * @param client - The client instance managing preferences
1135
- * @param conversations - The underlying conversations instance
1136
- */
1137
- constructor(client: Client$1, conversations: Conversations$1);
1138
- sync(): Promise<_xmtp_node_bindings.GroupSyncSummary>;
1139
- /**
1140
- * Retrieves the current inbox state of this client from the local database
1141
- *
1142
- * @returns Promise that resolves with the inbox state
1143
- */
1144
- inboxState(): Promise<_xmtp_node_bindings.InboxState>;
1145
- /**
1146
- * Retrieves the latest inbox state of this clientfrom the network
1147
- *
1148
- * @returns Promise that resolves with the inbox state
1149
- */
1150
- fetchInboxState(): Promise<_xmtp_node_bindings.InboxState>;
1151
- /**
1152
- * Retrieves the current inbox states for specified inbox IDs from the local
1153
- * database
1154
- *
1155
- * @param inboxIds - Array of inbox IDs to get state for
1156
- * @returns Promise that resolves with the inbox states for the inbox IDs
1157
- */
1158
- getInboxStates(inboxIds: string[]): Promise<_xmtp_node_bindings.InboxState[]>;
1159
- /**
1160
- * Retrieves the latest inbox states for specified inbox IDs from the network
1161
- *
1162
- * @param inboxIds - Array of inbox IDs to get state for
1163
- * @returns Promise that resolves with the inbox states for the inbox IDs
1164
- */
1165
- fetchInboxStates(inboxIds: string[]): Promise<_xmtp_node_bindings.InboxState[]>;
1166
- /**
1167
- * Updates consent states for multiple records
1168
- *
1169
- * @param consentStates - Array of consent records to update
1170
- * @returns Promise that resolves when consent states are updated
1171
- */
1172
- setConsentStates(consentStates: Consent[]): Promise<void>;
1173
- /**
1174
- * Retrieves consent state for a specific entity
1175
- *
1176
- * @param entityType - Type of entity to get consent for
1177
- * @param entity - Entity identifier
1178
- * @returns Promise that resolves with the consent state
1179
- */
1180
- getConsentState(entityType: ConsentEntityType, entity: string): Promise<_xmtp_node_bindings.ConsentState>;
1181
- /**
1182
- * Creates a stream of consent state updates
1183
- *
1184
- * @param options - Optional stream options
1185
- * @returns Stream instance for consent updates
1186
- */
1187
- streamConsent(options?: StreamOptions<Consent[]>): Promise<AsyncStreamProxy<Consent[]>>;
1188
- /**
1189
- * Creates a stream of user preference updates
1190
- *
1191
- * @param options - Optional stream options
1192
- * @returns Stream instance for preference updates
1193
- */
1194
- streamPreferences(options?: StreamOptions<UserPreferenceUpdate[]>): Promise<AsyncStreamProxy<UserPreferenceUpdate[]>>;
1212
+ export declare class Preferences {
1213
+ #private;
1214
+ /**
1215
+ * Creates a new preferences instance
1216
+ *
1217
+ * @param client - The client instance managing preferences
1218
+ * @param conversations - The underlying conversations instance
1219
+ */
1220
+ constructor(client: Client$1, conversations: Conversations$1);
1221
+ sync(): Promise<import("@xmtp/node-bindings").GroupSyncSummary>;
1222
+ /**
1223
+ * Retrieves the current inbox state of this client from the local database
1224
+ *
1225
+ * @returns Promise that resolves with the inbox state
1226
+ */
1227
+ inboxState(): Promise<import("@xmtp/node-bindings").InboxState>;
1228
+ /**
1229
+ * Retrieves the latest inbox state of this clientfrom the network
1230
+ *
1231
+ * @returns Promise that resolves with the inbox state
1232
+ */
1233
+ fetchInboxState(): Promise<import("@xmtp/node-bindings").InboxState>;
1234
+ /**
1235
+ * Retrieves the current inbox states for specified inbox IDs from the local
1236
+ * database
1237
+ *
1238
+ * @param inboxIds - Array of inbox IDs to get state for
1239
+ * @returns Promise that resolves with the inbox states for the inbox IDs
1240
+ */
1241
+ getInboxStates(inboxIds: string[]): Promise<import("@xmtp/node-bindings").InboxState[]>;
1242
+ /**
1243
+ * Retrieves the latest inbox states for specified inbox IDs from the network
1244
+ *
1245
+ * @param inboxIds - Array of inbox IDs to get state for
1246
+ * @returns Promise that resolves with the inbox states for the inbox IDs
1247
+ */
1248
+ fetchInboxStates(inboxIds: string[]): Promise<import("@xmtp/node-bindings").InboxState[]>;
1249
+ /**
1250
+ * Updates consent states for multiple records
1251
+ *
1252
+ * @param consentStates - Array of consent records to update
1253
+ * @returns Promise that resolves when consent states are updated
1254
+ */
1255
+ setConsentStates(consentStates: Consent$1[]): Promise<void>;
1256
+ /**
1257
+ * Retrieves consent state for a specific entity
1258
+ *
1259
+ * @param entityType - Type of entity to get consent for
1260
+ * @param entity - Entity identifier
1261
+ * @returns Promise that resolves with the consent state
1262
+ */
1263
+ getConsentState(entityType: ConsentEntityType$1, entity: string): Promise<import("@xmtp/node-bindings").ConsentState>;
1264
+ /**
1265
+ * Creates a stream of consent state updates
1266
+ *
1267
+ * @param options - Optional stream options
1268
+ * @returns Stream instance for consent updates
1269
+ */
1270
+ streamConsent(options?: StreamOptions<Consent$1[]>): Promise<AsyncStreamProxy<Consent$1[]>>;
1271
+ /**
1272
+ * Creates a stream of user preference updates
1273
+ *
1274
+ * @param options - Optional stream options
1275
+ * @returns Stream instance for preference updates
1276
+ */
1277
+ streamPreferences(options?: StreamOptions<UserPreferenceUpdate$1[]>): Promise<AsyncStreamProxy<UserPreferenceUpdate$1[]>>;
1195
1278
  }
1196
-
1279
+ //#endregion
1280
+ //#region src/Client.d.ts
1197
1281
  /**
1198
1282
  * Client for interacting with the XMTP network
1199
1283
  */
1200
- declare class Client<ContentTypes = ExtractCodecContentTypes> {
1201
- #private;
1202
- /**
1203
- * Creates a new XMTP client instance
1204
- *
1205
- * This class is not intended to be initialized directly.
1206
- * Use `Client.create` or `Client.build` instead.
1207
- *
1208
- * @param options - Optional configuration for the client
1209
- */
1210
- constructor(options?: ClientOptions);
1211
- /**
1212
- * Initializes the client with the provided identifier
1213
- *
1214
- * This is not meant to be called directly.
1215
- * Use `Client.create` or `Client.build` instead.
1216
- *
1217
- * @param identifier - The identifier to initialize the client with
1218
- */
1219
- init(identifier: Identifier): Promise<void>;
1220
- /**
1221
- * Creates a new client instance with a signer
1222
- *
1223
- * @param signer - The signer to use for authentication
1224
- * @param options - Optional configuration for the client
1225
- * @returns A new client instance
1226
- */
1227
- static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options?: DistributiveOmit<ClientOptions, "codecs"> & {
1228
- codecs?: ContentCodecs;
1229
- }): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
1230
- /**
1231
- * Creates a new client instance with an identifier
1232
- *
1233
- * Clients created with this method must already be registered.
1234
- * Any methods called that require a signer will throw an error.
1235
- *
1236
- * @param identifier - The identifier to use
1237
- * @param options - Optional configuration for the client
1238
- * @returns A new client instance
1239
- */
1240
- static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options?: DistributiveOmit<ClientOptions, "codecs"> & {
1241
- codecs?: ContentCodecs;
1242
- }): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
1243
- /**
1244
- * Gets the version of libxmtp used in the bindings
1245
- */
1246
- get libxmtpVersion(): string | undefined;
1247
- /**
1248
- * Gets the app version used by the client
1249
- */
1250
- get appVersion(): string | undefined;
1251
- /**
1252
- * Gets the XMTP environment the client is connected to
1253
- *
1254
- * @throws {ClientNotInitializedError} if the client is not initialized
1255
- */
1256
- get env(): XmtpEnv;
1257
- /**
1258
- * Gets the client options
1259
- */
1260
- get options(): ClientOptions | undefined;
1261
- /**
1262
- * Gets the signer associated with this client
1263
- */
1264
- get signer(): Signer | undefined;
1265
- /**
1266
- * Gets the account identifier for this client
1267
- */
1268
- get accountIdentifier(): Identifier | undefined;
1269
- /**
1270
- * Gets the inbox ID associated with this client
1271
- */
1272
- get inboxId(): string;
1273
- /**
1274
- * Gets the installation ID for this client
1275
- */
1276
- get installationId(): string;
1277
- /**
1278
- * Gets the installation ID bytes for this client
1279
- */
1280
- get installationIdBytes(): Uint8Array<ArrayBufferLike>;
1281
- /**
1282
- * Gets whether the client is registered with the XMTP network
1283
- *
1284
- * @throws {ClientNotInitializedError} if the client is not initialized
1285
- */
1286
- get isRegistered(): boolean;
1287
- /**
1288
- * Gets the conversations manager for this client
1289
- *
1290
- * @throws {ClientNotInitializedError} if the client is not initialized
1291
- */
1292
- get conversations(): Conversations<ContentTypes>;
1293
- /**
1294
- * Gets the debug information helpersfor this client
1295
- *
1296
- * @throws {ClientNotInitializedError} if the client is not initialized
1297
- */
1298
- get debugInformation(): DebugInformation;
1299
- /**
1300
- * Gets the preferences manager for this client
1301
- *
1302
- * @throws {ClientNotInitializedError} if the client is not initialized
1303
- */
1304
- get preferences(): Preferences;
1305
- /**
1306
- * Cleanly shuts down the client: cancels in-flight workers and detached
1307
- * streams, then releases the database connection.
1308
- *
1309
- * This is idempotent — calling it more than once resolves without error.
1310
- * Await this before deleting the database file or dropping the client
1311
- * reference to avoid log noise from background tasks running against a
1312
- * closed database.
1313
- *
1314
- * @throws {ClientNotInitializedError} if the client is not initialized
1315
- * @returns Promise that resolves when the client has shut down
1316
- */
1317
- close(): Promise<void>;
1318
- /**
1319
- * Adds a signature to a signature request using the client's signer (or the
1320
- * provided signer)
1321
- *
1322
- * WARNING: This function should be used with caution. It is only provided
1323
- * for use in special cases where the provided workflows do not meet the
1324
- * requirements of an application.
1325
- *
1326
- * It is highly recommended to use the `register`, `unsafe_addAccount`,
1327
- * `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
1328
- * methods instead.
1329
- *
1330
- * @param signatureRequest - The signature request to add the signature to
1331
- * @throws {ClientNotInitializedError} if the client is not initialized
1332
- * @throws {SignerUnavailableError} if no signer is available
1333
- */
1334
- unsafe_addSignature(signatureRequest: SignatureRequestHandle, signer?: Signer): Promise<void>;
1335
- /**
1336
- * Returns a signature request handler for creating a new inbox
1337
- *
1338
- * WARNING: This function should be used with caution. It is only provided
1339
- * for use in special cases where the provided workflows do not meet the
1340
- * requirements of an application.
1341
- *
1342
- * It is highly recommended to use the `register` method instead.
1343
- *
1344
- * @returns The signature text
1345
- * @throws {ClientNotInitializedError} if the client is not initialized
1346
- */
1347
- unsafe_createInboxSignatureRequest(): Promise<SignatureRequestHandle | null>;
1348
- /**
1349
- * Returns a signature request handler for adding a new account to the
1350
- * client's inbox
1351
- *
1352
- * WARNING: This function should be used with caution. It is only provided
1353
- * for use in special cases where the provided workflows do not meet the
1354
- * requirements of an application.
1355
- *
1356
- * It is highly recommended to use the `unsafe_addAccount` method instead.
1357
- *
1358
- * The `allowInboxReassign` parameter must be true or this function will
1359
- * throw an error.
1360
- *
1361
- * @param newAccountIdentifier - The identifier of the new account
1362
- * @param allowInboxReassign - Whether to allow inbox reassignment
1363
- * @returns The signature text
1364
- * @throws {ClientNotInitializedError} if the client is not initialized
1365
- */
1366
- unsafe_addAccountSignatureRequest(newAccountIdentifier: Identifier, allowInboxReassign?: boolean): Promise<SignatureRequestHandle>;
1367
- /**
1368
- * Returns a signature request handler for removing an account from the
1369
- * client's inbox
1370
- *
1371
- * WARNING: This function should be used with caution. It is only provided
1372
- * for use in special cases where the provided workflows do not meet the
1373
- * requirements of an application.
1374
- *
1375
- * It is highly recommended to use the `removeAccount` method instead.
1376
- *
1377
- * @param identifier - The identifier of the account to remove
1378
- * @returns The signature text
1379
- * @throws {ClientNotInitializedError} if the client is not initialized
1380
- */
1381
- unsafe_removeAccountSignatureRequest(identifier: Identifier): Promise<SignatureRequestHandle>;
1382
- /**
1383
- * Returns a signature request handler for revoking all other installations
1384
- * of the client's inbox
1385
- *
1386
- * WARNING: This function should be used with caution. It is only provided
1387
- * for use in special cases where the provided workflows do not meet the
1388
- * requirements of an application.
1389
- *
1390
- * It is highly recommended to use the `revokeAllOtherInstallations` method instead.
1391
- *
1392
- * @returns The signature text
1393
- * @throws {ClientNotInitializedError} if the client is not initialized
1394
- */
1395
- unsafe_revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle | null>;
1396
- /**
1397
- * Returns a signature request handler for revoking specific installations
1398
- * of the client's inbox
1399
- *
1400
- * WARNING: This function should be used with caution. It is only provided
1401
- * for use in special cases where the provided workflows do not meet the
1402
- * requirements of an application.
1403
- *
1404
- * It is highly recommended to use the `revokeInstallations` method instead.
1405
- *
1406
- * @param installationIds - The installation IDs to revoke
1407
- * @returns The signature text
1408
- * @throws {ClientNotInitializedError} if the client is not initialized
1409
- */
1410
- unsafe_revokeInstallationsSignatureRequest(installationIds: Uint8Array[]): Promise<SignatureRequestHandle>;
1411
- /**
1412
- * Returns a signature request handler for changing the recovery identifier
1413
- * for this client's inbox
1414
- *
1415
- * WARNING: This function should be used with caution. It is only provided
1416
- * for use in special cases where the provided workflows do not meet the
1417
- * requirements of an application.
1418
- *
1419
- * It is highly recommended to use the `changeRecoveryIdentifier` method instead.
1420
- *
1421
- * @param identifier - The new recovery identifier
1422
- * @returns The signature text
1423
- * @throws {ClientNotInitializedError} if the client is not initialized
1424
- */
1425
- unsafe_changeRecoveryIdentifierSignatureRequest(identifier: Identifier): Promise<SignatureRequestHandle>;
1426
- /**
1427
- * Applies a signature request to the client
1428
- *
1429
- * WARNING: This function should be used with caution. It is only provided
1430
- * for use in special cases where the provided workflows do not meet the
1431
- * requirements of an application.
1432
- *
1433
- * It is highly recommended to use the `register`, `unsafe_addAccount`,
1434
- * `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
1435
- * methods instead.
1436
- *
1437
- * @throws {ClientNotInitializedError} if the client is not initialized
1438
- */
1439
- unsafe_applySignatureRequest(signatureRequest: SignatureRequestHandle): Promise<void>;
1440
- /**
1441
- * Registers the client with the XMTP network
1442
- *
1443
- * Requires a signer, use `Client.create` to create a client with a signer.
1444
- *
1445
- * @throws {ClientNotInitializedError} if the client is not initialized
1446
- * @throws {SignerUnavailableError} if no signer is available
1447
- */
1448
- register(): Promise<void>;
1449
- /**
1450
- * Adds a new account to the client inbox
1451
- *
1452
- * WARNING: This function should be used with caution. Adding a wallet already
1453
- * associated with an inbox ID will cause the wallet to lose access to
1454
- * that inbox.
1455
- *
1456
- * The `allowInboxReassign` parameter must be true to reassign an inbox
1457
- * already associated with a different account.
1458
- *
1459
- * Requires a signer, use `Client.create` to create a client with a signer.
1460
- *
1461
- * @param newAccountSigner - The signer for the new account
1462
- * @param allowInboxReassign - Whether to allow inbox reassignment
1463
- * @throws {AccountAlreadyAssociatedError} if the account is already associated with an inbox ID
1464
- * @throws {ClientNotInitializedError} if the client is not initialized
1465
- * @throws {SignerUnavailableError} if no signer is available
1466
- */
1467
- unsafe_addAccount(newAccountSigner: Signer, allowInboxReassign?: boolean): Promise<void>;
1468
- /**
1469
- * Removes an account from the client's inbox
1470
- *
1471
- * Requires a signer, use `Client.create` to create a client with a signer.
1472
- *
1473
- * @param identifier - The identifier of the account to remove
1474
- * @throws {ClientNotInitializedError} if the client is not initialized
1475
- * @throws {SignerUnavailableError} if no signer is available
1476
- */
1477
- removeAccount(identifier: Identifier): Promise<void>;
1478
- /**
1479
- * Revokes all other installations of the client's inbox
1480
- *
1481
- * Requires a signer, use `Client.create` to create a client with a signer.
1482
- *
1483
- * @throws {ClientNotInitializedError} if the client is not initialized
1484
- * @throws {SignerUnavailableError} if no signer is available
1485
- */
1486
- revokeAllOtherInstallations(): Promise<void>;
1487
- /**
1488
- * Revokes specific installations of the client's inbox
1489
- *
1490
- * Requires a signer, use `Client.create` to create a client with a signer.
1491
- *
1492
- * @param installationIds - The installation IDs to revoke
1493
- * @throws {ClientNotInitializedError} if the client is not initialized
1494
- * @throws {SignerUnavailableError} if no signer is available
1495
- */
1496
- revokeInstallations(installationIds: Uint8Array[]): Promise<void>;
1497
- /**
1498
- * Revokes specific installations of the client's inbox without a client
1499
- *
1500
- * @param signer - The signer to use
1501
- * @param inboxId - The inbox ID to revoke installations for
1502
- * @param installationIds - The installation IDs to revoke
1503
- * @param backend - Optional `Backend` instance created with `createBackend()`
1504
- */
1505
- static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], backend?: Backend): Promise<void>;
1506
- /**
1507
- * Revokes specific installations of the client's inbox without a client
1508
- *
1509
- * @param signer - The signer to use
1510
- * @param inboxId - The inbox ID to revoke installations for
1511
- * @param installationIds - The installation IDs to revoke
1512
- * @param env - The environment to use
1513
- * @param gatewayHost - Optional gateway host
1514
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1515
- * of `XmtpEnv` and `gatewayHost`.
1516
- */
1517
- static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
1518
- /**
1519
- * Changes the recovery identifier for the client's inbox
1520
- *
1521
- * Requires a signer, use `Client.create` to create a client with a signer.
1522
- *
1523
- * @param identifier - The new recovery identifier
1524
- * @throws {ClientNotInitializedError} if the client is not initialized
1525
- * @throws {SignerUnavailableError} if no signer is available
1526
- */
1527
- changeRecoveryIdentifier(identifier: Identifier): Promise<void>;
1528
- /**
1529
- * Checks if the client can message the specified identifiers
1530
- *
1531
- * @param identifiers - The identifiers to check
1532
- * @returns Whether the client can message the identifiers
1533
- * @throws {ClientNotInitializedError} if the client is not initialized
1534
- */
1535
- canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
1536
- /**
1537
- * Fetches the latest inbox updates count for the specified inbox IDs
1538
- *
1539
- * @param inboxIds - The inbox IDs to check
1540
- * @returns Map of inbox IDs to their updates count
1541
- * @throws {ClientNotInitializedError} if the client is not initialized
1542
- */
1543
- fetchLatestInboxUpdatesCount(inboxIds: string[]): Promise<Map<string, number>>;
1544
- /**
1545
- * Fetches the latest inbox updates count for the client's inbox
1546
- *
1547
- * @returns The latest inbox updates count
1548
- * @throws {ClientNotInitializedError} if the client is not initialized
1549
- */
1550
- fetchOwnInboxUpdatesCount(): Promise<number>;
1551
- /**
1552
- * Fetches the key package statuses from the network for the specified
1553
- * installation IDs
1554
- *
1555
- * @param installationIds - The installation IDs to check
1556
- * @returns The key package statuses
1557
- * @throws {ClientNotInitializedError} if the client is not initialized
1558
- */
1559
- fetchKeyPackageStatuses(installationIds: string[]): Promise<Record<string, _xmtp_node_bindings.KeyPackageStatus>>;
1560
- /**
1561
- * Fetches the inbox ID for a given identifier from the local database
1562
- * If not found, fetches from the network
1563
- *
1564
- * @param identifier - The identifier to look up
1565
- * @returns The inbox ID, if found
1566
- * @throws {ClientNotInitializedError} if the client is not initialized
1567
- */
1568
- fetchInboxIdByIdentifier(identifier: Identifier): Promise<string | null>;
1569
- /**
1570
- * Signs a message with the installation key
1571
- *
1572
- * @param signatureText - The text to sign
1573
- * @returns The signature
1574
- * @throws {ClientNotInitializedError} if the client is not initialized
1575
- */
1576
- signWithInstallationKey(signatureText: string): Uint8Array<ArrayBufferLike>;
1577
- /**
1578
- * Verifies a signature was made with the installation key
1579
- *
1580
- * @param signatureText - The text that was signed
1581
- * @param signatureBytes - The signature bytes to verify
1582
- * @returns Whether the signature is valid
1583
- * @throws {ClientNotInitializedError} if the client is not initialized
1584
- */
1585
- verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
1586
- /**
1587
- * Fetches the inbox states for the specified inbox IDs from the network
1588
- * without a client
1589
- *
1590
- * @param inboxIds - The inbox IDs to get the state for
1591
- * @param backend - Optional `Backend` instance created with `createBackend()`
1592
- * @returns The inbox states for the specified inbox IDs
1593
- */
1594
- static fetchInboxStates(inboxIds: string[], backend?: Backend): Promise<InboxState[]>;
1595
- /**
1596
- * Fetches the inbox states for the specified inbox IDs from the network
1597
- * without a client
1598
- *
1599
- * @param inboxIds - The inbox IDs to get the state for
1600
- * @param env - The environment to use
1601
- * @param gatewayHost - Optional gateway host
1602
- * @returns The inbox states for the specified inbox IDs
1603
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1604
- * of `XmtpEnv` and `gatewayHost`.
1605
- */
1606
- static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<InboxState[]>;
1607
- /**
1608
- * Fetches the latest inbox updates count for the specified inbox IDs
1609
- * without a client
1610
- *
1611
- * @param inboxIds - The inbox IDs to check
1612
- * @param backend - Optional `Backend` instance created with `createBackend()`
1613
- * @returns Map of inbox IDs to their updates count
1614
- */
1615
- static fetchLatestInboxUpdatesCount(inboxIds: string[], backendOrEnv?: Backend | XmtpEnv): Promise<Map<string, number>>;
1616
- /**
1617
- * Fetches the latest inbox updates count for the specified inbox IDs
1618
- * without a client
1619
- *
1620
- * @param inboxIds - The inbox IDs to check
1621
- * @param env - The environment to use
1622
- * @param gatewayHost - Optional gateway host
1623
- * @returns Map of inbox IDs to their updates count
1624
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1625
- * of `XmtpEnv` and `gatewayHost`.
1626
- */
1627
- static fetchLatestInboxUpdatesCount(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<Map<string, number>>;
1628
- /**
1629
- * Checks if the specified identifiers can be messaged
1630
- *
1631
- * @param identifiers - The identifiers to check
1632
- * @param backend - Optional `Backend` instance created with `createBackend()`
1633
- * @returns Map of identifiers to whether they can be messaged
1634
- */
1635
- static canMessage(identifiers: Identifier[], backend?: Backend): Promise<Map<string, boolean>>;
1636
- /**
1637
- * Checks if the specified identifiers can be messaged
1638
- *
1639
- * @param identifiers - The identifiers to check
1640
- * @param env - Optional XMTP environment
1641
- * @returns Map of identifiers to whether they can be messaged
1642
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1643
- * of `XmtpEnv`.
1644
- */
1645
- static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
1646
- /**
1647
- * Verifies a signature was made with a public key
1648
- *
1649
- * @param signatureText - The text that was signed
1650
- * @param signatureBytes - The signature bytes to verify
1651
- * @param publicKey - The public key to verify against
1652
- * @returns Whether the signature is valid
1653
- */
1654
- static verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
1655
- /**
1656
- * Checks if an address is authorized for an inbox
1657
- *
1658
- * @param inboxId - The inbox ID to check
1659
- * @param address - The address to check
1660
- * @param backend - Optional `Backend` instance created with `createBackend()`
1661
- * @returns Whether the address is authorized
1662
- */
1663
- static isAddressAuthorized(inboxId: string, address: string, backend?: Backend): Promise<boolean>;
1664
- /**
1665
- * Checks if an address is authorized for an inbox
1666
- *
1667
- * @param inboxId - The inbox ID to check
1668
- * @param address - The address to check
1669
- * @param env - The environment to use
1670
- * @param gatewayHost - Optional gateway host
1671
- * @returns Whether the address is authorized
1672
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1673
- * of `XmtpEnv` and `gatewayHost`.
1674
- */
1675
- static isAddressAuthorized(inboxId: string, address: string, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
1676
- /**
1677
- * Checks if an installation is authorized for an inbox
1678
- *
1679
- * @param inboxId - The inbox ID to check
1680
- * @param installation - The installation to check
1681
- * @param backend - Optional `Backend` instance created with `createBackend()`
1682
- * @returns Whether the installation is authorized
1683
- */
1684
- static isInstallationAuthorized(inboxId: string, installation: Uint8Array, backend?: Backend): Promise<boolean>;
1685
- /**
1686
- * Checks if an installation is authorized for an inbox
1687
- *
1688
- * @param inboxId - The inbox ID to check
1689
- * @param installation - The installation to check
1690
- * @param env - The environment to use
1691
- * @param gatewayHost - Optional gateway host
1692
- * @returns Whether the installation is authorized
1693
- * @deprecated Pass a `Backend` instance created with `createBackend()` instead
1694
- * of `XmtpEnv` and `gatewayHost`.
1695
- */
1696
- static isInstallationAuthorized(inboxId: string, installation: Uint8Array, env?: XmtpEnv, gatewayHost?: string): Promise<boolean>;
1697
- /**
1698
- * Send a sync request to other devices on the network
1699
- *
1700
- * @param options - Archive options specifying what to sync (defaults to consent and messages)
1701
- * @param serverUrl - The server URL for the sync request (defaults to environment-specific URL)
1702
- * @returns Promise that resolves when the sync request is sent
1703
- */
1704
- sendSyncRequest(options?: ArchiveOptions, serverUrl?: string): Promise<void>;
1705
- /**
1706
- * Send a sync archive to the sync group
1707
- *
1708
- * @param pin - The pin used for reference when importing
1709
- * @param options - Archive options specifying what to sync (defaults to consent and messages)
1710
- * @param serverUrl - The server URL for the sync archive (defaults to environment-specific URL)
1711
- * @returns Promise that resolves when the sync archive is sent
1712
- */
1713
- sendSyncArchive(pin: string, options?: ArchiveOptions, serverUrl?: string): Promise<void>;
1714
- /**
1715
- * Process a sync archive that matches the pin given
1716
- *
1717
- * @param archivePin - Optional pin to match. If not provided, processes the last archive sent
1718
- * @returns Promise that resolves when the archive is processed
1719
- */
1720
- processSyncArchive(archivePin?: string | null): Promise<void>;
1721
- /**
1722
- * List the archives available for import in the sync group
1723
- *
1724
- * You may need to manually sync the sync group before calling
1725
- * this function to see recently uploaded archives.
1726
- *
1727
- * @param daysCutoff - Number of days to look back for archives
1728
- * @returns Array of available archive information
1729
- */
1730
- listAvailableArchives(daysCutoff: number): AvailableArchiveInfo[];
1731
- /**
1732
- * Archive application elements to file for later restoration
1733
- *
1734
- * @param path - The file path to save the archive
1735
- * @param key - Encryption key for the archive
1736
- * @param opts - Archive options specifying what to include (defaults to consent and messages)
1737
- * @returns Promise that resolves when the archive is created
1738
- */
1739
- createArchive(path: string, key: Uint8Array, opts?: ArchiveOptions): Promise<void>;
1740
- /**
1741
- * Import a previous archive from a file
1742
- *
1743
- * @param path - The file path to the archive
1744
- * @param key - Encryption key for the archive
1745
- * @returns Promise that resolves when the archive is imported
1746
- */
1747
- importArchive(path: string, key: Uint8Array): Promise<void>;
1748
- /**
1749
- * Load the metadata for an archive to see what it contains
1750
- *
1751
- * Reads only the metadata without loading the entire file, so this function is quick.
1752
- *
1753
- * @param path - The file path to the archive
1754
- * @param key - Encryption key for the archive
1755
- * @returns Promise that resolves with the archive metadata
1756
- */
1757
- archiveMetadata(path: string, key: Uint8Array): Promise<ArchiveMetadata>;
1758
- /**
1759
- * Manually sync all device sync groups
1760
- *
1761
- * @returns Promise that resolves with a summary of the sync operation
1762
- */
1763
- syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
1284
+ export declare class Client<ContentTypes = ExtractCodecContentTypes> {
1285
+ #private;
1286
+ /**
1287
+ * Creates a new XMTP client instance
1288
+ *
1289
+ * This class is not intended to be initialized directly.
1290
+ * Use `Client.create` or `Client.build` instead.
1291
+ *
1292
+ * @param options - Optional configuration for the client
1293
+ */
1294
+ constructor(options?: ClientOptions);
1295
+ /**
1296
+ * Initializes the client with the provided identifier
1297
+ *
1298
+ * This is not meant to be called directly.
1299
+ * Use `Client.create` or `Client.build` instead.
1300
+ *
1301
+ * @param identifier - The identifier to initialize the client with
1302
+ */
1303
+ init(identifier: Identifier$1): Promise<void>;
1304
+ /**
1305
+ * Creates a new client instance with a signer
1306
+ *
1307
+ * @param signer - The signer to use for authentication
1308
+ * @param options - Optional configuration for the client
1309
+ * @returns A new client instance
1310
+ */
1311
+ static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options: DistributiveOmit<ClientOptions, "codecs"> & {
1312
+ codecs?: ContentCodecs;
1313
+ }): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
1314
+ /**
1315
+ * Creates a new client instance with an identifier
1316
+ *
1317
+ * Clients created with this method must already be registered.
1318
+ * Any methods called that require a signer will throw an error.
1319
+ *
1320
+ * @param identifier - The identifier to use
1321
+ * @param options - Optional configuration for the client
1322
+ * @returns A new client instance
1323
+ */
1324
+ static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier$1, options: DistributiveOmit<ClientOptions, "codecs"> & {
1325
+ codecs?: ContentCodecs;
1326
+ }): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
1327
+ /**
1328
+ * Gets the version of libxmtp used in the bindings
1329
+ */
1330
+ get libxmtpVersion(): string | undefined;
1331
+ /**
1332
+ * Gets the app version used by the client
1333
+ */
1334
+ get appVersion(): string | undefined;
1335
+ /**
1336
+ * Gets the label used for the default database file name
1337
+ *
1338
+ * @throws {ClientNotInitializedError} if the client is not initialized
1339
+ */
1340
+ get env(): string;
1341
+ /**
1342
+ * Gets the client options
1343
+ */
1344
+ get options(): ClientOptions | undefined;
1345
+ /**
1346
+ * Gets the signer associated with this client
1347
+ */
1348
+ get signer(): Signer | undefined;
1349
+ /**
1350
+ * Gets the account identifier for this client
1351
+ */
1352
+ get accountIdentifier(): Identifier$1 | undefined;
1353
+ /**
1354
+ * Gets the inbox ID associated with this client
1355
+ */
1356
+ get inboxId(): string;
1357
+ /**
1358
+ * Gets the installation ID for this client
1359
+ */
1360
+ get installationId(): string;
1361
+ /**
1362
+ * Gets the installation ID bytes for this client
1363
+ */
1364
+ get installationIdBytes(): Uint8Array<ArrayBufferLike>;
1365
+ /**
1366
+ * Gets whether the client is registered with the XMTP network
1367
+ *
1368
+ * @throws {ClientNotInitializedError} if the client is not initialized
1369
+ */
1370
+ get isRegistered(): boolean;
1371
+ /**
1372
+ * Gets the conversations manager for this client
1373
+ *
1374
+ * @throws {ClientNotInitializedError} if the client is not initialized
1375
+ */
1376
+ get conversations(): Conversations<ContentTypes>;
1377
+ /**
1378
+ * Gets the debug information helpersfor this client
1379
+ *
1380
+ * @throws {ClientNotInitializedError} if the client is not initialized
1381
+ */
1382
+ get debugInformation(): DebugInformation;
1383
+ /**
1384
+ * Gets the preferences manager for this client
1385
+ *
1386
+ * @throws {ClientNotInitializedError} if the client is not initialized
1387
+ */
1388
+ get preferences(): Preferences;
1389
+ /**
1390
+ * Cleanly shuts down the client: cancels in-flight workers and detached
1391
+ * streams, then releases the database connection.
1392
+ *
1393
+ * This is idempotent — calling it more than once resolves without error.
1394
+ * Await this before deleting the database file or dropping the client
1395
+ * reference to avoid log noise from background tasks running against a
1396
+ * closed database.
1397
+ *
1398
+ * @throws {ClientNotInitializedError} if the client is not initialized
1399
+ * @returns Promise that resolves when the client has shut down
1400
+ */
1401
+ close(): Promise<void>;
1402
+ /**
1403
+ * Adds a signature to a signature request using the client's signer (or the
1404
+ * provided signer)
1405
+ *
1406
+ * WARNING: This function should be used with caution. It is only provided
1407
+ * for use in special cases where the provided workflows do not meet the
1408
+ * requirements of an application.
1409
+ *
1410
+ * It is highly recommended to use the `register`, `unsafe_addAccount`,
1411
+ * `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
1412
+ * methods instead.
1413
+ *
1414
+ * @param signatureRequest - The signature request to add the signature to
1415
+ * @throws {ClientNotInitializedError} if the client is not initialized
1416
+ * @throws {SignerUnavailableError} if no signer is available
1417
+ */
1418
+ unsafe_addSignature(signatureRequest: SignatureRequestHandle$1, signer?: Signer): Promise<void>;
1419
+ /**
1420
+ * Returns a signature request handler for creating a new inbox
1421
+ *
1422
+ * WARNING: This function should be used with caution. It is only provided
1423
+ * for use in special cases where the provided workflows do not meet the
1424
+ * requirements of an application.
1425
+ *
1426
+ * It is highly recommended to use the `register` method instead.
1427
+ *
1428
+ * @returns The signature text
1429
+ * @throws {ClientNotInitializedError} if the client is not initialized
1430
+ */
1431
+ unsafe_createInboxSignatureRequest(): Promise<SignatureRequestHandle$1 | null>;
1432
+ /**
1433
+ * Returns a signature request handler for adding a new account to the
1434
+ * client's inbox
1435
+ *
1436
+ * WARNING: This function should be used with caution. It is only provided
1437
+ * for use in special cases where the provided workflows do not meet the
1438
+ * requirements of an application.
1439
+ *
1440
+ * It is highly recommended to use the `unsafe_addAccount` method instead.
1441
+ *
1442
+ * The `allowInboxReassign` parameter must be true or this function will
1443
+ * throw an error.
1444
+ *
1445
+ * @param newAccountIdentifier - The identifier of the new account
1446
+ * @param allowInboxReassign - Whether to allow inbox reassignment
1447
+ * @returns The signature text
1448
+ * @throws {ClientNotInitializedError} if the client is not initialized
1449
+ */
1450
+ unsafe_addAccountSignatureRequest(newAccountIdentifier: Identifier$1, allowInboxReassign?: boolean): Promise<SignatureRequestHandle$1>;
1451
+ /**
1452
+ * Returns a signature request handler for removing an account from the
1453
+ * client's inbox
1454
+ *
1455
+ * WARNING: This function should be used with caution. It is only provided
1456
+ * for use in special cases where the provided workflows do not meet the
1457
+ * requirements of an application.
1458
+ *
1459
+ * It is highly recommended to use the `removeAccount` method instead.
1460
+ *
1461
+ * @param identifier - The identifier of the account to remove
1462
+ * @returns The signature text
1463
+ * @throws {ClientNotInitializedError} if the client is not initialized
1464
+ */
1465
+ unsafe_removeAccountSignatureRequest(identifier: Identifier$1): Promise<SignatureRequestHandle$1>;
1466
+ /**
1467
+ * Returns a signature request handler for revoking all other installations
1468
+ * of the client's inbox
1469
+ *
1470
+ * WARNING: This function should be used with caution. It is only provided
1471
+ * for use in special cases where the provided workflows do not meet the
1472
+ * requirements of an application.
1473
+ *
1474
+ * It is highly recommended to use the `revokeAllOtherInstallations` method instead.
1475
+ *
1476
+ * @returns The signature text
1477
+ * @throws {ClientNotInitializedError} if the client is not initialized
1478
+ */
1479
+ unsafe_revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle$1 | null>;
1480
+ /**
1481
+ * Returns a signature request handler for revoking specific installations
1482
+ * of the client's inbox
1483
+ *
1484
+ * WARNING: This function should be used with caution. It is only provided
1485
+ * for use in special cases where the provided workflows do not meet the
1486
+ * requirements of an application.
1487
+ *
1488
+ * It is highly recommended to use the `revokeInstallations` method instead.
1489
+ *
1490
+ * @param installationIds - The installation IDs to revoke
1491
+ * @returns The signature text
1492
+ * @throws {ClientNotInitializedError} if the client is not initialized
1493
+ */
1494
+ unsafe_revokeInstallationsSignatureRequest(installationIds: Uint8Array[]): Promise<SignatureRequestHandle$1>;
1495
+ /**
1496
+ * Returns a signature request handler for changing the recovery identifier
1497
+ * for this client's inbox
1498
+ *
1499
+ * WARNING: This function should be used with caution. It is only provided
1500
+ * for use in special cases where the provided workflows do not meet the
1501
+ * requirements of an application.
1502
+ *
1503
+ * It is highly recommended to use the `changeRecoveryIdentifier` method instead.
1504
+ *
1505
+ * @param identifier - The new recovery identifier
1506
+ * @returns The signature text
1507
+ * @throws {ClientNotInitializedError} if the client is not initialized
1508
+ */
1509
+ unsafe_changeRecoveryIdentifierSignatureRequest(identifier: Identifier$1): Promise<SignatureRequestHandle$1>;
1510
+ /**
1511
+ * Applies a signature request to the client
1512
+ *
1513
+ * WARNING: This function should be used with caution. It is only provided
1514
+ * for use in special cases where the provided workflows do not meet the
1515
+ * requirements of an application.
1516
+ *
1517
+ * It is highly recommended to use the `register`, `unsafe_addAccount`,
1518
+ * `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`
1519
+ * methods instead.
1520
+ *
1521
+ * @throws {ClientNotInitializedError} if the client is not initialized
1522
+ */
1523
+ unsafe_applySignatureRequest(signatureRequest: SignatureRequestHandle$1): Promise<void>;
1524
+ /**
1525
+ * Registers the client with the XMTP network
1526
+ *
1527
+ * Requires a signer, use `Client.create` to create a client with a signer.
1528
+ *
1529
+ * @throws {ClientNotInitializedError} if the client is not initialized
1530
+ * @throws {SignerUnavailableError} if no signer is available
1531
+ */
1532
+ register(): Promise<void>;
1533
+ /**
1534
+ * Adds a new account to the client inbox
1535
+ *
1536
+ * WARNING: This function should be used with caution. Adding a wallet already
1537
+ * associated with an inbox ID will cause the wallet to lose access to
1538
+ * that inbox.
1539
+ *
1540
+ * The `allowInboxReassign` parameter must be true to reassign an inbox
1541
+ * already associated with a different account.
1542
+ *
1543
+ * Requires a signer, use `Client.create` to create a client with a signer.
1544
+ *
1545
+ * @param newAccountSigner - The signer for the new account
1546
+ * @param allowInboxReassign - Whether to allow inbox reassignment
1547
+ * @throws {AccountAlreadyAssociatedError} if the account is already associated with an inbox ID
1548
+ * @throws {ClientNotInitializedError} if the client is not initialized
1549
+ * @throws {SignerUnavailableError} if no signer is available
1550
+ */
1551
+ unsafe_addAccount(newAccountSigner: Signer, allowInboxReassign?: boolean): Promise<void>;
1552
+ /**
1553
+ * Removes an account from the client's inbox
1554
+ *
1555
+ * Requires a signer, use `Client.create` to create a client with a signer.
1556
+ *
1557
+ * @param identifier - The identifier of the account to remove
1558
+ * @throws {ClientNotInitializedError} if the client is not initialized
1559
+ * @throws {SignerUnavailableError} if no signer is available
1560
+ */
1561
+ removeAccount(identifier: Identifier$1): Promise<void>;
1562
+ /**
1563
+ * Revokes all other installations of the client's inbox
1564
+ *
1565
+ * Requires a signer, use `Client.create` to create a client with a signer.
1566
+ *
1567
+ * @throws {ClientNotInitializedError} if the client is not initialized
1568
+ * @throws {SignerUnavailableError} if no signer is available
1569
+ */
1570
+ revokeAllOtherInstallations(): Promise<void>;
1571
+ /**
1572
+ * Revokes specific installations of the client's inbox
1573
+ *
1574
+ * Requires a signer, use `Client.create` to create a client with a signer.
1575
+ *
1576
+ * @param installationIds - The installation IDs to revoke
1577
+ * @throws {ClientNotInitializedError} if the client is not initialized
1578
+ * @throws {SignerUnavailableError} if no signer is available
1579
+ */
1580
+ revokeInstallations(installationIds: Uint8Array[]): Promise<void>;
1581
+ /** Revoke installations with an explicit backend or network options. */
1582
+ static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], optionsOrBackend: NetworkOptions | Backend$1): Promise<void>;
1583
+ /**
1584
+ * Changes the recovery identifier for the client's inbox
1585
+ *
1586
+ * Requires a signer, use `Client.create` to create a client with a signer.
1587
+ *
1588
+ * @param identifier - The new recovery identifier
1589
+ * @throws {ClientNotInitializedError} if the client is not initialized
1590
+ * @throws {SignerUnavailableError} if no signer is available
1591
+ */
1592
+ changeRecoveryIdentifier(identifier: Identifier$1): Promise<void>;
1593
+ /**
1594
+ * Checks if the client can message the specified identifiers
1595
+ *
1596
+ * @param identifiers - The identifiers to check
1597
+ * @returns Whether the client can message the identifiers
1598
+ * @throws {ClientNotInitializedError} if the client is not initialized
1599
+ */
1600
+ canMessage(identifiers: Identifier$1[]): Promise<Map<string, boolean>>;
1601
+ /**
1602
+ * Fetches the latest inbox updates count for the specified inbox IDs
1603
+ *
1604
+ * @param inboxIds - The inbox IDs to check
1605
+ * @returns Map of inbox IDs to their updates count
1606
+ * @throws {ClientNotInitializedError} if the client is not initialized
1607
+ */
1608
+ fetchLatestInboxUpdatesCount(inboxIds: string[]): Promise<Map<string, number>>;
1609
+ /**
1610
+ * Fetches the latest inbox updates count for the client's inbox
1611
+ *
1612
+ * @returns The latest inbox updates count
1613
+ * @throws {ClientNotInitializedError} if the client is not initialized
1614
+ */
1615
+ fetchOwnInboxUpdatesCount(): Promise<number>;
1616
+ /**
1617
+ * Fetches the key package statuses from the network for the specified
1618
+ * installation IDs
1619
+ *
1620
+ * @param installationIds - The installation IDs to check
1621
+ * @returns The key package statuses
1622
+ * @throws {ClientNotInitializedError} if the client is not initialized
1623
+ */
1624
+ fetchKeyPackageStatuses(installationIds: string[]): Promise<Record<string, import("@xmtp/node-bindings").KeyPackageStatus>>;
1625
+ /**
1626
+ * Fetches the inbox ID for a given identifier from the local database
1627
+ * If not found, fetches from the network
1628
+ *
1629
+ * @param identifier - The identifier to look up
1630
+ * @returns The inbox ID, if found
1631
+ * @throws {ClientNotInitializedError} if the client is not initialized
1632
+ */
1633
+ fetchInboxIdByIdentifier(identifier: Identifier$1): Promise<string | null>;
1634
+ /**
1635
+ * Signs a message with the installation key
1636
+ *
1637
+ * @param signatureText - The text to sign
1638
+ * @returns The signature
1639
+ * @throws {ClientNotInitializedError} if the client is not initialized
1640
+ */
1641
+ signWithInstallationKey(signatureText: string): Uint8Array<ArrayBufferLike>;
1642
+ /**
1643
+ * Verifies a signature was made with the installation key
1644
+ *
1645
+ * @param signatureText - The text that was signed
1646
+ * @param signatureBytes - The signature bytes to verify
1647
+ * @returns Whether the signature is valid
1648
+ * @throws {ClientNotInitializedError} if the client is not initialized
1649
+ */
1650
+ verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
1651
+ /** Fetch inbox states with an explicit backend or network options. */
1652
+ static fetchInboxStates(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend$1): Promise<import("@xmtp/node-bindings").InboxState[]>;
1653
+ /** Fetch inbox update counts with an explicit backend or network options. */
1654
+ static fetchLatestInboxUpdatesCount(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend$1): Promise<Map<string, number>>;
1655
+ /** Check identifiers with an explicit backend or network options. */
1656
+ static canMessage(identifiers: Identifier$1[], optionsOrBackend: NetworkOptions | Backend$1): Promise<Map<string, boolean>>;
1657
+ /**
1658
+ * Verifies a signature was made with a public key
1659
+ *
1660
+ * @param signatureText - The text that was signed
1661
+ * @param signatureBytes - The signature bytes to verify
1662
+ * @param publicKey - The public key to verify against
1663
+ * @returns Whether the signature is valid
1664
+ */
1665
+ static verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
1666
+ /** Check address authorization with an explicit backend or network options. */
1667
+ static isAddressAuthorized(inboxId: string, address: string, optionsOrBackend: NetworkOptions | Backend$1): Promise<boolean>;
1668
+ /** Check installation authorization with an explicit backend or network options. */
1669
+ static isInstallationAuthorized(inboxId: string, installation: Uint8Array, optionsOrBackend: NetworkOptions | Backend$1): Promise<boolean>;
1670
+ /**
1671
+ * Archive application elements to file for later restoration
1672
+ *
1673
+ * @param path - The file path to save the archive
1674
+ * @param key - Encryption key for the archive
1675
+ * @param opts - Archive options specifying what to include (defaults to consent and messages)
1676
+ * @returns Promise that resolves when the archive is created
1677
+ */
1678
+ createArchive(path: string, key: Uint8Array, opts?: ArchiveOptions$1): Promise<void>;
1679
+ /**
1680
+ * Import a previous archive from a file
1681
+ *
1682
+ * @param path - The file path to the archive
1683
+ * @param key - Encryption key for the archive
1684
+ * @returns Promise that resolves when the archive is imported
1685
+ */
1686
+ importArchive(path: string, key: Uint8Array): Promise<void>;
1687
+ /**
1688
+ * Load the metadata for an archive to see what it contains
1689
+ *
1690
+ * Reads only the metadata without loading the entire file, so this function is quick.
1691
+ *
1692
+ * @param path - The file path to the archive
1693
+ * @param key - Encryption key for the archive
1694
+ * @returns Promise that resolves with the archive metadata
1695
+ */
1696
+ archiveMetadata(path: string, key: Uint8Array): Promise<ArchiveMetadata$1>;
1697
+ /**
1698
+ * Manually sync all device sync groups
1699
+ *
1700
+ * @returns Promise that resolves with a summary of the sync operation
1701
+ */
1702
+ syncAllDeviceSyncGroups(): Promise<GroupSyncSummary$1>;
1703
+ /** Enable notifications and register the delivery channel. */
1704
+ enableNotifications(config: NotificationConfig): Promise<NotificationState>;
1705
+ /** Disable notifications. Per-conversation overrides remain stored. */
1706
+ disableNotifications(): Promise<void>;
1707
+ /** Read the local state without a backend request. */
1708
+ notificationState(): Promise<NotificationState>;
1709
+ /**
1710
+ * What the deployment published about itself, as this client resolved it
1711
+ * when it was built.
1712
+ *
1713
+ * Reads memory and makes no backend request. The value never changes for the
1714
+ * life of the client: a background refresh rewrites the stored copy, and a
1715
+ * new value takes effect at the next build.
1716
+ *
1717
+ * @throws {ClientNotInitializedError} if the client is not initialized
1718
+ */
1719
+ serverConfiguration(): ServerConfiguration$1;
1720
+ /**
1721
+ * Fetch the deployment configuration now, rewrite the stored copy, and
1722
+ * return what was fetched.
1723
+ *
1724
+ * The snapshot this client holds is unchanged; use it to observe a change an
1725
+ * operator has made without restarting.
1726
+ *
1727
+ * @throws {ClientNotInitializedError} if the client is not initialized
1728
+ * @throws {ConfigurationUnavailableError} if the deployment did not answer
1729
+ * @throws {ConfigurationInvalidError} if it published an unusable configuration
1730
+ * @throws {BackendMismatchError} if it published a different identifier
1731
+ * @throws {ClientVersionTooOldError} if it now requires a newer libxmtp
1732
+ */
1733
+ refreshServerConfiguration(): Promise<ServerConfiguration$1>;
1734
+ /**
1735
+ * Read what a deployment publishes about itself with no database, no client,
1736
+ * and no credential.
1737
+ *
1738
+ * Lets an app learn `auth.enabled`, `auth.requiredScopes`, and the accepted
1739
+ * smart contract wallet chains before it decides how to build a client.
1740
+ * Nothing is stored and no identifier binding is applied.
1741
+ *
1742
+ * @param target - A backend URL, network options, or an existing backend
1743
+ * @throws {ConfigurationUnavailableError} if the deployment did not answer
1744
+ * @throws {ConfigurationInvalidError} if it published an unusable configuration
1745
+ */
1746
+ static fetchServerConfiguration(target: string | NetworkOptions | Backend$1): Promise<ServerConfiguration$1>;
1764
1747
  }
1765
-
1766
- 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 };
1767
- export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, DeviceSyncOptions, DistributiveOmit, EOASigner, EnrichedReply, ExtractCodecContentTypes, HexString, NetworkOptions, OtherOptions, SCWSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
1748
+ //#endregion
1749
+ //#region src/utils/streamFailure.d.ts
1750
+ export type StreamFailureCause = {
1751
+ kind: "target_pending" | "receipt_pending" | "processing_pending" | "blocked" | "storage" | "receiver" | "invalid_topic";
1752
+ code: string | null;
1753
+ message: string;
1754
+ retryable: boolean;
1755
+ };
1756
+ export type UnfinishedStreamTopic = {
1757
+ topic: Uint8Array;
1758
+ /** Null means that target capture did not complete. */
1759
+ target: bigint | null;
1760
+ received: bigint;
1761
+ processed: bigint;
1762
+ unresolvedWelcomes: bigint[];
1763
+ inactive: boolean;
1764
+ cause: StreamFailureCause | null;
1765
+ };
1766
+ export type StreamBarrierFailure = {
1767
+ reason: "blocked" | "deadline" | "cancelled";
1768
+ unfinished: UnfinishedStreamTopic[];
1769
+ };
1770
+ export type StreamFailureDetails = {
1771
+ kind: "barrier" | "published_but_unconfirmed" | "catch_up";
1772
+ code: string;
1773
+ message: string;
1774
+ retryable: boolean;
1775
+ intentId: number | null;
1776
+ publishedIntentIds: number[];
1777
+ summary: {
1778
+ messages: bigint;
1779
+ conversations: bigint;
1780
+ failed: bigint;
1781
+ completed: boolean;
1782
+ } | null;
1783
+ barriers: StreamBarrierFailure[];
1784
+ };
1785
+ /**
1786
+ * Reads structured progress from a stream, sync, or publication error.
1787
+ * All sequence values are exact bigints. Invalid or absent details return undefined.
1788
+ * A published-but-unconfirmed error does not mean that publication failed.
1789
+ */
1790
+ export declare const getStreamFailureDetails: (error: unknown) => StreamFailureDetails | undefined;
1791
+ //#endregion
1792
+ //#region src/ServerConfiguration.d.ts
1793
+ /**
1794
+ * Typed failures for the deployment configuration a backend publishes
1795
+ * (spec 006 §7).
1796
+ *
1797
+ * The bindings report every one of these as an `Error` whose message begins
1798
+ * with `[ClientError::<Variant>]`. Matching on that string is what this module
1799
+ * removes: each of the six documented codes becomes its own class, so an app
1800
+ * writes `error instanceof BackendMismatchError` instead of a regular
1801
+ * expression over a message that may be reworded.
1802
+ *
1803
+ * Every class keeps the binding's message and the original error as `cause`,
1804
+ * so the identifiers, versions, scopes, or chain the core reported are still
1805
+ * readable for diagnostics.
1806
+ */
1807
+ /**
1808
+ * Base class of the six configuration failures. Catch this to handle any of
1809
+ * them; catch a subclass to handle one.
1810
+ */
1811
+ export declare class ServerConfigurationError extends Error {
1812
+ /** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
1813
+ readonly code: string;
1814
+ constructor(
1815
+ /** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
1816
+ code: string, message: string, options?: ErrorOptions);
1817
+ }
1818
+ /**
1819
+ * The configuration could not be read: the deployment did not answer, answered
1820
+ * `UNIMPLEMENTED` because it predates spec 006, or the copy could not be
1821
+ * stored.
1822
+ */
1823
+ export declare class ConfigurationUnavailableError extends ServerConfigurationError {
1824
+ constructor(message: string, options?: ErrorOptions);
1825
+ }
1826
+ /**
1827
+ * The deployment answered with a configuration no client can use: an empty or
1828
+ * malformed identifier, an unparseable minimum version, or a chain that is not
1829
+ * a CAIP-2 identifier. Nothing is stored.
1830
+ */
1831
+ export declare class ConfigurationInvalidError extends ServerConfigurationError {
1832
+ constructor(message: string, options?: ErrorOptions);
1833
+ }
1834
+ /**
1835
+ * This database is bound to a different deployment. The identifier the backend
1836
+ * published is not the one the database was created against. Recovery is a
1837
+ * database created for the deployment the app now uses.
1838
+ */
1839
+ export declare class BackendMismatchError extends ServerConfigurationError {
1840
+ constructor(message: string, options?: ErrorOptions);
1841
+ }
1842
+ /** The deployment requires a newer libxmtp than this SDK is built on. */
1843
+ export declare class ClientVersionTooOldError extends ServerConfigurationError {
1844
+ constructor(message: string, options?: ErrorOptions);
1845
+ }
1846
+ /**
1847
+ * The deployment requires authentication and no credential source was
1848
+ * configured. The message carries the scopes it requires.
1849
+ */
1850
+ export declare class AuthRequiredError extends ServerConfigurationError {
1851
+ constructor(message: string, options?: ErrorOptions);
1852
+ }
1853
+ /**
1854
+ * A smart contract wallet signature names a chain the deployment does not
1855
+ * verify on. Raised before any network call, and only for signatures the app
1856
+ * supplied.
1857
+ */
1858
+ export declare class ChainNotAcceptedError extends ServerConfigurationError {
1859
+ constructor(message: string, options?: ErrorOptions);
1860
+ }
1861
+ /**
1862
+ * Classifies an error from any SDK call as one of the six configuration
1863
+ * failures, or `undefined` when it is something else.
1864
+ *
1865
+ * Use this where the SDK hands back the raw error, for instance a
1866
+ * `ChainNotAcceptedError` raised deep inside a call that supplies a smart
1867
+ * contract wallet signature.
1868
+ */
1869
+ export declare const toServerConfigurationError: (error: unknown) => ServerConfigurationError | undefined;
1870
+ /**
1871
+ * Rethrows an error as its typed configuration failure, or unchanged when it
1872
+ * is not one.
1873
+ */
1874
+ export declare const throwServerConfigurationError: (error: unknown) => never;
1875
+ //#endregion
1876
+ export { type Action, ActionStyle, type Actions, type ApiStats, type AppDataChange, type ArchiveMetadata, type ArchiveOptions, type AsyncStreamProxy, type Attachment, type AuthCallback, type AuthConfiguration, type Backend, type BackendBuilder, BackupElementSelectionOption, type BuiltInContentTypes, type ClientOptions, type Consent, ConsentEntityType, ConsentState, type ContentOptions, ContentType, type ConversationDebugInfo, type ConversationListItem, ConversationType, type CreateDmOptions, type CreateGroupOptions, type Credential, type Cursor, type DEFAULT_RETRY_ATTEMPTS, type DEFAULT_RETRY_DELAY, type DeliveryCursor, DeliveryStatus, type DeviceSyncOptions, type DistributiveOmit, type EOASigner, type EncryptedAttachment, type EnrichedReply, type ExtractCodecContentTypes, type GetBlockNumber, type GetChainId, type GetIdentifier, type GroupMember, GroupMembershipState, GroupMessageKind, type GroupMetadata, type GroupPermissions, GroupPermissionsOptions, type GroupSyncSummary, type GroupUpdated, type HmacKey, type Identifier, IdentifierKind, type IdentityStats, type Inbox, type InboxState, type Installation, type Intent, type KeyPackageStatus, type LeaveRequest, type Lifetime, type LimitsConfiguration, type ListConversationsOptions, ListConversationsOrderBy, type ListMessagesOptions, LogLevel, type LogOptions, type Message, type MessageAcknowledgement, type MessageCatchUp, type MessageCatchUpGeneration, type MessageDelivery, type MessageDisappearingSettings, type MessageHistorySnapshot, type MessageReaderSource, MessageSortBy, type MessageTopicStatus, MetadataField, type MetadataFieldChange, type MlsConfiguration, type MultiRemoteAttachment, type NetworkOptions, type NotificationChannel, type NotificationConfig, type NotificationOverride, type NotificationState, type OtherOptions, PermissionLevel, PermissionPolicy, type PermissionPolicySet, PermissionUpdateType, type Reaction, ReactionAction, ReactionSchema, type ReadReceipt, type RemoteAttachment, type Reply, type ResolveValue, type RetentionConfiguration, type SCWSigner, type SendMessageOpts, type SendOpts, type ServerConfiguration, type SignMessage, type SignatureRequestHandle, type Signer, type SigningKeyDescription, SortDirection, type StorageOptions, type StreamCallback, type StreamFunction, type StreamOptions, type StreamValueMutator, type TransactionMetadata, type TransactionReference, type UserPreferenceUpdate, type VisibilityConfirmationOptions, type WalletCall, type WalletSendCalls, type WorkerConfigOptions, type WorkerIntervalOverride, type WorkerJitterOverride, WorkerKind, contentTypeActions, contentTypeAttachment, contentTypeGroupUpdated, contentTypeIntent, contentTypeLeaveRequest, contentTypeMarkdown, contentTypeMultiRemoteAttachment, contentTypeReaction, contentTypeReadReceipt, contentTypeRemoteAttachment, contentTypeReply, contentTypeText, contentTypeTransactionReference, contentTypeWalletSendCalls, type createStream, decryptAttachment, encodeActions, encodeAttachment, encodeIntent, encodeMarkdown, encodeMultiRemoteAttachment, encodeReaction, encodeReadReceipt, encodeRemoteAttachment, encodeText, encodeTransactionReference, encodeWalletSendCalls, encryptAttachment, flushTelemetry, initLogging };
1877
+ //# sourceMappingURL=index.d.ts.map