@xmtp/browser-sdk 6.5.0 → 7.0.0-dev.b5cdc06
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 +17 -0
- package/dist/index.d.ts +291 -51
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/workers/client.js +1 -1
- package/dist/workers/client.js.map +1 -1
- package/package.json +17 -8
- package/src/Client.ts +360 -14
- package/src/WorkerClient.ts +77 -8
- package/src/WorkerConversation.ts +4 -4
- package/src/constants.ts +5 -0
- package/src/index.ts +10 -1
- package/src/types/actions/client.ts +90 -2
- package/src/types/options.ts +44 -11
- package/src/utils/WorkerBridge.ts +1 -1
- package/src/utils/createBackend.ts +45 -0
- package/src/utils/createClient.ts +65 -27
- package/src/utils/inboxId.ts +5 -15
- package/src/utils/inboxState.ts +5 -9
- package/src/utils/installations.ts +8 -17
- package/src/utils/signer.ts +37 -1
- package/src/workers/client.ts +52 -2
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, 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, GroupMember, PermissionUpdateType, PermissionPolicy, MetadataField, EncodedContent, SendMessageOpts, Reply, ListMessagesOptions, MessageDisappearingSettings, HmacKey, ConversationDebugInfo, GroupPermissionsOptions, PermissionPolicySet, GroupMetadata, ApiStats, IdentityStats, InboxState
|
|
3
|
-
export { Action, ActionStyle, Actions, ApiStats, Attachment, Consent, ConsentEntityType, ConsentState, ContentType, ConversationDebugInfo, ConversationListItem, ConversationType, CreateDmOptions, CreateGroupOptions, Cursor, DeliveryStatus, EncryptedAttachment, GroupMember, GroupMembershipState, GroupMessageKind, GroupMetadata, GroupPermissions, GroupPermissionsOptions, GroupSyncSummary, GroupUpdated, HmacKey, Identifier, IdentifierKind, IdentityStats, Inbox, InboxState, Installation, Intent, KeyPackageStatus, LeaveRequest, Lifetime, ListConversationsOptions, ListConversationsOrderBy, ListMessagesOptions, LogLevel, LogOptions, Message, MessageDisappearingSettings, MessageSortBy, MetadataField, MetadataFieldChange, MultiRemoteAttachment, PermissionLevel, PermissionPolicy, PermissionPolicySet, PermissionUpdateType, Reaction, ReactionAction, ReactionSchema, ReadReceipt, RemoteAttachment,
|
|
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, 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, 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> = {
|
|
@@ -82,33 +82,6 @@ type StreamValueMutator<T = unknown, V = T> = (value: T) => V | Promise<V>;
|
|
|
82
82
|
*/
|
|
83
83
|
declare const createStream: <T = unknown, V = T>(streamFunction: StreamFunction<T>, streamValueMutator?: StreamValueMutator<T, V | undefined>, options?: StreamOptions<T, V>) => Promise<AsyncStreamProxy<V>>;
|
|
84
84
|
|
|
85
|
-
/**
|
|
86
|
-
* Pre-configured URLs for the XMTP network based on the environment
|
|
87
|
-
*
|
|
88
|
-
* @constant
|
|
89
|
-
* @property {string} local - The local URL for the XMTP network
|
|
90
|
-
* @property {string} dev - The development URL for the XMTP network
|
|
91
|
-
* @property {string} production - The production URL for the XMTP network
|
|
92
|
-
*/
|
|
93
|
-
declare const ApiUrls: {
|
|
94
|
-
readonly local: "http://localhost:5557";
|
|
95
|
-
readonly dev: "https://api.dev.xmtp.network:5558";
|
|
96
|
-
readonly production: "https://api.production.xmtp.network:5558";
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Pre-configured URLs for the XMTP history sync service based on the environment
|
|
100
|
-
*
|
|
101
|
-
* @constant
|
|
102
|
-
* @property {string} local - The local URL for the XMTP history sync service
|
|
103
|
-
* @property {string} dev - The development URL for the XMTP history sync service
|
|
104
|
-
* @property {string} production - The production URL for the XMTP history sync service
|
|
105
|
-
*/
|
|
106
|
-
declare const HistorySyncUrls: {
|
|
107
|
-
readonly local: "http://localhost:5558";
|
|
108
|
-
readonly dev: "https://message-history.dev.ephemera.network";
|
|
109
|
-
readonly production: "https://message-history.production.ephemera.network";
|
|
110
|
-
};
|
|
111
|
-
|
|
112
85
|
declare class CodecRegistry {
|
|
113
86
|
#private;
|
|
114
87
|
constructor(codecs: ContentCodec[]);
|
|
@@ -158,7 +131,8 @@ declare class DecodedMessage<ContentTypes = unknown> {
|
|
|
158
131
|
constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
|
|
159
132
|
}
|
|
160
133
|
|
|
161
|
-
type
|
|
134
|
+
type VisibilityConfirmationOptions = WasmVisibilityConfirmationOptions;
|
|
135
|
+
type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
|
|
162
136
|
/**
|
|
163
137
|
* Network options
|
|
164
138
|
*/
|
|
@@ -172,15 +146,28 @@ type NetworkOptions = {
|
|
|
172
146
|
* specific endpoint
|
|
173
147
|
*/
|
|
174
148
|
apiUrl?: string;
|
|
149
|
+
/**
|
|
150
|
+
* gatewayHost can be used to override the gateway endpoint
|
|
151
|
+
*/
|
|
152
|
+
gatewayHost?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Custom app version
|
|
155
|
+
*/
|
|
156
|
+
appVersion?: string;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Device sync options
|
|
160
|
+
*/
|
|
161
|
+
type DeviceSyncOptions = {
|
|
175
162
|
/**
|
|
176
163
|
* historySyncUrl can be used to override the `env` flag and connect to a
|
|
177
164
|
* specific endpoint for syncing history
|
|
178
165
|
*/
|
|
179
166
|
historySyncUrl?: string | null;
|
|
180
167
|
/**
|
|
181
|
-
*
|
|
168
|
+
* Disable device sync
|
|
182
169
|
*/
|
|
183
|
-
|
|
170
|
+
disableDeviceSync?: boolean;
|
|
184
171
|
};
|
|
185
172
|
type ContentOptions = {
|
|
186
173
|
/**
|
|
@@ -229,19 +216,28 @@ type OtherOptions = {
|
|
|
229
216
|
*/
|
|
230
217
|
loggingLevel?: LogLevel;
|
|
231
218
|
/**
|
|
232
|
-
*
|
|
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.
|
|
233
224
|
*/
|
|
234
|
-
|
|
225
|
+
workerConfig?: WorkerConfigOptions;
|
|
235
226
|
/**
|
|
236
|
-
* Disable
|
|
227
|
+
* Disable automatic registration when creating a client
|
|
237
228
|
*/
|
|
238
|
-
|
|
229
|
+
disableAutoRegister?: boolean;
|
|
239
230
|
/**
|
|
240
|
-
*
|
|
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.
|
|
241
235
|
*/
|
|
242
|
-
|
|
236
|
+
waitForRegistrationVisible?: VisibilityConfirmationOptions;
|
|
243
237
|
};
|
|
244
|
-
type ClientOptions = NetworkOptions
|
|
238
|
+
type ClientOptions = (NetworkOptions | {
|
|
239
|
+
backend: Backend;
|
|
240
|
+
}) & DeviceSyncOptions & ContentOptions & StorageOptions & OtherOptions;
|
|
245
241
|
type EnrichedReply<T = unknown, U = unknown> = {
|
|
246
242
|
referenceId: string;
|
|
247
243
|
content: T;
|
|
@@ -283,6 +279,8 @@ type SafeSigner = {
|
|
|
283
279
|
chainId: bigint;
|
|
284
280
|
blockNumber?: bigint;
|
|
285
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;
|
|
286
284
|
declare const toSafeSigner: (signer: Signer, signature: Uint8Array) => Promise<SafeSigner>;
|
|
287
285
|
|
|
288
286
|
declare class WorkerConversations {
|
|
@@ -337,10 +335,11 @@ declare class WorkerPreferences {
|
|
|
337
335
|
|
|
338
336
|
declare class WorkerClient {
|
|
339
337
|
#private;
|
|
340
|
-
constructor(client: Client$1);
|
|
338
|
+
constructor(client: Client$1, env: XmtpEnv);
|
|
341
339
|
static create(identifier: Identifier, options?: Omit<ClientOptions, "codecs">): Promise<WorkerClient>;
|
|
342
340
|
get libxmtpVersion(): string;
|
|
343
341
|
get appVersion(): string;
|
|
342
|
+
get env(): XmtpEnv;
|
|
344
343
|
get accountIdentifier(): Identifier;
|
|
345
344
|
get inboxId(): string;
|
|
346
345
|
get installationId(): string;
|
|
@@ -350,6 +349,8 @@ declare class WorkerClient {
|
|
|
350
349
|
get debugInformation(): WorkerDebugInformation;
|
|
351
350
|
get preferences(): WorkerPreferences;
|
|
352
351
|
canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
|
|
352
|
+
fetchLatestInboxUpdatesCount(inboxIds: string[]): Promise<Record<string, number>>;
|
|
353
|
+
fetchOwnInboxUpdatesCount(): Promise<number>;
|
|
353
354
|
addSignature(signatureRequest: SignatureRequestHandle, signer: SafeSigner): Promise<void>;
|
|
354
355
|
applySignatureRequest(signatureRequest: SignatureRequestHandle): Promise<void>;
|
|
355
356
|
processSignatureRequest(signer: SafeSigner, signatureRequest: SignatureRequestHandle): Promise<void>;
|
|
@@ -359,13 +360,20 @@ declare class WorkerClient {
|
|
|
359
360
|
revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle | undefined>;
|
|
360
361
|
revokeInstallationsSignatureRequest(installationIds: Uint8Array[]): Promise<SignatureRequestHandle>;
|
|
361
362
|
changeRecoveryIdentifierSignatureRequest(identifier: Identifier): Promise<SignatureRequestHandle>;
|
|
362
|
-
registerIdentity(signer: SafeSigner, signatureRequest: SignatureRequestHandle): Promise<void>;
|
|
363
|
+
registerIdentity(signer: SafeSigner, signatureRequest: SignatureRequestHandle, visibilityConfirmationOptions?: VisibilityConfirmationOptions): Promise<void>;
|
|
363
364
|
getInboxIdByIdentifier(identifier: Identifier): Promise<string | undefined>;
|
|
364
365
|
signWithInstallationKey(signatureText: string): Uint8Array<ArrayBufferLike>;
|
|
365
366
|
verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
|
|
366
367
|
verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
|
|
367
368
|
fetchKeyPackageStatuses(installationIds: string[]): Promise<Map<string, KeyPackageStatus>>;
|
|
368
|
-
sendSyncRequest(): Promise<void>;
|
|
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>;
|
|
369
377
|
}
|
|
370
378
|
|
|
371
379
|
declare class WorkerConversation {
|
|
@@ -463,6 +471,7 @@ type ClientAction = {
|
|
|
463
471
|
id: string;
|
|
464
472
|
result: {
|
|
465
473
|
appVersion: string;
|
|
474
|
+
env: string;
|
|
466
475
|
inboxId: string;
|
|
467
476
|
installationId: string;
|
|
468
477
|
installationIdBytes: Uint8Array;
|
|
@@ -551,6 +560,7 @@ type ClientAction = {
|
|
|
551
560
|
data: {
|
|
552
561
|
signer: SafeSigner;
|
|
553
562
|
signatureRequestId: string;
|
|
563
|
+
waitForRegistrationVisible?: VisibilityConfirmationOptions;
|
|
554
564
|
};
|
|
555
565
|
} | {
|
|
556
566
|
action: "client.addAccount";
|
|
@@ -608,6 +618,18 @@ type ClientAction = {
|
|
|
608
618
|
data: {
|
|
609
619
|
identifiers: Identifier[];
|
|
610
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>;
|
|
611
633
|
} | {
|
|
612
634
|
action: "client.getInboxIdByIdentifier";
|
|
613
635
|
id: string;
|
|
@@ -650,6 +672,61 @@ type ClientAction = {
|
|
|
650
672
|
action: "client.sendSyncRequest";
|
|
651
673
|
id: string;
|
|
652
674
|
result: undefined;
|
|
675
|
+
data: {
|
|
676
|
+
options: ArchiveOptions;
|
|
677
|
+
serverUrl: string;
|
|
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;
|
|
653
730
|
data: undefined;
|
|
654
731
|
};
|
|
655
732
|
|
|
@@ -2197,6 +2274,10 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2197
2274
|
* Gets the app version used by the client
|
|
2198
2275
|
*/
|
|
2199
2276
|
get appVersion(): string | undefined;
|
|
2277
|
+
/**
|
|
2278
|
+
* Gets the XMTP environment used by this client
|
|
2279
|
+
*/
|
|
2280
|
+
get env(): XmtpEnv | undefined;
|
|
2200
2281
|
/**
|
|
2201
2282
|
* Creates signature text for creating a new inbox
|
|
2202
2283
|
*
|
|
@@ -2367,21 +2448,45 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2367
2448
|
/**
|
|
2368
2449
|
* Revokes specific installations of the client's inbox without a client
|
|
2369
2450
|
*
|
|
2370
|
-
* @param env - The environment to use
|
|
2371
2451
|
* @param signer - The signer to use
|
|
2372
2452
|
* @param inboxId - The inbox ID to revoke installations for
|
|
2373
2453
|
* @param installationIds - The installation IDs to revoke
|
|
2454
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
2455
|
+
*/
|
|
2456
|
+
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], backend?: Backend): Promise<void>;
|
|
2457
|
+
/**
|
|
2458
|
+
* Revokes specific installations of the client's inbox without a client
|
|
2459
|
+
*
|
|
2460
|
+
* @param signer - The signer to use
|
|
2461
|
+
* @param inboxId - The inbox ID to revoke installations for
|
|
2462
|
+
* @param installationIds - The installation IDs to revoke
|
|
2463
|
+
* @param env - The environment to use
|
|
2464
|
+
* @param gatewayHost - Optional gateway host
|
|
2465
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2466
|
+
* of `XmtpEnv` and `gatewayHost`.
|
|
2374
2467
|
*/
|
|
2375
2468
|
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
|
|
2469
|
+
/**
|
|
2470
|
+
* Fetches the inbox states for the specified inbox IDs from the network
|
|
2471
|
+
* without a client
|
|
2472
|
+
*
|
|
2473
|
+
* @param inboxIds - The inbox IDs to get the state for
|
|
2474
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
2475
|
+
* @returns The inbox states for the specified inbox IDs
|
|
2476
|
+
*/
|
|
2477
|
+
static fetchInboxStates(inboxIds: string[], backend?: Backend): Promise<InboxState[]>;
|
|
2376
2478
|
/**
|
|
2377
2479
|
* Fetches the inbox states for the specified inbox IDs from the network
|
|
2378
2480
|
* without a client
|
|
2379
2481
|
*
|
|
2380
2482
|
* @param inboxIds - The inbox IDs to get the state for
|
|
2381
2483
|
* @param env - The environment to use
|
|
2484
|
+
* @param gatewayHost - Optional gateway host
|
|
2382
2485
|
* @returns The inbox states for the specified inbox IDs
|
|
2486
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2487
|
+
* of `XmtpEnv` and `gatewayHost`.
|
|
2383
2488
|
*/
|
|
2384
|
-
static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<
|
|
2489
|
+
static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<InboxState[]>;
|
|
2385
2490
|
/**
|
|
2386
2491
|
* Changes the recovery identifier for the client's inbox
|
|
2387
2492
|
*
|
|
@@ -2404,14 +2509,58 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2404
2509
|
* @returns Whether the client can message the identifiers
|
|
2405
2510
|
*/
|
|
2406
2511
|
canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
|
|
2512
|
+
/**
|
|
2513
|
+
* Fetches the latest inbox updates count for the specified inbox IDs
|
|
2514
|
+
*
|
|
2515
|
+
* @param inboxIds - The inbox IDs to check
|
|
2516
|
+
* @returns Map of inbox IDs to their updates count
|
|
2517
|
+
*/
|
|
2518
|
+
fetchLatestInboxUpdatesCount(inboxIds: string[]): Promise<Map<string, number>>;
|
|
2519
|
+
/**
|
|
2520
|
+
* Fetches the latest inbox updates count for the client's inbox
|
|
2521
|
+
*
|
|
2522
|
+
* @returns The latest inbox updates count
|
|
2523
|
+
*/
|
|
2524
|
+
fetchOwnInboxUpdatesCount(): Promise<number>;
|
|
2525
|
+
/**
|
|
2526
|
+
* Checks if the specified identifiers can be messaged
|
|
2527
|
+
*
|
|
2528
|
+
* @param identifiers - The identifiers to check
|
|
2529
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
2530
|
+
* @returns Map of identifiers to whether they can be messaged
|
|
2531
|
+
*/
|
|
2532
|
+
static canMessage(identifiers: Identifier[], backend?: Backend): Promise<Map<string, boolean>>;
|
|
2407
2533
|
/**
|
|
2408
2534
|
* Checks if the specified identifiers can be messaged
|
|
2409
2535
|
*
|
|
2410
2536
|
* @param identifiers - The identifiers to check
|
|
2411
2537
|
* @param env - Optional XMTP environment
|
|
2412
2538
|
* @returns Map of identifiers to whether they can be messaged
|
|
2539
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2540
|
+
* of `XmtpEnv`.
|
|
2413
2541
|
*/
|
|
2414
2542
|
static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
|
|
2543
|
+
/**
|
|
2544
|
+
* Fetches the latest inbox updates count for the specified inbox IDs
|
|
2545
|
+
* without a client
|
|
2546
|
+
*
|
|
2547
|
+
* @param inboxIds - The inbox IDs to check
|
|
2548
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
2549
|
+
* @returns Map of inbox IDs to their updates count
|
|
2550
|
+
*/
|
|
2551
|
+
static fetchLatestInboxUpdatesCount(inboxIds: string[], backendOrEnv?: Backend | XmtpEnv): Promise<Map<string, number>>;
|
|
2552
|
+
/**
|
|
2553
|
+
* Fetches the latest inbox updates count for the specified inbox IDs
|
|
2554
|
+
* without a client
|
|
2555
|
+
*
|
|
2556
|
+
* @param inboxIds - The inbox IDs to check
|
|
2557
|
+
* @param env - Optional XMTP environment
|
|
2558
|
+
* @param gatewayHost - Optional gateway host
|
|
2559
|
+
* @returns Map of inbox IDs to their updates count
|
|
2560
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2561
|
+
* of `XmtpEnv` and `gatewayHost`.
|
|
2562
|
+
*/
|
|
2563
|
+
static fetchLatestInboxUpdatesCount(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<Map<string, number>>;
|
|
2415
2564
|
/**
|
|
2416
2565
|
* Fetches the inbox ID for a given identifier from the local database
|
|
2417
2566
|
* If not found, fetches from the network
|
|
@@ -2455,9 +2604,67 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2455
2604
|
/**
|
|
2456
2605
|
* Send a sync request to other devices on the network
|
|
2457
2606
|
*
|
|
2607
|
+
* @param options - Archive options specifying what to sync (defaults to consent and messages)
|
|
2608
|
+
* @param serverUrl - The server URL for the sync request (defaults to environment-specific URL)
|
|
2458
2609
|
* @returns Promise that resolves when the sync request is sent
|
|
2459
2610
|
*/
|
|
2460
|
-
sendSyncRequest(): Promise<void>;
|
|
2611
|
+
sendSyncRequest(options?: ArchiveOptions, serverUrl?: string): Promise<void>;
|
|
2612
|
+
/**
|
|
2613
|
+
* Send a sync archive to the sync group
|
|
2614
|
+
*
|
|
2615
|
+
* @param pin - The pin used for reference when importing
|
|
2616
|
+
* @param options - Archive options specifying what to sync (defaults to consent and messages)
|
|
2617
|
+
* @param serverUrl - The server URL for the sync archive (defaults to environment-specific URL)
|
|
2618
|
+
* @returns Promise that resolves when the sync archive is sent
|
|
2619
|
+
*/
|
|
2620
|
+
sendSyncArchive(pin: string, options?: ArchiveOptions, serverUrl?: string): Promise<void>;
|
|
2621
|
+
/**
|
|
2622
|
+
* Process a sync archive that matches the pin given
|
|
2623
|
+
*
|
|
2624
|
+
* @param archivePin - Optional pin to match. If not provided, processes the last archive sent
|
|
2625
|
+
* @returns Promise that resolves when the archive is processed
|
|
2626
|
+
*/
|
|
2627
|
+
processSyncArchive(archivePin?: string | null): Promise<void>;
|
|
2628
|
+
/**
|
|
2629
|
+
* List the archives available for import in the sync group
|
|
2630
|
+
*
|
|
2631
|
+
* You may need to manually sync the sync group before calling
|
|
2632
|
+
* this function to see recently uploaded archives.
|
|
2633
|
+
*
|
|
2634
|
+
* @param daysCutoff - Number of days to look back for archives
|
|
2635
|
+
* @returns Promise that resolves with array of available archive information
|
|
2636
|
+
*/
|
|
2637
|
+
listAvailableArchives(daysCutoff: number): Promise<AvailableArchiveInfo[]>;
|
|
2638
|
+
/**
|
|
2639
|
+
* Export archive data to bytes for later restoration
|
|
2640
|
+
*
|
|
2641
|
+
* @param key - Encryption key for the archive
|
|
2642
|
+
* @param opts - Archive options specifying what to include (defaults to consent and messages)
|
|
2643
|
+
* @returns Promise that resolves with the archive data as bytes
|
|
2644
|
+
*/
|
|
2645
|
+
createArchive(key: Uint8Array, opts?: ArchiveOptions): Promise<Uint8Array>;
|
|
2646
|
+
/**
|
|
2647
|
+
* Import an archive from bytes
|
|
2648
|
+
*
|
|
2649
|
+
* @param data - The archive data as bytes
|
|
2650
|
+
* @param key - Encryption key for the archive
|
|
2651
|
+
* @returns Promise that resolves when the archive is imported
|
|
2652
|
+
*/
|
|
2653
|
+
importArchive(data: Uint8Array, key: Uint8Array): Promise<void>;
|
|
2654
|
+
/**
|
|
2655
|
+
* Load the metadata for an archive to see what it contains
|
|
2656
|
+
*
|
|
2657
|
+
* @param data - The archive data as bytes
|
|
2658
|
+
* @param key - Encryption key for the archive
|
|
2659
|
+
* @returns Promise that resolves with the archive metadata
|
|
2660
|
+
*/
|
|
2661
|
+
archiveMetadata(data: Uint8Array, key: Uint8Array): Promise<ArchiveMetadata>;
|
|
2662
|
+
/**
|
|
2663
|
+
* Manually sync all device sync groups
|
|
2664
|
+
*
|
|
2665
|
+
* @returns Promise that resolves with a summary of the sync operation
|
|
2666
|
+
*/
|
|
2667
|
+
syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>;
|
|
2461
2668
|
}
|
|
2462
2669
|
|
|
2463
2670
|
declare class Opfs {
|
|
@@ -2476,6 +2683,8 @@ declare class Opfs {
|
|
|
2476
2683
|
clearAll(): Promise<void>;
|
|
2477
2684
|
}
|
|
2478
2685
|
|
|
2686
|
+
declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
|
|
2687
|
+
|
|
2479
2688
|
/**
|
|
2480
2689
|
* Generates an inbox ID for a given identifier
|
|
2481
2690
|
*
|
|
@@ -2485,14 +2694,13 @@ declare class Opfs {
|
|
|
2485
2694
|
*/
|
|
2486
2695
|
declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => Promise<string>;
|
|
2487
2696
|
/**
|
|
2488
|
-
* Gets the inbox ID for a specific identifier
|
|
2697
|
+
* Gets the inbox ID for a specific identifier using a Backend
|
|
2489
2698
|
*
|
|
2699
|
+
* @param backend - The Backend instance for API communication
|
|
2490
2700
|
* @param identifier - The identifier to get the inbox ID for
|
|
2491
|
-
* @param env - Optional XMTP environment configuration (default: "dev")
|
|
2492
|
-
* @param gatewayHost - Optional gateway host override
|
|
2493
2701
|
* @returns Promise that resolves with the inbox ID for the identifier
|
|
2494
2702
|
*/
|
|
2495
|
-
declare const getInboxIdForIdentifier: (
|
|
2703
|
+
declare const getInboxIdForIdentifier: (backend: Backend, identifier: Identifier) => Promise<string | undefined>;
|
|
2496
2704
|
|
|
2497
2705
|
/**
|
|
2498
2706
|
* Gets the name of a metadata field
|
|
@@ -2502,6 +2710,38 @@ declare const getInboxIdForIdentifier: (identifier: Identifier, env?: XmtpEnv, g
|
|
|
2502
2710
|
*/
|
|
2503
2711
|
declare const metadataFieldName: (field: MetadataField) => Promise<string>;
|
|
2504
2712
|
|
|
2713
|
+
/**
|
|
2714
|
+
* Pre-configured URLs for the XMTP network based on the environment
|
|
2715
|
+
*
|
|
2716
|
+
* @deprecated Use `createBackend()` instead.
|
|
2717
|
+
* @constant
|
|
2718
|
+
* @property {string} local - The local URL for the XMTP network
|
|
2719
|
+
* @property {string} dev - The development URL for the XMTP network
|
|
2720
|
+
* @property {string} production - The production URL for the XMTP network
|
|
2721
|
+
*/
|
|
2722
|
+
declare const ApiUrls: {
|
|
2723
|
+
readonly local: "http://localhost:5557";
|
|
2724
|
+
readonly dev: "https://api.dev.xmtp.network:5558";
|
|
2725
|
+
readonly production: "https://api.production.xmtp.network:5558";
|
|
2726
|
+
};
|
|
2727
|
+
/**
|
|
2728
|
+
* Pre-configured URLs for the XMTP history sync service based on the environment
|
|
2729
|
+
*
|
|
2730
|
+
* @constant
|
|
2731
|
+
* @property {string} local - The local URL for the XMTP history sync service
|
|
2732
|
+
* @property {string} dev - The development URL for the XMTP history sync service
|
|
2733
|
+
* @property {string} production - The production URL for the XMTP history sync service
|
|
2734
|
+
*/
|
|
2735
|
+
declare const HistorySyncUrls: {
|
|
2736
|
+
readonly local: "http://localhost:5558";
|
|
2737
|
+
readonly dev: "https://message-history.dev.ephemera.network";
|
|
2738
|
+
readonly production: "https://message-history.production.ephemera.network";
|
|
2739
|
+
readonly "testnet-staging": "https://message-history.dev.ephemera.network";
|
|
2740
|
+
readonly "testnet-dev": "https://message-history.dev.ephemera.network";
|
|
2741
|
+
readonly testnet: "https://message-history.dev.ephemera.network";
|
|
2742
|
+
readonly mainnet: "https://message-history.production.ephemera.network";
|
|
2743
|
+
};
|
|
2744
|
+
|
|
2505
2745
|
declare const encodeActions: (actions: _xmtp_wasm_bindings.Actions) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2506
2746
|
declare const encodeAttachment: (attachment: _xmtp_wasm_bindings.Attachment) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2507
2747
|
declare const encodeIntent: (intent: _xmtp_wasm_bindings.Intent) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
@@ -2577,5 +2817,5 @@ declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent>;
|
|
|
2577
2817
|
declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions>;
|
|
2578
2818
|
declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
|
|
2579
2819
|
|
|
2580
|
-
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, 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 };
|
|
2581
|
-
export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, EOASigner, EnrichedReply, ExtractCodecContentTypes, HmacKeys, LastReadTimes, NetworkOptions, OtherOptions, SCWSigner, SafeConversation, SafeSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
|
|
2820
|
+
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 };
|
|
2821
|
+
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 };
|