@xmtp/browser-sdk 6.4.1 → 7.0.0-dev.57a7203

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 CHANGED
@@ -57,6 +57,23 @@ pnpm install @xmtp/browser-sdk
57
57
  yarn add @xmtp/browser-sdk
58
58
  ```
59
59
 
60
+ ## Signer utilities
61
+
62
+ The SDK exports `createEOASigner` and `createSCWSigner` helper functions for creating XMTP-compatible signers. These require `viem` as a peer dependency, which is optional and only needs to be installed if you use these utilities.
63
+
64
+ ```bash
65
+ npm install viem
66
+ ```
67
+
68
+ **Example**
69
+
70
+ ```ts
71
+ import { createEOASigner } from "@xmtp/browser-sdk";
72
+
73
+ // Create an EOA signer (generates a random key if none provided)
74
+ const eoaSigner = createEOASigner();
75
+ ```
76
+
60
77
  ## Developing
61
78
 
62
79
  Run `yarn dev` to build the SDK and watch for changes, which will trigger a rebuild.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _xmtp_wasm_bindings from '@xmtp/wasm-bindings';
2
- 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, Identifier, Conversations as Conversations$1, ConsentState, ListConversationsOptions, CreateGroupOptions, CreateDmOptions, Conversation as Conversation$1, ConversationType, Message, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, KeyPackageStatus, ArchiveOptions, GroupMember, PermissionUpdateType, PermissionPolicy, MetadataField, EncodedContent, SendMessageOpts, Reply, ListMessagesOptions, MessageDisappearingSettings, HmacKey, ConversationDebugInfo, GroupPermissionsOptions, PermissionPolicySet, GroupMetadata, ApiStats, IdentityStats, InboxState, GroupSyncSummary } from '@xmtp/wasm-bindings';
3
- export { Action, ActionStyle, Actions, ApiStats, ArchiveOptions, Attachment, 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, SignatureRequestHandle, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, WalletCall, WalletSendCalls } from '@xmtp/wasm-bindings';
2
+ 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, WasmVisibilityConfirmationOptions, Identifier, Conversations as Conversations$1, ConsentState, ListConversationsOptions, CreateGroupOptions, CreateDmOptions, Conversation as Conversation$1, ConversationType, Message, Client as Client$1, Consent, ConsentEntityType, UserPreferenceUpdate, SignatureRequestHandle, KeyPackageStatus, ArchiveOptions, AvailableArchiveInfo, ArchiveMetadata, GroupSyncSummary, GroupMember, PermissionUpdateType, PermissionPolicy, MetadataField, EncodedContent, SendMessageOpts, SendOpts, Reply, ListMessagesOptions, MessageDisappearingSettings, HmacKey, ConversationDebugInfo, GroupPermissionsOptions, PermissionPolicySet, GroupMetadata, ApiStats, IdentityStats, InboxState } from '@xmtp/wasm-bindings';
3
+ export { Action, ActionStyle, Actions, ApiStats, ArchiveMetadata, ArchiveOptions, Attachment, AvailableArchiveInfo, Backend, BackendBuilder, BackupElementSelectionOption, Consent, ConsentEntityType, ConsentState, ContentType, ConversationDebugInfo, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, Cursor, DeliveryStatus, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupUpdated, HmacKey, Identifier, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, KeyPackageStatus, LeaveRequest, Lifetime, ListConversationsOptions, ListConversationsOrderBy, ListMessagesOptions, LogLevel, LogOptions, Message, MessageDisappearingSettings, MessageSortBy, MetadataField, MetadataFieldChange, MultiRemoteAttachment, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, Reaction, ReactionAction, ReactionSchema, ReadReceipt, RemoteAttachment, Reply, SendMessageOpts, SendOpts, SignatureRequestHandle, SortDirection, TransactionMetadata, TransactionReference, UserPreferenceUpdate, WalletCall, WalletSendCalls, WorkerConfigOptions, WorkerIntervalOverride, WorkerKind } from '@xmtp/wasm-bindings';
4
4
  import { ContentCodec, ContentTypeId } from '@xmtp/content-type-primitives';
5
5
 
6
6
  type ResolveValue<T> = {
@@ -131,6 +131,7 @@ declare class DecodedMessage<ContentTypes = unknown> {
131
131
  constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
132
132
  }
133
133
 
134
+ type VisibilityConfirmationOptions = WasmVisibilityConfirmationOptions;
134
135
  type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
135
136
  /**
136
137
  * Network options
@@ -214,10 +215,25 @@ type OtherOptions = {
214
215
  * Logging level
215
216
  */
216
217
  loggingLevel?: LogLevel;
218
+ /**
219
+ * Tuning for the background worker scheduler (intervals, jitter, per-worker
220
+ * overrides, and disabled workers). All fields are optional; omitting this
221
+ * object preserves the default worker behavior.
222
+ *
223
+ * Intervals are specified in nanoseconds.
224
+ */
225
+ workerConfig?: WorkerConfigOptions;
217
226
  /**
218
227
  * Disable automatic registration when creating a client
219
228
  */
220
229
  disableAutoRegister?: boolean;
230
+ /**
231
+ * Options for waiting until client registration is visible on the network.
232
+ *
233
+ * When set, `registerIdentity` will wait for the specified quorum of nodes
234
+ * to confirm the registration before resolving.
235
+ */
236
+ waitForRegistrationVisible?: VisibilityConfirmationOptions;
221
237
  };
222
238
  type ClientOptions = (NetworkOptions | {
223
239
  backend: Backend;
@@ -263,6 +279,8 @@ type SafeSigner = {
263
279
  chainId: bigint;
264
280
  blockNumber?: bigint;
265
281
  };
282
+ declare const createEOASigner: (key?: `0x${string}`) => Signer;
283
+ declare const createSCWSigner: (address: `0x${string}`, signMessage: (message: string) => Promise<string> | string, chainId: bigint) => Signer;
266
284
  declare const toSafeSigner: (signer: Signer, signature: Uint8Array) => Promise<SafeSigner>;
267
285
 
268
286
  declare class WorkerConversations {
@@ -331,6 +349,8 @@ declare class WorkerClient {
331
349
  get debugInformation(): WorkerDebugInformation;
332
350
  get preferences(): WorkerPreferences;
333
351
  canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
352
+ fetchLatestInboxUpdatesCount(inboxIds: string[]): Promise<Record<string, number>>;
353
+ fetchOwnInboxUpdatesCount(): Promise<number>;
334
354
  addSignature(signatureRequest: SignatureRequestHandle, signer: SafeSigner): Promise<void>;
335
355
  applySignatureRequest(signatureRequest: SignatureRequestHandle): Promise<void>;
336
356
  processSignatureRequest(signer: SafeSigner, signatureRequest: SignatureRequestHandle): Promise<void>;
@@ -340,13 +360,20 @@ declare class WorkerClient {
340
360
  revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle | undefined>;
341
361
  revokeInstallationsSignatureRequest(installationIds: Uint8Array[]): Promise<SignatureRequestHandle>;
342
362
  changeRecoveryIdentifierSignatureRequest(identifier: Identifier): Promise<SignatureRequestHandle>;
343
- registerIdentity(signer: SafeSigner, signatureRequest: SignatureRequestHandle): Promise<void>;
363
+ registerIdentity(signer: SafeSigner, signatureRequest: SignatureRequestHandle, visibilityConfirmationOptions?: VisibilityConfirmationOptions): Promise<void>;
344
364
  getInboxIdByIdentifier(identifier: Identifier): Promise<string | undefined>;
345
365
  signWithInstallationKey(signatureText: string): Uint8Array<ArrayBufferLike>;
346
366
  verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
347
367
  verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
348
368
  fetchKeyPackageStatuses(installationIds: string[]): Promise<Map<string, KeyPackageStatus>>;
349
369
  sendSyncRequest(options: ArchiveOptions, serverUrl: string): Promise<void>;
370
+ sendSyncArchive(options: ArchiveOptions, serverUrl: string, pin: string): Promise<void>;
371
+ processSyncArchive(archivePin?: string | null): Promise<void>;
372
+ listAvailableArchives(daysCutoff: number): AvailableArchiveInfo[];
373
+ createArchive(opts: ArchiveOptions, key: Uint8Array): Promise<Uint8Array>;
374
+ importArchive(data: Uint8Array, key: Uint8Array): Promise<void>;
375
+ archiveMetadata(data: Uint8Array, key: Uint8Array): Promise<ArchiveMetadata>;
376
+ syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
350
377
  }
351
378
 
352
379
  declare class WorkerConversation {
@@ -386,19 +413,20 @@ declare class WorkerConversation {
386
413
  addSuperAdmin(inboxId: string): Promise<void>;
387
414
  removeSuperAdmin(inboxId: string): Promise<void>;
388
415
  publishMessages(): Promise<void>;
416
+ processStreamedMessage(envelopeBytes: Uint8Array): Promise<Message[]>;
389
417
  send(encodedContent: EncodedContent, opts?: SendMessageOpts): Promise<string>;
390
- sendText(text: string, isOptimistic?: boolean): Promise<string>;
391
- sendMarkdown(markdown: string, isOptimistic?: boolean): Promise<string>;
392
- sendReaction(reaction: Reaction, isOptimistic?: boolean): Promise<string>;
393
- sendReadReceipt(isOptimistic?: boolean): Promise<string>;
394
- sendReply(reply: Reply, isOptimistic?: boolean): Promise<string>;
395
- sendTransactionReference(transactionReference: TransactionReference, isOptimistic?: boolean): Promise<string>;
396
- sendWalletSendCalls(walletSendCalls: WalletSendCalls, isOptimistic?: boolean): Promise<string>;
397
- sendActions(actions: Actions, isOptimistic?: boolean): Promise<string>;
398
- sendIntent(intent: Intent, isOptimistic?: boolean): Promise<string>;
399
- sendAttachment(attachment: Attachment, isOptimistic?: boolean): Promise<string>;
400
- sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, isOptimistic?: boolean): Promise<string>;
401
- sendRemoteAttachment(remoteAttachment: RemoteAttachment, isOptimistic?: boolean): Promise<string>;
418
+ sendText(text: string, opts?: SendOpts): Promise<string>;
419
+ sendMarkdown(markdown: string, opts?: SendOpts): Promise<string>;
420
+ sendReaction(reaction: Reaction, opts?: SendOpts): Promise<string>;
421
+ sendReadReceipt(opts?: SendOpts): Promise<string>;
422
+ sendReply(reply: Reply, opts?: SendOpts): Promise<string>;
423
+ sendTransactionReference(transactionReference: TransactionReference, opts?: SendOpts): Promise<string>;
424
+ sendWalletSendCalls(walletSendCalls: WalletSendCalls, opts?: SendOpts): Promise<string>;
425
+ sendActions(actions: Actions, opts?: SendOpts): Promise<string>;
426
+ sendIntent(intent: Intent, opts?: SendOpts): Promise<string>;
427
+ sendAttachment(attachment: Attachment, opts?: SendOpts): Promise<string>;
428
+ sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, opts?: SendOpts): Promise<string>;
429
+ sendRemoteAttachment(remoteAttachment: RemoteAttachment, opts?: SendOpts): Promise<string>;
402
430
  messages(options?: ListMessagesOptions): Promise<DecodedMessage$1[]>;
403
431
  countMessages(options?: ListMessagesOptions): Promise<bigint>;
404
432
  consentState(): ConsentState;
@@ -532,6 +560,7 @@ type ClientAction = {
532
560
  data: {
533
561
  signer: SafeSigner;
534
562
  signatureRequestId: string;
563
+ waitForRegistrationVisible?: VisibilityConfirmationOptions;
535
564
  };
536
565
  } | {
537
566
  action: "client.addAccount";
@@ -589,6 +618,18 @@ type ClientAction = {
589
618
  data: {
590
619
  identifiers: Identifier[];
591
620
  };
621
+ } | {
622
+ action: "client.fetchLatestInboxUpdatesCount";
623
+ id: string;
624
+ result: Record<string, number>;
625
+ data: {
626
+ inboxIds: string[];
627
+ };
628
+ } | {
629
+ action: "client.fetchOwnInboxUpdatesCount";
630
+ id: string;
631
+ result: number;
632
+ data: Record<string, never>;
592
633
  } | {
593
634
  action: "client.getInboxIdByIdentifier";
594
635
  id: string;
@@ -635,6 +676,58 @@ type ClientAction = {
635
676
  options: ArchiveOptions;
636
677
  serverUrl: string;
637
678
  };
679
+ } | {
680
+ action: "client.sendSyncArchive";
681
+ id: string;
682
+ result: undefined;
683
+ data: {
684
+ options: ArchiveOptions;
685
+ serverUrl: string;
686
+ pin: string;
687
+ };
688
+ } | {
689
+ action: "client.processSyncArchive";
690
+ id: string;
691
+ result: undefined;
692
+ data: {
693
+ archivePin?: string | null;
694
+ };
695
+ } | {
696
+ action: "client.listAvailableArchives";
697
+ id: string;
698
+ result: AvailableArchiveInfo[];
699
+ data: {
700
+ daysCutoff: number;
701
+ };
702
+ } | {
703
+ action: "client.createArchive";
704
+ id: string;
705
+ result: Uint8Array;
706
+ data: {
707
+ opts: ArchiveOptions;
708
+ key: Uint8Array;
709
+ };
710
+ } | {
711
+ action: "client.importArchive";
712
+ id: string;
713
+ result: undefined;
714
+ data: {
715
+ data: Uint8Array;
716
+ key: Uint8Array;
717
+ };
718
+ } | {
719
+ action: "client.archiveMetadata";
720
+ id: string;
721
+ result: ArchiveMetadata;
722
+ data: {
723
+ data: Uint8Array;
724
+ key: Uint8Array;
725
+ };
726
+ } | {
727
+ action: "client.syncAllDeviceSyncGroups";
728
+ id: string;
729
+ result: GroupSyncSummary;
730
+ data: undefined;
638
731
  };
639
732
 
640
733
  type ConversationAction = {
@@ -660,6 +753,14 @@ type ConversationAction = {
660
753
  data: {
661
754
  id: string;
662
755
  };
756
+ } | {
757
+ action: "conversation.processStreamedMessage";
758
+ id: string;
759
+ result: Message[];
760
+ data: {
761
+ id: string;
762
+ envelopeBytes: Uint8Array;
763
+ };
663
764
  } | {
664
765
  action: "conversation.messages";
665
766
  id: string;
@@ -783,7 +884,7 @@ type ConversationAction = {
783
884
  data: {
784
885
  id: string;
785
886
  text: string;
786
- isOptimistic?: boolean;
887
+ opts?: SendOpts;
787
888
  };
788
889
  } | {
789
890
  action: "conversation.sendMarkdown";
@@ -792,7 +893,7 @@ type ConversationAction = {
792
893
  data: {
793
894
  id: string;
794
895
  markdown: string;
795
- isOptimistic?: boolean;
896
+ opts?: SendOpts;
796
897
  };
797
898
  } | {
798
899
  action: "conversation.sendReaction";
@@ -801,7 +902,7 @@ type ConversationAction = {
801
902
  data: {
802
903
  id: string;
803
904
  reaction: Reaction;
804
- isOptimistic?: boolean;
905
+ opts?: SendOpts;
805
906
  };
806
907
  } | {
807
908
  action: "conversation.sendReadReceipt";
@@ -809,7 +910,7 @@ type ConversationAction = {
809
910
  result: string;
810
911
  data: {
811
912
  id: string;
812
- isOptimistic?: boolean;
913
+ opts?: SendOpts;
813
914
  };
814
915
  } | {
815
916
  action: "conversation.sendReply";
@@ -818,7 +919,7 @@ type ConversationAction = {
818
919
  data: {
819
920
  id: string;
820
921
  reply: Reply;
821
- isOptimistic?: boolean;
922
+ opts?: SendOpts;
822
923
  };
823
924
  } | {
824
925
  action: "conversation.sendTransactionReference";
@@ -827,7 +928,7 @@ type ConversationAction = {
827
928
  data: {
828
929
  id: string;
829
930
  transactionReference: TransactionReference;
830
- isOptimistic?: boolean;
931
+ opts?: SendOpts;
831
932
  };
832
933
  } | {
833
934
  action: "conversation.sendWalletSendCalls";
@@ -836,7 +937,7 @@ type ConversationAction = {
836
937
  data: {
837
938
  id: string;
838
939
  walletSendCalls: WalletSendCalls;
839
- isOptimistic?: boolean;
940
+ opts?: SendOpts;
840
941
  };
841
942
  } | {
842
943
  action: "conversation.sendActions";
@@ -845,7 +946,7 @@ type ConversationAction = {
845
946
  data: {
846
947
  id: string;
847
948
  actions: Actions;
848
- isOptimistic?: boolean;
949
+ opts?: SendOpts;
849
950
  };
850
951
  } | {
851
952
  action: "conversation.sendIntent";
@@ -854,7 +955,7 @@ type ConversationAction = {
854
955
  data: {
855
956
  id: string;
856
957
  intent: Intent;
857
- isOptimistic?: boolean;
958
+ opts?: SendOpts;
858
959
  };
859
960
  } | {
860
961
  action: "conversation.sendAttachment";
@@ -863,7 +964,7 @@ type ConversationAction = {
863
964
  data: {
864
965
  id: string;
865
966
  attachment: Attachment;
866
- isOptimistic?: boolean;
967
+ opts?: SendOpts;
867
968
  };
868
969
  } | {
869
970
  action: "conversation.sendMultiRemoteAttachment";
@@ -872,7 +973,7 @@ type ConversationAction = {
872
973
  data: {
873
974
  id: string;
874
975
  multiRemoteAttachment: MultiRemoteAttachment;
875
- isOptimistic?: boolean;
976
+ opts?: SendOpts;
876
977
  };
877
978
  } | {
878
979
  action: "conversation.sendRemoteAttachment";
@@ -881,7 +982,7 @@ type ConversationAction = {
881
982
  data: {
882
983
  id: string;
883
984
  remoteAttachment: RemoteAttachment;
884
- isOptimistic?: boolean;
985
+ opts?: SendOpts;
885
986
  };
886
987
  };
887
988
 
@@ -1397,6 +1498,13 @@ declare class Conversation<ContentTypes = unknown> {
1397
1498
  * @returns Promise that resolves when publishing is complete
1398
1499
  */
1399
1500
  publishMessages(): Promise<void>;
1501
+ /**
1502
+ * Decodes, decrypts, and persists a raw envelope from a group message stream.
1503
+ *
1504
+ * @param envelopeBytes - Raw protobuf-encoded envelope bytes from the stream
1505
+ * @returns The processed and stored messages
1506
+ */
1507
+ processStreamedMessage(envelopeBytes: Uint8Array): Promise<_xmtp_wasm_bindings.Message[]>;
1400
1508
  /**
1401
1509
  * Sends a message
1402
1510
  *
@@ -1404,8 +1512,10 @@ declare class Conversation<ContentTypes = unknown> {
1404
1512
  * @param options - Optional send options
1405
1513
  * @param options.shouldPush - Indicates whether this message should be
1406
1514
  * included in push notifications
1407
- * @param options.isOptimistic - Indicates whether this message should be
1515
+ * @param options.optimistic - Indicates whether this message should be
1408
1516
  * sent optimistically and published later via `publishMessages`
1517
+ * @param options.idempotencyKey - Optional idempotency key; re-sending
1518
+ * identical content with the same key produces the same deduplicated message id
1409
1519
  * @returns Promise that resolves with the message ID after it has been sent
1410
1520
  */
1411
1521
  send(content: EncodedContent, options?: SendMessageOpts): Promise<string>;
@@ -1413,97 +1523,97 @@ declare class Conversation<ContentTypes = unknown> {
1413
1523
  * Sends a text message
1414
1524
  *
1415
1525
  * @param text - The text to send
1416
- * @param isOptimistic - Whether to send the message optimistically
1526
+ * @param opts - Send options (optimistic delivery, idempotency key)
1417
1527
  * @returns Promise that resolves with the message ID after it has been sent
1418
1528
  */
1419
- sendText(text: string, isOptimistic?: boolean): Promise<string>;
1529
+ sendText(text: string, opts?: SendOpts): Promise<string>;
1420
1530
  /**
1421
1531
  * Sends a markdown message
1422
1532
  *
1423
1533
  * @param markdown - The markdown to send
1424
- * @param isOptimistic - Whether to send the message optimistically
1534
+ * @param opts - Send options (optimistic delivery, idempotency key)
1425
1535
  * @returns Promise that resolves with the message ID after it has been sent
1426
1536
  */
1427
- sendMarkdown(markdown: string, isOptimistic?: boolean): Promise<string>;
1537
+ sendMarkdown(markdown: string, opts?: SendOpts): Promise<string>;
1428
1538
  /**
1429
1539
  * Sends a reaction message
1430
1540
  *
1431
1541
  * @param reaction - The reaction to send
1432
- * @param isOptimistic - Whether to send the message optimistically
1542
+ * @param opts - Send options (optimistic delivery, idempotency key)
1433
1543
  * @returns Promise that resolves with the message ID after it has been sent
1434
1544
  */
1435
- sendReaction(reaction: Reaction, isOptimistic?: boolean): Promise<string>;
1545
+ sendReaction(reaction: Reaction, opts?: SendOpts): Promise<string>;
1436
1546
  /**
1437
1547
  * Sends a read receipt message
1438
1548
  *
1439
- * @param isOptimistic - Whether to send the message optimistically
1549
+ * @param opts - Send options (optimistic delivery, idempotency key)
1440
1550
  * @returns Promise that resolves with the message ID after it has been sent
1441
1551
  */
1442
- sendReadReceipt(isOptimistic?: boolean): Promise<string>;
1552
+ sendReadReceipt(opts?: SendOpts): Promise<string>;
1443
1553
  /**
1444
1554
  * Sends a reply message
1445
1555
  *
1446
1556
  * @param reply - The reply to send
1447
- * @param isOptimistic - Whether to send the message optimistically
1557
+ * @param opts - Send options (optimistic delivery, idempotency key)
1448
1558
  * @returns Promise that resolves with the message ID after it has been sent
1449
1559
  */
1450
- sendReply(reply: Reply, isOptimistic?: boolean): Promise<string>;
1560
+ sendReply(reply: Reply, opts?: SendOpts): Promise<string>;
1451
1561
  /**
1452
1562
  * Sends a transaction reference message
1453
1563
  *
1454
1564
  * @param transactionReference - The transaction reference to send
1455
- * @param isOptimistic - Whether to send the message optimistically
1565
+ * @param opts - Send options (optimistic delivery, idempotency key)
1456
1566
  * @returns Promise that resolves with the message ID after it has been sent
1457
1567
  */
1458
- sendTransactionReference(transactionReference: TransactionReference, isOptimistic?: boolean): Promise<string>;
1568
+ sendTransactionReference(transactionReference: TransactionReference, opts?: SendOpts): Promise<string>;
1459
1569
  /**
1460
1570
  * Sends a wallet send calls message
1461
1571
  *
1462
1572
  * @param walletSendCalls - The wallet send calls to send
1463
- * @param isOptimistic - Whether to send the message optimistically
1573
+ * @param opts - Send options (optimistic delivery, idempotency key)
1464
1574
  * @returns Promise that resolves with the message ID after it has been sent
1465
1575
  */
1466
- sendWalletSendCalls(walletSendCalls: WalletSendCalls, isOptimistic?: boolean): Promise<string>;
1576
+ sendWalletSendCalls(walletSendCalls: WalletSendCalls, opts?: SendOpts): Promise<string>;
1467
1577
  /**
1468
1578
  * Sends an actions message
1469
1579
  *
1470
1580
  * @param actions - The actions to send
1471
- * @param isOptimistic - Whether to send the message optimistically
1581
+ * @param opts - Send options (optimistic delivery, idempotency key)
1472
1582
  * @returns Promise that resolves with the message ID after it has been sent
1473
1583
  */
1474
- sendActions(actions: Actions, isOptimistic?: boolean): Promise<string>;
1584
+ sendActions(actions: Actions, opts?: SendOpts): Promise<string>;
1475
1585
  /**
1476
1586
  * Sends an intent message
1477
1587
  *
1478
1588
  * @param intent - The intent to send
1479
- * @param isOptimistic - Whether to send the message optimistically
1589
+ * @param opts - Send options (optimistic delivery, idempotency key)
1480
1590
  * @returns Promise that resolves with the message ID after it has been sent
1481
1591
  */
1482
- sendIntent(intent: Intent, isOptimistic?: boolean): Promise<string>;
1592
+ sendIntent(intent: Intent, opts?: SendOpts): Promise<string>;
1483
1593
  /**
1484
1594
  * Sends an attachment message
1485
1595
  *
1486
1596
  * @param attachment - The attachment to send
1487
- * @param isOptimistic - Whether to send the message optimistically
1597
+ * @param opts - Send options (optimistic delivery, idempotency key)
1488
1598
  * @returns Promise that resolves with the message ID after it has been sent
1489
1599
  */
1490
- sendAttachment(attachment: Attachment, isOptimistic?: boolean): Promise<string>;
1600
+ sendAttachment(attachment: Attachment, opts?: SendOpts): Promise<string>;
1491
1601
  /**
1492
1602
  * Sends a multi remote attachment message
1493
1603
  *
1494
1604
  * @param multiRemoteAttachment - The multi remote attachment to send
1495
- * @param isOptimistic - Whether to send the message optimistically
1605
+ * @param opts - Send options (optimistic delivery, idempotency key)
1496
1606
  * @returns Promise that resolves with the message ID after it has been sent
1497
1607
  */
1498
- sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, isOptimistic?: boolean): Promise<string>;
1608
+ sendMultiRemoteAttachment(multiRemoteAttachment: MultiRemoteAttachment, opts?: SendOpts): Promise<string>;
1499
1609
  /**
1500
1610
  * Sends a remote attachment message
1501
1611
  *
1502
1612
  * @param remoteAttachment - The remote attachment to send
1503
- * @param isOptimistic - Whether to send the message optimistically
1613
+ * @param opts - Send options (optimistic delivery, idempotency key)
1504
1614
  * @returns Promise that resolves with the message ID after it has been sent
1505
1615
  */
1506
- sendRemoteAttachment(remoteAttachment: RemoteAttachment, isOptimistic?: boolean): Promise<string>;
1616
+ sendRemoteAttachment(remoteAttachment: RemoteAttachment, opts?: SendOpts): Promise<string>;
1507
1617
  /**
1508
1618
  * Lists messages in this conversation
1509
1619
  *
@@ -2401,6 +2511,19 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
2401
2511
  * @returns Whether the client can message the identifiers
2402
2512
  */
2403
2513
  canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
2514
+ /**
2515
+ * Fetches the latest inbox updates count for the specified inbox IDs
2516
+ *
2517
+ * @param inboxIds - The inbox IDs to check
2518
+ * @returns Map of inbox IDs to their updates count
2519
+ */
2520
+ fetchLatestInboxUpdatesCount(inboxIds: string[]): Promise<Map<string, number>>;
2521
+ /**
2522
+ * Fetches the latest inbox updates count for the client's inbox
2523
+ *
2524
+ * @returns The latest inbox updates count
2525
+ */
2526
+ fetchOwnInboxUpdatesCount(): Promise<number>;
2404
2527
  /**
2405
2528
  * Checks if the specified identifiers can be messaged
2406
2529
  *
@@ -2419,6 +2542,27 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
2419
2542
  * of `XmtpEnv`.
2420
2543
  */
2421
2544
  static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
2545
+ /**
2546
+ * Fetches the latest inbox updates count for the specified inbox IDs
2547
+ * without a client
2548
+ *
2549
+ * @param inboxIds - The inbox IDs to check
2550
+ * @param backend - Optional `Backend` instance created with `createBackend()`
2551
+ * @returns Map of inbox IDs to their updates count
2552
+ */
2553
+ static fetchLatestInboxUpdatesCount(inboxIds: string[], backendOrEnv?: Backend | XmtpEnv): Promise<Map<string, number>>;
2554
+ /**
2555
+ * Fetches the latest inbox updates count for the specified inbox IDs
2556
+ * without a client
2557
+ *
2558
+ * @param inboxIds - The inbox IDs to check
2559
+ * @param env - Optional XMTP environment
2560
+ * @param gatewayHost - Optional gateway host
2561
+ * @returns Map of inbox IDs to their updates count
2562
+ * @deprecated Pass a `Backend` instance created with `createBackend()` instead
2563
+ * of `XmtpEnv` and `gatewayHost`.
2564
+ */
2565
+ static fetchLatestInboxUpdatesCount(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<Map<string, number>>;
2422
2566
  /**
2423
2567
  * Fetches the inbox ID for a given identifier from the local database
2424
2568
  * If not found, fetches from the network
@@ -2462,11 +2606,67 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
2462
2606
  /**
2463
2607
  * Send a sync request to other devices on the network
2464
2608
  *
2465
- * @param options - Archive options specifying what to sync
2466
- * @param serverUrl - The server URL for the sync request
2609
+ * @param options - Archive options specifying what to sync (defaults to consent and messages)
2610
+ * @param serverUrl - The server URL for the sync request (defaults to environment-specific URL)
2467
2611
  * @returns Promise that resolves when the sync request is sent
2468
2612
  */
2469
- sendSyncRequest(options: ArchiveOptions, serverUrl: string): Promise<void>;
2613
+ sendSyncRequest(options?: ArchiveOptions, serverUrl?: string): Promise<void>;
2614
+ /**
2615
+ * Send a sync archive to the sync group
2616
+ *
2617
+ * @param pin - The pin used for reference when importing
2618
+ * @param options - Archive options specifying what to sync (defaults to consent and messages)
2619
+ * @param serverUrl - The server URL for the sync archive (defaults to environment-specific URL)
2620
+ * @returns Promise that resolves when the sync archive is sent
2621
+ */
2622
+ sendSyncArchive(pin: string, options?: ArchiveOptions, serverUrl?: string): Promise<void>;
2623
+ /**
2624
+ * Process a sync archive that matches the pin given
2625
+ *
2626
+ * @param archivePin - Optional pin to match. If not provided, processes the last archive sent
2627
+ * @returns Promise that resolves when the archive is processed
2628
+ */
2629
+ processSyncArchive(archivePin?: string | null): Promise<void>;
2630
+ /**
2631
+ * List the archives available for import in the sync group
2632
+ *
2633
+ * You may need to manually sync the sync group before calling
2634
+ * this function to see recently uploaded archives.
2635
+ *
2636
+ * @param daysCutoff - Number of days to look back for archives
2637
+ * @returns Promise that resolves with array of available archive information
2638
+ */
2639
+ listAvailableArchives(daysCutoff: number): Promise<AvailableArchiveInfo[]>;
2640
+ /**
2641
+ * Export archive data to bytes for later restoration
2642
+ *
2643
+ * @param key - Encryption key for the archive
2644
+ * @param opts - Archive options specifying what to include (defaults to consent and messages)
2645
+ * @returns Promise that resolves with the archive data as bytes
2646
+ */
2647
+ createArchive(key: Uint8Array, opts?: ArchiveOptions): Promise<Uint8Array>;
2648
+ /**
2649
+ * Import an archive from bytes
2650
+ *
2651
+ * @param data - The archive data as bytes
2652
+ * @param key - Encryption key for the archive
2653
+ * @returns Promise that resolves when the archive is imported
2654
+ */
2655
+ importArchive(data: Uint8Array, key: Uint8Array): Promise<void>;
2656
+ /**
2657
+ * Load the metadata for an archive to see what it contains
2658
+ *
2659
+ * @param data - The archive data as bytes
2660
+ * @param key - Encryption key for the archive
2661
+ * @returns Promise that resolves with the archive metadata
2662
+ */
2663
+ archiveMetadata(data: Uint8Array, key: Uint8Array): Promise<ArchiveMetadata>;
2664
+ /**
2665
+ * Manually sync all device sync groups
2666
+ *
2667
+ * @returns Promise that resolves with a summary of the sync operation
2668
+ */
2669
+ syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
2470
2670
  }
2471
2671
 
2472
2672
  declare class Opfs {
@@ -2619,5 +2819,5 @@ declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent>;
2619
2819
  declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions>;
2620
2820
  declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
2621
2821
 
2622
- export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DecodedMessage, Dm, Group, GroupNotFoundError, HistorySyncUrls, InboxReassignError, Opfs, OpfsInitializationError, OpfsNotInitializedError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, StreamNotFoundError, contentTypeActions, contentTypeAttachment, contentTypeGroupUpdated, contentTypeIntent, contentTypeLeaveRequest, contentTypeMarkdown, contentTypeMultiRemoteAttachment, contentTypeReaction, contentTypeReadReceipt, contentTypeRemoteAttachment, contentTypeReply, contentTypeText, contentTypeTransactionReference, contentTypeWalletSendCalls, createBackend, createStream, decryptAttachment, encodeActions, encodeAttachment, encodeIntent, encodeMarkdown, encodeMultiRemoteAttachment, encodeReaction, encodeReadReceipt, encodeRemoteAttachment, encodeText, encodeTransactionReference, encodeWalletSendCalls, encryptAttachment, generateInboxId, getInboxIdForIdentifier, isActions, isAttachment, isGroupUpdated, isIntent, isLeaveRequest, isMarkdown, isMultiRemoteAttachment, isReaction, isReadReceipt, isRemoteAttachment, isReply, isText, isTextReply, isTransactionReference, isWalletSendCalls, metadataFieldName, toSafeConversation, toSafeSigner };
2623
- export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, DeviceSyncOptions, EOASigner, EnrichedReply, ExtractCodecContentTypes, HmacKeys, LastReadTimes, NetworkOptions, OtherOptions, SCWSigner, SafeConversation, SafeSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
2822
+ export { AccountAlreadyAssociatedError, ApiUrls, Client, ClientNotInitializedError, Conversation, Conversations, DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_DELAY, DecodedMessage, Dm, Group, GroupNotFoundError, HistorySyncUrls, InboxReassignError, Opfs, OpfsInitializationError, OpfsNotInitializedError, SignerUnavailableError, StreamFailedError, StreamInvalidRetryAttemptsError, StreamNotFoundError, contentTypeActions, contentTypeAttachment, contentTypeGroupUpdated, contentTypeIntent, contentTypeLeaveRequest, contentTypeMarkdown, contentTypeMultiRemoteAttachment, contentTypeReaction, contentTypeReadReceipt, contentTypeRemoteAttachment, contentTypeReply, contentTypeText, contentTypeTransactionReference, contentTypeWalletSendCalls, createBackend, createEOASigner, createSCWSigner, createStream, decryptAttachment, encodeActions, encodeAttachment, encodeIntent, encodeMarkdown, encodeMultiRemoteAttachment, encodeReaction, encodeReadReceipt, encodeRemoteAttachment, encodeText, encodeTransactionReference, encodeWalletSendCalls, encryptAttachment, generateInboxId, getInboxIdForIdentifier, isActions, isAttachment, isGroupUpdated, isIntent, isLeaveRequest, isMarkdown, isMultiRemoteAttachment, isReaction, isReadReceipt, isRemoteAttachment, isReply, isText, isTextReply, isTransactionReference, isWalletSendCalls, metadataFieldName, toSafeConversation, toSafeSigner };
2823
+ export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, DeviceSyncOptions, EOASigner, EnrichedReply, ExtractCodecContentTypes, HmacKeys, LastReadTimes, NetworkOptions, OtherOptions, SCWSigner, SafeConversation, SafeSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, VisibilityConfirmationOptions, XmtpEnv };