@xmtp/browser-sdk 6.4.1 → 6.5.0
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 +69 -111
- 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 +14 -115
- package/src/Conversation.ts +13 -0
- package/src/WorkerClient.ts +7 -14
- package/src/WorkerConversation.ts +8 -4
- package/src/constants.ts +0 -5
- package/src/index.ts +1 -5
- package/src/types/actions/client.ts +2 -10
- package/src/types/actions/conversation.ts +10 -0
- package/src/types/options.ts +13 -27
- package/src/utils/createClient.ts +27 -58
- package/src/utils/inboxId.ts +15 -5
- package/src/utils/inboxState.ts +9 -5
- package/src/utils/installations.ts +17 -8
- package/src/workers/client.ts +7 -2
- package/src/utils/createBackend.ts +0 -45
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,
|
|
3
|
-
export { Action, ActionStyle, Actions, ApiStats,
|
|
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, RemoteAttachmentInfo, 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,6 +82,33 @@ 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
|
+
|
|
85
112
|
declare class CodecRegistry {
|
|
86
113
|
#private;
|
|
87
114
|
constructor(codecs: ContentCodec[]);
|
|
@@ -131,7 +158,7 @@ declare class DecodedMessage<ContentTypes = unknown> {
|
|
|
131
158
|
constructor(codecRegistry: CodecRegistry, message: DecodedMessage$1);
|
|
132
159
|
}
|
|
133
160
|
|
|
134
|
-
type XmtpEnv =
|
|
161
|
+
type XmtpEnv = keyof typeof ApiUrls;
|
|
135
162
|
/**
|
|
136
163
|
* Network options
|
|
137
164
|
*/
|
|
@@ -145,28 +172,15 @@ type NetworkOptions = {
|
|
|
145
172
|
* specific endpoint
|
|
146
173
|
*/
|
|
147
174
|
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 = {
|
|
161
175
|
/**
|
|
162
176
|
* historySyncUrl can be used to override the `env` flag and connect to a
|
|
163
177
|
* specific endpoint for syncing history
|
|
164
178
|
*/
|
|
165
179
|
historySyncUrl?: string | null;
|
|
166
180
|
/**
|
|
167
|
-
*
|
|
181
|
+
* gatewayHost can be used to override the gateway endpoint
|
|
168
182
|
*/
|
|
169
|
-
|
|
183
|
+
gatewayHost?: string | null;
|
|
170
184
|
};
|
|
171
185
|
type ContentOptions = {
|
|
172
186
|
/**
|
|
@@ -218,10 +232,16 @@ type OtherOptions = {
|
|
|
218
232
|
* Disable automatic registration when creating a client
|
|
219
233
|
*/
|
|
220
234
|
disableAutoRegister?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Disable device sync
|
|
237
|
+
*/
|
|
238
|
+
disableDeviceSync?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Custom app version
|
|
241
|
+
*/
|
|
242
|
+
appVersion?: string;
|
|
221
243
|
};
|
|
222
|
-
type ClientOptions =
|
|
223
|
-
backend: Backend;
|
|
224
|
-
}) & DeviceSyncOptions & ContentOptions & StorageOptions & OtherOptions;
|
|
244
|
+
type ClientOptions = NetworkOptions & ContentOptions & StorageOptions & OtherOptions;
|
|
225
245
|
type EnrichedReply<T = unknown, U = unknown> = {
|
|
226
246
|
referenceId: string;
|
|
227
247
|
content: T;
|
|
@@ -317,11 +337,10 @@ declare class WorkerPreferences {
|
|
|
317
337
|
|
|
318
338
|
declare class WorkerClient {
|
|
319
339
|
#private;
|
|
320
|
-
constructor(client: Client$1
|
|
340
|
+
constructor(client: Client$1);
|
|
321
341
|
static create(identifier: Identifier, options?: Omit<ClientOptions, "codecs">): Promise<WorkerClient>;
|
|
322
342
|
get libxmtpVersion(): string;
|
|
323
343
|
get appVersion(): string;
|
|
324
|
-
get env(): XmtpEnv;
|
|
325
344
|
get accountIdentifier(): Identifier;
|
|
326
345
|
get inboxId(): string;
|
|
327
346
|
get installationId(): string;
|
|
@@ -346,7 +365,7 @@ declare class WorkerClient {
|
|
|
346
365
|
verifySignedWithInstallationKey(signatureText: string, signatureBytes: Uint8Array): boolean;
|
|
347
366
|
verifySignedWithPublicKey(signatureText: string, signatureBytes: Uint8Array, publicKey: Uint8Array): boolean;
|
|
348
367
|
fetchKeyPackageStatuses(installationIds: string[]): Promise<Map<string, KeyPackageStatus>>;
|
|
349
|
-
sendSyncRequest(
|
|
368
|
+
sendSyncRequest(): Promise<void>;
|
|
350
369
|
}
|
|
351
370
|
|
|
352
371
|
declare class WorkerConversation {
|
|
@@ -386,6 +405,7 @@ declare class WorkerConversation {
|
|
|
386
405
|
addSuperAdmin(inboxId: string): Promise<void>;
|
|
387
406
|
removeSuperAdmin(inboxId: string): Promise<void>;
|
|
388
407
|
publishMessages(): Promise<void>;
|
|
408
|
+
processStreamedMessage(envelopeBytes: Uint8Array): Promise<Message[]>;
|
|
389
409
|
send(encodedContent: EncodedContent, opts?: SendMessageOpts): Promise<string>;
|
|
390
410
|
sendText(text: string, isOptimistic?: boolean): Promise<string>;
|
|
391
411
|
sendMarkdown(markdown: string, isOptimistic?: boolean): Promise<string>;
|
|
@@ -443,7 +463,6 @@ type ClientAction = {
|
|
|
443
463
|
id: string;
|
|
444
464
|
result: {
|
|
445
465
|
appVersion: string;
|
|
446
|
-
env: string;
|
|
447
466
|
inboxId: string;
|
|
448
467
|
installationId: string;
|
|
449
468
|
installationIdBytes: Uint8Array;
|
|
@@ -631,10 +650,7 @@ type ClientAction = {
|
|
|
631
650
|
action: "client.sendSyncRequest";
|
|
632
651
|
id: string;
|
|
633
652
|
result: undefined;
|
|
634
|
-
data:
|
|
635
|
-
options: ArchiveOptions;
|
|
636
|
-
serverUrl: string;
|
|
637
|
-
};
|
|
653
|
+
data: undefined;
|
|
638
654
|
};
|
|
639
655
|
|
|
640
656
|
type ConversationAction = {
|
|
@@ -660,6 +676,14 @@ type ConversationAction = {
|
|
|
660
676
|
data: {
|
|
661
677
|
id: string;
|
|
662
678
|
};
|
|
679
|
+
} | {
|
|
680
|
+
action: "conversation.processStreamedMessage";
|
|
681
|
+
id: string;
|
|
682
|
+
result: Message[];
|
|
683
|
+
data: {
|
|
684
|
+
id: string;
|
|
685
|
+
envelopeBytes: Uint8Array;
|
|
686
|
+
};
|
|
663
687
|
} | {
|
|
664
688
|
action: "conversation.messages";
|
|
665
689
|
id: string;
|
|
@@ -1397,6 +1421,13 @@ declare class Conversation<ContentTypes = unknown> {
|
|
|
1397
1421
|
* @returns Promise that resolves when publishing is complete
|
|
1398
1422
|
*/
|
|
1399
1423
|
publishMessages(): Promise<void>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Decodes, decrypts, and persists a raw envelope from a group message stream.
|
|
1426
|
+
*
|
|
1427
|
+
* @param envelopeBytes - Raw protobuf-encoded envelope bytes from the stream
|
|
1428
|
+
* @returns The processed and stored messages
|
|
1429
|
+
*/
|
|
1430
|
+
processStreamedMessage(envelopeBytes: Uint8Array): Promise<_xmtp_wasm_bindings.Message[]>;
|
|
1400
1431
|
/**
|
|
1401
1432
|
* Sends a message
|
|
1402
1433
|
*
|
|
@@ -2166,10 +2197,6 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2166
2197
|
* Gets the app version used by the client
|
|
2167
2198
|
*/
|
|
2168
2199
|
get appVersion(): string | undefined;
|
|
2169
|
-
/**
|
|
2170
|
-
* Gets the XMTP environment used by this client
|
|
2171
|
-
*/
|
|
2172
|
-
get env(): XmtpEnv | undefined;
|
|
2173
2200
|
/**
|
|
2174
2201
|
* Creates signature text for creating a new inbox
|
|
2175
2202
|
*
|
|
@@ -2340,45 +2367,21 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2340
2367
|
/**
|
|
2341
2368
|
* Revokes specific installations of the client's inbox without a client
|
|
2342
2369
|
*
|
|
2370
|
+
* @param env - The environment to use
|
|
2343
2371
|
* @param signer - The signer to use
|
|
2344
2372
|
* @param inboxId - The inbox ID to revoke installations for
|
|
2345
2373
|
* @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`.
|
|
2359
2374
|
*/
|
|
2360
2375
|
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[]>;
|
|
2370
2376
|
/**
|
|
2371
2377
|
* Fetches the inbox states for the specified inbox IDs from the network
|
|
2372
2378
|
* without a client
|
|
2373
2379
|
*
|
|
2374
2380
|
* @param inboxIds - The inbox IDs to get the state for
|
|
2375
2381
|
* @param env - The environment to use
|
|
2376
|
-
* @param gatewayHost - Optional gateway host
|
|
2377
2382
|
* @returns The inbox states for the specified inbox IDs
|
|
2378
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2379
|
-
* of `XmtpEnv` and `gatewayHost`.
|
|
2380
2383
|
*/
|
|
2381
|
-
static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<InboxState[]>;
|
|
2384
|
+
static fetchInboxStates(inboxIds: string[], env?: XmtpEnv, gatewayHost?: string): Promise<_xmtp_wasm_bindings.InboxState[]>;
|
|
2382
2385
|
/**
|
|
2383
2386
|
* Changes the recovery identifier for the client's inbox
|
|
2384
2387
|
*
|
|
@@ -2401,22 +2404,12 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2401
2404
|
* @returns Whether the client can message the identifiers
|
|
2402
2405
|
*/
|
|
2403
2406
|
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>>;
|
|
2412
2407
|
/**
|
|
2413
2408
|
* Checks if the specified identifiers can be messaged
|
|
2414
2409
|
*
|
|
2415
2410
|
* @param identifiers - The identifiers to check
|
|
2416
2411
|
* @param env - Optional XMTP environment
|
|
2417
2412
|
* @returns Map of identifiers to whether they can be messaged
|
|
2418
|
-
* @deprecated Pass a `Backend` instance created with `createBackend()` instead
|
|
2419
|
-
* of `XmtpEnv`.
|
|
2420
2413
|
*/
|
|
2421
2414
|
static canMessage(identifiers: Identifier[], env?: XmtpEnv): Promise<Map<string, boolean>>;
|
|
2422
2415
|
/**
|
|
@@ -2462,11 +2455,9 @@ declare class Client<ContentTypes = ExtractCodecContentTypes> {
|
|
|
2462
2455
|
/**
|
|
2463
2456
|
* Send a sync request to other devices on the network
|
|
2464
2457
|
*
|
|
2465
|
-
* @param options - Archive options specifying what to sync
|
|
2466
|
-
* @param serverUrl - The server URL for the sync request
|
|
2467
2458
|
* @returns Promise that resolves when the sync request is sent
|
|
2468
2459
|
*/
|
|
2469
|
-
sendSyncRequest(
|
|
2460
|
+
sendSyncRequest(): Promise<void>;
|
|
2470
2461
|
}
|
|
2471
2462
|
|
|
2472
2463
|
declare class Opfs {
|
|
@@ -2485,8 +2476,6 @@ declare class Opfs {
|
|
|
2485
2476
|
clearAll(): Promise<void>;
|
|
2486
2477
|
}
|
|
2487
2478
|
|
|
2488
|
-
declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
|
|
2489
|
-
|
|
2490
2479
|
/**
|
|
2491
2480
|
* Generates an inbox ID for a given identifier
|
|
2492
2481
|
*
|
|
@@ -2496,13 +2485,14 @@ declare const createBackend: (options?: NetworkOptions) => Promise<Backend>;
|
|
|
2496
2485
|
*/
|
|
2497
2486
|
declare const generateInboxId: (identifier: Identifier, nonce?: bigint) => Promise<string>;
|
|
2498
2487
|
/**
|
|
2499
|
-
* Gets the inbox ID for a specific identifier
|
|
2488
|
+
* Gets the inbox ID for a specific identifier and optional environment
|
|
2500
2489
|
*
|
|
2501
|
-
* @param backend - The Backend instance for API communication
|
|
2502
2490
|
* @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
|
|
2503
2493
|
* @returns Promise that resolves with the inbox ID for the identifier
|
|
2504
2494
|
*/
|
|
2505
|
-
declare const getInboxIdForIdentifier: (
|
|
2495
|
+
declare const getInboxIdForIdentifier: (identifier: Identifier, env?: XmtpEnv, gatewayHost?: string) => Promise<string | undefined>;
|
|
2506
2496
|
|
|
2507
2497
|
/**
|
|
2508
2498
|
* Gets the name of a metadata field
|
|
@@ -2512,38 +2502,6 @@ declare const getInboxIdForIdentifier: (backend: Backend, identifier: Identifier
|
|
|
2512
2502
|
*/
|
|
2513
2503
|
declare const metadataFieldName: (field: MetadataField) => Promise<string>;
|
|
2514
2504
|
|
|
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
|
-
|
|
2547
2505
|
declare const encodeActions: (actions: _xmtp_wasm_bindings.Actions) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2548
2506
|
declare const encodeAttachment: (attachment: _xmtp_wasm_bindings.Attachment) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
2549
2507
|
declare const encodeIntent: (intent: _xmtp_wasm_bindings.Intent) => Promise<_xmtp_wasm_bindings.EncodedContent>;
|
|
@@ -2619,5 +2577,5 @@ declare const isIntent: (m: DecodedMessage) => m is DecodedMessage<Intent>;
|
|
|
2619
2577
|
declare const isActions: (m: DecodedMessage) => m is DecodedMessage<Actions>;
|
|
2620
2578
|
declare const isMarkdown: (m: DecodedMessage) => m is DecodedMessage<string>;
|
|
2621
2579
|
|
|
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,
|
|
2623
|
-
export type { AsyncStreamProxy, BuiltInContentTypes, ClientOptions, ContentOptions,
|
|
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 };
|
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 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};
|
|
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 P}from"@xmtp/content-type-primitives";class F{#e;constructor(e){this.#e=new Map(e.map(e=>[P(e.contentType),e]))}getCodec(e){return this.#e.get(P(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 "${P(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 processStreamedMessage(e){return this.#c.action("conversation.processStreamedMessage",{id:this.#a,envelopeBytes:e})}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 Pe{#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 Fe{#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){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!==N.Off;this.#c=new $e(t,n),this.#i=new F([...e?.codecs??[]]),this.#M=e,this.#f=new Oe(this,this.#c,this.#i),this.#v=new Pe(this.#c),this.#D=new Fe(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};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|