@xmtp/browser-sdk 6.4.0 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +112 -54
- 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 +3 -3
- package/src/Client.ts +131 -15
- package/src/Conversations.ts +1 -1
- package/src/WorkerClient.ts +14 -7
- package/src/WorkerConversation.ts +4 -4
- package/src/constants.ts +5 -0
- package/src/index.ts +5 -1
- package/src/types/actions/client.ts +10 -2
- package/src/types/options.ts +27 -13
- package/src/utils/createBackend.ts +45 -0
- package/src/utils/createClient.ts +58 -27
- package/src/utils/inboxId.ts +5 -15
- package/src/utils/inboxState.ts +5 -9
- package/src/utils/installations.ts +8 -17
- package/src/workers/client.ts +2 -1
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, GroupSyncSummary } from '@xmtp/wasm-bindings';
|
|
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, 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';
|
|
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,7 @@ declare class DecodedMessage<ContentTypes = unknown> {
|
|
|
158
131
|
constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
|
|
159
132
|
}
|
|
160
133
|
|
|
161
|
-
type XmtpEnv =
|
|
134
|
+
type XmtpEnv = "local" | "dev" | "production" | "testnet-staging" | "testnet-dev" | "testnet" | "mainnet";
|
|
162
135
|
/**
|
|
163
136
|
* Network options
|
|
164
137
|
*/
|
|
@@ -172,15 +145,28 @@ type NetworkOptions = {
|
|
|
172
145
|
* specific endpoint
|
|
173
146
|
*/
|
|
174
147
|
apiUrl?: string;
|
|
148
|
+
/**
|
|
149
|
+
* gatewayHost can be used to override the gateway endpoint
|
|
150
|
+
*/
|
|
151
|
+
gatewayHost?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Custom app version
|
|
154
|
+
*/
|
|
155
|
+
appVersion?: string;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Device sync options
|
|
159
|
+
*/
|
|
160
|
+
type DeviceSyncOptions = {
|
|
175
161
|
/**
|
|
176
162
|
* historySyncUrl can be used to override the `env` flag and connect to a
|
|
177
163
|
* specific endpoint for syncing history
|
|
178
164
|
*/
|
|
179
165
|
historySyncUrl?: string | null;
|
|
180
166
|
/**
|
|
181
|
-
*
|
|
167
|
+
* Disable device sync
|
|
182
168
|
*/
|
|
183
|
-
|
|
169
|
+
disableDeviceSync?: boolean;
|
|
184
170
|
};
|
|
185
171
|
type ContentOptions = {
|
|
186
172
|
/**
|
|
@@ -232,16 +218,10 @@ type OtherOptions = {
|
|
|
232
218
|
* Disable automatic registration when creating a client
|
|
233
219
|
*/
|
|
234
220
|
disableAutoRegister?: boolean;
|
|
235
|
-
/**
|
|
236
|
-
* Disable device sync
|
|
237
|
-
*/
|
|
238
|
-
disableDeviceSync?: boolean;
|
|
239
|
-
/**
|
|
240
|
-
* Custom app version
|
|
241
|
-
*/
|
|
242
|
-
appVersion?: string;
|
|
243
221
|
};
|
|
244
|
-
type ClientOptions = NetworkOptions
|
|
222
|
+
type ClientOptions = (NetworkOptions | {
|
|
223
|
+
backend: Backend;
|
|
224
|
+
}) & DeviceSyncOptions & ContentOptions & StorageOptions & OtherOptions;
|
|
245
225
|
type EnrichedReply<T = unknown, U = unknown> = {
|
|
246
226
|
referenceId: string;
|
|
247
227
|
content: T;
|
|
@@ -337,10 +317,11 @@ declare class WorkerPreferences {
|
|
|
337
317
|
|
|
338
318
|
declare class WorkerClient {
|
|
339
319
|
#private;
|
|
340
|
-
constructor(client: Client$1);
|
|
320
|
+
constructor(client: Client$1, env: XmtpEnv);
|
|
341
321
|
static create(identifier: Identifier, options?: Omit<ClientOptions, "codecs">): Promise<WorkerClient>;
|
|
342
322
|
get libxmtpVersion(): string;
|
|
343
323
|
get appVersion(): string;
|
|
324
|
+
get env(): XmtpEnv;
|
|
344
325
|
get accountIdentifier(): Identifier;
|
|
345
326
|
get inboxId(): string;
|
|
346
327
|
get installationId(): string;
|
|
@@ -365,7 +346,7 @@ declare class WorkerClient {
|
|
|
365
346
|
verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
|
|
366
347
|
verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
|
|
367
348
|
fetchKeyPackageStatuses(installationIds: string[]): Promise<Map<string, KeyPackageStatus>>;
|
|
368
|
-
sendSyncRequest(): Promise<void>;
|
|
349
|
+
sendSyncRequest(options: ArchiveOptions, serverUrl: string): Promise<void>;
|
|
369
350
|
}
|
|
370
351
|
|
|
371
352
|
declare class WorkerConversation {
|
|
@@ -462,6 +443,7 @@ type ClientAction = {
|
|
|
462
443
|
id: string;
|
|
463
444
|
result: {
|
|
464
445
|
appVersion: string;
|
|
446
|
+
env: string;
|
|
465
447
|
inboxId: string;
|
|
466
448
|
installationId: string;
|
|
467
449
|
installationIdBytes: Uint8Array;
|
|
@@ -649,7 +631,10 @@ type ClientAction = {
|
|
|
649
631
|
action: "client.sendSyncRequest";
|
|
650
632
|
id: string;
|
|
651
633
|
result: undefined;
|
|
652
|
-
data:
|
|
634
|
+
data: {
|
|
635
|
+
options: ArchiveOptions;
|
|
636
|
+
serverUrl: string;
|
|
637
|
+
};
|
|
653
638
|
};
|
|
654
639
|
|
|
655
640
|
type ConversationAction = {
|
|
@@ -1896,7 +1881,7 @@ declare class Conversations<ContentTypes = unknown> {
|
|
|
1896
1881
|
/**
|
|
1897
1882
|
* Creates a new group conversation with the specified inbox IDs
|
|
1898
1883
|
*
|
|
1899
|
-
* @param inboxIds - Array of inbox IDs for group members
|
|
1884
|
+
* @param inboxIds - Array of inbox IDs for other group members (the creator is included automatically)
|
|
1900
1885
|
* @param options - Optional group creation options
|
|
1901
1886
|
* @returns Promise that resolves with the new group
|
|
1902
1887
|
*/
|
|
@@ -2181,6 +2166,10 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2181
2166
|
* Gets the app version used by the client
|
|
2182
2167
|
*/
|
|
2183
2168
|
get appVersion(): string | undefined;
|
|
2169
|
+
/**
|
|
2170
|
+
* Gets the XMTP environment used by this client
|
|
2171
|
+
*/
|
|
2172
|
+
get env(): XmtpEnv | undefined;
|
|
2184
2173
|
/**
|
|
2185
2174
|
* Creates signature text for creating a new inbox
|
|
2186
2175
|
*
|
|
@@ -2351,21 +2340,45 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2351
2340
|
/**
|
|
2352
2341
|
* Revokes specific installations of the client's inbox without a client
|
|
2353
2342
|
*
|
|
2354
|
-
* @param env - The environment to use
|
|
2355
2343
|
* @param signer - The signer to use
|
|
2356
2344
|
* @param inboxId - The inbox ID to revoke installations for
|
|
2357
2345
|
* @param installationIds - The installation IDs to revoke
|
|
2346
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
2347
|
+
*/
|
|
2348
|
+
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], backend?: Backend): Promise<void>;
|
|
2349
|
+
/**
|
|
2350
|
+
* Revokes specific installations of the client's inbox without a client
|
|
2351
|
+
*
|
|
2352
|
+
* @param signer - The signer to use
|
|
2353
|
+
* @param inboxId - The inbox ID to revoke installations for
|
|
2354
|
+
* @param installationIds - The installation IDs to revoke
|
|
2355
|
+
* @param env - The environment to use
|
|
2356
|
+
* @param gatewayHost - Optional gateway host
|
|
2357
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2358
|
+
* of `XmtpEnv` and `gatewayHost`.
|
|
2358
2359
|
*/
|
|
2359
2360
|
static revokeInstallations(signer: Signer, inboxId: string, installationIds: Uint8Array[], env?: XmtpEnv, gatewayHost?: string): Promise<void>;
|
|
2361
|
+
/**
|
|
2362
|
+
* Fetches the inbox states for the specified inbox IDs from the network
|
|
2363
|
+
* without a client
|
|
2364
|
+
*
|
|
2365
|
+
* @param inboxIds - The inbox IDs to get the state for
|
|
2366
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
2367
|
+
* @returns The inbox states for the specified inbox IDs
|
|
2368
|
+
*/
|
|
2369
|
+
static fetchInboxStates(inboxIds: string[], backend?: Backend): Promise<InboxState[]>;
|
|
2360
2370
|
/**
|
|
2361
2371
|
* Fetches the inbox states for the specified inbox IDs from the network
|
|
2362
2372
|
* without a client
|
|
2363
2373
|
*
|
|
2364
2374
|
* @param inboxIds - The inbox IDs to get the state for
|
|
2365
2375
|
* @param env - The environment to use
|
|
2376
|
+
* @param gatewayHost - Optional gateway host
|
|
2366
2377
|
* @returns The inbox states for the specified inbox IDs
|
|
2378
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2379
|
+
* of `XmtpEnv` and `gatewayHost`.
|
|
2367
2380
|
*/
|
|
2368
|
-
static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<
|
|
2381
|
+
static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<InboxState[]>;
|
|
2369
2382
|
/**
|
|
2370
2383
|
* Changes the recovery identifier for the client's inbox
|
|
2371
2384
|
*
|
|
@@ -2388,12 +2401,22 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2388
2401
|
* @returns Whether the client can message the identifiers
|
|
2389
2402
|
*/
|
|
2390
2403
|
canMessage(identifiers: Identifier[]): Promise<Map<string, boolean>>;
|
|
2404
|
+
/**
|
|
2405
|
+
* Checks if the specified identifiers can be messaged
|
|
2406
|
+
*
|
|
2407
|
+
* @param identifiers - The identifiers to check
|
|
2408
|
+
* @param backend - Optional `Backend` instance created with `createBackend()`
|
|
2409
|
+
* @returns Map of identifiers to whether they can be messaged
|
|
2410
|
+
*/
|
|
2411
|
+
static canMessage(identifiers: Identifier[], backend?: Backend): Promise<Map<string, boolean>>;
|
|
2391
2412
|
/**
|
|
2392
2413
|
* Checks if the specified identifiers can be messaged
|
|
2393
2414
|
*
|
|
2394
2415
|
* @param identifiers - The identifiers to check
|
|
2395
2416
|
* @param env - Optional XMTP environment
|
|
2396
2417
|
* @returns Map of identifiers to whether they can be messaged
|
|
2418
|
+
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2419
|
+
* of `XmtpEnv`.
|
|
2397
2420
|
*/
|
|
2398
2421
|
static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
|
|
2399
2422
|
/**
|
|
@@ -2439,9 +2462,11 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2439
2462
|
/**
|
|
2440
2463
|
* Send a sync request to other devices on the network
|
|
2441
2464
|
*
|
|
2465
|
+
* @param options - Archive options specifying what to sync
|
|
2466
|
+
* @param serverUrl - The server URL for the sync request
|
|
2442
2467
|
* @returns Promise that resolves when the sync request is sent
|
|
2443
2468
|
*/
|
|
2444
|
-
sendSyncRequest(): Promise<void>;
|
|
2469
|
+
sendSyncRequest(options: ArchiveOptions, serverUrl: string): Promise<void>;
|
|
2445
2470
|
}
|
|
2446
2471
|
|
|
2447
2472
|
declare class Opfs {
|
|
@@ -2460,6 +2485,8 @@ declare class Opfs {
|
|
|
2460
2485
|
clearAll(): Promise<void>;
|
|
2461
2486
|
}
|
|
2462
2487
|
|
|
2488
|
+
declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
|
|
2489
|
+
|
|
2463
2490
|
/**
|
|
2464
2491
|
* Generates an inbox ID for a given identifier
|
|
2465
2492
|
*
|
|
@@ -2469,14 +2496,13 @@ declare class Opfs {
|
|
|
2469
2496
|
*/
|
|
2470
2497
|
declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => Promise<string>;
|
|
2471
2498
|
/**
|
|
2472
|
-
* Gets the inbox ID for a specific identifier
|
|
2499
|
+
* Gets the inbox ID for a specific identifier using a Backend
|
|
2473
2500
|
*
|
|
2501
|
+
* @param backend - The Backend instance for API communication
|
|
2474
2502
|
* @param identifier - The identifier to get the inbox ID for
|
|
2475
|
-
* @param env - Optional XMTP environment configuration (default: "dev")
|
|
2476
|
-
* @param gatewayHost - Optional gateway host override
|
|
2477
2503
|
* @returns Promise that resolves with the inbox ID for the identifier
|
|
2478
2504
|
*/
|
|
2479
|
-
declare const getInboxIdForIdentifier: (
|
|
2505
|
+
declare const getInboxIdForIdentifier: (backend: Backend, identifier: Identifier) => Promise<string | undefined>;
|
|
2480
2506
|
|
|
2481
2507
|
/**
|
|
2482
2508
|
* Gets the name of a metadata field
|
|
@@ -2486,6 +2512,38 @@ declare const getInboxIdForIdentifier: (identifier: Identifier, env?: XmtpEnv, g
|
|
|
2486
2512
|
*/
|
|
2487
2513
|
declare const metadataFieldName: (field: MetadataField) => Promise<string>;
|
|
2488
2514
|
|
|
2515
|
+
/**
|
|
2516
|
+
* Pre-configured URLs for the XMTP network based on the environment
|
|
2517
|
+
*
|
|
2518
|
+
* @deprecated Use `createBackend()` instead.
|
|
2519
|
+
* @constant
|
|
2520
|
+
* @property {string} local - The local URL for the XMTP network
|
|
2521
|
+
* @property {string} dev - The development URL for the XMTP network
|
|
2522
|
+
* @property {string} production - The production URL for the XMTP network
|
|
2523
|
+
*/
|
|
2524
|
+
declare const ApiUrls: {
|
|
2525
|
+
readonly local: "http://localhost:5557";
|
|
2526
|
+
readonly dev: "https://api.dev.xmtp.network:5558";
|
|
2527
|
+
readonly production: "https://api.production.xmtp.network:5558";
|
|
2528
|
+
};
|
|
2529
|
+
/**
|
|
2530
|
+
* Pre-configured URLs for the XMTP history sync service based on the environment
|
|
2531
|
+
*
|
|
2532
|
+
* @constant
|
|
2533
|
+
* @property {string} local - The local URL for the XMTP history sync service
|
|
2534
|
+
* @property {string} dev - The development URL for the XMTP history sync service
|
|
2535
|
+
* @property {string} production - The production URL for the XMTP history sync service
|
|
2536
|
+
*/
|
|
2537
|
+
declare const HistorySyncUrls: {
|
|
2538
|
+
readonly local: "http://localhost:5558";
|
|
2539
|
+
readonly dev: "https://message-history.dev.ephemera.network";
|
|
2540
|
+
readonly production: "https://message-history.production.ephemera.network";
|
|
2541
|
+
readonly "testnet-staging": "https://message-history.dev.ephemera.network";
|
|
2542
|
+
readonly "testnet-dev": "https://message-history.dev.ephemera.network";
|
|
2543
|
+
readonly testnet: "https://message-history.dev.ephemera.network";
|
|
2544
|
+
readonly mainnet: "https://message-history.production.ephemera.network";
|
|
2545
|
+
};
|
|
2546
|
+
|
|
2489
2547
|
declare const encodeActions: (actions: _xmtp_wasm_bindings.Actions) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2490
2548
|
declare const encodeAttachment: (attachment: _xmtp_wasm_bindings.Attachment) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2491
2549
|
declare const encodeIntent: (intent: _xmtp_wasm_bindings.Intent) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
@@ -2561,5 +2619,5 @@ declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent>;
|
|
|
2561
2619
|
declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions>;
|
|
2562
2620
|
declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
|
|
2563
2621
|
|
|
2564
|
-
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 };
|
|
2565
|
-
export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions, EOASigner, EnrichedReply, ExtractCodecContentTypes, HmacKeys, LastReadTimes, NetworkOptions, OtherOptions, SCWSigner, SafeConversation, SafeSigner, Signer, StorageOptions, StreamCallback, StreamFunction, StreamOptions, StreamValueMutator, XmtpEnv };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{encodeActions as t,encodeAttachment as n,encodeIntent as s,encodeMarkdown as i,encodeMultiRemoteAttachment as r,encodeReaction as a,encodeReadReceipt as o,encodeRemoteAttachment as c,encodeText as d,encodeTransactionReference as u,encodeWalletSendCalls as h,contentTypeActions as p,contentTypeAttachment as l,contentTypeGroupUpdated as y,contentTypeIntent as g,contentTypeLeaveRequest as w,contentTypeMarkdown as m,contentTypeMultiRemoteAttachment as I,contentTypeReaction as k,contentTypeReadReceipt as f,contentTypeRemoteAttachment as v,contentTypeReply as x,contentTypeText as R,contentTypeTransactionReference as b,contentTypeWalletSendCalls as S,encryptAttachment as A,decryptAttachment as T,ConversationType as M,generateInboxId as D,getInboxIdForIdentifier as C,inboxStateFromInboxIds as q,applySignatureRequest as B,revokeInstallationsSignatureRequest as E,LogLevel as N,metadataFieldName as O}from"@xmtp/wasm-bindings";export{ActionStyle,ConsentEntityType,ConsentState,ContentType,ConversationType,DeliveryStatus,GroupMembershipState,GroupMessageKind,GroupPermissionsOptions,IdentifierKind,ListConversationsOrderBy,LogLevel,MessageSortBy,MetadataField,PermissionLevel,PermissionPolicy,PermissionUpdateType,ReactionAction,ReactionSchema,SortDirection}from"@xmtp/wasm-bindings";import{contentTypeToString as F}from"@xmtp/content-type-primitives";class P{#e;constructor(e){this.#e=new Map(e.map(e=>[F(e.contentType),e]))}getCodec(e){return this.#e.get(F(e))}}const L=t=>async(...n)=>(await e(),t(...n)),G=L(t),U=L(n),W=L(s),K=L(i),_=L(r),V=L(a),$=L(o),j=L(c),z=L(d),X=L(u),H=L(h),J=L(p),Q=L(l),Y=L(y),Z=L(g),ee=L(w),te=L(m),ne=L(I),se=L(k),ie=L(f),re=L(v),ae=L(x),oe=L(R),ce=L(b),de=L(S),ue=L(A),he=L(T);function pe(e){return new Date(Number(e/1000000n))}const le=e=>{switch(e.type){case"text":case"markdown":case"reply":case"reaction":case"attachment":case"remoteAttachment":case"multiRemoteAttachment":case"transactionReference":case"groupUpdated":case"readReceipt":case"leaveRequest":case"walletSendCalls":case"intent":case"actions":case"deletedMessage":case"custom":return e.content;default:return null}};class ye{content;contentType;conversationId;deliveryStatus;expiresAtNs;expiresAt;fallback;id;kind;numReplies;reactions;senderInboxId;sentAt;sentAtNs;constructor(e,t){switch(this.id=t.id,this.expiresAtNs=t.expiresAtNs,this.expiresAt=t.expiresAtNs?pe(t.expiresAtNs):void 0,this.sentAtNs=t.sentAtNs,this.sentAt=pe(t.sentAtNs),this.conversationId=t.conversationId,this.senderInboxId=t.senderInboxId,this.contentType=t.contentType,this.fallback=t.fallback??void 0,this.kind=t.kind,this.deliveryStatus=t.deliveryStatus,this.numReplies=t.numReplies,this.reactions=t.reactions.map(t=>new ye(e,t)),this.content=le(t.content)??void 0,t.content.type){case"reply":{const n=t.content.content;let s=le(n.content);if("custom"===n.content.type){const t=e.getCodec(n.content.content.type);if(t)try{s=t.decode(s)}catch(e){e instanceof Error?console.warn(`Error decoding custom content: ${e.message}`):console.warn("Error decoding custom content")}}this.content={referenceId:n.referenceId,content:s,contentType:()=>(async e=>{switch(e.type){case"text":return oe();case"markdown":return te();case"reply":return ae();case"reaction":return se();case"attachment":return Q();case"remoteAttachment":return re();case"multiRemoteAttachment":return ne();case"transactionReference":return ce();case"groupUpdated":return Y();case"readReceipt":return ie();case"leaveRequest":return ee();case"walletSendCalls":return de();case"intent":return Z();case"actions":return J();case"deletedMessage":default:return;case"custom":return e.content.type}})(n.content),inReplyTo:n.inReplyTo?new ye(e,n.inReplyTo):null};break}case"custom":{const n=t.content.content,s=e.getCodec(this.contentType);if(s)try{this.content=s.decode(n)}catch(e){e instanceof Error?console.warn(`Error decoding custom content: ${e.message}`):console.warn("Error decoding custom content"),this.content=void 0}else console.warn(`No codec found for content type "${F(this.contentType)}"`),this.content=void 0;break}}}}class ge{isDone=!1;#t=[];#n;onDone;onReturn;constructor(){this.#n=[],this.isDone=!1}flush(){for(;this.#t.length>0;){const e=this.#t.shift();e&&e({done:!0,value:void 0})}}done(){this.flush(),this.#n=[],this.#t=[],this.isDone=!0,this.onDone?.()}push=e=>{if(this.isDone)return;const t=this.#t.shift();t?t({done:!1,value:e}):this.#n.push(e)};next=()=>this.isDone?Promise.resolve({done:!0,value:void 0}):this.#n.length>0?Promise.resolve({done:!1,value:this.#n.shift()}):new Promise(e=>{this.#t.push(e)});return=()=>(this.onReturn?.(),this.done(),Promise.resolve({done:!0,value:void 0}));end=()=>this.return();[Symbol.asyncIterator](){return this}}const we=["end","isDone","next","return",Symbol.asyncIterator],me=e=>we.includes(e);class Ie extends Error{constructor(){super("Client not initialized, use Client.create or Client.build to create a client")}}class ke extends Error{constructor(){super("Signer unavailable, use Client.create to create a client with a signer")}}class fe extends Error{constructor(){super("Unable to create add account signature text, `allowInboxReassign` must be true")}}class ve extends Error{constructor(e){super(`Account already associated with inbox ${e}`)}}class xe extends Error{constructor(e){super(`Group "${e}" not found`)}}class Re extends Error{constructor(e){super(`Stream "${e}" not found`)}}class be extends Error{constructor(e){super(`Stream failed, retried ${e} ${"time"+(1!==e?"s":"")}`)}}class Se extends Error{constructor(){super("Stream retry attempts must be greater than 0")}}class Ae extends Error{constructor(){super("OPFS must be initialized before accessing its methods")}}class Te extends Error{constructor(){super("Failed to initialize OPFS, ensure that there are no other active XMTP clients or Opfs instances")}}const Me=1e4,De=6,Ce=async(e,t,n)=>{const{onEnd:s,onError:i,onFail:r,onRestart:a,onRetry:o,onValue:c,retryAttempts:d=De,retryDelay:u=Me,retryOnFail:h=!0}=n??{};if(h&&d<0)throw new Se;const p=new ge,l=(e,n)=>{if(e)i?.(e);else if(void 0!==n)try{if(t){const e=t(n);(e=>!!e&&("object"==typeof e||"function"==typeof e)&&"then"in e&&"function"==typeof e.then)(e)?e.then(e=>{void 0!==e&&(p.push(e),c?.(e))}).catch(e=>{i?.(e)}):void 0!==e&&(p.push(e),c?.(e))}else p.push(n),c?.(n)}catch(e){i?.(e)}},y=async(t=d)=>{try{if(0===t)throw p.end(),new be(d);await(n=u,new Promise(e=>setTimeout(e,n))),o?.(d-t+1,d);const i=await e(l,()=>{r?.(),y()});p.onDone=()=>{i(),s?.()},a?.()}catch(e){i?.(e),y(t-1)}var n},g=()=>{if(!h)throw p.end(),new be(0);y()};try{const t=await e(l,()=>{r?.(),g()});p.onDone=()=>{t(),s?.()}}catch(e){i?.(e),g()}return new Proxy(p,{get(e,t,n){if(me(t))return Reflect.get(e,t,n)},set:()=>!0,has:(e,t)=>me(t),ownKeys:()=>we,getOwnPropertyDescriptor(e,t){if(me(t))return{enumerable:!0,configurable:!0,value:Reflect.get(e,t)}}})},qe=()=>{const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")};class Be{#s;#i;#r;#a;#o;#c;constructor(e,t,n,s){this.#c=e,this.#i=t,this.#a=n,this.#d(s)}#d(e){this.#s=e?.addedByInboxId,this.#o=e?.metadata,this.#r=e?.createdAtNs}get id(){return this.#a}get addedByInboxId(){return this.#s}get createdAtNs(){return this.#r}get createdAt(){return this.#r?pe(this.#r):void 0}get metadata(){return this.#o}get topic(){return`/xmtp/mls/1/g-${this.id}/proto`}async lastMessage(){const e=await this.#c.action("conversation.lastMessage",{id:this.#a});return e?new ye(this.#i,e):void 0}async isActive(){return this.#c.action("conversation.isActive",{id:this.#a})}async members(){return this.#c.action("conversation.members",{id:this.#a})}async sync(){const e=await this.#c.action("conversation.sync",{id:this.#a});return this.#d(e),e}async publishMessages(){return this.#c.action("conversation.publishMessages",{id:this.#a})}async send(e,t){return this.#c.action("conversation.send",{id:this.#a,content:e,options:t})}async sendText(e,t){return this.#c.action("conversation.sendText",{id:this.#a,text:e,isOptimistic:t})}async sendMarkdown(e,t){return this.#c.action("conversation.sendMarkdown",{id:this.#a,markdown:e,isOptimistic:t})}async sendReaction(e,t){return this.#c.action("conversation.sendReaction",{id:this.#a,reaction:e,isOptimistic:t})}async sendReadReceipt(e){return this.#c.action("conversation.sendReadReceipt",{id:this.#a,isOptimistic:e})}async sendReply(e,t){return this.#c.action("conversation.sendReply",{id:this.#a,reply:e,isOptimistic:t})}async sendTransactionReference(e,t){return this.#c.action("conversation.sendTransactionReference",{id:this.#a,transactionReference:e,isOptimistic:t})}async sendWalletSendCalls(e,t){return this.#c.action("conversation.sendWalletSendCalls",{id:this.#a,walletSendCalls:e,isOptimistic:t})}async sendActions(e,t){return this.#c.action("conversation.sendActions",{id:this.#a,actions:e,isOptimistic:t})}async sendIntent(e,t){return this.#c.action("conversation.sendIntent",{id:this.#a,intent:e,isOptimistic:t})}async sendAttachment(e,t){return this.#c.action("conversation.sendAttachment",{id:this.#a,attachment:e,isOptimistic:t})}async sendMultiRemoteAttachment(e,t){return this.#c.action("conversation.sendMultiRemoteAttachment",{id:this.#a,multiRemoteAttachment:e,isOptimistic:t})}async sendRemoteAttachment(e,t){return this.#c.action("conversation.sendRemoteAttachment",{id:this.#a,remoteAttachment:e,isOptimistic:t})}async messages(e){return(await this.#c.action("conversation.messages",{id:this.#a,options:e})).map(e=>new ye(this.#i,e))}async countMessages(e){return await this.#c.action("conversation.countMessages",{id:this.#a,options:e})}async consentState(){return this.#c.action("conversation.consentState",{id:this.#a})}async updateConsentState(e){return this.#c.action("conversation.updateConsentState",{id:this.#a,state:e})}async messageDisappearingSettings(){return this.#c.action("conversation.messageDisappearingSettings",{id:this.#a})}async updateMessageDisappearingSettings(e,t){return this.#c.action("conversation.updateMessageDisappearingSettings",{id:this.#a,fromNs:e,inNs:t})}async removeMessageDisappearingSettings(){return this.#c.action("conversation.removeMessageDisappearingSettings",{id:this.#a})}async isMessageDisappearingEnabled(){return this.#c.action("conversation.isMessageDisappearingEnabled",{id:this.#a})}async stream(e){return Ce(async(t,n)=>{const s=qe();return e?.disableSync||await this.sync(),await this.#c.action("conversation.stream",{groupId:this.#a,streamId:s}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},e=>new ye(this.#i,e),e)}async pausedForVersion(){return this.#c.action("conversation.pausedForVersion",{id:this.#a})}async hmacKeys(){return this.#c.action("conversation.hmacKeys",{id:this.#a})}async debugInfo(){return this.#c.action("conversation.debugInfo",{id:this.#a})}async lastReadTimes(){return this.#c.action("conversation.lastReadTimes",{id:this.#a})}}class Ee extends Be{#i;#c;#a;constructor(e,t,n,s){super(e,t,n,s),this.#c=e,this.#i=t,this.#a=n}async peerInboxId(){return this.#c.action("dm.peerInboxId",{id:this.#a})}async duplicateDms(){return(await this.#c.action("dm.duplicateDms",{id:this.#a})).map(e=>new Ee(this.#c,this.#i,e.id,e))}}class Ne extends Be{#u=[];#h;#c;#p;#a;#l;#y;#g=[];#d(e){this.#y=e?.name??"",this.#l=e?.imageUrl??"",this.#p=e?.description??"",this.#h=e?.appData??"",this.#u=e?.admins??[],this.#g=e?.superAdmins??[]}constructor(e,t,n,s){super(e,t,n,s),this.#c=e,this.#a=n,this.#d(s)}async sync(){const e=await super.sync();return this.#d(e),e}get name(){return this.#y}async updateName(e){await this.#c.action("group.updateName",{id:this.#a,name:e}),this.#y=e}get imageUrl(){return this.#l}async updateImageUrl(e){await this.#c.action("group.updateImageUrl",{id:this.#a,imageUrl:e}),this.#l=e}get description(){return this.#p}async updateDescription(e){await this.#c.action("group.updateDescription",{id:this.#a,description:e}),this.#p=e}get appData(){return this.#h}async updateAppData(e){await this.#c.action("group.updateAppData",{id:this.#a,appData:e}),this.#h=e}get admins(){return this.#u}get superAdmins(){return this.#g}async listAdmins(){const e=await this.#c.action("group.listAdmins",{id:this.#a});return this.#u=e,e}async listSuperAdmins(){const e=await this.#c.action("group.listSuperAdmins",{id:this.#a});return this.#g=e,e}async permissions(){return this.#c.action("group.permissions",{id:this.#a})}async updatePermission(e,t,n){return this.#c.action("group.updatePermission",{id:this.#a,permissionType:e,policy:t,metadataField:n})}async isAdmin(e){return(await this.listAdmins()).includes(e)}async isSuperAdmin(e){return(await this.listSuperAdmins()).includes(e)}async addMembersByIdentifiers(e){return this.#c.action("group.addMembersByIdentifiers",{id:this.#a,identifiers:e})}async addMembers(e){return this.#c.action("group.addMembers",{id:this.#a,inboxIds:e})}async removeMembersByIdentifiers(e){return this.#c.action("group.removeMembersByIdentifiers",{id:this.#a,identifiers:e})}async removeMembers(e){return this.#c.action("group.removeMembers",{id:this.#a,inboxIds:e})}async addAdmin(e){return this.#c.action("group.addAdmin",{id:this.#a,inboxId:e})}async removeAdmin(e){return this.#c.action("group.removeAdmin",{id:this.#a,inboxId:e})}async addSuperAdmin(e){return this.#c.action("group.addSuperAdmin",{id:this.#a,inboxId:e})}async removeSuperAdmin(e){return this.#c.action("group.removeSuperAdmin",{id:this.#a,inboxId:e})}async requestRemoval(){return this.#c.action("group.requestRemoval",{id:this.#a})}async isPendingRemoval(){return this.#c.action("group.isPendingRemoval",{id:this.#a})}}class Oe{#w;#i;#c;constructor(e,t,n){this.#w=e,this.#c=t,this.#i=n}get topic(){return this.#w.installationId?`/xmtp/mls/1/w-${this.#w.installationId}/proto`:void 0}async sync(){return this.#c.action("conversations.sync")}async syncAll(e){return this.#c.action("conversations.syncAll",{consentStates:e})}async getConversationById(e){const t=await this.#c.action("conversations.getConversationById",{id:e});if(t)switch(t.metadata.conversationType){case M.Group:return new Ne(this.#c,this.#i,t.id,t);case M.Dm:return new Ee(this.#c,this.#i,t.id,t);default:return}}async getMessageById(e){const t=await this.#c.action("conversations.getMessageById",{id:e});return t?new ye(this.#i,t):void 0}async getDmByInboxId(e){const t=await this.#c.action("conversations.getDmByInboxId",{inboxId:e});return t?new Ee(this.#c,this.#i,t.id,t):void 0}async fetchDmByIdentifier(e){const t=await this.#c.action("client.getInboxIdByIdentifier",{identifier:e});if(t)return this.getDmByInboxId(t)}async list(e){return(await this.#c.action("conversations.list",{options:e})).map(e=>{switch(e.metadata.conversationType){case M.Dm:return new Ee(this.#c,this.#i,e.id,e);case M.Group:return new Ne(this.#c,this.#i,e.id,e);default:return}}).filter(e=>void 0!==e)}async listGroups(e){return(await this.#c.action("conversations.listGroups",{options:e})).map(e=>new Ne(this.#c,this.#i,e.id,e))}async listDms(e){return(await this.#c.action("conversations.listDms",{options:e})).map(e=>new Ee(this.#c,this.#i,e.id,e))}async createGroupOptimistic(e){const t=await this.#c.action("conversations.createGroupOptimistic",{options:e});return new Ne(this.#c,this.#i,t.id,t)}async createGroupWithIdentifiers(e,t){const n=await this.#c.action("conversations.createGroupWithIdentifiers",{identifiers:e,options:t});return new Ne(this.#c,this.#i,n.id,n)}async createGroup(e,t){const n=await this.#c.action("conversations.createGroup",{inboxIds:e,options:t});return new Ne(this.#c,this.#i,n.id,n)}async createDmWithIdentifier(e,t){const n=await this.#c.action("conversations.createDmWithIdentifier",{identifier:e,options:t});return new Ee(this.#c,this.#i,n.id,n)}async createDm(e,t){const n=await this.#c.action("conversations.createDm",{inboxId:e,options:t});return new Ee(this.#c,this.#i,n.id,n)}async hmacKeys(){return this.#c.action("conversations.hmacKeys")}async stream(e){return Ce(async(t,n)=>{const s=qe();return e?.disableSync||await this.sync(),await this.#c.action("conversations.stream",{streamId:s,conversationType:e?.conversationType}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},e=>{switch(e.metadata.conversationType){case M.Group:return new Ne(this.#c,this.#i,e.id,e);case M.Dm:return new Ee(this.#c,this.#i,e.id,e);default:return void console.warn(`Unknown conversation type: ${e.metadata.conversationType}`)}},e)}async streamGroups(e){return this.stream({...e,conversationType:M.Group})}async streamDms(e){return this.stream({...e,conversationType:M.Dm})}async streamAllMessages(e){return Ce(async(t,n)=>{const s=qe();return e?.disableSync||await this.sync(),await this.#c.action("conversations.streamAllMessages",{streamId:s,conversationType:e?.conversationType,consentStates:e?.consentStates}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},e=>new ye(this.#i,e),e)}async streamAllGroupMessages(e){return this.streamAllMessages({...e,conversationType:M.Group})}async streamAllDmMessages(e){return this.streamAllMessages({...e,conversationType:M.Dm})}async streamMessageDeletions(e){return Ce(async t=>{const n=qe();return await this.#c.action("conversations.streamDeletedMessages",{streamId:n}),this.#c.handleStreamMessage(n,t,e)},e=>e.id,e)}async streamDeletedMessages(e){return Ce(async t=>{const n=qe();return await this.#c.action("conversations.streamDeletedMessages",{streamId:n}),this.#c.handleStreamMessage(n,t,e)},e=>new ye(this.#i,e),e)}}class Fe{#c;constructor(e){this.#c=e}apiStatistics(){return this.#c.action("debugInformation.apiStatistics")}apiIdentityStatistics(){return this.#c.action("debugInformation.apiIdentityStatistics")}apiAggregateStatistics(){return this.#c.action("debugInformation.apiAggregateStatistics")}clearAllStatistics(){return this.#c.action("debugInformation.clearAllStatistics")}}class Pe{#c;constructor(e){this.#c=e}sync(){return this.#c.action("preferences.sync")}async inboxState(){return this.#c.action("preferences.inboxState",{refreshFromNetwork:!1})}async fetchInboxState(){return this.#c.action("preferences.inboxState",{refreshFromNetwork:!0})}async getInboxStates(e){return this.#c.action("preferences.getInboxStates",{inboxIds:e,refreshFromNetwork:!1})}async fetchInboxStates(e){return this.#c.action("preferences.getInboxStates",{inboxIds:e,refreshFromNetwork:!0})}async setConsentStates(e){return this.#c.action("preferences.setConsentStates",{records:e})}async getConsentState(e,t){return this.#c.action("preferences.getConsentState",{entityType:e,entity:t})}async streamConsent(e){return Ce(async(t,n)=>{const s=qe();return e?.disableSync||await this.sync(),await this.#c.action("preferences.streamConsent",{streamId:s}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},void 0,e)}async streamPreferences(e){return Ce(async(t,n)=>{const s=qe();return e?.disableSync||await this.sync(),await this.#c.action("preferences.streamPreferences",{streamId:s}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},void 0,e)}}const Le={local:"http://localhost:5557",dev:"https://api.dev.xmtp.network:5558",production:"https://api.production.xmtp.network:5558"},Ge={local:"http://localhost:5558",dev:"https://message-history.dev.ephemera.network",production:"https://message-history.production.ephemera.network"},Ue=async(t,n)=>(await e(),D(t,n)),We=async(t,n,s)=>{await e();const i=n?Le[n]:Le.dev,r=i.startsWith("https");return C(i,s??null,r,t)},Ke=async(t,n,s,i,r)=>{await e();const a=await t.getIdentifier(),{signatureText:o,signatureRequest:c}=await(async(t,n,s,i,r)=>{await e();const a=E(Le[i??"dev"],r??null,t,n,s);return{signatureText:await a.signatureText(),signatureRequest:a}})(a,n,s,i,r),d=await t.signMessage(o),u=Le[i??"dev"];switch(t.type){case"EOA":await c.addEcdsaSignature(d);break;case"SCW":await c.addScwSignature(a,d,t.getChainId(),t.getBlockNumber?.())}await B(u,r??null,c)},_e=async(e,t)=>{switch(e.type){case"EOA":return{type:"EOA",identifier:await e.getIdentifier(),signature:t};case"SCW":return{type:"SCW",identifier:await e.getIdentifier(),signature:t,chainId:e.getChainId(),blockNumber:e.getBlockNumber?.()}}},Ve=e=>{console.error(`[worker] error: ${e.message}`)};class $e{#c;#m;#I=new Map;constructor(e,t){this.#c=e,this.#c.addEventListener("message",this.handleMessage),this.#c.addEventListener("error",Ve),this.#m=t??!1}action(e,...t){const n=qe();this.#c.postMessage({action:e,id:n,data:t[0]});return new Promise((e,t)=>{this.#I.set(n,{resolve:e,reject:t})})}handleMessage=e=>{const t=e.data;this.#m&&console.log("[worker] client received event data",t);const n=this.#I.get(t.id);n&&(this.#I.delete(t.id),"error"in t?n.reject(t.error):n.resolve(t.result))};handleStreamMessage=(e,t,n)=>{const s=s=>{const i=s.data;if(i.streamId===e){if("stream.fail"===i.action)return void n?.onFail?.();"error"in i?t(i.error,void 0):t(null,i.result)}};return this.#c.addEventListener("message",s),async()=>{await this.action("endStream",{streamId:e}),this.#c.removeEventListener("message",s)}};close(){this.#c.removeEventListener("message",this.handleMessage),this.#c.removeEventListener("error",Ve),this.#c.terminate()}}class je{#k;#i;#f;#v;#x;#R;#b;#S;#A=!1;#T;#M;#D;#C;#c;constructor(e){const t=new Worker(new URL("./workers/client",import.meta.url),{type:"module"}),n=void 0!==e?.loggingLevel&&e.loggingLevel!==N.Off;this.#c=new $e(t,n),this.#M=e,this.#i=new P([...e?.codecs??[]]),this.#f=new Oe(this,this.#c,this.#i),this.#v=new Fe(this.#c),this.#D=new Pe(this.#c)}async init(e){const t=await this.#c.action("client.init",{identifier:e,options:this.#M});this.#k=t.appVersion,this.#x=e,this.#R=t.inboxId,this.#b=t.installationId,this.#S=t.installationIdBytes,this.#T=t.libxmtpVersion,this.#A=!0}close(){this.#c.close(),this.#A=!1}static async create(e,t){const n=new je(t);return n.#C=e,await n.init(await e.getIdentifier()),t?.disableAutoRegister||await n.register(),n}static async build(e,t){const n=new je({...t,disableAutoRegister:!0});return await n.init(e),n}get options(){return this.#M}get signer(){return this.#C}get isReady(){return this.#A}get inboxId(){return this.#R}get accountIdentifier(){return this.#x}get installationId(){return this.#b}get installationIdBytes(){return this.#S}get conversations(){return this.#f}get debugInformation(){return this.#v}get preferences(){return this.#D}get libxmtpVersion(){return this.#T}get appVersion(){return this.#k}async unsafe_createInboxSignatureText(){return this.#c.action("client.createInboxSignatureText",{signatureRequestId:qe()})}async unsafe_addAccountSignatureText(e,t=!1){if(!t)throw new fe;return this.#c.action("client.addAccountSignatureText",{newIdentifier:e,signatureRequestId:qe()})}async unsafe_removeAccountSignatureText(e){return this.#c.action("client.removeAccountSignatureText",{identifier:e,signatureRequestId:qe()})}async unsafe_revokeAllOtherInstallationsSignatureText(){return this.#c.action("client.revokeAllOtherInstallationsSignatureText",{signatureRequestId:qe()})}async unsafe_revokeInstallationsSignatureText(e){return this.#c.action("client.revokeInstallationsSignatureText",{installationIds:e,signatureRequestId:qe()})}async unsafe_changeRecoveryIdentifierSignatureText(e){return this.#c.action("client.changeRecoveryIdentifierSignatureText",{identifier:e,signatureRequestId:qe()})}async unsafe_applySignatureRequest(e,t){return this.#c.action("client.applySignatureRequest",{signer:e,signatureRequestId:t})}async register(){if(!this.#C)throw new ke;const{signatureText:e,signatureRequestId:t}=await this.unsafe_createInboxSignatureText();if(!e||!t)return;const n=await this.#C.signMessage(e),s=await _e(this.#C,n);return this.#c.action("client.registerIdentity",{signer:s,signatureRequestId:t})}async unsafe_addAccount(e,t=!1){if(!this.#C)throw new ke;if(!t)throw new fe;const n=await this.fetchInboxIdByIdentifier(await e.getIdentifier());if(n)throw new ve(n);const{signatureText:s,signatureRequestId:i}=await this.unsafe_addAccountSignatureText(await e.getIdentifier(),!0),r=await e.signMessage(s),a=await _e(e,r);return this.#c.action("client.addAccount",{identifier:a.identifier,signer:a,signatureRequestId:i})}async removeAccount(e){if(!this.#C)throw new ke;const{signatureText:t,signatureRequestId:n}=await this.unsafe_removeAccountSignatureText(e),s=await this.#C.signMessage(t),i=await _e(this.#C,s);return this.#c.action("client.removeAccount",{identifier:e,signer:i,signatureRequestId:n})}async revokeAllOtherInstallations(){if(!this.#C)throw new ke;const{signatureText:e,signatureRequestId:t}=await this.unsafe_revokeAllOtherInstallationsSignatureText();if(!e)return;const n=await this.#C.signMessage(e),s=await _e(this.#C,n);return this.#c.action("client.revokeAllOtherInstallations",{signer:s,signatureRequestId:t})}async revokeInstallations(e){if(!this.#C)throw new ke;const{signatureText:t,signatureRequestId:n}=await this.unsafe_revokeInstallationsSignatureText(e),s=await this.#C.signMessage(t),i=await _e(this.#C,s);return this.#c.action("client.revokeInstallations",{installationIds:e,signer:i,signatureRequestId:n})}static async revokeInstallations(e,t,n,s,i){await Ke(e,t,n,s,i)}static async fetchInboxStates(t,n,s){return(async(t,n,s)=>(await e(),q(Le[n??"dev"],s??null,t)))(t,n,s)}async changeRecoveryIdentifier(e){if(!this.#C)throw new ke;const{signatureText:t,signatureRequestId:n}=await this.unsafe_changeRecoveryIdentifierSignatureText(e),s=await this.#C.signMessage(t),i=await _e(this.#C,s);return this.#c.action("client.changeRecoveryIdentifier",{identifier:e,signer:i,signatureRequestId:n})}async isRegistered(){return this.#c.action("client.isRegistered")}async canMessage(e){return this.#c.action("client.canMessage",{identifiers:e})}static async canMessage(e,t){const n=new Map;for(const s of e){const e=await We(s,t);n.set(s.identifier.toLowerCase(),void 0!==e)}return n}async fetchInboxIdByIdentifier(e){return this.#c.action("client.getInboxIdByIdentifier",{identifier:e})}signWithInstallationKey(e){return this.#c.action("client.signWithInstallationKey",{signatureText:e})}verifySignedWithInstallationKey(e,t){return this.#c.action("client.verifySignedWithInstallationKey",{signatureText:e,signatureBytes:t})}verifySignedWithPublicKey(e,t,n){return this.#c.action("client.verifySignedWithPublicKey",{signatureText:e,signatureBytes:t,publicKey:n})}async fetchKeyPackageStatuses(e){return this.#c.action("client.fetchKeyPackageStatuses",{installationIds:e})}async sendSyncRequest(){return this.#c.action("client.sendSyncRequest")}}class ze{#c;#m;constructor(e){const t=new Worker(new URL("./workers/opfs",import.meta.url),{type:"module"});this.#c=new $e(t,e),this.#m=e??!1}async init(){await this.#c.action("opfs.init",{enableLogging:this.#m})}close(){this.#c.close()}static async create(e){const t=new ze(e);return await t.init(),t}async listFiles(){return this.#c.action("opfs.listFiles")}async fileCount(){return this.#c.action("opfs.fileCount")}async poolCapacity(){return this.#c.action("opfs.poolCapacity")}async fileExists(e){return this.#c.action("opfs.fileExists",{path:e})}async deleteFile(e){return this.#c.action("opfs.deleteFile",{path:e})}async exportDb(e){return this.#c.action("opfs.exportDb",{path:e})}async importDb(e,t){return this.#c.action("opfs.importDb",{path:e,data:t})}async clearAll(){return this.#c.action("opfs.clearAll")}}const Xe=async t=>(await e(),O(t)),He=async e=>({id:e.id,name:e.name,imageUrl:e.imageUrl,description:e.description,appData:e.appData,permissions:e.permissions(),addedByInboxId:e.addedByInboxId,metadata:await e.metadata(),admins:e.listAdmins(),superAdmins:e.listSuperAdmins(),createdAtNs:e.createdAtNs}),Je=e=>"xmtp.org"===e.contentType.authorityId&&"reaction"===e.contentType.typeId,Qe=e=>"xmtp.org"===e.contentType.authorityId&&"reply"===e.contentType.typeId,Ye=e=>Qe(e)&&"string"==typeof e.content?.content,Ze=e=>"xmtp.org"===e.contentType.authorityId&&"text"===e.contentType.typeId,et=e=>"xmtp.org"===e.contentType.authorityId&&"remoteStaticAttachment"===e.contentType.typeId,tt=e=>"xmtp.org"===e.contentType.authorityId&&"attachment"===e.contentType.typeId,nt=e=>"xmtp.org"===e.contentType.authorityId&&"multiRemoteStaticAttachment"===e.contentType.typeId,st=e=>"xmtp.org"===e.contentType.authorityId&&"transactionReference"===e.contentType.typeId,it=e=>"xmtp.org"===e.contentType.authorityId&&"group_updated"===e.contentType.typeId,rt=e=>"xmtp.org"===e.contentType.authorityId&&"readReceipt"===e.contentType.typeId,at=e=>"xmtp.org"===e.contentType.authorityId&&"leave_request"===e.contentType.typeId,ot=e=>"xmtp.org"===e.contentType.authorityId&&"walletSendCalls"===e.contentType.typeId,ct=e=>"coinbase.com"===e.contentType.authorityId&&"intent"===e.contentType.typeId,dt=e=>"coinbase.com"===e.contentType.authorityId&&"actions"===e.contentType.typeId,ut=e=>"xmtp.org"===e.contentType.authorityId&&"markdown"===e.contentType.typeId;export{ve as AccountAlreadyAssociatedError,Le as ApiUrls,je as Client,Ie as ClientNotInitializedError,Be as Conversation,Oe as Conversations,ye as DecodedMessage,Ee as Dm,Ne as Group,xe as GroupNotFoundError,Ge as HistorySyncUrls,fe as InboxReassignError,ze as Opfs,Te as OpfsInitializationError,Ae as OpfsNotInitializedError,ke as SignerUnavailableError,be as StreamFailedError,Se as StreamInvalidRetryAttemptsError,Re as StreamNotFoundError,J as contentTypeActions,Q as contentTypeAttachment,Y as contentTypeGroupUpdated,Z as contentTypeIntent,ee as contentTypeLeaveRequest,te as contentTypeMarkdown,ne as contentTypeMultiRemoteAttachment,se as contentTypeReaction,ie as contentTypeReadReceipt,re as contentTypeRemoteAttachment,ae as contentTypeReply,oe as contentTypeText,ce as contentTypeTransactionReference,de as contentTypeWalletSendCalls,he as decryptAttachment,G as encodeActions,U as encodeAttachment,W as encodeIntent,K as encodeMarkdown,_ as encodeMultiRemoteAttachment,V as encodeReaction,$ as encodeReadReceipt,j as encodeRemoteAttachment,z as encodeText,X as encodeTransactionReference,H as encodeWalletSendCalls,ue as encryptAttachment,Ue as generateInboxId,We as getInboxIdForIdentifier,dt as isActions,tt as isAttachment,it as isGroupUpdated,ct as isIntent,at as isLeaveRequest,ut as isMarkdown,nt as isMultiRemoteAttachment,Je as isReaction,rt as isReadReceipt,et as isRemoteAttachment,Qe as isReply,Ze as isText,Ye as isTextReply,st as isTransactionReference,ot as isWalletSendCalls,Xe as metadataFieldName,He as toSafeConversation,_e as toSafeSigner};
|
|
1
|
+
import e,{encodeActions as t,encodeAttachment as n,encodeIntent as s,encodeMarkdown as i,encodeMultiRemoteAttachment as r,encodeReaction as a,encodeReadReceipt as o,encodeRemoteAttachment as c,encodeText as d,encodeTransactionReference as u,encodeWalletSendCalls as h,contentTypeActions as p,contentTypeAttachment as l,contentTypeGroupUpdated as y,contentTypeIntent as g,contentTypeLeaveRequest as w,contentTypeMarkdown as m,contentTypeMultiRemoteAttachment as k,contentTypeReaction as I,contentTypeReadReceipt as v,contentTypeRemoteAttachment as f,contentTypeReply as x,contentTypeText as R,contentTypeTransactionReference as b,contentTypeWalletSendCalls as S,encryptAttachment as A,decryptAttachment as T,ConversationType as M,XmtpEnv as D,BackendBuilder as C,generateInboxId as q,getInboxIdForIdentifier as B,inboxStateFromInboxIds as E,applySignatureRequest as N,revokeInstallationsSignatureRequest as O,LogLevel as P,Backend as F,metadataFieldName as L}from"@xmtp/wasm-bindings";export{ActionStyle,BackupElementSelectionOption,ConsentEntityType,ConsentState,ContentType,ConversationType,DeliveryStatus,GroupMembershipState,GroupMessageKind,GroupPermissionsOptions,IdentifierKind,ListConversationsOrderBy,LogLevel,MessageSortBy,MetadataField,PermissionLevel,PermissionPolicy,PermissionUpdateType,ReactionAction,ReactionSchema,SortDirection}from"@xmtp/wasm-bindings";import{contentTypeToString as U}from"@xmtp/content-type-primitives";class G{#e;constructor(e){this.#e=new Map(e.map(e=>[U(e.contentType),e]))}getCodec(e){return this.#e.get(U(e))}}const W=t=>async(...n)=>(await e(),t(...n)),V=W(t),K=W(n),_=W(s),$=W(i),j=W(r),H=W(a),z=W(o),X=W(c),J=W(d),Q=W(u),Y=W(h),Z=W(p),ee=W(l),te=W(y),ne=W(g),se=W(w),ie=W(m),re=W(k),ae=W(I),oe=W(v),ce=W(f),de=W(x),ue=W(R),he=W(b),pe=W(S),le=W(A),ye=W(T);function ge(e){return new Date(Number(e/1000000n))}const we=e=>{switch(e.type){case"text":case"markdown":case"reply":case"reaction":case"attachment":case"remoteAttachment":case"multiRemoteAttachment":case"transactionReference":case"groupUpdated":case"readReceipt":case"leaveRequest":case"walletSendCalls":case"intent":case"actions":case"deletedMessage":case"custom":return e.content;default:return null}};class me{content;contentType;conversationId;deliveryStatus;expiresAtNs;expiresAt;fallback;id;kind;numReplies;reactions;senderInboxId;sentAt;sentAtNs;constructor(e,t){switch(this.id=t.id,this.expiresAtNs=t.expiresAtNs,this.expiresAt=t.expiresAtNs?ge(t.expiresAtNs):void 0,this.sentAtNs=t.sentAtNs,this.sentAt=ge(t.sentAtNs),this.conversationId=t.conversationId,this.senderInboxId=t.senderInboxId,this.contentType=t.contentType,this.fallback=t.fallback??void 0,this.kind=t.kind,this.deliveryStatus=t.deliveryStatus,this.numReplies=t.numReplies,this.reactions=t.reactions.map(t=>new me(e,t)),this.content=we(t.content)??void 0,t.content.type){case"reply":{const n=t.content.content;let s=we(n.content);if("custom"===n.content.type){const t=e.getCodec(n.content.content.type);if(t)try{s=t.decode(s)}catch(e){e instanceof Error?console.warn(`Error decoding custom content: ${e.message}`):console.warn("Error decoding custom content")}}this.content={referenceId:n.referenceId,content:s,contentType:()=>(async e=>{switch(e.type){case"text":return ue();case"markdown":return ie();case"reply":return de();case"reaction":return ae();case"attachment":return ee();case"remoteAttachment":return ce();case"multiRemoteAttachment":return re();case"transactionReference":return he();case"groupUpdated":return te();case"readReceipt":return oe();case"leaveRequest":return se();case"walletSendCalls":return pe();case"intent":return ne();case"actions":return Z();case"deletedMessage":default:return;case"custom":return e.content.type}})(n.content),inReplyTo:n.inReplyTo?new me(e,n.inReplyTo):null};break}case"custom":{const n=t.content.content,s=e.getCodec(this.contentType);if(s)try{this.content=s.decode(n)}catch(e){e instanceof Error?console.warn(`Error decoding custom content: ${e.message}`):console.warn("Error decoding custom content"),this.content=void 0}else console.warn(`No codec found for content type "${U(this.contentType)}"`),this.content=void 0;break}}}}class ke{isDone=!1;#t=[];#n;onDone;onReturn;constructor(){this.#n=[],this.isDone=!1}flush(){for(;this.#t.length>0;){const e=this.#t.shift();e&&e({done:!0,value:void 0})}}done(){this.flush(),this.#n=[],this.#t=[],this.isDone=!0,this.onDone?.()}push=e=>{if(this.isDone)return;const t=this.#t.shift();t?t({done:!1,value:e}):this.#n.push(e)};next=()=>this.isDone?Promise.resolve({done:!0,value:void 0}):this.#n.length>0?Promise.resolve({done:!1,value:this.#n.shift()}):new Promise(e=>{this.#t.push(e)});return=()=>(this.onReturn?.(),this.done(),Promise.resolve({done:!0,value:void 0}));end=()=>this.return();[Symbol.asyncIterator](){return this}}const Ie=["end","isDone","next","return",Symbol.asyncIterator],ve=e=>Ie.includes(e);class fe extends Error{constructor(){super("Client not initialized, use Client.create or Client.build to create a client")}}class xe extends Error{constructor(){super("Signer unavailable, use Client.create to create a client with a signer")}}class Re extends Error{constructor(){super("Unable to create add account signature text, `allowInboxReassign` must be true")}}class be extends Error{constructor(e){super(`Account already associated with inbox ${e}`)}}class Se extends Error{constructor(e){super(`Group "${e}" not found`)}}class Ae extends Error{constructor(e){super(`Stream "${e}" not found`)}}class Te extends Error{constructor(e){super(`Stream failed, retried ${e} ${"time"+(1!==e?"s":"")}`)}}class Me extends Error{constructor(){super("Stream retry attempts must be greater than 0")}}class De extends Error{constructor(){super("OPFS must be initialized before accessing its methods")}}class Ce extends Error{constructor(){super("Failed to initialize OPFS, ensure that there are no other active XMTP clients or Opfs instances")}}const qe=1e4,Be=6,Ee=async(e,t,n)=>{const{onEnd:s,onError:i,onFail:r,onRestart:a,onRetry:o,onValue:c,retryAttempts:d=Be,retryDelay:u=qe,retryOnFail:h=!0}=n??{};if(h&&d<0)throw new Me;const p=new ke,l=(e,n)=>{if(e)i?.(e);else if(void 0!==n)try{if(t){const e=t(n);(e=>!!e&&("object"==typeof e||"function"==typeof e)&&"then"in e&&"function"==typeof e.then)(e)?e.then(e=>{void 0!==e&&(p.push(e),c?.(e))}).catch(e=>{i?.(e)}):void 0!==e&&(p.push(e),c?.(e))}else p.push(n),c?.(n)}catch(e){i?.(e)}},y=async(t=d)=>{try{if(0===t)throw p.end(),new Te(d);await(n=u,new Promise(e=>setTimeout(e,n))),o?.(d-t+1,d);const i=await e(l,()=>{r?.(),y()});p.onDone=()=>{i(),s?.()},a?.()}catch(e){i?.(e),y(t-1)}var n},g=()=>{if(!h)throw p.end(),new Te(0);y()};try{const t=await e(l,()=>{r?.(),g()});p.onDone=()=>{t(),s?.()}}catch(e){i?.(e),g()}return new Proxy(p,{get(e,t,n){if(ve(t))return Reflect.get(e,t,n)},set:()=>!0,has:(e,t)=>ve(t),ownKeys:()=>Ie,getOwnPropertyDescriptor(e,t){if(ve(t))return{enumerable:!0,configurable:!0,value:Reflect.get(e,t)}}})},Ne=()=>{const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")};class Oe{#s;#i;#r;#a;#o;#c;constructor(e,t,n,s){this.#c=e,this.#i=t,this.#a=n,this.#d(s)}#d(e){this.#s=e?.addedByInboxId,this.#o=e?.metadata,this.#r=e?.createdAtNs}get id(){return this.#a}get addedByInboxId(){return this.#s}get createdAtNs(){return this.#r}get createdAt(){return this.#r?ge(this.#r):void 0}get metadata(){return this.#o}get topic(){return`/xmtp/mls/1/g-${this.id}/proto`}async lastMessage(){const e=await this.#c.action("conversation.lastMessage",{id:this.#a});return e?new me(this.#i,e):void 0}async isActive(){return this.#c.action("conversation.isActive",{id:this.#a})}async members(){return this.#c.action("conversation.members",{id:this.#a})}async sync(){const e=await this.#c.action("conversation.sync",{id:this.#a});return this.#d(e),e}async publishMessages(){return this.#c.action("conversation.publishMessages",{id:this.#a})}async send(e,t){return this.#c.action("conversation.send",{id:this.#a,content:e,options:t})}async sendText(e,t){return this.#c.action("conversation.sendText",{id:this.#a,text:e,isOptimistic:t})}async sendMarkdown(e,t){return this.#c.action("conversation.sendMarkdown",{id:this.#a,markdown:e,isOptimistic:t})}async sendReaction(e,t){return this.#c.action("conversation.sendReaction",{id:this.#a,reaction:e,isOptimistic:t})}async sendReadReceipt(e){return this.#c.action("conversation.sendReadReceipt",{id:this.#a,isOptimistic:e})}async sendReply(e,t){return this.#c.action("conversation.sendReply",{id:this.#a,reply:e,isOptimistic:t})}async sendTransactionReference(e,t){return this.#c.action("conversation.sendTransactionReference",{id:this.#a,transactionReference:e,isOptimistic:t})}async sendWalletSendCalls(e,t){return this.#c.action("conversation.sendWalletSendCalls",{id:this.#a,walletSendCalls:e,isOptimistic:t})}async sendActions(e,t){return this.#c.action("conversation.sendActions",{id:this.#a,actions:e,isOptimistic:t})}async sendIntent(e,t){return this.#c.action("conversation.sendIntent",{id:this.#a,intent:e,isOptimistic:t})}async sendAttachment(e,t){return this.#c.action("conversation.sendAttachment",{id:this.#a,attachment:e,isOptimistic:t})}async sendMultiRemoteAttachment(e,t){return this.#c.action("conversation.sendMultiRemoteAttachment",{id:this.#a,multiRemoteAttachment:e,isOptimistic:t})}async sendRemoteAttachment(e,t){return this.#c.action("conversation.sendRemoteAttachment",{id:this.#a,remoteAttachment:e,isOptimistic:t})}async messages(e){return(await this.#c.action("conversation.messages",{id:this.#a,options:e})).map(e=>new me(this.#i,e))}async countMessages(e){return await this.#c.action("conversation.countMessages",{id:this.#a,options:e})}async consentState(){return this.#c.action("conversation.consentState",{id:this.#a})}async updateConsentState(e){return this.#c.action("conversation.updateConsentState",{id:this.#a,state:e})}async messageDisappearingSettings(){return this.#c.action("conversation.messageDisappearingSettings",{id:this.#a})}async updateMessageDisappearingSettings(e,t){return this.#c.action("conversation.updateMessageDisappearingSettings",{id:this.#a,fromNs:e,inNs:t})}async removeMessageDisappearingSettings(){return this.#c.action("conversation.removeMessageDisappearingSettings",{id:this.#a})}async isMessageDisappearingEnabled(){return this.#c.action("conversation.isMessageDisappearingEnabled",{id:this.#a})}async stream(e){return Ee(async(t,n)=>{const s=Ne();return e?.disableSync||await this.sync(),await this.#c.action("conversation.stream",{groupId:this.#a,streamId:s}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},e=>new me(this.#i,e),e)}async pausedForVersion(){return this.#c.action("conversation.pausedForVersion",{id:this.#a})}async hmacKeys(){return this.#c.action("conversation.hmacKeys",{id:this.#a})}async debugInfo(){return this.#c.action("conversation.debugInfo",{id:this.#a})}async lastReadTimes(){return this.#c.action("conversation.lastReadTimes",{id:this.#a})}}class Pe extends Oe{#i;#c;#a;constructor(e,t,n,s){super(e,t,n,s),this.#c=e,this.#i=t,this.#a=n}async peerInboxId(){return this.#c.action("dm.peerInboxId",{id:this.#a})}async duplicateDms(){return(await this.#c.action("dm.duplicateDms",{id:this.#a})).map(e=>new Pe(this.#c,this.#i,e.id,e))}}class Fe extends Oe{#u=[];#h;#c;#p;#a;#l;#y;#g=[];#d(e){this.#y=e?.name??"",this.#l=e?.imageUrl??"",this.#p=e?.description??"",this.#h=e?.appData??"",this.#u=e?.admins??[],this.#g=e?.superAdmins??[]}constructor(e,t,n,s){super(e,t,n,s),this.#c=e,this.#a=n,this.#d(s)}async sync(){const e=await super.sync();return this.#d(e),e}get name(){return this.#y}async updateName(e){await this.#c.action("group.updateName",{id:this.#a,name:e}),this.#y=e}get imageUrl(){return this.#l}async updateImageUrl(e){await this.#c.action("group.updateImageUrl",{id:this.#a,imageUrl:e}),this.#l=e}get description(){return this.#p}async updateDescription(e){await this.#c.action("group.updateDescription",{id:this.#a,description:e}),this.#p=e}get appData(){return this.#h}async updateAppData(e){await this.#c.action("group.updateAppData",{id:this.#a,appData:e}),this.#h=e}get admins(){return this.#u}get superAdmins(){return this.#g}async listAdmins(){const e=await this.#c.action("group.listAdmins",{id:this.#a});return this.#u=e,e}async listSuperAdmins(){const e=await this.#c.action("group.listSuperAdmins",{id:this.#a});return this.#g=e,e}async permissions(){return this.#c.action("group.permissions",{id:this.#a})}async updatePermission(e,t,n){return this.#c.action("group.updatePermission",{id:this.#a,permissionType:e,policy:t,metadataField:n})}async isAdmin(e){return(await this.listAdmins()).includes(e)}async isSuperAdmin(e){return(await this.listSuperAdmins()).includes(e)}async addMembersByIdentifiers(e){return this.#c.action("group.addMembersByIdentifiers",{id:this.#a,identifiers:e})}async addMembers(e){return this.#c.action("group.addMembers",{id:this.#a,inboxIds:e})}async removeMembersByIdentifiers(e){return this.#c.action("group.removeMembersByIdentifiers",{id:this.#a,identifiers:e})}async removeMembers(e){return this.#c.action("group.removeMembers",{id:this.#a,inboxIds:e})}async addAdmin(e){return this.#c.action("group.addAdmin",{id:this.#a,inboxId:e})}async removeAdmin(e){return this.#c.action("group.removeAdmin",{id:this.#a,inboxId:e})}async addSuperAdmin(e){return this.#c.action("group.addSuperAdmin",{id:this.#a,inboxId:e})}async removeSuperAdmin(e){return this.#c.action("group.removeSuperAdmin",{id:this.#a,inboxId:e})}async requestRemoval(){return this.#c.action("group.requestRemoval",{id:this.#a})}async isPendingRemoval(){return this.#c.action("group.isPendingRemoval",{id:this.#a})}}class Le{#w;#i;#c;constructor(e,t,n){this.#w=e,this.#c=t,this.#i=n}get topic(){return this.#w.installationId?`/xmtp/mls/1/w-${this.#w.installationId}/proto`:void 0}async sync(){return this.#c.action("conversations.sync")}async syncAll(e){return this.#c.action("conversations.syncAll",{consentStates:e})}async getConversationById(e){const t=await this.#c.action("conversations.getConversationById",{id:e});if(t)switch(t.metadata.conversationType){case M.Group:return new Fe(this.#c,this.#i,t.id,t);case M.Dm:return new Pe(this.#c,this.#i,t.id,t);default:return}}async getMessageById(e){const t=await this.#c.action("conversations.getMessageById",{id:e});return t?new me(this.#i,t):void 0}async getDmByInboxId(e){const t=await this.#c.action("conversations.getDmByInboxId",{inboxId:e});return t?new Pe(this.#c,this.#i,t.id,t):void 0}async fetchDmByIdentifier(e){const t=await this.#c.action("client.getInboxIdByIdentifier",{identifier:e});if(t)return this.getDmByInboxId(t)}async list(e){return(await this.#c.action("conversations.list",{options:e})).map(e=>{switch(e.metadata.conversationType){case M.Dm:return new Pe(this.#c,this.#i,e.id,e);case M.Group:return new Fe(this.#c,this.#i,e.id,e);default:return}}).filter(e=>void 0!==e)}async listGroups(e){return(await this.#c.action("conversations.listGroups",{options:e})).map(e=>new Fe(this.#c,this.#i,e.id,e))}async listDms(e){return(await this.#c.action("conversations.listDms",{options:e})).map(e=>new Pe(this.#c,this.#i,e.id,e))}async createGroupOptimistic(e){const t=await this.#c.action("conversations.createGroupOptimistic",{options:e});return new Fe(this.#c,this.#i,t.id,t)}async createGroupWithIdentifiers(e,t){const n=await this.#c.action("conversations.createGroupWithIdentifiers",{identifiers:e,options:t});return new Fe(this.#c,this.#i,n.id,n)}async createGroup(e,t){const n=await this.#c.action("conversations.createGroup",{inboxIds:e,options:t});return new Fe(this.#c,this.#i,n.id,n)}async createDmWithIdentifier(e,t){const n=await this.#c.action("conversations.createDmWithIdentifier",{identifier:e,options:t});return new Pe(this.#c,this.#i,n.id,n)}async createDm(e,t){const n=await this.#c.action("conversations.createDm",{inboxId:e,options:t});return new Pe(this.#c,this.#i,n.id,n)}async hmacKeys(){return this.#c.action("conversations.hmacKeys")}async stream(e){return Ee(async(t,n)=>{const s=Ne();return e?.disableSync||await this.sync(),await this.#c.action("conversations.stream",{streamId:s,conversationType:e?.conversationType}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},e=>{switch(e.metadata.conversationType){case M.Group:return new Fe(this.#c,this.#i,e.id,e);case M.Dm:return new Pe(this.#c,this.#i,e.id,e);default:return void console.warn(`Unknown conversation type: ${e.metadata.conversationType}`)}},e)}async streamGroups(e){return this.stream({...e,conversationType:M.Group})}async streamDms(e){return this.stream({...e,conversationType:M.Dm})}async streamAllMessages(e){return Ee(async(t,n)=>{const s=Ne();return e?.disableSync||await this.sync(),await this.#c.action("conversations.streamAllMessages",{streamId:s,conversationType:e?.conversationType,consentStates:e?.consentStates}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},e=>new me(this.#i,e),e)}async streamAllGroupMessages(e){return this.streamAllMessages({...e,conversationType:M.Group})}async streamAllDmMessages(e){return this.streamAllMessages({...e,conversationType:M.Dm})}async streamMessageDeletions(e){return Ee(async t=>{const n=Ne();return await this.#c.action("conversations.streamDeletedMessages",{streamId:n}),this.#c.handleStreamMessage(n,t,e)},e=>e.id,e)}async streamDeletedMessages(e){return Ee(async t=>{const n=Ne();return await this.#c.action("conversations.streamDeletedMessages",{streamId:n}),this.#c.handleStreamMessage(n,t,e)},e=>new me(this.#i,e),e)}}class Ue{#c;constructor(e){this.#c=e}apiStatistics(){return this.#c.action("debugInformation.apiStatistics")}apiIdentityStatistics(){return this.#c.action("debugInformation.apiIdentityStatistics")}apiAggregateStatistics(){return this.#c.action("debugInformation.apiAggregateStatistics")}clearAllStatistics(){return this.#c.action("debugInformation.clearAllStatistics")}}class Ge{#c;constructor(e){this.#c=e}sync(){return this.#c.action("preferences.sync")}async inboxState(){return this.#c.action("preferences.inboxState",{refreshFromNetwork:!1})}async fetchInboxState(){return this.#c.action("preferences.inboxState",{refreshFromNetwork:!0})}async getInboxStates(e){return this.#c.action("preferences.getInboxStates",{inboxIds:e,refreshFromNetwork:!1})}async fetchInboxStates(e){return this.#c.action("preferences.getInboxStates",{inboxIds:e,refreshFromNetwork:!0})}async setConsentStates(e){return this.#c.action("preferences.setConsentStates",{records:e})}async getConsentState(e,t){return this.#c.action("preferences.getConsentState",{entityType:e,entity:t})}async streamConsent(e){return Ee(async(t,n)=>{const s=Ne();return e?.disableSync||await this.sync(),await this.#c.action("preferences.streamConsent",{streamId:s}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},void 0,e)}async streamPreferences(e){return Ee(async(t,n)=>{const s=Ne();return e?.disableSync||await this.sync(),await this.#c.action("preferences.streamPreferences",{streamId:s}),this.#c.handleStreamMessage(s,t,{...e,onFail:n})},void 0,e)}}const We={local:D.Local,dev:D.Dev,production:D.Production,"testnet-staging":D.TestnetStaging,"testnet-dev":D.TestnetDev,testnet:D.Testnet,mainnet:D.Mainnet};D.Local,D.Dev,D.Production,D.TestnetStaging,D.TestnetDev,D.Testnet,D.Mainnet;const Ve=async t=>{await e();let n=new C(We[t?.env??"dev"]);return t?.apiUrl&&(n=n.setApiUrl(t.apiUrl)),t?.gatewayHost&&(n=n.setGatewayHost(t.gatewayHost)),t?.appVersion&&(n=n.setAppVersion(t.appVersion)),n.build()},Ke=async(t,n)=>(await e(),q(t,n)),_e=async(t,n)=>(await e(),B(t,n)),$e=async(t,n,s,i)=>{await e();const r=await n.getIdentifier(),{signatureText:a,signatureRequest:o}=await(async(t,n,s,i)=>{await e();const r=O(t,n,s,i);return{signatureText:await r.signatureText(),signatureRequest:r}})(t,r,s,i),c=await n.signMessage(a);switch(n.type){case"EOA":await o.addEcdsaSignature(c);break;case"SCW":await o.addScwSignature(r,c,n.getChainId(),n.getBlockNumber?.())}await N(t,o)},je=async(e,t)=>{switch(e.type){case"EOA":return{type:"EOA",identifier:await e.getIdentifier(),signature:t};case"SCW":return{type:"SCW",identifier:await e.getIdentifier(),signature:t,chainId:e.getChainId(),blockNumber:e.getBlockNumber?.()}}},He=e=>{console.error(`[worker] error: ${e.message}`)};class ze{#c;#m;#k=new Map;constructor(e,t){this.#c=e,this.#c.addEventListener("message",this.handleMessage),this.#c.addEventListener("error",He),this.#m=t??!1}action(e,...t){const n=Ne();this.#c.postMessage({action:e,id:n,data:t[0]});return new Promise((e,t)=>{this.#k.set(n,{resolve:e,reject:t})})}handleMessage=e=>{const t=e.data;this.#m&&console.log("[worker] client received event data",t);const n=this.#k.get(t.id);n&&(this.#k.delete(t.id),"error"in t?n.reject(t.error):n.resolve(t.result))};handleStreamMessage=(e,t,n)=>{const s=s=>{const i=s.data;if(i.streamId===e){if("stream.fail"===i.action)return void n?.onFail?.();"error"in i?t(i.error,void 0):t(null,i.result)}};return this.#c.addEventListener("message",s),async()=>{await this.action("endStream",{streamId:e}),this.#c.removeEventListener("message",s)}};close(){this.#c.removeEventListener("message",this.handleMessage),this.#c.removeEventListener("error",He),this.#c.terminate()}}const Xe=async(e,t)=>e instanceof F?e:Ve({env:e,gatewayHost:t});class Je{#I;#i;#v;#f;#x;#R;#b;#S;#A;#T=!1;#M;#D;#C;#q;#c;constructor(e){e&&Object.defineProperty(e,"codecs",{value:e.codecs,enumerable:!1});const t=new Worker(new URL("./workers/client",import.meta.url),{type:"module"}),n=void 0!==e?.loggingLevel&&e.loggingLevel!==P.Off;this.#c=new ze(t,n),this.#i=new G([...e?.codecs??[]]),this.#D=e,this.#v=new Le(this,this.#c,this.#i),this.#f=new Ue(this.#c),this.#C=new Ge(this.#c)}async init(e){const t=await this.#c.action("client.init",{identifier:e,options:this.#D});this.#I=t.appVersion,this.#x=t.env,this.#R=e,this.#b=t.inboxId,this.#S=t.installationId,this.#A=t.installationIdBytes,this.#M=t.libxmtpVersion,this.#T=!0}close(){this.#c.close(),this.#T=!1}static async create(e,t){const n=new Je(t);return n.#q=e,await n.init(await e.getIdentifier()),t?.disableAutoRegister||await n.register(),n}static async build(e,t){const n=new Je({...t,disableAutoRegister:!0});return await n.init(e),n}get options(){return this.#D}get signer(){return this.#q}get isReady(){return this.#T}get inboxId(){return this.#b}get accountIdentifier(){return this.#R}get installationId(){return this.#S}get installationIdBytes(){return this.#A}get conversations(){return this.#v}get debugInformation(){return this.#f}get preferences(){return this.#C}get libxmtpVersion(){return this.#M}get appVersion(){return this.#I}get env(){return this.#x}async unsafe_createInboxSignatureText(){return this.#c.action("client.createInboxSignatureText",{signatureRequestId:Ne()})}async unsafe_addAccountSignatureText(e,t=!1){if(!t)throw new Re;return this.#c.action("client.addAccountSignatureText",{newIdentifier:e,signatureRequestId:Ne()})}async unsafe_removeAccountSignatureText(e){return this.#c.action("client.removeAccountSignatureText",{identifier:e,signatureRequestId:Ne()})}async unsafe_revokeAllOtherInstallationsSignatureText(){return this.#c.action("client.revokeAllOtherInstallationsSignatureText",{signatureRequestId:Ne()})}async unsafe_revokeInstallationsSignatureText(e){return this.#c.action("client.revokeInstallationsSignatureText",{installationIds:e,signatureRequestId:Ne()})}async unsafe_changeRecoveryIdentifierSignatureText(e){return this.#c.action("client.changeRecoveryIdentifierSignatureText",{identifier:e,signatureRequestId:Ne()})}async unsafe_applySignatureRequest(e,t){return this.#c.action("client.applySignatureRequest",{signer:e,signatureRequestId:t})}async register(){if(!this.#q)throw new xe;const{signatureText:e,signatureRequestId:t}=await this.unsafe_createInboxSignatureText();if(!e||!t)return;const n=await this.#q.signMessage(e),s=await je(this.#q,n);return this.#c.action("client.registerIdentity",{signer:s,signatureRequestId:t})}async unsafe_addAccount(e,t=!1){if(!this.#q)throw new xe;if(!t)throw new Re;const n=await this.fetchInboxIdByIdentifier(await e.getIdentifier());if(n)throw new be(n);const{signatureText:s,signatureRequestId:i}=await this.unsafe_addAccountSignatureText(await e.getIdentifier(),!0),r=await e.signMessage(s),a=await je(e,r);return this.#c.action("client.addAccount",{identifier:a.identifier,signer:a,signatureRequestId:i})}async removeAccount(e){if(!this.#q)throw new xe;const{signatureText:t,signatureRequestId:n}=await this.unsafe_removeAccountSignatureText(e),s=await this.#q.signMessage(t),i=await je(this.#q,s);return this.#c.action("client.removeAccount",{identifier:e,signer:i,signatureRequestId:n})}async revokeAllOtherInstallations(){if(!this.#q)throw new xe;const{signatureText:e,signatureRequestId:t}=await this.unsafe_revokeAllOtherInstallationsSignatureText();if(!e)return;const n=await this.#q.signMessage(e),s=await je(this.#q,n);return this.#c.action("client.revokeAllOtherInstallations",{signer:s,signatureRequestId:t})}async revokeInstallations(e){if(!this.#q)throw new xe;const{signatureText:t,signatureRequestId:n}=await this.unsafe_revokeInstallationsSignatureText(e),s=await this.#q.signMessage(t),i=await je(this.#q,s);return this.#c.action("client.revokeInstallations",{installationIds:e,signer:i,signatureRequestId:n})}static async revokeInstallations(e,t,n,s,i){const r=await Xe(s,i);await $e(r,e,t,n)}static async fetchInboxStates(t,n,s){return(async(t,n)=>(await e(),E(t,n)))(await Xe(n,s),t)}async changeRecoveryIdentifier(e){if(!this.#q)throw new xe;const{signatureText:t,signatureRequestId:n}=await this.unsafe_changeRecoveryIdentifierSignatureText(e),s=await this.#q.signMessage(t),i=await je(this.#q,s);return this.#c.action("client.changeRecoveryIdentifier",{identifier:e,signer:i,signatureRequestId:n})}async isRegistered(){return this.#c.action("client.isRegistered")}async canMessage(e){return this.#c.action("client.canMessage",{identifiers:e})}static async canMessage(e,t){const n=await Xe(t),s=new Map;for(const t of e){const e=await _e(n,t);s.set(t.identifier.toLowerCase(),void 0!==e)}return s}async fetchInboxIdByIdentifier(e){return this.#c.action("client.getInboxIdByIdentifier",{identifier:e})}signWithInstallationKey(e){return this.#c.action("client.signWithInstallationKey",{signatureText:e})}verifySignedWithInstallationKey(e,t){return this.#c.action("client.verifySignedWithInstallationKey",{signatureText:e,signatureBytes:t})}verifySignedWithPublicKey(e,t,n){return this.#c.action("client.verifySignedWithPublicKey",{signatureText:e,signatureBytes:t,publicKey:n})}async fetchKeyPackageStatuses(e){return this.#c.action("client.fetchKeyPackageStatuses",{installationIds:e})}async sendSyncRequest(e,t){return this.#c.action("client.sendSyncRequest",{options:e,serverUrl:t})}}class Qe{#c;#m;constructor(e){const t=new Worker(new URL("./workers/opfs",import.meta.url),{type:"module"});this.#c=new ze(t,e),this.#m=e??!1}async init(){await this.#c.action("opfs.init",{enableLogging:this.#m})}close(){this.#c.close()}static async create(e){const t=new Qe(e);return await t.init(),t}async listFiles(){return this.#c.action("opfs.listFiles")}async fileCount(){return this.#c.action("opfs.fileCount")}async poolCapacity(){return this.#c.action("opfs.poolCapacity")}async fileExists(e){return this.#c.action("opfs.fileExists",{path:e})}async deleteFile(e){return this.#c.action("opfs.deleteFile",{path:e})}async exportDb(e){return this.#c.action("opfs.exportDb",{path:e})}async importDb(e,t){return this.#c.action("opfs.importDb",{path:e,data:t})}async clearAll(){return this.#c.action("opfs.clearAll")}}const Ye=async t=>(await e(),L(t)),Ze={local:"http://localhost:5557",dev:"https://api.dev.xmtp.network:5558",production:"https://api.production.xmtp.network:5558"},et={local:"http://localhost:5558",dev:"https://message-history.dev.ephemera.network",production:"https://message-history.production.ephemera.network","testnet-staging":"https://message-history.dev.ephemera.network","testnet-dev":"https://message-history.dev.ephemera.network",testnet:"https://message-history.dev.ephemera.network",mainnet:"https://message-history.production.ephemera.network"},tt=async e=>({id:e.id,name:e.name,imageUrl:e.imageUrl,description:e.description,appData:e.appData,permissions:e.permissions(),addedByInboxId:e.addedByInboxId,metadata:await e.metadata(),admins:e.listAdmins(),superAdmins:e.listSuperAdmins(),createdAtNs:e.createdAtNs}),nt=e=>"xmtp.org"===e.contentType.authorityId&&"reaction"===e.contentType.typeId,st=e=>"xmtp.org"===e.contentType.authorityId&&"reply"===e.contentType.typeId,it=e=>st(e)&&"string"==typeof e.content?.content,rt=e=>"xmtp.org"===e.contentType.authorityId&&"text"===e.contentType.typeId,at=e=>"xmtp.org"===e.contentType.authorityId&&"remoteStaticAttachment"===e.contentType.typeId,ot=e=>"xmtp.org"===e.contentType.authorityId&&"attachment"===e.contentType.typeId,ct=e=>"xmtp.org"===e.contentType.authorityId&&"multiRemoteStaticAttachment"===e.contentType.typeId,dt=e=>"xmtp.org"===e.contentType.authorityId&&"transactionReference"===e.contentType.typeId,ut=e=>"xmtp.org"===e.contentType.authorityId&&"group_updated"===e.contentType.typeId,ht=e=>"xmtp.org"===e.contentType.authorityId&&"readReceipt"===e.contentType.typeId,pt=e=>"xmtp.org"===e.contentType.authorityId&&"leave_request"===e.contentType.typeId,lt=e=>"xmtp.org"===e.contentType.authorityId&&"walletSendCalls"===e.contentType.typeId,yt=e=>"coinbase.com"===e.contentType.authorityId&&"intent"===e.contentType.typeId,gt=e=>"coinbase.com"===e.contentType.authorityId&&"actions"===e.contentType.typeId,wt=e=>"xmtp.org"===e.contentType.authorityId&&"markdown"===e.contentType.typeId;export{be as AccountAlreadyAssociatedError,Ze as ApiUrls,Je as Client,fe as ClientNotInitializedError,Oe as Conversation,Le as Conversations,me as DecodedMessage,Pe as Dm,Fe as Group,Se as GroupNotFoundError,et as HistorySyncUrls,Re as InboxReassignError,Qe as Opfs,Ce as OpfsInitializationError,De as OpfsNotInitializedError,xe as SignerUnavailableError,Te as StreamFailedError,Me as StreamInvalidRetryAttemptsError,Ae as StreamNotFoundError,Z as contentTypeActions,ee as contentTypeAttachment,te as contentTypeGroupUpdated,ne as contentTypeIntent,se as contentTypeLeaveRequest,ie as contentTypeMarkdown,re as contentTypeMultiRemoteAttachment,ae as contentTypeReaction,oe as contentTypeReadReceipt,ce as contentTypeRemoteAttachment,de as contentTypeReply,ue as contentTypeText,he as contentTypeTransactionReference,pe as contentTypeWalletSendCalls,Ve as createBackend,ye as decryptAttachment,V as encodeActions,K as encodeAttachment,_ as encodeIntent,$ as encodeMarkdown,j as encodeMultiRemoteAttachment,H as encodeReaction,z as encodeReadReceipt,X as encodeRemoteAttachment,J as encodeText,Q as encodeTransactionReference,Y as encodeWalletSendCalls,le as encryptAttachment,Ke as generateInboxId,_e as getInboxIdForIdentifier,gt as isActions,ot as isAttachment,ut as isGroupUpdated,yt as isIntent,pt as isLeaveRequest,wt as isMarkdown,ct as isMultiRemoteAttachment,nt as isReaction,ht as isReadReceipt,at as isRemoteAttachment,st as isReply,rt as isText,it as isTextReply,dt as isTransactionReference,lt as isWalletSendCalls,Ye as metadataFieldName,tt as toSafeConversation,je as toSafeSigner};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|