@xmtp/node-sdk 6.2.0-dev.999b077 → 6.2.0-dev.e7edced
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/README.md +23 -3
- package/dist/index.d.ts +365 -277
- package/dist/index.js +1185 -627
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
1
|
import { ContentCodec, ContentTypeId } from '@xmtp/content-type-primitives';
|
|
2
2
|
import * as _xmtp_node_bindings from '@xmtp/node-bindings';
|
|
3
|
-
import { ContentTypeId as ContentTypeId$1, DeliveryStatus, GroupMessageKind, Reaction, DecodedMessage as DecodedMessage$1, LeaveRequest, ReadReceipt, Attachment, RemoteAttachment, TransactionReference, WalletSendCalls, Actions, Intent, MultiRemoteAttachment, GroupUpdated, DeletedMessage, Backend, LogLevel, WorkerConfigOptions, VisibilityConfirmationOptions, AppDataChange,
|
|
4
|
-
export { Action, ActionStyle, Actions, ApiStats, AppDataChange, ArchiveMetadata, ArchiveOptions, Attachment,
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Pre-configured URLs for the XMTP network based on the environment
|
|
8
|
-
*
|
|
9
|
-
* @deprecated Use `createBackend()` instead.
|
|
10
|
-
* @constant
|
|
11
|
-
* @property {string} local - The local URL for the XMTP network
|
|
12
|
-
* @property {string} dev - The development URL for the XMTP network
|
|
13
|
-
* @property {string} production - The production URL for the XMTP network
|
|
14
|
-
*/
|
|
15
|
-
declare const ApiUrls: {
|
|
16
|
-
readonly local: "http://localhost:5556";
|
|
17
|
-
readonly dev: "https://grpc.dev.xmtp.network:443";
|
|
18
|
-
readonly production: "https://grpc.production.xmtp.network:443";
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Pre-configured URLs for the XMTP history sync service based on the environment
|
|
22
|
-
*
|
|
23
|
-
* @constant
|
|
24
|
-
* @property {string} local - The local URL for the XMTP history sync service
|
|
25
|
-
* @property {string} dev - The development URL for the XMTP history sync service
|
|
26
|
-
* @property {string} production - The production URL for the XMTP history sync service
|
|
27
|
-
*/
|
|
28
|
-
declare const HistorySyncUrls: {
|
|
29
|
-
readonly local: "http://localhost:5558";
|
|
30
|
-
readonly dev: "https://message-history.dev.ephemera.network";
|
|
31
|
-
readonly production: "https://message-history.production.ephemera.network";
|
|
32
|
-
readonly "testnet-staging": "https://message-history.dev.ephemera.network";
|
|
33
|
-
readonly "testnet-dev": "https://message-history.dev.ephemera.network";
|
|
34
|
-
readonly testnet: "https://message-history.dev.ephemera.network";
|
|
35
|
-
readonly mainnet: "https://message-history.production.ephemera.network";
|
|
36
|
-
};
|
|
3
|
+
import { DeliveryCursor, ContentTypeId as ContentTypeId$1, DeliveryStatus, GroupMessageKind, Reaction, DecodedMessage as DecodedMessage$1, LeaveRequest, ReadReceipt, Attachment, RemoteAttachment, TransactionReference, WalletSendCalls, Actions, Intent, MultiRemoteAttachment, GroupUpdated, DeletedMessage, Backend, LogLevel, WorkerConfigOptions, VisibilityConfirmationOptions, AppDataChange, Identifier, StreamCloser, ConversationType, ConsentState, MessageCatchUp, Conversation as Conversation$1, Message, EncodedContent, SendMessageOpts, SendOpts, Reply, ListMessagesOptions, PermissionUpdateType, PermissionPolicy, MetadataField, Conversations as Conversations$1, CreateGroupOptions, CreateDmOptions, ListConversationsOptions, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, ArchiveOptions, ArchiveMetadata, GroupSyncSummary, ServerConfiguration } from '@xmtp/node-bindings';
|
|
4
|
+
export { Action, ActionStyle, Actions, ApiStats, AppDataChange, ArchiveMetadata, ArchiveOptions, Attachment, AuthConfiguration, Backend, BackendBuilder, BackupElementSelectionOption, Consent, ConsentEntityType, ConsentState, ContentType, ConversationDebugInfo, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, Cursor, DeliveryCursor, DeliveryStatus, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupUpdated, HmacKey, Identifier, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, KeyPackageStatus, LeaveRequest, Lifetime, LimitsConfiguration, ListConversationsOptions, ListConversationsOrderBy, ListMessagesOptions, LogLevel, LogOptions, Message, MessageCatchUp, MessageCatchUpGeneration, MessageDisappearingSettings, MessageHistorySnapshot, MessageSortBy, MessageTopicStatus, MetadataField, MetadataFieldChange, MlsConfiguration, MultiRemoteAttachment, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, Reaction, ReactionAction, ReactionSchema, ReadReceipt, RemoteAttachment, Reply, RetentionConfiguration, SendMessageOpts, SendOpts, ServerConfiguration, SignatureRequestHandle, SigningKeyDescription, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, VisibilityConfirmationOptions, WalletCall, WalletSendCalls, WorkerConfigOptions, WorkerIntervalOverride, WorkerJitterOverride, WorkerKind, contentTypeActions, contentTypeAttachment, contentTypeGroupUpdated, contentTypeIntent, contentTypeLeaveRequest, contentTypeMarkdown, contentTypeMultiRemoteAttachment, contentTypeReaction, contentTypeReadReceipt, contentTypeRemoteAttachment, contentTypeReply, contentTypeText, contentTypeTransactionReference, contentTypeWalletSendCalls, decryptAttachment, encodeActions, encodeAttachment, encodeIntent, encodeMarkdown, encodeMultiRemoteAttachment, encodeReaction, encodeReadReceipt, encodeRemoteAttachment, encodeText, encodeTransactionReference, encodeWalletSendCalls, encryptAttachment, flushTelemetry, initLogging } from '@xmtp/node-bindings';
|
|
37
5
|
|
|
38
6
|
declare class CodecRegistry {
|
|
39
7
|
#private;
|
|
@@ -67,6 +35,8 @@ declare class CodecRegistry {
|
|
|
67
35
|
* @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)
|
|
68
36
|
*/
|
|
69
37
|
declare class DecodedMessage<ContentTypes = unknown> {
|
|
38
|
+
/** Database-local position of this delivery. Absent for ordinary history reads. */
|
|
39
|
+
deliveryCursor?: DeliveryCursor;
|
|
70
40
|
content: ContentTypes | undefined;
|
|
71
41
|
contentType: ContentTypeId$1;
|
|
72
42
|
conversationId: string;
|
|
@@ -88,49 +58,33 @@ type HexString = `0x${string}`;
|
|
|
88
58
|
declare function isHexString(value: unknown): value is HexString;
|
|
89
59
|
declare function validHex(value: unknown): HexString;
|
|
90
60
|
|
|
91
|
-
/**
|
|
92
|
-
* XMTP environment
|
|
93
|
-
*/
|
|
94
|
-
type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
|
|
95
61
|
/**
|
|
96
62
|
* Network options
|
|
97
63
|
*/
|
|
64
|
+
/** A backend credential. Include the `Bearer ` prefix when required. */
|
|
65
|
+
type Credential = {
|
|
66
|
+
/** Header name. Defaults to `authorization`. */
|
|
67
|
+
name?: string;
|
|
68
|
+
value: string;
|
|
69
|
+
/** Expiration as Unix seconds. Must be a safe integer. */
|
|
70
|
+
expiresAtSeconds: number;
|
|
71
|
+
};
|
|
72
|
+
/** Called when the backend needs a credential, including credential refresh. */
|
|
73
|
+
type AuthCallback = () => Promise<Credential>;
|
|
98
74
|
type NetworkOptions = {
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
*/
|
|
75
|
+
/** Backend URL, including the HTTP or HTTPS scheme. */
|
|
76
|
+
backendUrl: string;
|
|
77
|
+
/** Label used only for the default database file name. */
|
|
78
|
+
env?: string;
|
|
79
|
+
/** Custom app version. */
|
|
121
80
|
appVersion?: string;
|
|
81
|
+
/** Supply backend credentials. Separate from the XMTP identity signer. */
|
|
82
|
+
authCallback?: AuthCallback;
|
|
122
83
|
};
|
|
123
84
|
/**
|
|
124
85
|
* Device sync options
|
|
125
86
|
*/
|
|
126
87
|
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
88
|
/**
|
|
135
89
|
* Disable device sync
|
|
136
90
|
*/
|
|
@@ -147,8 +101,8 @@ type StorageOptions = {
|
|
|
147
101
|
*
|
|
148
102
|
* - `undefined` (or excluded from the client options)
|
|
149
103
|
* The database will be created in the current working directory and is based on
|
|
150
|
-
* the
|
|
151
|
-
* Example: `xmtp-
|
|
104
|
+
* the environment label and client inbox ID.
|
|
105
|
+
* Example: `xmtp-default-<inbox-id>.db3`
|
|
152
106
|
*
|
|
153
107
|
* - `null`
|
|
154
108
|
* No database will be created and all data will be lost once the client disconnects.
|
|
@@ -165,7 +119,7 @@ type StorageOptions = {
|
|
|
165
119
|
/**
|
|
166
120
|
* Encryption key for the local DB (32 bytes, hex)
|
|
167
121
|
*
|
|
168
|
-
* @see https://docs.xmtp.org/
|
|
122
|
+
* @see https://docs.xmtp.org/sdk/client/#view-an-encrypted-database
|
|
169
123
|
*/
|
|
170
124
|
dbEncryptionKey?: Uint8Array | HexString;
|
|
171
125
|
/**
|
|
@@ -220,6 +174,10 @@ type OtherOptions = {
|
|
|
220
174
|
* Call {@link flushTelemetry} on graceful shutdown to flush buffered spans.
|
|
221
175
|
*/
|
|
222
176
|
otelEndpoint?: string;
|
|
177
|
+
/** Service name attached to exported telemetry. */
|
|
178
|
+
otelServiceName?: string;
|
|
179
|
+
/** Fraction of root spans sampled, from 0 to 1. */
|
|
180
|
+
otelSampleRatio?: number;
|
|
223
181
|
/**
|
|
224
182
|
* Resource attributes attached to all exported telemetry spans
|
|
225
183
|
* (e.g. `{ "service.instance.id": "herald-7", "deployment.environment": "prod" }`).
|
|
@@ -246,8 +204,7 @@ type OtherOptions = {
|
|
|
246
204
|
/**
|
|
247
205
|
* Options for waiting until client registration is visible on the network.
|
|
248
206
|
*
|
|
249
|
-
* When set, `registerIdentity`
|
|
250
|
-
* to confirm the registration before resolving.
|
|
207
|
+
* When set, `registerIdentity` waits until the backend can read the registration.
|
|
251
208
|
*/
|
|
252
209
|
waitForRegistrationVisible?: VisibilityConfirmationOptions;
|
|
253
210
|
/**
|
|
@@ -287,8 +244,7 @@ type EnrichedReply<T = unknown, U = unknown> = {
|
|
|
287
244
|
type BuiltInContentTypes = string | LeaveRequest | Reaction | ReadReceipt | Attachment | RemoteAttachment | TransactionReference | WalletSendCalls | Actions | Intent | MultiRemoteAttachment | GroupUpdated | DeletedMessage;
|
|
288
245
|
type ExtractCodecContentTypes<C extends ContentCodec[] = []> = C extends readonly [] ? BuiltInContentTypes : [...C][number] extends ContentCodec<infer T> ? T | BuiltInContentTypes | EnrichedReply<T | BuiltInContentTypes, T | BuiltInContentTypes> : BuiltInContentTypes;
|
|
289
246
|
|
|
290
|
-
declare const
|
|
291
|
-
declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
|
|
247
|
+
declare const createBackend: (options: NetworkOptions) => Promise<Backend>;
|
|
292
248
|
|
|
293
249
|
declare class InboxReassignError extends Error {
|
|
294
250
|
constructor();
|
|
@@ -350,6 +306,11 @@ interface AsyncStreamProxy<T> extends AsyncIterable<T> {
|
|
|
350
306
|
|
|
351
307
|
declare const DEFAULT_RETRY_DELAY = 60000;
|
|
352
308
|
declare const DEFAULT_RETRY_ATTEMPTS = 10;
|
|
309
|
+
/**
|
|
310
|
+
* Notification streams created by createStream use the retry settings and hooks.
|
|
311
|
+
* Durable message streams use onValue, onError, and onEnd. Core handles their
|
|
312
|
+
* network recovery; notification retry settings and hooks do not apply.
|
|
313
|
+
*/
|
|
353
314
|
type StreamOptions<T = unknown, V = T> = {
|
|
354
315
|
/**
|
|
355
316
|
* Called when the stream ends
|
|
@@ -360,38 +321,41 @@ type StreamOptions<T = unknown, V = T> = {
|
|
|
360
321
|
*/
|
|
361
322
|
onError?: (error: Error) => void;
|
|
362
323
|
/**
|
|
363
|
-
* Called when
|
|
324
|
+
* Called when a notification stream fails
|
|
364
325
|
*/
|
|
365
326
|
onFail?: () => void;
|
|
366
327
|
/**
|
|
367
|
-
* Called when
|
|
328
|
+
* Called when a notification stream is restarted
|
|
368
329
|
*/
|
|
369
330
|
onRestart?: () => void;
|
|
370
331
|
/**
|
|
371
|
-
* Called when
|
|
332
|
+
* Called when a notification stream is retried
|
|
372
333
|
*/
|
|
373
334
|
onRetry?: (attempts: number, maxAttempts: number) => void;
|
|
374
335
|
/**
|
|
375
|
-
* Called when a value is emitted from the stream
|
|
336
|
+
* Called when a value is emitted from the stream.
|
|
337
|
+
* For message streams, this selects callback mode. Do not also iterate that stream.
|
|
338
|
+
* Message delivery is acknowledged after this callback returns successfully.
|
|
376
339
|
*/
|
|
377
|
-
onValue?: (value: V) => void
|
|
340
|
+
onValue?: (value: V) => void | Promise<void>;
|
|
378
341
|
/**
|
|
379
|
-
* The number of times to retry
|
|
342
|
+
* The number of times to retry a notification stream
|
|
380
343
|
* (default: 10)
|
|
381
344
|
*/
|
|
382
345
|
retryAttempts?: number;
|
|
383
346
|
/**
|
|
384
|
-
* The delay between retries (in milliseconds)
|
|
347
|
+
* The delay between notification stream retries (in milliseconds)
|
|
385
348
|
* (default: 60000)
|
|
386
349
|
*/
|
|
387
350
|
retryDelay?: number;
|
|
388
351
|
/**
|
|
389
|
-
* Whether to retry
|
|
352
|
+
* Whether to retry a notification stream if it fails
|
|
390
353
|
* (default: true)
|
|
391
354
|
*/
|
|
392
355
|
retryOnFail?: boolean;
|
|
393
356
|
/**
|
|
394
|
-
* Whether to
|
|
357
|
+
* Whether to skip pre-sync for notification streams.
|
|
358
|
+
* Durable message readers start receipt without a separate pre-sync.
|
|
395
359
|
* (default: false)
|
|
396
360
|
*/
|
|
397
361
|
disableSync?: boolean;
|
|
@@ -412,7 +376,6 @@ type StreamValueMutator<T = unknown, V = T> = (value: T) => V | Promise<V>;
|
|
|
412
376
|
* @param streamFunction - The stream function to create a stream from
|
|
413
377
|
* @param streamValueMutator - An optional function to mutate the value emitted from the stream
|
|
414
378
|
* @param options - The options for the stream
|
|
415
|
-
* @param args - Additional arguments to pass to the stream function
|
|
416
379
|
* @returns An async iterable stream proxy
|
|
417
380
|
* @throws {StreamInvalidRetryAttemptsError} if the retryAttempts option is less than 0 and retryOnFail is true
|
|
418
381
|
* @throws {StreamFailedError} if the stream fails and can't be restarted
|
|
@@ -435,6 +398,81 @@ declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent>;
|
|
|
435
398
|
declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions>;
|
|
436
399
|
declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
|
|
437
400
|
|
|
401
|
+
type MessageAcknowledgement = {
|
|
402
|
+
checkOwner(): boolean | Promise<boolean>;
|
|
403
|
+
acknowledge(): void | Promise<void>;
|
|
404
|
+
reject(): void | Promise<void>;
|
|
405
|
+
};
|
|
406
|
+
type MessageDelivery<T> = {
|
|
407
|
+
message: T;
|
|
408
|
+
cursor: DeliveryCursor;
|
|
409
|
+
acknowledgement: MessageAcknowledgement;
|
|
410
|
+
};
|
|
411
|
+
type MessageReaderSource<T> = {
|
|
412
|
+
nextDelivery(): Promise<MessageDelivery<T> | null | undefined>;
|
|
413
|
+
close(): void | Promise<void>;
|
|
414
|
+
updateScope(groupIds?: string[]): void | Promise<void>;
|
|
415
|
+
updateFilter(conversationType?: ConversationType, consentStates?: ConsentState[]): void | Promise<void>;
|
|
416
|
+
catchUpSnapshot(): MessageCatchUp | Promise<MessageCatchUp>;
|
|
417
|
+
catchUpChanged(): Promise<MessageCatchUp>;
|
|
418
|
+
};
|
|
419
|
+
/** One pending item. Construction selects callback mode or next-request acknowledgement. */
|
|
420
|
+
declare class MessageStream<T, V> implements AsyncIterable<V> {
|
|
421
|
+
#private;
|
|
422
|
+
constructor(reader: MessageReaderSource<T>, convert: (message: T, cursor: DeliveryCursor) => V | undefined | Promise<V | undefined>, options?: StreamOptions<T, V>);
|
|
423
|
+
get isDone(): boolean;
|
|
424
|
+
get deliveredCursor(): DeliveryCursor | undefined;
|
|
425
|
+
next: () => Promise<IteratorResult<V, undefined>>;
|
|
426
|
+
return: () => Promise<IteratorReturnResult<undefined>>;
|
|
427
|
+
end: () => Promise<IteratorReturnResult<undefined>>;
|
|
428
|
+
updateScope: (groupIds?: string[]) => void | Promise<void>;
|
|
429
|
+
updateFilter: (conversationType?: ConversationType, consentStates?: ConsentState[]) => void | Promise<void>;
|
|
430
|
+
catchUpSnapshot: () => MessageCatchUp | Promise<MessageCatchUp>;
|
|
431
|
+
catchUpChanged: () => Promise<MessageCatchUp>;
|
|
432
|
+
[Symbol.asyncIterator](): this;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** Delivery channel for this installation. */
|
|
436
|
+
type NotificationChannel = {
|
|
437
|
+
type: "apns";
|
|
438
|
+
token: string;
|
|
439
|
+
} | {
|
|
440
|
+
type: "fcm";
|
|
441
|
+
token: string;
|
|
442
|
+
} | {
|
|
443
|
+
type: "http";
|
|
444
|
+
url: string;
|
|
445
|
+
signingKey: Uint8Array;
|
|
446
|
+
};
|
|
447
|
+
/** Notification delivery and conversation rules. */
|
|
448
|
+
type NotificationConfig = {
|
|
449
|
+
channel: NotificationChannel;
|
|
450
|
+
/** Defaults to Allowed. An empty list selects no consent states. */
|
|
451
|
+
consentStates?: ConsentState[];
|
|
452
|
+
/** Defaults to true. */
|
|
453
|
+
includeWelcomes?: boolean;
|
|
454
|
+
/** Defaults to false. */
|
|
455
|
+
includeSyncGroups?: boolean;
|
|
456
|
+
/** Defaults to false. */
|
|
457
|
+
includeCommits?: boolean;
|
|
458
|
+
};
|
|
459
|
+
/** Reset to the configured consent rules with "default". */
|
|
460
|
+
type NotificationOverride = "enabled" | "disabled" | "default";
|
|
461
|
+
/** A notification failure with a stable error code. */
|
|
462
|
+
declare class NotificationError extends Error {
|
|
463
|
+
readonly code: string;
|
|
464
|
+
constructor(code: string, options?: ErrorOptions);
|
|
465
|
+
}
|
|
466
|
+
/** Local notification state. Reading it makes no backend request. */
|
|
467
|
+
type NotificationState = {
|
|
468
|
+
state: "disabled";
|
|
469
|
+
} | {
|
|
470
|
+
state: "enabled";
|
|
471
|
+
} | {
|
|
472
|
+
state: "failed";
|
|
473
|
+
error: NotificationError;
|
|
474
|
+
};
|
|
475
|
+
|
|
438
476
|
/**
|
|
439
477
|
* Represents a conversation
|
|
440
478
|
*
|
|
@@ -458,6 +496,10 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
458
496
|
* Gets whether this conversation is currently active
|
|
459
497
|
*/
|
|
460
498
|
get isActive(): boolean;
|
|
499
|
+
/** Override notification rules, or reset the override with "default". */
|
|
500
|
+
setNotifications(value: NotificationOverride): Promise<void>;
|
|
501
|
+
/** Read the effective notification value for this conversation. */
|
|
502
|
+
notificationsEnabled(): Promise<boolean>;
|
|
461
503
|
/**
|
|
462
504
|
* Gets the inbox ID that added this client's inbox to the conversation
|
|
463
505
|
*/
|
|
@@ -500,12 +542,19 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
500
542
|
*/
|
|
501
543
|
sync(): Promise<void>;
|
|
502
544
|
/**
|
|
503
|
-
*
|
|
545
|
+
* Reads retained messages after the default acknowledgement position.
|
|
546
|
+
* Set `from` to replay after a cursor without changing default progress.
|
|
547
|
+
* Set `onValue` for callback mode, or request items with the iterator.
|
|
548
|
+
* Core owns network recovery. Legacy retry options and `disableSync` do not apply.
|
|
504
549
|
*
|
|
505
|
-
* @param options - Optional
|
|
550
|
+
* @param options - Optional delivery callbacks and replay cursor
|
|
506
551
|
* @returns Stream instance for new messages
|
|
507
552
|
*/
|
|
508
|
-
stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes>>
|
|
553
|
+
stream(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
|
|
554
|
+
from?: DeliveryCursor;
|
|
555
|
+
}): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
|
|
556
|
+
messageHistorySnapshot(limit: number): _xmtp_node_bindings.MessageHistorySnapshot;
|
|
557
|
+
beginningDeliveryCursor(): DeliveryCursor;
|
|
509
558
|
/**
|
|
510
559
|
* Decodes, decrypts, and persists a raw envelope from a group message stream.
|
|
511
560
|
*
|
|
@@ -903,7 +952,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
903
952
|
*
|
|
904
953
|
* @param id - The conversation ID to look up
|
|
905
954
|
* @returns The conversation if found, undefined otherwise
|
|
906
|
-
* @see https://docs.xmtp.org/
|
|
955
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
907
956
|
*/
|
|
908
957
|
getConversationById(id: string): Promise<Group<ContentTypes> | Dm<ContentTypes> | undefined>;
|
|
909
958
|
/**
|
|
@@ -911,7 +960,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
911
960
|
*
|
|
912
961
|
* @param inboxId - The inbox ID to look up
|
|
913
962
|
* @returns The DM if found, undefined otherwise
|
|
914
|
-
* @see https://docs.xmtp.org/
|
|
963
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
915
964
|
*/
|
|
916
965
|
getDmByInboxId(inboxId: string): Dm<ContentTypes> | undefined;
|
|
917
966
|
/**
|
|
@@ -919,7 +968,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
919
968
|
*
|
|
920
969
|
* @param identifier - The identifier to look up
|
|
921
970
|
* @returns Promise that resolves with the DM, if found
|
|
922
|
-
* @see https://docs.xmtp.org/
|
|
971
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
923
972
|
*/
|
|
924
973
|
fetchDmByIdentifier(identifier: Identifier): Promise<Dm<ContentTypes> | undefined>;
|
|
925
974
|
/**
|
|
@@ -927,7 +976,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
927
976
|
*
|
|
928
977
|
* @param id - The message ID to look up
|
|
929
978
|
* @returns The decoded message if found, undefined otherwise
|
|
930
|
-
* @see https://docs.xmtp.org/
|
|
979
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
931
980
|
*/
|
|
932
981
|
getMessageById(id: string): DecodedMessage<ContentTypes> | undefined;
|
|
933
982
|
/**
|
|
@@ -935,7 +984,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
935
984
|
*
|
|
936
985
|
* @param options - Optional group creation options
|
|
937
986
|
* @returns The new group
|
|
938
|
-
* @see https://docs.xmtp.org/
|
|
987
|
+
* @see https://docs.xmtp.org/sdk/conversations/#optimistically-create-a-group
|
|
939
988
|
*/
|
|
940
989
|
createGroupOptimistic(options?: CreateGroupOptions): Group<ContentTypes>;
|
|
941
990
|
/**
|
|
@@ -944,7 +993,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
944
993
|
* @param identifiers - Array of identifiers for group members
|
|
945
994
|
* @param options - Optional group creation options
|
|
946
995
|
* @returns The new group
|
|
947
|
-
* @see https://docs.xmtp.org/
|
|
996
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-group
|
|
948
997
|
*/
|
|
949
998
|
createGroupWithIdentifiers(identifiers: Identifier[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
|
|
950
999
|
/**
|
|
@@ -953,7 +1002,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
953
1002
|
* @param inboxIds - Array of inbox IDs for group members
|
|
954
1003
|
* @param options - Optional group creation options
|
|
955
1004
|
* @returns The new group
|
|
956
|
-
* @see https://docs.xmtp.org/
|
|
1005
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-group
|
|
957
1006
|
*/
|
|
958
1007
|
createGroup(inboxIds: string[], options?: CreateGroupOptions): Promise<Group<ContentTypes>>;
|
|
959
1008
|
/**
|
|
@@ -962,7 +1011,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
962
1011
|
* @param identifier - Identifier for the DM recipient
|
|
963
1012
|
* @param options - Optional DM creation options
|
|
964
1013
|
* @returns The new DM
|
|
965
|
-
* @see https://docs.xmtp.org/
|
|
1014
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
|
|
966
1015
|
*/
|
|
967
1016
|
createDmWithIdentifier(identifier: Identifier, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
|
|
968
1017
|
/**
|
|
@@ -971,7 +1020,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
971
1020
|
* @param inboxId - Inbox ID for the DM recipient
|
|
972
1021
|
* @param options - Optional DM creation options
|
|
973
1022
|
* @returns The new DM
|
|
974
|
-
* @see https://docs.xmtp.org/
|
|
1023
|
+
* @see https://docs.xmtp.org/sdk/conversations/#create-a-dm
|
|
975
1024
|
*/
|
|
976
1025
|
createDm(inboxId: string, options?: CreateDmOptions): Promise<Dm<ContentTypes>>;
|
|
977
1026
|
/**
|
|
@@ -979,7 +1028,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
979
1028
|
*
|
|
980
1029
|
* @param options - Optional filtering and pagination options
|
|
981
1030
|
* @returns Array of conversations
|
|
982
|
-
* @see https://docs.xmtp.org/
|
|
1031
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
983
1032
|
*/
|
|
984
1033
|
list(options?: ListConversationsOptions): Promise<(Group<ContentTypes> | Dm<ContentTypes>)[]>;
|
|
985
1034
|
/**
|
|
@@ -987,7 +1036,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
987
1036
|
*
|
|
988
1037
|
* @param options - Optional filtering and pagination options
|
|
989
1038
|
* @returns Array of groups
|
|
990
|
-
* @see https://docs.xmtp.org/
|
|
1039
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
991
1040
|
*/
|
|
992
1041
|
listGroups(options?: Omit<ListConversationsOptions, "conversationType">): Group<ContentTypes>[];
|
|
993
1042
|
/**
|
|
@@ -995,14 +1044,14 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
995
1044
|
*
|
|
996
1045
|
* @param options - Optional filtering and pagination options
|
|
997
1046
|
* @returns Array of DMs
|
|
998
|
-
* @see https://docs.xmtp.org/
|
|
1047
|
+
* @see https://docs.xmtp.org/sdk/conversations/
|
|
999
1048
|
*/
|
|
1000
1049
|
listDms(options?: Omit<ListConversationsOptions, "conversationType">): Dm<ContentTypes>[];
|
|
1001
1050
|
/**
|
|
1002
1051
|
* Synchronizes conversations for the current client from the network
|
|
1003
1052
|
*
|
|
1004
1053
|
* @returns Promise that resolves when sync is complete
|
|
1005
|
-
* @see https://docs.xmtp.org/
|
|
1054
|
+
* @see https://docs.xmtp.org/sdk/sync/
|
|
1006
1055
|
*/
|
|
1007
1056
|
sync(): Promise<void>;
|
|
1008
1057
|
/**
|
|
@@ -1011,7 +1060,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1011
1060
|
*
|
|
1012
1061
|
* @param consentStates - Optional array of consent states to filter by
|
|
1013
1062
|
* @returns Promise that resolves when sync is complete
|
|
1014
|
-
* @see https://docs.xmtp.org/
|
|
1063
|
+
* @see https://docs.xmtp.org/sdk/sync/
|
|
1015
1064
|
*/
|
|
1016
1065
|
syncAll(consentStates?: ConsentState[]): Promise<_xmtp_node_bindings.GroupSyncSummary>;
|
|
1017
1066
|
/**
|
|
@@ -1020,7 +1069,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1020
1069
|
* @param options - Optional stream options
|
|
1021
1070
|
* @param options.conversationType - Optional conversation type to filter by
|
|
1022
1071
|
* @returns Stream instance for new conversations
|
|
1023
|
-
* @see https://docs.xmtp.org/
|
|
1072
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1024
1073
|
*/
|
|
1025
1074
|
stream(options?: StreamOptions<Conversation$1, Group<ContentTypes> | Dm<ContentTypes> | undefined> & {
|
|
1026
1075
|
conversationType?: ConversationType;
|
|
@@ -1030,7 +1079,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1030
1079
|
*
|
|
1031
1080
|
* @param options - Optional stream options
|
|
1032
1081
|
* @returns Stream instance for new group conversations
|
|
1033
|
-
* @see https://docs.xmtp.org/
|
|
1082
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1034
1083
|
*/
|
|
1035
1084
|
streamGroups(options?: StreamOptions<Conversation$1, Group<ContentTypes>>): Promise<AsyncStreamProxy<Group<ContentTypes>>>;
|
|
1036
1085
|
/**
|
|
@@ -1038,44 +1087,59 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1038
1087
|
*
|
|
1039
1088
|
* @param options - Optional stream options
|
|
1040
1089
|
* @returns Stream instance for new DM conversations
|
|
1041
|
-
* @see https://docs.xmtp.org/
|
|
1090
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1042
1091
|
*/
|
|
1043
1092
|
streamDms(options?: StreamOptions<Conversation$1, Dm<ContentTypes>>): Promise<AsyncStreamProxy<Dm<ContentTypes>>>;
|
|
1044
1093
|
/**
|
|
1045
|
-
*
|
|
1094
|
+
* Reads retained messages after each group's default acknowledgement position.
|
|
1095
|
+
* Set `from` to replay after a cursor without changing default progress.
|
|
1096
|
+
* Set `onValue` for callback mode, or request items with the iterator.
|
|
1097
|
+
* Core owns network recovery. Legacy retry options and `disableSync` do not apply.
|
|
1046
1098
|
*
|
|
1047
1099
|
* @param options - Optional stream options
|
|
1048
1100
|
* @param options.conversationType - Optional conversation type to filter by
|
|
1049
1101
|
* @param options.consentStates - Optional array of consent states to filter by
|
|
1050
1102
|
* @returns Stream instance for new messages
|
|
1051
|
-
* @see https://docs.xmtp.org/
|
|
1103
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1052
1104
|
*/
|
|
1053
1105
|
streamAllMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
|
|
1054
1106
|
conversationType?: ConversationType;
|
|
1055
1107
|
consentStates?: ConsentState[];
|
|
1056
|
-
|
|
1108
|
+
groupIds?: string[];
|
|
1109
|
+
from?: DeliveryCursor;
|
|
1110
|
+
}): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
|
|
1111
|
+
messageHistorySnapshot(limit: number, options?: {
|
|
1112
|
+
groupIds?: string[];
|
|
1113
|
+
conversationType?: ConversationType;
|
|
1114
|
+
consentStates?: ConsentState[];
|
|
1115
|
+
}): _xmtp_node_bindings.MessageHistorySnapshot;
|
|
1116
|
+
beginningDeliveryCursor(): DeliveryCursor;
|
|
1057
1117
|
/**
|
|
1058
|
-
*
|
|
1118
|
+
* Reads retained group messages with default progress or an explicit replay cursor.
|
|
1059
1119
|
*
|
|
1060
1120
|
* @param options - Optional stream options
|
|
1061
1121
|
* @param options.consentStates - Optional array of consent states to filter by
|
|
1062
1122
|
* @returns Stream instance for new group messages
|
|
1063
|
-
* @see https://docs.xmtp.org/
|
|
1123
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1064
1124
|
*/
|
|
1065
1125
|
streamAllGroupMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
|
|
1066
1126
|
consentStates?: ConsentState[];
|
|
1067
|
-
|
|
1127
|
+
groupIds?: string[];
|
|
1128
|
+
from?: DeliveryCursor;
|
|
1129
|
+
}): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
|
|
1068
1130
|
/**
|
|
1069
|
-
*
|
|
1131
|
+
* Reads retained DM messages with default progress or an explicit replay cursor.
|
|
1070
1132
|
*
|
|
1071
1133
|
* @param options - Optional stream options
|
|
1072
1134
|
* @param options.consentStates - Optional array of consent states to filter by
|
|
1073
1135
|
* @returns Stream instance for new DM messages
|
|
1074
|
-
* @see https://docs.xmtp.org/
|
|
1136
|
+
* @see https://docs.xmtp.org/sdk/stream/#stream-methods
|
|
1075
1137
|
*/
|
|
1076
1138
|
streamAllDmMessages(options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {
|
|
1077
1139
|
consentStates?: ConsentState[];
|
|
1078
|
-
|
|
1140
|
+
groupIds?: string[];
|
|
1141
|
+
from?: DeliveryCursor;
|
|
1142
|
+
}): Promise<MessageStream<Message, DecodedMessage<ContentTypes>>>;
|
|
1079
1143
|
/**
|
|
1080
1144
|
* Creates a stream for message deletions that streams the message IDs of
|
|
1081
1145
|
* deleted messages
|
|
@@ -1102,7 +1166,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1102
1166
|
* Gets the HMAC keys for all conversations
|
|
1103
1167
|
*
|
|
1104
1168
|
* @returns The HMAC keys for all conversations
|
|
1105
|
-
* @see https://docs.xmtp.org/
|
|
1169
|
+
* @see https://docs.xmtp.org/sdk/push-notifications/
|
|
1106
1170
|
*/
|
|
1107
1171
|
hmacKeys(): Record<string, _xmtp_node_bindings.HmacKey[]>;
|
|
1108
1172
|
}
|
|
@@ -1224,7 +1288,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1224
1288
|
* @param options - Optional configuration for the client
|
|
1225
1289
|
* @returns A new client instance
|
|
1226
1290
|
*/
|
|
1227
|
-
static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options
|
|
1291
|
+
static create<ContentCodecs extends ContentCodec[] = []>(signer: Signer, options: DistributiveOmit<ClientOptions, "codecs"> & {
|
|
1228
1292
|
codecs?: ContentCodecs;
|
|
1229
1293
|
}): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
|
|
1230
1294
|
/**
|
|
@@ -1237,7 +1301,7 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1237
1301
|
* @param options - Optional configuration for the client
|
|
1238
1302
|
* @returns A new client instance
|
|
1239
1303
|
*/
|
|
1240
|
-
static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options
|
|
1304
|
+
static build<ContentCodecs extends ContentCodec[] = []>(identifier: Identifier, options: DistributiveOmit<ClientOptions, "codecs"> & {
|
|
1241
1305
|
codecs?: ContentCodecs;
|
|
1242
1306
|
}): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>;
|
|
1243
1307
|
/**
|
|
@@ -1249,11 +1313,11 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1249
1313
|
*/
|
|
1250
1314
|
get appVersion(): string | undefined;
|
|
1251
1315
|
/**
|
|
1252
|
-
* Gets the
|
|
1316
|
+
* Gets the label used for the default database file name
|
|
1253
1317
|
*
|
|
1254
1318
|
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1255
1319
|
*/
|
|
1256
|
-
get env():
|
|
1320
|
+
get env(): string;
|
|
1257
1321
|
/**
|
|
1258
1322
|
* Gets the client options
|
|
1259
1323
|
*/
|
|
@@ -1494,27 +1558,8 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1494
1558
|
* @throws {SignerUnavailableError} if no signer is available
|
|
1495
1559
|
*/
|
|
1496
1560
|
revokeInstallations(installationIds: Uint8Array[]): Promise<void>;
|
|
1497
|
-
/**
|
|
1498
|
-
|
|
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>;
|
|
1561
|
+
/** Revoke installations with an explicit backend or network options. */
|
|
1562
|
+
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], optionsOrBackend: NetworkOptions | Backend): Promise<void>;
|
|
1518
1563
|
/**
|
|
1519
1564
|
* Changes the recovery identifier for the client's inbox
|
|
1520
1565
|
*
|
|
@@ -1583,66 +1628,12 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1583
1628
|
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1584
1629
|
*/
|
|
1585
1630
|
verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
|
|
1586
|
-
/**
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
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>>;
|
|
1631
|
+
/** Fetch inbox states with an explicit backend or network options. */
|
|
1632
|
+
static fetchInboxStates(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend): Promise<_xmtp_node_bindings.InboxState[]>;
|
|
1633
|
+
/** Fetch inbox update counts with an explicit backend or network options. */
|
|
1634
|
+
static fetchLatestInboxUpdatesCount(inboxIds: string[], optionsOrBackend: NetworkOptions | Backend): Promise<Map<string, number>>;
|
|
1635
|
+
/** Check identifiers with an explicit backend or network options. */
|
|
1636
|
+
static canMessage(identifiers: Identifier[], optionsOrBackend: NetworkOptions | Backend): Promise<Map<string, boolean>>;
|
|
1646
1637
|
/**
|
|
1647
1638
|
* Verifies a signature was made with a public key
|
|
1648
1639
|
*
|
|
@@ -1652,82 +1643,10 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1652
1643
|
* @returns Whether the signature is valid
|
|
1653
1644
|
*/
|
|
1654
1645
|
static verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
|
|
1655
|
-
/**
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
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[];
|
|
1646
|
+
/** Check address authorization with an explicit backend or network options. */
|
|
1647
|
+
static isAddressAuthorized(inboxId: string, address: string, optionsOrBackend: NetworkOptions | Backend): Promise<boolean>;
|
|
1648
|
+
/** Check installation authorization with an explicit backend or network options. */
|
|
1649
|
+
static isInstallationAuthorized(inboxId: string, installation: Uint8Array, optionsOrBackend: NetworkOptions | Backend): Promise<boolean>;
|
|
1731
1650
|
/**
|
|
1732
1651
|
* Archive application elements to file for later restoration
|
|
1733
1652
|
*
|
|
@@ -1761,7 +1680,176 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
1761
1680
|
* @returns Promise that resolves with a summary of the sync operation
|
|
1762
1681
|
*/
|
|
1763
1682
|
syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
|
|
1683
|
+
/** Enable notifications and register the delivery channel. */
|
|
1684
|
+
enableNotifications(config: NotificationConfig): Promise<NotificationState>;
|
|
1685
|
+
/** Disable notifications. Per-conversation overrides remain stored. */
|
|
1686
|
+
disableNotifications(): Promise<void>;
|
|
1687
|
+
/** Read the local state without a backend request. */
|
|
1688
|
+
notificationState(): Promise<NotificationState>;
|
|
1689
|
+
/**
|
|
1690
|
+
* What the deployment published about itself, as this client resolved it
|
|
1691
|
+
* when it was built (spec 006 CFG-030, CFG-080).
|
|
1692
|
+
*
|
|
1693
|
+
* Reads memory and makes no backend request. The value never changes for the
|
|
1694
|
+
* life of the client: a background refresh rewrites the stored copy, and a
|
|
1695
|
+
* new value takes effect at the next build.
|
|
1696
|
+
*
|
|
1697
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1698
|
+
*/
|
|
1699
|
+
serverConfiguration(): ServerConfiguration;
|
|
1700
|
+
/**
|
|
1701
|
+
* Fetch the deployment configuration now, rewrite the stored copy, and
|
|
1702
|
+
* return what was fetched (spec 006 CFG-082).
|
|
1703
|
+
*
|
|
1704
|
+
* The snapshot this client holds is unchanged; use it to observe a change an
|
|
1705
|
+
* operator has made without restarting.
|
|
1706
|
+
*
|
|
1707
|
+
* @throws {ClientNotInitializedError} if the client is not initialized
|
|
1708
|
+
* @throws {ConfigurationUnavailableError} if the deployment did not answer
|
|
1709
|
+
* @throws {ConfigurationInvalidError} if it published an unusable configuration
|
|
1710
|
+
* @throws {BackendMismatchError} if it published a different identifier
|
|
1711
|
+
* @throws {ClientVersionTooOldError} if it now requires a newer libxmtp
|
|
1712
|
+
*/
|
|
1713
|
+
refreshServerConfiguration(): Promise<ServerConfiguration>;
|
|
1714
|
+
/**
|
|
1715
|
+
* Read what a deployment publishes about itself with no database, no client,
|
|
1716
|
+
* and no credential (spec 006 CFG-081, CFG-045).
|
|
1717
|
+
*
|
|
1718
|
+
* Lets an app learn `auth.enabled`, `auth.requiredScopes`, and the accepted
|
|
1719
|
+
* smart contract wallet chains before it decides how to build a client.
|
|
1720
|
+
* Nothing is stored and no identifier binding is applied.
|
|
1721
|
+
*
|
|
1722
|
+
* @param target - A backend URL, network options, or an existing backend
|
|
1723
|
+
* @throws {ConfigurationUnavailableError} if the deployment did not answer
|
|
1724
|
+
* @throws {ConfigurationInvalidError} if it published an unusable configuration
|
|
1725
|
+
*/
|
|
1726
|
+
static fetchServerConfiguration(target: string | NetworkOptions | Backend): Promise<ServerConfiguration>;
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
type StreamFailureCause = {
|
|
1730
|
+
kind: "target_pending" | "receipt_pending" | "processing_pending" | "blocked" | "storage" | "receiver" | "invalid_topic";
|
|
1731
|
+
code: string | null;
|
|
1732
|
+
message: string;
|
|
1733
|
+
retryable: boolean;
|
|
1734
|
+
};
|
|
1735
|
+
type UnfinishedStreamTopic = {
|
|
1736
|
+
topic: Uint8Array;
|
|
1737
|
+
/** Null means that target capture did not complete. */
|
|
1738
|
+
target: bigint | null;
|
|
1739
|
+
received: bigint;
|
|
1740
|
+
processed: bigint;
|
|
1741
|
+
unresolvedWelcomes: bigint[];
|
|
1742
|
+
inactive: boolean;
|
|
1743
|
+
cause: StreamFailureCause | null;
|
|
1744
|
+
};
|
|
1745
|
+
type StreamBarrierFailure = {
|
|
1746
|
+
reason: "blocked" | "deadline" | "cancelled";
|
|
1747
|
+
unfinished: UnfinishedStreamTopic[];
|
|
1748
|
+
};
|
|
1749
|
+
type StreamFailureDetails = {
|
|
1750
|
+
kind: "barrier" | "published_but_unconfirmed" | "catch_up";
|
|
1751
|
+
code: string;
|
|
1752
|
+
message: string;
|
|
1753
|
+
retryable: boolean;
|
|
1754
|
+
intentId: number | null;
|
|
1755
|
+
publishedIntentIds: number[];
|
|
1756
|
+
summary: {
|
|
1757
|
+
messages: bigint;
|
|
1758
|
+
conversations: bigint;
|
|
1759
|
+
failed: bigint;
|
|
1760
|
+
completed: boolean;
|
|
1761
|
+
} | null;
|
|
1762
|
+
barriers: StreamBarrierFailure[];
|
|
1763
|
+
};
|
|
1764
|
+
/**
|
|
1765
|
+
* Reads structured progress from a stream, sync, or publication error.
|
|
1766
|
+
* All sequence values are exact bigints. Invalid or absent details return undefined.
|
|
1767
|
+
* A published-but-unconfirmed error does not mean that publication failed.
|
|
1768
|
+
*/
|
|
1769
|
+
declare const getStreamFailureDetails: (error: unknown) => StreamFailureDetails | undefined;
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* Typed failures for the deployment configuration a backend publishes
|
|
1773
|
+
* (spec 006 §7, CFG-083).
|
|
1774
|
+
*
|
|
1775
|
+
* The bindings report every one of these as an `Error` whose message begins
|
|
1776
|
+
* with `[ClientError::<Variant>]`. Matching on that string is what this module
|
|
1777
|
+
* removes: each of the six documented codes becomes its own class, so an app
|
|
1778
|
+
* writes `error instanceof BackendMismatchError` instead of a regular
|
|
1779
|
+
* expression over a message that may be reworded.
|
|
1780
|
+
*
|
|
1781
|
+
* Every class keeps the binding's message and the original error as `cause`,
|
|
1782
|
+
* so the identifiers, versions, scopes, or chain the core reported are still
|
|
1783
|
+
* readable for diagnostics.
|
|
1784
|
+
*/
|
|
1785
|
+
/**
|
|
1786
|
+
* Base class of the six configuration failures. Catch this to handle any of
|
|
1787
|
+
* them; catch a subclass to handle one.
|
|
1788
|
+
*/
|
|
1789
|
+
declare class ServerConfigurationError extends Error {
|
|
1790
|
+
/** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
|
|
1791
|
+
readonly code: string;
|
|
1792
|
+
constructor(
|
|
1793
|
+
/** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */
|
|
1794
|
+
code: string, message: string, options?: ErrorOptions);
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* The configuration could not be read: the deployment did not answer, answered
|
|
1798
|
+
* `UNIMPLEMENTED` because it predates spec 006, or the copy could not be
|
|
1799
|
+
* stored.
|
|
1800
|
+
*/
|
|
1801
|
+
declare class ConfigurationUnavailableError extends ServerConfigurationError {
|
|
1802
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* The deployment answered with a configuration no client can use: an empty or
|
|
1806
|
+
* malformed identifier, an unparseable minimum version, or a chain that is not
|
|
1807
|
+
* a CAIP-2 identifier. Nothing is stored.
|
|
1808
|
+
*/
|
|
1809
|
+
declare class ConfigurationInvalidError extends ServerConfigurationError {
|
|
1810
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* This database is bound to a different deployment. The identifier the backend
|
|
1814
|
+
* published is not the one the database was created against. Recovery is a
|
|
1815
|
+
* database created for the deployment the app now uses.
|
|
1816
|
+
*/
|
|
1817
|
+
declare class BackendMismatchError extends ServerConfigurationError {
|
|
1818
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1819
|
+
}
|
|
1820
|
+
/** The deployment requires a newer libxmtp than this SDK is built on. */
|
|
1821
|
+
declare class ClientVersionTooOldError extends ServerConfigurationError {
|
|
1822
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1764
1823
|
}
|
|
1824
|
+
/**
|
|
1825
|
+
* The deployment requires authentication and no credential source was
|
|
1826
|
+
* configured. The message carries the scopes it requires.
|
|
1827
|
+
*/
|
|
1828
|
+
declare class AuthRequiredError extends ServerConfigurationError {
|
|
1829
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* A smart contract wallet signature names a chain the deployment does not
|
|
1833
|
+
* verify on. Raised before any network call, and only for signatures the app
|
|
1834
|
+
* supplied.
|
|
1835
|
+
*/
|
|
1836
|
+
declare class ChainNotAcceptedError extends ServerConfigurationError {
|
|
1837
|
+
constructor(message: string, options?: ErrorOptions);
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Classifies an error from any SDK call as one of the six configuration
|
|
1841
|
+
* failures, or `undefined` when it is something else.
|
|
1842
|
+
*
|
|
1843
|
+
* Use this where the SDK hands back the raw error, for instance a
|
|
1844
|
+
* `ChainNotAcceptedError` raised deep inside a call that supplies a smart
|
|
1845
|
+
* contract wallet signature.
|
|
1846
|
+
*/
|
|
1847
|
+
declare const toServerConfigurationError: (error: unknown) => ServerConfigurationError | undefined;
|
|
1848
|
+
/**
|
|
1849
|
+
* Rethrows an error as its typed configuration failure, or unchanged when it
|
|
1850
|
+
* is not one.
|
|
1851
|
+
*/
|
|
1852
|
+
declare const throwServerConfigurationError: (error: unknown) => never;
|
|
1765
1853
|
|
|
1766
|
-
export { AccountAlreadyAssociatedError,
|
|
1767
|
-
export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, DeviceSyncOptions, DistributiveOmit, EOASigner, EnrichedReply, ExtractCodecContentTypes, HexString, NetworkOptions, OtherOptions, SCWSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator,
|
|
1854
|
+
export { AccountAlreadyAssociatedError, AuthRequiredError, BackendMismatchError, ChainNotAcceptedError, Client, ClientNotInitializedError, ClientVersionTooOldError, CodecRegistry, ConfigurationInvalidError, ConfigurationUnavailableError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DebugInformation, DecodedMessage, Dm, Group, InboxReassignError, MessageStream, MissingContentTypeError, NotificationError, Preferences, ServerConfigurationError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, createBackend, createStream, generateInboxId, getInboxIdForIdentifier, getStreamFailureDetails, isActions, isAttachment, isGroupUpdated, isHexString, isIntent, isLeaveRequest, isMarkdown, isMultiRemoteAttachment, isReaction, isReadReceipt, isRemoteAttachment, isReply, isText, isTextReply, isTransactionReference, isWalletSendCalls, throwServerConfigurationError, toServerConfigurationError, validHex };
|
|
1855
|
+
export type { AsyncStreamProxy, AuthCallback, BuiltInContentTypes, ClientOptions, ContentOptions, Credential, DeviceSyncOptions, DistributiveOmit, EOASigner, EnrichedReply, ExtractCodecContentTypes, GetBlockNumber, GetChainId, GetIdentifier, HexString, MessageAcknowledgement, MessageDelivery, MessageReaderSource, NetworkOptions, NotificationChannel, NotificationConfig, NotificationOverride, NotificationState, OtherOptions, ResolveValue, SCWSigner, SignMessage, Signer, StorageOptions, StreamBarrierFailure, StreamCallback, StreamFailureCause, StreamFailureDetails, StreamFunction, StreamOptions, StreamValueMutator, UnfinishedStreamTopic };
|