@xmtp/browser-sdk 6.5.0 → 7.0.0-dev.57a7203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/index.d.ts +342 -100
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/workers/client.js +1 -1
- package/dist/workers/client.js.map +1 -1
- package/package.json +17 -8
- package/src/Client.ts +360 -14
- package/src/Conversation.ts +40 -40
- package/src/WorkerClient.ts +77 -8
- package/src/WorkerConversation.ts +29 -37
- package/src/constants.ts +5 -0
- package/src/index.ts +11 -1
- package/src/types/actions/client.ts +90 -2
- package/src/types/actions/conversation.ts +13 -12
- package/src/types/options.ts +44 -11
- package/src/utils/WorkerBridge.ts +1 -1
- package/src/utils/createBackend.ts +45 -0
- package/src/utils/createClient.ts +65 -27
- package/src/utils/inboxId.ts +5 -15
- package/src/utils/inboxState.ts +5 -9
- package/src/utils/installations.ts +8 -17
- package/src/utils/signer.ts +37 -1
- package/src/workers/client.ts +64 -23
package/src/Conversation.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type RemoteAttachment,
|
|
11
11
|
type Reply,
|
|
12
12
|
type SendMessageOpts,
|
|
13
|
+
type SendOpts,
|
|
13
14
|
type TransactionReference,
|
|
14
15
|
type WalletSendCalls,
|
|
15
16
|
type DecodedMessage as XmtpDecodedMessage,
|
|
@@ -160,8 +161,10 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
160
161
|
* @param options - Optional send options
|
|
161
162
|
* @param options.shouldPush - Indicates whether this message should be
|
|
162
163
|
* included in push notifications
|
|
163
|
-
* @param options.
|
|
164
|
+
* @param options.optimistic - Indicates whether this message should be
|
|
164
165
|
* sent optimistically and published later via `publishMessages`
|
|
166
|
+
* @param options.idempotencyKey - Optional idempotency key; re-sending
|
|
167
|
+
* identical content with the same key produces the same deduplicated message id
|
|
165
168
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
166
169
|
*/
|
|
167
170
|
async send(content: EncodedContent, options?: SendMessageOpts) {
|
|
@@ -176,14 +179,14 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
176
179
|
* Sends a text message
|
|
177
180
|
*
|
|
178
181
|
* @param text - The text to send
|
|
179
|
-
* @param
|
|
182
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
180
183
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
181
184
|
*/
|
|
182
|
-
async sendText(text: string,
|
|
185
|
+
async sendText(text: string, opts?: SendOpts) {
|
|
183
186
|
return this.#worker.action("conversation.sendText", {
|
|
184
187
|
id: this.#id,
|
|
185
188
|
text,
|
|
186
|
-
|
|
189
|
+
opts,
|
|
187
190
|
});
|
|
188
191
|
}
|
|
189
192
|
|
|
@@ -191,14 +194,14 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
191
194
|
* Sends a markdown message
|
|
192
195
|
*
|
|
193
196
|
* @param markdown - The markdown to send
|
|
194
|
-
* @param
|
|
197
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
195
198
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
196
199
|
*/
|
|
197
|
-
async sendMarkdown(markdown: string,
|
|
200
|
+
async sendMarkdown(markdown: string, opts?: SendOpts) {
|
|
198
201
|
return this.#worker.action("conversation.sendMarkdown", {
|
|
199
202
|
id: this.#id,
|
|
200
203
|
markdown,
|
|
201
|
-
|
|
204
|
+
opts,
|
|
202
205
|
});
|
|
203
206
|
}
|
|
204
207
|
|
|
@@ -206,27 +209,27 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
206
209
|
* Sends a reaction message
|
|
207
210
|
*
|
|
208
211
|
* @param reaction - The reaction to send
|
|
209
|
-
* @param
|
|
212
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
210
213
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
211
214
|
*/
|
|
212
|
-
async sendReaction(reaction: Reaction,
|
|
215
|
+
async sendReaction(reaction: Reaction, opts?: SendOpts) {
|
|
213
216
|
return this.#worker.action("conversation.sendReaction", {
|
|
214
217
|
id: this.#id,
|
|
215
218
|
reaction,
|
|
216
|
-
|
|
219
|
+
opts,
|
|
217
220
|
});
|
|
218
221
|
}
|
|
219
222
|
|
|
220
223
|
/**
|
|
221
224
|
* Sends a read receipt message
|
|
222
225
|
*
|
|
223
|
-
* @param
|
|
226
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
224
227
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
225
228
|
*/
|
|
226
|
-
async sendReadReceipt(
|
|
229
|
+
async sendReadReceipt(opts?: SendOpts) {
|
|
227
230
|
return this.#worker.action("conversation.sendReadReceipt", {
|
|
228
231
|
id: this.#id,
|
|
229
|
-
|
|
232
|
+
opts,
|
|
230
233
|
});
|
|
231
234
|
}
|
|
232
235
|
|
|
@@ -234,14 +237,14 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
234
237
|
* Sends a reply message
|
|
235
238
|
*
|
|
236
239
|
* @param reply - The reply to send
|
|
237
|
-
* @param
|
|
240
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
238
241
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
239
242
|
*/
|
|
240
|
-
async sendReply(reply: Reply,
|
|
243
|
+
async sendReply(reply: Reply, opts?: SendOpts) {
|
|
241
244
|
return this.#worker.action("conversation.sendReply", {
|
|
242
245
|
id: this.#id,
|
|
243
246
|
reply,
|
|
244
|
-
|
|
247
|
+
opts,
|
|
245
248
|
});
|
|
246
249
|
}
|
|
247
250
|
|
|
@@ -249,17 +252,17 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
249
252
|
* Sends a transaction reference message
|
|
250
253
|
*
|
|
251
254
|
* @param transactionReference - The transaction reference to send
|
|
252
|
-
* @param
|
|
255
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
253
256
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
254
257
|
*/
|
|
255
258
|
async sendTransactionReference(
|
|
256
259
|
transactionReference: TransactionReference,
|
|
257
|
-
|
|
260
|
+
opts?: SendOpts,
|
|
258
261
|
) {
|
|
259
262
|
return this.#worker.action("conversation.sendTransactionReference", {
|
|
260
263
|
id: this.#id,
|
|
261
264
|
transactionReference,
|
|
262
|
-
|
|
265
|
+
opts,
|
|
263
266
|
});
|
|
264
267
|
}
|
|
265
268
|
|
|
@@ -267,17 +270,14 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
267
270
|
* Sends a wallet send calls message
|
|
268
271
|
*
|
|
269
272
|
* @param walletSendCalls - The wallet send calls to send
|
|
270
|
-
* @param
|
|
273
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
271
274
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
272
275
|
*/
|
|
273
|
-
async sendWalletSendCalls(
|
|
274
|
-
walletSendCalls: WalletSendCalls,
|
|
275
|
-
isOptimistic?: boolean,
|
|
276
|
-
) {
|
|
276
|
+
async sendWalletSendCalls(walletSendCalls: WalletSendCalls, opts?: SendOpts) {
|
|
277
277
|
return this.#worker.action("conversation.sendWalletSendCalls", {
|
|
278
278
|
id: this.#id,
|
|
279
279
|
walletSendCalls,
|
|
280
|
-
|
|
280
|
+
opts,
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
|
|
@@ -285,14 +285,14 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
285
285
|
* Sends an actions message
|
|
286
286
|
*
|
|
287
287
|
* @param actions - The actions to send
|
|
288
|
-
* @param
|
|
288
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
289
289
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
290
290
|
*/
|
|
291
|
-
async sendActions(actions: Actions,
|
|
291
|
+
async sendActions(actions: Actions, opts?: SendOpts) {
|
|
292
292
|
return this.#worker.action("conversation.sendActions", {
|
|
293
293
|
id: this.#id,
|
|
294
294
|
actions,
|
|
295
|
-
|
|
295
|
+
opts,
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
|
|
@@ -300,14 +300,14 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
300
300
|
* Sends an intent message
|
|
301
301
|
*
|
|
302
302
|
* @param intent - The intent to send
|
|
303
|
-
* @param
|
|
303
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
304
304
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
305
305
|
*/
|
|
306
|
-
async sendIntent(intent: Intent,
|
|
306
|
+
async sendIntent(intent: Intent, opts?: SendOpts) {
|
|
307
307
|
return this.#worker.action("conversation.sendIntent", {
|
|
308
308
|
id: this.#id,
|
|
309
309
|
intent,
|
|
310
|
-
|
|
310
|
+
opts,
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
313
|
|
|
@@ -315,14 +315,14 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
315
315
|
* Sends an attachment message
|
|
316
316
|
*
|
|
317
317
|
* @param attachment - The attachment to send
|
|
318
|
-
* @param
|
|
318
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
319
319
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
320
320
|
*/
|
|
321
|
-
async sendAttachment(attachment: Attachment,
|
|
321
|
+
async sendAttachment(attachment: Attachment, opts?: SendOpts) {
|
|
322
322
|
return this.#worker.action("conversation.sendAttachment", {
|
|
323
323
|
id: this.#id,
|
|
324
324
|
attachment,
|
|
325
|
-
|
|
325
|
+
opts,
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
|
|
@@ -330,17 +330,17 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
330
330
|
* Sends a multi remote attachment message
|
|
331
331
|
*
|
|
332
332
|
* @param multiRemoteAttachment - The multi remote attachment to send
|
|
333
|
-
* @param
|
|
333
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
334
334
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
335
335
|
*/
|
|
336
336
|
async sendMultiRemoteAttachment(
|
|
337
337
|
multiRemoteAttachment: MultiRemoteAttachment,
|
|
338
|
-
|
|
338
|
+
opts?: SendOpts,
|
|
339
339
|
) {
|
|
340
340
|
return this.#worker.action("conversation.sendMultiRemoteAttachment", {
|
|
341
341
|
id: this.#id,
|
|
342
342
|
multiRemoteAttachment,
|
|
343
|
-
|
|
343
|
+
opts,
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
346
|
|
|
@@ -348,17 +348,17 @@ export class Conversation<ContentTypes = unknown> {
|
|
|
348
348
|
* Sends a remote attachment message
|
|
349
349
|
*
|
|
350
350
|
* @param remoteAttachment - The remote attachment to send
|
|
351
|
-
* @param
|
|
351
|
+
* @param opts - Send options (optimistic delivery, idempotency key)
|
|
352
352
|
* @returns Promise that resolves with the message ID after it has been sent
|
|
353
353
|
*/
|
|
354
354
|
async sendRemoteAttachment(
|
|
355
355
|
remoteAttachment: RemoteAttachment,
|
|
356
|
-
|
|
356
|
+
opts?: SendOpts,
|
|
357
357
|
) {
|
|
358
358
|
return this.#worker.action("conversation.sendRemoteAttachment", {
|
|
359
359
|
id: this.#id,
|
|
360
360
|
remoteAttachment,
|
|
361
|
-
|
|
361
|
+
opts,
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
364
|
|
package/src/WorkerClient.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verifySignedWithPublicKey,
|
|
3
|
+
type ArchiveMetadata,
|
|
4
|
+
type ArchiveOptions,
|
|
5
|
+
type AvailableArchiveInfo,
|
|
3
6
|
type Client,
|
|
7
|
+
type GroupSyncSummary,
|
|
4
8
|
type Identifier,
|
|
5
9
|
type KeyPackageStatus,
|
|
6
10
|
type SignatureRequestHandle,
|
|
7
11
|
} from "@xmtp/wasm-bindings";
|
|
8
|
-
import type {
|
|
12
|
+
import type {
|
|
13
|
+
ClientOptions,
|
|
14
|
+
VisibilityConfirmationOptions,
|
|
15
|
+
XmtpEnv,
|
|
16
|
+
} from "@/types/options";
|
|
9
17
|
import { createClient } from "@/utils/createClient";
|
|
10
18
|
import type { SafeSigner } from "@/utils/signer";
|
|
11
19
|
import { WorkerConversations } from "@/WorkerConversations";
|
|
@@ -16,10 +24,12 @@ export class WorkerClient {
|
|
|
16
24
|
#client: Client;
|
|
17
25
|
#conversations: WorkerConversations;
|
|
18
26
|
#debugInformation: WorkerDebugInformation;
|
|
27
|
+
#env: XmtpEnv;
|
|
19
28
|
#preferences: WorkerPreferences;
|
|
20
29
|
|
|
21
|
-
constructor(client: Client) {
|
|
30
|
+
constructor(client: Client, env: XmtpEnv) {
|
|
22
31
|
this.#client = client;
|
|
32
|
+
this.#env = env;
|
|
23
33
|
const conversations = client.conversations();
|
|
24
34
|
this.#conversations = new WorkerConversations(this, conversations);
|
|
25
35
|
this.#debugInformation = new WorkerDebugInformation(client);
|
|
@@ -30,8 +40,8 @@ export class WorkerClient {
|
|
|
30
40
|
identifier: Identifier,
|
|
31
41
|
options?: Omit<ClientOptions, "codecs">,
|
|
32
42
|
) {
|
|
33
|
-
const client = await createClient(identifier, options);
|
|
34
|
-
return new WorkerClient(client);
|
|
43
|
+
const { client, env } = await createClient(identifier, options);
|
|
44
|
+
return new WorkerClient(client, env);
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
get libxmtpVersion() {
|
|
@@ -42,6 +52,10 @@ export class WorkerClient {
|
|
|
42
52
|
return this.#client.appVersion;
|
|
43
53
|
}
|
|
44
54
|
|
|
55
|
+
get env() {
|
|
56
|
+
return this.#env;
|
|
57
|
+
}
|
|
58
|
+
|
|
45
59
|
get accountIdentifier() {
|
|
46
60
|
return this.#client.accountIdentifier;
|
|
47
61
|
}
|
|
@@ -80,6 +94,19 @@ export class WorkerClient {
|
|
|
80
94
|
>;
|
|
81
95
|
}
|
|
82
96
|
|
|
97
|
+
async fetchLatestInboxUpdatesCount(inboxIds: string[]) {
|
|
98
|
+
const result = (await this.#client.fetchLatestInboxUpdatesCount(
|
|
99
|
+
true,
|
|
100
|
+
inboxIds,
|
|
101
|
+
)) as Map<string, number> | Record<string, number>;
|
|
102
|
+
|
|
103
|
+
return result instanceof Map ? Object.fromEntries(result) : result;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async fetchOwnInboxUpdatesCount() {
|
|
107
|
+
return this.#client.fetchOwnInboxUpdatesCount(true);
|
|
108
|
+
}
|
|
109
|
+
|
|
83
110
|
async addSignature(
|
|
84
111
|
signatureRequest: SignatureRequestHandle,
|
|
85
112
|
signer: SafeSigner,
|
|
@@ -138,13 +165,17 @@ export class WorkerClient {
|
|
|
138
165
|
async registerIdentity(
|
|
139
166
|
signer: SafeSigner,
|
|
140
167
|
signatureRequest: SignatureRequestHandle,
|
|
168
|
+
visibilityConfirmationOptions?: VisibilityConfirmationOptions,
|
|
141
169
|
) {
|
|
142
170
|
await this.addSignature(signatureRequest, signer);
|
|
143
|
-
await this.#client.registerIdentity(
|
|
171
|
+
await this.#client.registerIdentity(
|
|
172
|
+
signatureRequest,
|
|
173
|
+
visibilityConfirmationOptions,
|
|
174
|
+
);
|
|
144
175
|
}
|
|
145
176
|
|
|
146
177
|
async getInboxIdByIdentifier(identifier: Identifier) {
|
|
147
|
-
return this.#client.
|
|
178
|
+
return this.#client.findInboxIdByIdentity(identifier);
|
|
148
179
|
}
|
|
149
180
|
|
|
150
181
|
signWithInstallationKey(signatureText: string) {
|
|
@@ -185,7 +216,45 @@ export class WorkerClient {
|
|
|
185
216
|
) as Promise<Map<string, KeyPackageStatus>>;
|
|
186
217
|
}
|
|
187
218
|
|
|
188
|
-
async sendSyncRequest() {
|
|
189
|
-
return this.#client.sendSyncRequest();
|
|
219
|
+
async sendSyncRequest(options: ArchiveOptions, serverUrl: string) {
|
|
220
|
+
return this.#client.device_sync().sendSyncRequest(options, serverUrl);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async sendSyncArchive(
|
|
224
|
+
options: ArchiveOptions,
|
|
225
|
+
serverUrl: string,
|
|
226
|
+
pin: string,
|
|
227
|
+
) {
|
|
228
|
+
return this.#client.device_sync().sendSyncArchive(options, serverUrl, pin);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async processSyncArchive(archivePin?: string | null) {
|
|
232
|
+
return this.#client.device_sync().processSyncArchive(archivePin);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
listAvailableArchives(daysCutoff: number): AvailableArchiveInfo[] {
|
|
236
|
+
return this.#client.device_sync().listAvailableArchives(BigInt(daysCutoff));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async createArchive(
|
|
240
|
+
opts: ArchiveOptions,
|
|
241
|
+
key: Uint8Array,
|
|
242
|
+
): Promise<Uint8Array> {
|
|
243
|
+
return this.#client.device_sync().createArchive(opts, key);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async importArchive(data: Uint8Array, key: Uint8Array) {
|
|
247
|
+
return this.#client.device_sync().importArchive(data, key);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async archiveMetadata(
|
|
251
|
+
data: Uint8Array,
|
|
252
|
+
key: Uint8Array,
|
|
253
|
+
): Promise<ArchiveMetadata> {
|
|
254
|
+
return this.#client.device_sync().archiveMetadata(data, key);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async syncAllDeviceSyncGroups(): Promise<GroupSyncSummary> {
|
|
258
|
+
return this.#client.device_sync().syncAllDeviceSyncGroups();
|
|
190
259
|
}
|
|
191
260
|
}
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
type RemoteAttachment,
|
|
24
24
|
type Reply,
|
|
25
25
|
type SendMessageOpts,
|
|
26
|
+
type SendOpts,
|
|
26
27
|
type TransactionReference,
|
|
27
28
|
type WalletSendCalls,
|
|
28
29
|
} from "@xmtp/wasm-bindings";
|
|
@@ -153,19 +154,19 @@ export class WorkerConversation {
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
async addMembersByIdentifiers(identifiers: Identifier[]) {
|
|
156
|
-
return this.#group.
|
|
157
|
+
return this.#group.addMembersByIdentity(identifiers);
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
async addMembers(inboxIds: string[]) {
|
|
160
|
-
return this.#group.
|
|
161
|
+
return this.#group.addMembers(inboxIds);
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
async removeMembersByIdentifiers(identifiers: Identifier[]) {
|
|
164
|
-
return this.#group.
|
|
165
|
+
return this.#group.removeMembersByIdentity(identifiers);
|
|
165
166
|
}
|
|
166
167
|
|
|
167
168
|
async removeMembers(inboxIds: string[]) {
|
|
168
|
-
return this.#group.
|
|
169
|
+
return this.#group.removeMembers(inboxIds);
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
async addAdmin(inboxId: string) {
|
|
@@ -196,70 +197,61 @@ export class WorkerConversation {
|
|
|
196
197
|
return this.#group.send(encodedContent, opts ?? { shouldPush: true });
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
async sendText(text: string,
|
|
200
|
-
return this.#group.sendText(text,
|
|
200
|
+
async sendText(text: string, opts?: SendOpts) {
|
|
201
|
+
return this.#group.sendText(text, opts);
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
async sendMarkdown(markdown: string,
|
|
204
|
-
return this.#group.sendMarkdown(markdown,
|
|
204
|
+
async sendMarkdown(markdown: string, opts?: SendOpts) {
|
|
205
|
+
return this.#group.sendMarkdown(markdown, opts);
|
|
205
206
|
}
|
|
206
207
|
|
|
207
|
-
async sendReaction(reaction: Reaction,
|
|
208
|
-
return this.#group.sendReaction(reaction,
|
|
208
|
+
async sendReaction(reaction: Reaction, opts?: SendOpts) {
|
|
209
|
+
return this.#group.sendReaction(reaction, opts);
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
async sendReadReceipt(
|
|
212
|
-
return this.#group.sendReadReceipt(
|
|
212
|
+
async sendReadReceipt(opts?: SendOpts) {
|
|
213
|
+
return this.#group.sendReadReceipt(opts);
|
|
213
214
|
}
|
|
214
215
|
|
|
215
|
-
async sendReply(reply: Reply,
|
|
216
|
-
return this.#group.sendReply(reply,
|
|
216
|
+
async sendReply(reply: Reply, opts?: SendOpts) {
|
|
217
|
+
return this.#group.sendReply(reply, opts);
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
async sendTransactionReference(
|
|
220
221
|
transactionReference: TransactionReference,
|
|
221
|
-
|
|
222
|
+
opts?: SendOpts,
|
|
222
223
|
) {
|
|
223
|
-
return this.#group.sendTransactionReference(
|
|
224
|
-
transactionReference,
|
|
225
|
-
isOptimistic,
|
|
226
|
-
);
|
|
224
|
+
return this.#group.sendTransactionReference(transactionReference, opts);
|
|
227
225
|
}
|
|
228
226
|
|
|
229
|
-
async sendWalletSendCalls(
|
|
230
|
-
walletSendCalls
|
|
231
|
-
isOptimistic?: boolean,
|
|
232
|
-
) {
|
|
233
|
-
return this.#group.sendWalletSendCalls(walletSendCalls, isOptimistic);
|
|
227
|
+
async sendWalletSendCalls(walletSendCalls: WalletSendCalls, opts?: SendOpts) {
|
|
228
|
+
return this.#group.sendWalletSendCalls(walletSendCalls, opts);
|
|
234
229
|
}
|
|
235
230
|
|
|
236
|
-
async sendActions(actions: Actions,
|
|
237
|
-
return this.#group.sendActions(actions,
|
|
231
|
+
async sendActions(actions: Actions, opts?: SendOpts) {
|
|
232
|
+
return this.#group.sendActions(actions, opts);
|
|
238
233
|
}
|
|
239
234
|
|
|
240
|
-
async sendIntent(intent: Intent,
|
|
241
|
-
return this.#group.sendIntent(intent,
|
|
235
|
+
async sendIntent(intent: Intent, opts?: SendOpts) {
|
|
236
|
+
return this.#group.sendIntent(intent, opts);
|
|
242
237
|
}
|
|
243
238
|
|
|
244
|
-
async sendAttachment(attachment: Attachment,
|
|
245
|
-
return this.#group.sendAttachment(attachment,
|
|
239
|
+
async sendAttachment(attachment: Attachment, opts?: SendOpts) {
|
|
240
|
+
return this.#group.sendAttachment(attachment, opts);
|
|
246
241
|
}
|
|
247
242
|
|
|
248
243
|
async sendMultiRemoteAttachment(
|
|
249
244
|
multiRemoteAttachment: MultiRemoteAttachment,
|
|
250
|
-
|
|
245
|
+
opts?: SendOpts,
|
|
251
246
|
) {
|
|
252
|
-
return this.#group.sendMultiRemoteAttachment(
|
|
253
|
-
multiRemoteAttachment,
|
|
254
|
-
isOptimistic,
|
|
255
|
-
);
|
|
247
|
+
return this.#group.sendMultiRemoteAttachment(multiRemoteAttachment, opts);
|
|
256
248
|
}
|
|
257
249
|
|
|
258
250
|
async sendRemoteAttachment(
|
|
259
251
|
remoteAttachment: RemoteAttachment,
|
|
260
|
-
|
|
252
|
+
opts?: SendOpts,
|
|
261
253
|
) {
|
|
262
|
-
return this.#group.sendRemoteAttachment(remoteAttachment,
|
|
254
|
+
return this.#group.sendRemoteAttachment(remoteAttachment, opts);
|
|
263
255
|
}
|
|
264
256
|
|
|
265
257
|
async messages(options?: ListMessagesOptions): Promise<DecodedMessage[]> {
|
package/src/constants.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pre-configured URLs for the XMTP network based on the environment
|
|
3
3
|
*
|
|
4
|
+
* @deprecated Use `createBackend()` instead.
|
|
4
5
|
* @constant
|
|
5
6
|
* @property {string} local - The local URL for the XMTP network
|
|
6
7
|
* @property {string} dev - The development URL for the XMTP network
|
|
@@ -24,4 +25,8 @@ export const HistorySyncUrls = {
|
|
|
24
25
|
local: "http://localhost:5558",
|
|
25
26
|
dev: "https://message-history.dev.ephemera.network",
|
|
26
27
|
production: "https://message-history.production.ephemera.network",
|
|
28
|
+
"testnet-staging": "https://message-history.dev.ephemera.network",
|
|
29
|
+
"testnet-dev": "https://message-history.dev.ephemera.network",
|
|
30
|
+
testnet: "https://message-history.dev.ephemera.network",
|
|
31
|
+
mainnet: "https://message-history.production.ephemera.network",
|
|
27
32
|
} as const;
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { Conversation } from "./Conversation";
|
|
|
5
5
|
export { Dm } from "./Dm";
|
|
6
6
|
export { Group } from "./Group";
|
|
7
7
|
export { DecodedMessage } from "./DecodedMessage";
|
|
8
|
+
export { createBackend } from "./utils/createBackend";
|
|
8
9
|
export { generateInboxId, getInboxIdForIdentifier } from "./utils/inboxId";
|
|
9
10
|
export { metadataFieldName } from "./utils/metadata";
|
|
10
11
|
export { ApiUrls, HistorySyncUrls } from "./constants";
|
|
@@ -16,7 +17,12 @@ export type {
|
|
|
16
17
|
Action,
|
|
17
18
|
Actions,
|
|
18
19
|
ApiStats,
|
|
20
|
+
ArchiveMetadata,
|
|
21
|
+
ArchiveOptions,
|
|
19
22
|
Attachment,
|
|
23
|
+
AvailableArchiveInfo,
|
|
24
|
+
Backend,
|
|
25
|
+
BackendBuilder,
|
|
20
26
|
Consent,
|
|
21
27
|
ConversationDebugInfo,
|
|
22
28
|
ConversationListItem,
|
|
@@ -50,18 +56,21 @@ export type {
|
|
|
50
56
|
Reaction,
|
|
51
57
|
ReadReceipt,
|
|
52
58
|
RemoteAttachment,
|
|
53
|
-
RemoteAttachmentInfo,
|
|
54
59
|
Reply,
|
|
55
60
|
SendMessageOpts,
|
|
61
|
+
SendOpts,
|
|
56
62
|
SignatureRequestHandle,
|
|
57
63
|
TransactionMetadata,
|
|
58
64
|
TransactionReference,
|
|
59
65
|
UserPreferenceUpdate,
|
|
60
66
|
WalletCall,
|
|
61
67
|
WalletSendCalls,
|
|
68
|
+
WorkerConfigOptions,
|
|
69
|
+
WorkerIntervalOverride,
|
|
62
70
|
} from "@xmtp/wasm-bindings";
|
|
63
71
|
export {
|
|
64
72
|
ActionStyle,
|
|
73
|
+
BackupElementSelectionOption,
|
|
65
74
|
ConsentEntityType,
|
|
66
75
|
ConsentState,
|
|
67
76
|
ContentType,
|
|
@@ -81,6 +90,7 @@ export {
|
|
|
81
90
|
ReactionAction,
|
|
82
91
|
ReactionSchema,
|
|
83
92
|
SortDirection,
|
|
93
|
+
WorkerKind,
|
|
84
94
|
} from "@xmtp/wasm-bindings";
|
|
85
95
|
export * from "./utils/signer";
|
|
86
96
|
export * from "./utils/errors";
|