@xmtp/browser-sdk 0.0.23 → 1.0.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/src/Client.ts CHANGED
@@ -10,21 +10,20 @@ import { TextCodec } from "@xmtp/content-type-text";
10
10
  import {
11
11
  GroupMessageKind,
12
12
  SignatureRequestType,
13
- type ConsentEntityType,
13
+ type Identifier,
14
14
  } from "@xmtp/wasm-bindings";
15
15
  import { ClientWorkerClass } from "@/ClientWorkerClass";
16
16
  import { Conversations } from "@/Conversations";
17
+ import { Preferences } from "@/Preferences";
17
18
  import type { ClientOptions, XmtpEnv } from "@/types";
18
19
  import {
19
20
  fromSafeEncodedContent,
20
21
  toSafeEncodedContent,
21
- type SafeConsent,
22
22
  type SafeMessage,
23
23
  } from "@/utils/conversions";
24
24
  import { type Signer } from "@/utils/signer";
25
25
 
26
26
  export class Client extends ClientWorkerClass {
27
- #accountAddress: string;
28
27
  #codecs: Map<string, ContentCodec>;
29
28
  #conversations: Conversations;
30
29
  #encryptionKey: Uint8Array;
@@ -32,12 +31,12 @@ export class Client extends ClientWorkerClass {
32
31
  #installationId: string | undefined;
33
32
  #installationIdBytes: Uint8Array | undefined;
34
33
  #isReady = false;
34
+ #preferences: Preferences;
35
35
  #signer: Signer;
36
36
  options?: ClientOptions;
37
37
 
38
38
  constructor(
39
39
  signer: Signer,
40
- accountAddress: string,
41
40
  encryptionKey: Uint8Array,
42
41
  options?: ClientOptions,
43
42
  ) {
@@ -48,11 +47,11 @@ export class Client extends ClientWorkerClass {
48
47
  worker,
49
48
  options?.loggingLevel !== undefined && options.loggingLevel !== "off",
50
49
  );
51
- this.#accountAddress = accountAddress;
52
50
  this.options = options;
53
51
  this.#encryptionKey = encryptionKey;
54
52
  this.#signer = signer;
55
53
  this.#conversations = new Conversations(this);
54
+ this.#preferences = new Preferences(this);
56
55
  const codecs = [
57
56
  new GroupUpdatedCodec(),
58
57
  new TextCodec(),
@@ -63,13 +62,9 @@ export class Client extends ClientWorkerClass {
63
62
  );
64
63
  }
65
64
 
66
- get accountAddress() {
67
- return this.#accountAddress;
68
- }
69
-
70
65
  async init() {
71
66
  const result = await this.sendMessage("init", {
72
- address: this.accountAddress,
67
+ identifier: await this.#signer.getIdentifier(),
73
68
  encryptionKey: this.#encryptionKey,
74
69
  options: this.options,
75
70
  });
@@ -84,8 +79,7 @@ export class Client extends ClientWorkerClass {
84
79
  encryptionKey: Uint8Array,
85
80
  options?: ClientOptions,
86
81
  ) {
87
- const address = await signer.getAddress();
88
- const client = new Client(signer, address, encryptionKey, options);
82
+ const client = new Client(signer, encryptionKey, options);
89
83
 
90
84
  await client.init();
91
85
 
@@ -104,6 +98,10 @@ export class Client extends ClientWorkerClass {
104
98
  return this.#inboxId;
105
99
  }
106
100
 
101
+ async accountIdentifier() {
102
+ return this.#signer.getIdentifier();
103
+ }
104
+
107
105
  get installationId() {
108
106
  return this.#installationId;
109
107
  }
@@ -112,6 +110,14 @@ export class Client extends ClientWorkerClass {
112
110
  return this.#installationIdBytes;
113
111
  }
114
112
 
113
+ get conversations() {
114
+ return this.#conversations;
115
+ }
116
+
117
+ get preferences() {
118
+ return this.#preferences;
119
+ }
120
+
115
121
  /**
116
122
  * WARNING: This function should be used with caution. It is only provided
117
123
  * for use in special cases where the provided workflows do not meet the
@@ -134,7 +140,7 @@ export class Client extends ClientWorkerClass {
134
140
  * throw an error.
135
141
  */
136
142
  async unsafe_addAccountSignatureText(
137
- newAccountAddress: string,
143
+ newIdentifier: Identifier,
138
144
  allowInboxReassign: boolean = false,
139
145
  ) {
140
146
  if (!allowInboxReassign) {
@@ -144,7 +150,7 @@ export class Client extends ClientWorkerClass {
144
150
  }
145
151
 
146
152
  return this.sendMessage("addAccountSignatureText", {
147
- newAccountAddress,
153
+ newIdentifier,
148
154
  });
149
155
  }
150
156
 
@@ -155,8 +161,10 @@ export class Client extends ClientWorkerClass {
155
161
  *
156
162
  * It is highly recommended to use the `removeAccount` function instead.
157
163
  */
158
- async unsafe_removeAccountSignatureText(accountAddress: string) {
159
- return this.sendMessage("removeAccountSignatureText", { accountAddress });
164
+ async unsafe_removeAccountSignatureText(identifier: Identifier) {
165
+ return this.sendMessage("removeAccountSignatureText", {
166
+ identifier,
167
+ });
160
168
  }
161
169
 
162
170
  /**
@@ -203,18 +211,21 @@ export class Client extends ClientWorkerClass {
203
211
  ) {
204
212
  const signature = await signer.signMessage(signatureText);
205
213
 
206
- if (signer.walletType === "SCW") {
207
- await this.sendMessage("addScwSignature", {
208
- type: signatureType,
209
- bytes: signature,
210
- chainId: signer.getChainId(),
211
- blockNumber: signer.getBlockNumber?.(),
212
- });
213
- } else {
214
- await this.sendMessage("addSignature", {
215
- type: signatureType,
216
- bytes: signature,
217
- });
214
+ switch (signer.type) {
215
+ case "SCW":
216
+ await this.sendMessage("addScwSignature", {
217
+ type: signatureType,
218
+ bytes: signature,
219
+ chainId: signer.getChainId(),
220
+ blockNumber: signer.getBlockNumber?.(),
221
+ });
222
+ break;
223
+ case "EOA":
224
+ await this.sendMessage("addEcdsaSignature", {
225
+ type: signatureType,
226
+ bytes: signature,
227
+ });
228
+ break;
218
229
  }
219
230
  }
220
231
 
@@ -261,8 +272,8 @@ export class Client extends ClientWorkerClass {
261
272
  allowInboxReassign: boolean = false,
262
273
  ) {
263
274
  // check for existing inbox id
264
- const existingInboxId = await this.findInboxIdByAddress(
265
- await newAccountSigner.getAddress(),
275
+ const existingInboxId = await this.findInboxIdByIdentifier(
276
+ await newAccountSigner.getIdentifier(),
266
277
  );
267
278
 
268
279
  if (existingInboxId && !allowInboxReassign) {
@@ -272,7 +283,7 @@ export class Client extends ClientWorkerClass {
272
283
  }
273
284
 
274
285
  const signatureText = await this.unsafe_addAccountSignatureText(
275
- await newAccountSigner.getAddress(),
286
+ await newAccountSigner.getIdentifier(),
276
287
  true,
277
288
  );
278
289
 
@@ -289,9 +300,9 @@ export class Client extends ClientWorkerClass {
289
300
  await this.unsafe_applySignatures();
290
301
  }
291
302
 
292
- async removeAccount(accountAddress: string) {
303
+ async removeAccount(accountIdentifier: Identifier) {
293
304
  const signatureText =
294
- await this.unsafe_removeAccountSignatureText(accountAddress);
305
+ await this.unsafe_removeAccountSignatureText(accountIdentifier);
295
306
 
296
307
  if (!signatureText) {
297
308
  throw new Error("Unable to generate remove account signature text");
@@ -346,15 +357,17 @@ export class Client extends ClientWorkerClass {
346
357
  return this.sendMessage("isRegistered", undefined);
347
358
  }
348
359
 
349
- async canMessage(accountAddresses: string[]) {
350
- return this.sendMessage("canMessage", { accountAddresses });
360
+ async canMessage(identifiers: Identifier[]) {
361
+ return this.sendMessage("canMessage", { identifiers });
351
362
  }
352
363
 
353
- static async canMessage(accountAddresses: string[], env?: XmtpEnv) {
354
- const accountAddress = "0x0000000000000000000000000000000000000000";
364
+ static async canMessage(identifiers: Identifier[], env?: XmtpEnv) {
355
365
  const signer: Signer = {
356
- walletType: "EOA",
357
- getAddress: () => accountAddress,
366
+ type: "EOA",
367
+ getIdentifier: () => ({
368
+ identifier: "0x0000000000000000000000000000000000000000",
369
+ identifierKind: "Ethereum",
370
+ }),
358
371
  signMessage: () => new Uint8Array(),
359
372
  };
360
373
  const client = await Client.create(
@@ -365,33 +378,11 @@ export class Client extends ClientWorkerClass {
365
378
  env,
366
379
  },
367
380
  );
368
- return client.canMessage(accountAddresses);
369
- }
370
-
371
- async findInboxIdByAddress(address: string) {
372
- return this.sendMessage("findInboxIdByAddress", { address });
373
- }
374
-
375
- async inboxState(refreshFromNetwork?: boolean) {
376
- return this.sendMessage("inboxState", {
377
- refreshFromNetwork: refreshFromNetwork ?? false,
378
- });
379
- }
380
-
381
- async getLatestInboxState(inboxId: string) {
382
- return this.sendMessage("getLatestInboxState", { inboxId });
381
+ return client.canMessage(identifiers);
383
382
  }
384
383
 
385
- async setConsentStates(records: SafeConsent[]) {
386
- return this.sendMessage("setConsentStates", { records });
387
- }
388
-
389
- async getConsentState(entityType: ConsentEntityType, entity: string) {
390
- return this.sendMessage("getConsentState", { entityType, entity });
391
- }
392
-
393
- get conversations() {
394
- return this.#conversations;
384
+ async findInboxIdByIdentifier(identifier: Identifier) {
385
+ return this.sendMessage("findInboxIdByIdentifier", { identifier });
395
386
  }
396
387
 
397
388
  codecFor(contentType: ContentTypeId) {
@@ -199,4 +199,10 @@ export class Conversation {
199
199
  };
200
200
  return asyncStream;
201
201
  }
202
+
203
+ async pausedForVersion() {
204
+ return this.#client.sendMessage("getGroupPausedForVersion", {
205
+ id: this.#id,
206
+ });
207
+ }
202
208
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ConversationType,
3
3
  type ConsentState,
4
- type UserPreference,
4
+ type Identifier,
5
5
  } from "@xmtp/wasm-bindings";
6
6
  import { v4 } from "uuid";
7
7
  import { AsyncStream, type StreamCallback } from "@/AsyncStream";
@@ -10,7 +10,6 @@ import { DecodedMessage } from "@/DecodedMessage";
10
10
  import { Dm } from "@/Dm";
11
11
  import { Group } from "@/Group";
12
12
  import type {
13
- SafeConsent,
14
13
  SafeConversation,
15
14
  SafeCreateDmOptions,
16
15
  SafeCreateGroupOptions,
@@ -97,38 +96,47 @@ export class Conversations {
97
96
  );
98
97
  }
99
98
 
100
- async newGroup(accountAddresses: string[], options?: SafeCreateGroupOptions) {
101
- const conversation = await this.#client.sendMessage("newGroup", {
102
- accountAddresses,
103
- options,
104
- });
99
+ async newGroupWithIdentifiers(
100
+ identifiers: Identifier[],
101
+ options?: SafeCreateGroupOptions,
102
+ ) {
103
+ const conversation = await this.#client.sendMessage(
104
+ "newGroupWithIdentifiers",
105
+ {
106
+ identifiers,
107
+ options,
108
+ },
109
+ );
105
110
 
106
111
  return new Group(this.#client, conversation.id, conversation);
107
112
  }
108
113
 
109
- async newGroupByInboxIds(
110
- inboxIds: string[],
111
- options?: SafeCreateGroupOptions,
112
- ) {
113
- const conversation = await this.#client.sendMessage("newGroupByInboxIds", {
114
- inboxIds,
115
- options,
116
- });
114
+ async newGroup(inboxIds: string[], options?: SafeCreateGroupOptions) {
115
+ const conversation = await this.#client.sendMessage(
116
+ "newGroupWithInboxIds",
117
+ {
118
+ inboxIds,
119
+ options,
120
+ },
121
+ );
117
122
 
118
123
  return new Group(this.#client, conversation.id, conversation);
119
124
  }
120
125
 
121
- async newDm(accountAddress: string, options?: SafeCreateDmOptions) {
122
- const conversation = await this.#client.sendMessage("newDm", {
123
- accountAddress,
126
+ async newDmWithIdentifier(
127
+ identifier: Identifier,
128
+ options?: SafeCreateDmOptions,
129
+ ) {
130
+ const conversation = await this.#client.sendMessage("newDmWithIdentifier", {
131
+ identifier,
124
132
  options,
125
133
  });
126
134
 
127
135
  return new Dm(this.#client, conversation.id, conversation);
128
136
  }
129
137
 
130
- async newDmByInboxId(inboxId: string, options?: SafeCreateDmOptions) {
131
- const conversation = await this.#client.sendMessage("newDmByInboxId", {
138
+ async newDm(inboxId: string, options?: SafeCreateDmOptions) {
139
+ const conversation = await this.#client.sendMessage("newDmWithInboxId", {
132
140
  inboxId,
133
141
  options,
134
142
  });
@@ -231,48 +239,4 @@ export class Conversations {
231
239
  async streamAllDmMessages(callback?: StreamCallback<DecodedMessage>) {
232
240
  return this.streamAllMessages(callback, ConversationType.Dm);
233
241
  }
234
-
235
- async streamConsent(callback?: StreamCallback<SafeConsent[]>) {
236
- const streamId = v4();
237
- const asyncStream = new AsyncStream<SafeConsent[]>();
238
- const endStream = this.#client.handleStreamMessage<SafeConsent[]>(
239
- streamId,
240
- (error, value) => {
241
- void asyncStream.callback(error, value ?? undefined);
242
- void callback?.(error, value ?? undefined);
243
- },
244
- );
245
- await this.#client.sendMessage("streamConsent", {
246
- streamId,
247
- });
248
- asyncStream.onReturn = () => {
249
- void this.#client.sendMessage("endStream", {
250
- streamId,
251
- });
252
- endStream();
253
- };
254
- return asyncStream;
255
- }
256
-
257
- async streamPreferences(callback?: StreamCallback<UserPreference[]>) {
258
- const streamId = v4();
259
- const asyncStream = new AsyncStream<UserPreference[]>();
260
- const endStream = this.#client.handleStreamMessage<UserPreference[]>(
261
- streamId,
262
- (error, value) => {
263
- void asyncStream.callback(error, value ?? undefined);
264
- void callback?.(error, value ?? undefined);
265
- },
266
- );
267
- await this.#client.sendMessage("streamPreferences", {
268
- streamId,
269
- });
270
- asyncStream.onReturn = () => {
271
- void this.#client.sendMessage("endStream", {
272
- streamId,
273
- });
274
- endStream();
275
- };
276
- return asyncStream;
277
- }
278
242
  }
package/src/Group.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ Identifier,
2
3
  MetadataField,
3
4
  PermissionPolicy,
4
5
  PermissionUpdateType,
@@ -132,28 +133,28 @@ export class Group extends Conversation {
132
133
  return superAdmins.includes(inboxId);
133
134
  }
134
135
 
135
- async addMembers(accountAddresses: string[]) {
136
+ async addMembersByIdentifiers(identifiers: Identifier[]) {
136
137
  return this.#client.sendMessage("addGroupMembers", {
137
138
  id: this.#id,
138
- accountAddresses,
139
+ identifiers,
139
140
  });
140
141
  }
141
142
 
142
- async addMembersByInboxId(inboxIds: string[]) {
143
+ async addMembers(inboxIds: string[]) {
143
144
  return this.#client.sendMessage("addGroupMembersByInboxId", {
144
145
  id: this.#id,
145
146
  inboxIds,
146
147
  });
147
148
  }
148
149
 
149
- async removeMembers(accountAddresses: string[]) {
150
+ async removeMembersByIdentifiers(identifiers: Identifier[]) {
150
151
  return this.#client.sendMessage("removeGroupMembers", {
151
152
  id: this.#id,
152
- accountAddresses,
153
+ identifiers,
153
154
  });
154
155
  }
155
156
 
156
- async removeMembersByInboxId(inboxIds: string[]) {
157
+ async removeMembers(inboxIds: string[]) {
157
158
  return this.#client.sendMessage("removeGroupMembersByInboxId", {
158
159
  id: this.#id,
159
160
  inboxIds,
@@ -0,0 +1,75 @@
1
+ import type { ConsentEntityType, UserPreference } from "@xmtp/wasm-bindings";
2
+ import { v4 } from "uuid";
3
+ import { AsyncStream, type StreamCallback } from "@/AsyncStream";
4
+ import type { SafeConsent } from "@/utils/conversions";
5
+ import type { Client } from "./Client";
6
+
7
+ export class Preferences {
8
+ #client: Client;
9
+
10
+ constructor(client: Client) {
11
+ this.#client = client;
12
+ }
13
+
14
+ async inboxState(refreshFromNetwork?: boolean) {
15
+ return this.#client.sendMessage("inboxState", {
16
+ refreshFromNetwork: refreshFromNetwork ?? false,
17
+ });
18
+ }
19
+
20
+ async getLatestInboxState(inboxId: string) {
21
+ return this.#client.sendMessage("getLatestInboxState", { inboxId });
22
+ }
23
+
24
+ async setConsentStates(records: SafeConsent[]) {
25
+ return this.#client.sendMessage("setConsentStates", { records });
26
+ }
27
+
28
+ async getConsentState(entityType: ConsentEntityType, entity: string) {
29
+ return this.#client.sendMessage("getConsentState", { entityType, entity });
30
+ }
31
+
32
+ async streamConsent(callback?: StreamCallback<SafeConsent[]>) {
33
+ const streamId = v4();
34
+ const asyncStream = new AsyncStream<SafeConsent[]>();
35
+ const endStream = this.#client.handleStreamMessage<SafeConsent[]>(
36
+ streamId,
37
+ (error, value) => {
38
+ void asyncStream.callback(error, value ?? undefined);
39
+ void callback?.(error, value ?? undefined);
40
+ },
41
+ );
42
+ await this.#client.sendMessage("streamConsent", {
43
+ streamId,
44
+ });
45
+ asyncStream.onReturn = () => {
46
+ void this.#client.sendMessage("endStream", {
47
+ streamId,
48
+ });
49
+ endStream();
50
+ };
51
+ return asyncStream;
52
+ }
53
+
54
+ async streamPreferences(callback?: StreamCallback<UserPreference[]>) {
55
+ const streamId = v4();
56
+ const asyncStream = new AsyncStream<UserPreference[]>();
57
+ const endStream = this.#client.handleStreamMessage<UserPreference[]>(
58
+ streamId,
59
+ (error, value) => {
60
+ void asyncStream.callback(error, value ?? undefined);
61
+ void callback?.(error, value ?? undefined);
62
+ },
63
+ );
64
+ await this.#client.sendMessage("streamPreferences", {
65
+ streamId,
66
+ });
67
+ asyncStream.onReturn = () => {
68
+ void this.#client.sendMessage("endStream", {
69
+ streamId,
70
+ });
71
+ endStream();
72
+ };
73
+ return asyncStream;
74
+ }
75
+ }
package/src/Utils.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Identifier } from "@xmtp/wasm-bindings";
1
2
  import type { XmtpEnv } from "@/types/options";
2
3
  import { UtilsWorkerClass } from "@/UtilsWorkerClass";
3
4
 
@@ -11,16 +12,16 @@ export class Utils extends UtilsWorkerClass {
11
12
  this.#enableLogging = enableLogging ?? false;
12
13
  }
13
14
 
14
- async generateInboxId(address: string) {
15
+ async generateInboxId(identifier: Identifier) {
15
16
  return this.sendMessage("generateInboxId", {
16
- address,
17
+ identifier,
17
18
  enableLogging: this.#enableLogging,
18
19
  });
19
20
  }
20
21
 
21
- async getInboxIdForAddress(address: string, env?: XmtpEnv) {
22
- return this.sendMessage("getInboxIdForAddress", {
23
- address,
22
+ async getInboxIdForIdentifier(identifier: Identifier, env?: XmtpEnv) {
23
+ return this.sendMessage("getInboxIdForIdentifier", {
24
+ identifier,
24
25
  env,
25
26
  enableLogging: this.#enableLogging,
26
27
  });
@@ -1,38 +1,37 @@
1
1
  import {
2
2
  verifySignedWithPublicKey,
3
3
  type Client,
4
- type ConsentEntityType,
4
+ type Identifier,
5
5
  type SignatureRequestType,
6
6
  } from "@xmtp/wasm-bindings";
7
7
  import type { ClientOptions } from "@/types";
8
- import { fromSafeConsent, type SafeConsent } from "@/utils/conversions";
9
8
  import { createClient } from "@/utils/createClient";
10
9
  import { WorkerConversations } from "@/WorkerConversations";
10
+ import { WorkerPreferences } from "@/WorkerPreferences";
11
11
 
12
12
  export class WorkerClient {
13
13
  #client: Client;
14
-
15
14
  #conversations: WorkerConversations;
16
-
17
- #accountAddress: string;
15
+ #preferences: WorkerPreferences;
18
16
 
19
17
  constructor(client: Client) {
20
18
  this.#client = client;
21
- this.#accountAddress = client.accountAddress;
22
- this.#conversations = new WorkerConversations(this, client.conversations());
19
+ const conversations = client.conversations();
20
+ this.#conversations = new WorkerConversations(this, conversations);
21
+ this.#preferences = new WorkerPreferences(client, conversations);
23
22
  }
24
23
 
25
24
  static async create(
26
- accountAddress: string,
25
+ identifier: Identifier,
27
26
  encryptionKey: Uint8Array,
28
27
  options?: Omit<ClientOptions, "codecs">,
29
28
  ) {
30
- const client = await createClient(accountAddress, encryptionKey, options);
29
+ const client = await createClient(identifier, encryptionKey, options);
31
30
  return new WorkerClient(client);
32
31
  }
33
32
 
34
- get accountAddress() {
35
- return this.#accountAddress;
33
+ get accountIdentifier() {
34
+ return this.#client.accountIdentifier;
36
35
  }
37
36
 
38
37
  get inboxId() {
@@ -51,6 +50,14 @@ export class WorkerClient {
51
50
  return this.#client.isRegistered;
52
51
  }
53
52
 
53
+ get conversations() {
54
+ return this.#conversations;
55
+ }
56
+
57
+ get preferences() {
58
+ return this.#preferences;
59
+ }
60
+
54
61
  createInboxSignatureText() {
55
62
  try {
56
63
  return this.#client.createInboxSignatureText();
@@ -59,17 +66,17 @@ export class WorkerClient {
59
66
  }
60
67
  }
61
68
 
62
- async addAccountSignatureText(accountAddress: string) {
69
+ async addAccountSignatureText(identifier: Identifier) {
63
70
  try {
64
- return await this.#client.addWalletSignatureText(accountAddress);
71
+ return await this.#client.addWalletSignatureText(identifier);
65
72
  } catch {
66
73
  return undefined;
67
74
  }
68
75
  }
69
76
 
70
- async removeAccountSignatureText(accountAddress: string) {
77
+ async removeAccountSignatureText(identifier: Identifier) {
71
78
  try {
72
- return await this.#client.revokeWalletSignatureText(accountAddress);
79
+ return await this.#client.revokeWalletSignatureText(identifier);
73
80
  } catch {
74
81
  return undefined;
75
82
  }
@@ -93,8 +100,8 @@ export class WorkerClient {
93
100
  }
94
101
  }
95
102
 
96
- async addSignature(type: SignatureRequestType, bytes: Uint8Array) {
97
- return this.#client.addSignature(type, bytes);
103
+ async addEcdsaSignature(type: SignatureRequestType, bytes: Uint8Array) {
104
+ return this.#client.addEcdsaSignature(type, bytes);
98
105
  }
99
106
 
100
107
  async addScwSignature(
@@ -110,8 +117,8 @@ export class WorkerClient {
110
117
  return this.#client.applySignatureRequests();
111
118
  }
112
119
 
113
- async canMessage(accountAddresses: string[]) {
114
- return this.#client.canMessage(accountAddresses) as Promise<
120
+ async canMessage(identifiers: Identifier[]) {
121
+ return this.#client.canMessage(identifiers) as Promise<
115
122
  Map<string, boolean>
116
123
  >;
117
124
  }
@@ -120,28 +127,8 @@ export class WorkerClient {
120
127
  return this.#client.registerIdentity();
121
128
  }
122
129
 
123
- async findInboxIdByAddress(address: string) {
124
- return this.#client.findInboxIdByAddress(address);
125
- }
126
-
127
- async inboxState(refreshFromNetwork: boolean) {
128
- return this.#client.inboxState(refreshFromNetwork);
129
- }
130
-
131
- async getLatestInboxState(inboxId: string) {
132
- return this.#client.getLatestInboxState(inboxId);
133
- }
134
-
135
- async setConsentStates(records: SafeConsent[]) {
136
- return this.#client.setConsentStates(records.map(fromSafeConsent));
137
- }
138
-
139
- async getConsentState(entityType: ConsentEntityType, entity: string) {
140
- return this.#client.getConsentState(entityType, entity);
141
- }
142
-
143
- get conversations() {
144
- return this.#conversations;
130
+ async findInboxIdByIdentifier(identifier: Identifier) {
131
+ return this.#client.findInboxIdByIdentifier(identifier);
145
132
  }
146
133
 
147
134
  signWithInstallationKey(signatureText: string) {