@xmtp/browser-sdk 2.2.0 → 3.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/dist/index.d.ts +314 -134
- 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/dist/workers/utils.js +1 -1
- package/dist/workers/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/AsyncStream.ts +27 -32
- package/src/Client.ts +138 -169
- package/src/DebugInformation.ts +48 -0
- package/src/Utils.ts +77 -0
- package/src/WorkerClient.ts +55 -83
- package/src/WorkerDebugInformation.ts +41 -0
- package/src/index.ts +3 -2
- package/src/types/actions/client.ts +84 -58
- package/src/types/actions/debugInformation.ts +35 -0
- package/src/types/actions/utils.ts +33 -0
- package/src/types/actions.ts +3 -1
- package/src/utils/conversions.ts +2 -2
- package/src/utils/errors.ts +0 -27
- package/src/utils/signer.ts +36 -0
- package/src/workers/client.ts +140 -34
- package/src/workers/utils.ts +50 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Client } from "./Client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Debug information helpers for the client
|
|
5
|
+
*
|
|
6
|
+
* This class is not intended to be initialized directly.
|
|
7
|
+
*/
|
|
8
|
+
export class DebugInformation<ContentTypes = unknown> {
|
|
9
|
+
#client: Client<ContentTypes>;
|
|
10
|
+
|
|
11
|
+
constructor(client: Client<ContentTypes>) {
|
|
12
|
+
this.#client = client;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
apiStatistics() {
|
|
16
|
+
return this.#client.sendMessage(
|
|
17
|
+
"debugInformation.apiStatistics",
|
|
18
|
+
undefined,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
apiIdentityStatistics() {
|
|
23
|
+
return this.#client.sendMessage(
|
|
24
|
+
"debugInformation.apiIdentityStatistics",
|
|
25
|
+
undefined,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
apiAggregateStatistics() {
|
|
30
|
+
return this.#client.sendMessage(
|
|
31
|
+
"debugInformation.apiAggregateStatistics",
|
|
32
|
+
undefined,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
clearAllStatistics() {
|
|
37
|
+
return this.#client.sendMessage(
|
|
38
|
+
"debugInformation.clearAllStatistics",
|
|
39
|
+
undefined,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
uploadDebugArchive(serverUrl?: string) {
|
|
44
|
+
return this.#client.sendMessage("debugInformation.uploadDebugArchive", {
|
|
45
|
+
serverUrl,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/Utils.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Identifier } from "@xmtp/wasm-bindings";
|
|
2
2
|
import type { XmtpEnv } from "@/types/options";
|
|
3
|
+
import { toSafeSigner, type Signer } from "@/utils/signer";
|
|
3
4
|
import { UtilsWorkerClass } from "@/UtilsWorkerClass";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -43,4 +44,80 @@ export class Utils extends UtilsWorkerClass {
|
|
|
43
44
|
env,
|
|
44
45
|
});
|
|
45
46
|
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates signature text for revoking installations
|
|
50
|
+
*
|
|
51
|
+
* WARNING: This function should be used with caution. It is only provided
|
|
52
|
+
* for use in special cases where the provided workflows do not meet the
|
|
53
|
+
* requirements of an application.
|
|
54
|
+
*
|
|
55
|
+
* It is highly recommended to use the `revokeInstallations` method instead.
|
|
56
|
+
*
|
|
57
|
+
* @param env - The environment to use
|
|
58
|
+
* @param identifier - The identifier to revoke installations for
|
|
59
|
+
* @param inboxId - The inbox ID to revoke installations for
|
|
60
|
+
* @param installationIds - The installation IDs to revoke
|
|
61
|
+
* @returns The signature text
|
|
62
|
+
*/
|
|
63
|
+
async revokeInstallationsSignatureText(
|
|
64
|
+
identifier: Identifier,
|
|
65
|
+
inboxId: string,
|
|
66
|
+
installationIds: Uint8Array[],
|
|
67
|
+
env?: XmtpEnv,
|
|
68
|
+
) {
|
|
69
|
+
return this.sendMessage("utils.revokeInstallationsSignatureText", {
|
|
70
|
+
env,
|
|
71
|
+
identifier,
|
|
72
|
+
inboxId,
|
|
73
|
+
installationIds,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Revokes installations for a given inbox ID
|
|
79
|
+
*
|
|
80
|
+
* @param env - The environment to use
|
|
81
|
+
* @param signer - The signer to use
|
|
82
|
+
* @param inboxId - The inbox ID to revoke installations for
|
|
83
|
+
* @param installationIds - The installation IDs to revoke
|
|
84
|
+
* @returns Promise that resolves with the result of the revoke installations operation
|
|
85
|
+
*/
|
|
86
|
+
async revokeInstallations(
|
|
87
|
+
signer: Signer,
|
|
88
|
+
inboxId: string,
|
|
89
|
+
installationIds: Uint8Array[],
|
|
90
|
+
env?: XmtpEnv,
|
|
91
|
+
) {
|
|
92
|
+
const identifier = await signer.getIdentifier();
|
|
93
|
+
const signatureText = await this.revokeInstallationsSignatureText(
|
|
94
|
+
identifier,
|
|
95
|
+
inboxId,
|
|
96
|
+
installationIds,
|
|
97
|
+
env,
|
|
98
|
+
);
|
|
99
|
+
const signature = await signer.signMessage(signatureText);
|
|
100
|
+
const safeSigner = await toSafeSigner(signer, signature);
|
|
101
|
+
|
|
102
|
+
return this.sendMessage("utils.revokeInstallations", {
|
|
103
|
+
signer: safeSigner,
|
|
104
|
+
inboxId,
|
|
105
|
+
installationIds,
|
|
106
|
+
env,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Gets the inbox state for the specified inbox IDs without a client
|
|
112
|
+
*
|
|
113
|
+
* @param inboxIds - The inbox IDs to get the state for
|
|
114
|
+
* @param env - The environment to use
|
|
115
|
+
* @returns The inbox state for the specified inbox IDs
|
|
116
|
+
*/
|
|
117
|
+
async inboxStateFromInboxIds(inboxIds: string[], env?: XmtpEnv) {
|
|
118
|
+
return this.sendMessage("utils.inboxStateFromInboxIds", {
|
|
119
|
+
inboxIds,
|
|
120
|
+
env,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
46
123
|
}
|
package/src/WorkerClient.ts
CHANGED
|
@@ -3,26 +3,27 @@ import {
|
|
|
3
3
|
type Client,
|
|
4
4
|
type Identifier,
|
|
5
5
|
type KeyPackageStatus,
|
|
6
|
-
type
|
|
6
|
+
type SignatureRequestHandle,
|
|
7
7
|
} from "@xmtp/wasm-bindings";
|
|
8
|
-
import { HistorySyncUrls } from "@/constants";
|
|
9
8
|
import type { ClientOptions } from "@/types/options";
|
|
10
9
|
import { createClient } from "@/utils/createClient";
|
|
10
|
+
import type { SafeSigner } from "@/utils/signer";
|
|
11
11
|
import { WorkerConversations } from "@/WorkerConversations";
|
|
12
|
+
import { WorkerDebugInformation } from "@/WorkerDebugInformation";
|
|
12
13
|
import { WorkerPreferences } from "@/WorkerPreferences";
|
|
13
14
|
|
|
14
15
|
export class WorkerClient {
|
|
15
16
|
#client: Client;
|
|
16
17
|
#conversations: WorkerConversations;
|
|
17
|
-
#
|
|
18
|
+
#debugInformation: WorkerDebugInformation;
|
|
18
19
|
#preferences: WorkerPreferences;
|
|
19
20
|
|
|
20
21
|
constructor(client: Client, options?: ClientOptions) {
|
|
21
22
|
this.#client = client;
|
|
22
23
|
const conversations = client.conversations();
|
|
23
24
|
this.#conversations = new WorkerConversations(this, conversations);
|
|
25
|
+
this.#debugInformation = new WorkerDebugInformation(client, options);
|
|
24
26
|
this.#preferences = new WorkerPreferences(client, conversations);
|
|
25
|
-
this.#options = options;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
static async create(
|
|
@@ -57,87 +58,81 @@ export class WorkerClient {
|
|
|
57
58
|
return this.#conversations;
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
get debugInformation() {
|
|
62
|
+
return this.#debugInformation;
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
get preferences() {
|
|
61
66
|
return this.#preferences;
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
69
|
+
async canMessage(identifiers: Identifier[]) {
|
|
70
|
+
return this.#client.canMessage(identifiers) as Promise<
|
|
71
|
+
Map<string, boolean>
|
|
72
|
+
>;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
async
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
async addSignature(
|
|
76
|
+
signatureRequest: SignatureRequestHandle,
|
|
77
|
+
signer: SafeSigner,
|
|
78
|
+
) {
|
|
79
|
+
switch (signer.type) {
|
|
80
|
+
case "SCW":
|
|
81
|
+
await signatureRequest.addScwSignature(
|
|
82
|
+
signer.identifier,
|
|
83
|
+
signer.signature,
|
|
84
|
+
signer.chainId,
|
|
85
|
+
signer.blockNumber,
|
|
86
|
+
);
|
|
87
|
+
break;
|
|
88
|
+
case "EOA":
|
|
89
|
+
await signatureRequest.addEcdsaSignature(signer.signature);
|
|
90
|
+
break;
|
|
77
91
|
}
|
|
78
92
|
}
|
|
79
93
|
|
|
80
|
-
async
|
|
81
|
-
|
|
82
|
-
return await this.#client.revokeWalletSignatureText(identifier);
|
|
83
|
-
} catch {
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
94
|
+
async applySignatureRequest(signatureRequest: SignatureRequestHandle) {
|
|
95
|
+
return this.#client.applySignatureRequest(signatureRequest);
|
|
86
96
|
}
|
|
87
97
|
|
|
88
|
-
async
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
async processSignatureRequest(
|
|
99
|
+
signer: SafeSigner,
|
|
100
|
+
signatureRequest: SignatureRequestHandle,
|
|
101
|
+
) {
|
|
102
|
+
await this.addSignature(signatureRequest, signer);
|
|
103
|
+
await this.applySignatureRequest(signatureRequest);
|
|
94
104
|
}
|
|
95
105
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return await this.#client.revokeInstallationsSignatureText(
|
|
99
|
-
installationIds,
|
|
100
|
-
);
|
|
101
|
-
} catch {
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
106
|
+
createInboxSignatureRequest() {
|
|
107
|
+
return this.#client.createInboxSignatureRequest();
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
async
|
|
107
|
-
|
|
108
|
-
return await this.#client.changeRecoveryIdentifierSignatureText(
|
|
109
|
-
identifier,
|
|
110
|
-
);
|
|
111
|
-
} catch {
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
110
|
+
async addAccountSignatureRequest(newAccountIdentifier: Identifier) {
|
|
111
|
+
return this.#client.addWalletSignatureRequest(newAccountIdentifier);
|
|
114
112
|
}
|
|
115
113
|
|
|
116
|
-
async
|
|
117
|
-
return this.#client.
|
|
114
|
+
async removeAccountSignatureRequest(identifier: Identifier) {
|
|
115
|
+
return this.#client.revokeWalletSignatureRequest(identifier);
|
|
118
116
|
}
|
|
119
117
|
|
|
120
|
-
async
|
|
121
|
-
|
|
122
|
-
bytes: Uint8Array,
|
|
123
|
-
chainId: bigint,
|
|
124
|
-
blockNumber?: bigint,
|
|
125
|
-
) {
|
|
126
|
-
return this.#client.addScwSignature(type, bytes, chainId, blockNumber);
|
|
118
|
+
async revokeAllOtherInstallationsSignatureRequest() {
|
|
119
|
+
return this.#client.revokeAllOtherInstallationsSignatureRequest();
|
|
127
120
|
}
|
|
128
121
|
|
|
129
|
-
async
|
|
130
|
-
return this.#client.
|
|
122
|
+
async revokeInstallationsSignatureRequest(installationIds: Uint8Array[]) {
|
|
123
|
+
return this.#client.revokeInstallationsSignatureRequest(installationIds);
|
|
131
124
|
}
|
|
132
125
|
|
|
133
|
-
async
|
|
134
|
-
return this.#client.
|
|
135
|
-
Map<string, boolean>
|
|
136
|
-
>;
|
|
126
|
+
async changeRecoveryIdentifierSignatureRequest(identifier: Identifier) {
|
|
127
|
+
return this.#client.changeRecoveryIdentifierSignatureRequest(identifier);
|
|
137
128
|
}
|
|
138
129
|
|
|
139
|
-
async registerIdentity(
|
|
140
|
-
|
|
130
|
+
async registerIdentity(
|
|
131
|
+
signer: SafeSigner,
|
|
132
|
+
signatureRequest: SignatureRequestHandle,
|
|
133
|
+
) {
|
|
134
|
+
await this.addSignature(signatureRequest, signer);
|
|
135
|
+
await this.#client.registerIdentity(signatureRequest);
|
|
141
136
|
}
|
|
142
137
|
|
|
143
138
|
async findInboxIdByIdentifier(identifier: Identifier) {
|
|
@@ -181,27 +176,4 @@ export class WorkerClient {
|
|
|
181
176
|
installationIds,
|
|
182
177
|
) as Promise<Map<string, KeyPackageStatus>>;
|
|
183
178
|
}
|
|
184
|
-
|
|
185
|
-
apiStatistics() {
|
|
186
|
-
return this.#client.apiStatistics();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
apiIdentityStatistics() {
|
|
190
|
-
return this.#client.apiIdentityStatistics();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
apiAggregateStatistics() {
|
|
194
|
-
return this.#client.apiAggregateStatistics();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
clearAllStatistics() {
|
|
198
|
-
this.#client.clearAllStatistics();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
async uploadDebugArchive(serverUrl?: string) {
|
|
202
|
-
const env = this.#options?.env || "dev";
|
|
203
|
-
const historySyncUrl =
|
|
204
|
-
this.#options?.historySyncUrl || HistorySyncUrls[env];
|
|
205
|
-
return this.#client.uploadDebugArchive(serverUrl || historySyncUrl);
|
|
206
|
-
}
|
|
207
179
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Client } from "@xmtp/wasm-bindings";
|
|
2
|
+
import { HistorySyncUrls } from "@/constants";
|
|
3
|
+
import type { ClientOptions } from "@/types/options";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Debug information helpers for the client
|
|
7
|
+
*
|
|
8
|
+
* This class is not intended to be initialized directly.
|
|
9
|
+
*/
|
|
10
|
+
export class WorkerDebugInformation {
|
|
11
|
+
#client: Client;
|
|
12
|
+
#options?: ClientOptions;
|
|
13
|
+
|
|
14
|
+
constructor(client: Client, options?: ClientOptions) {
|
|
15
|
+
this.#client = client;
|
|
16
|
+
this.#options = options;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
apiStatistics() {
|
|
20
|
+
return this.#client.apiStatistics();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
apiIdentityStatistics() {
|
|
24
|
+
return this.#client.apiIdentityStatistics();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
apiAggregateStatistics() {
|
|
28
|
+
return this.#client.apiAggregateStatistics();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
clearAllStatistics() {
|
|
32
|
+
this.#client.clearAllStatistics();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
uploadDebugArchive(serverUrl?: string) {
|
|
36
|
+
const env = this.#options?.env || "dev";
|
|
37
|
+
const historySyncUrl =
|
|
38
|
+
this.#options?.historySyncUrl || HistorySyncUrls[env];
|
|
39
|
+
return this.#client.uploadDebugArchive(serverUrl || historySyncUrl);
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -47,8 +47,9 @@ export {
|
|
|
47
47
|
PermissionPolicy,
|
|
48
48
|
PermissionPolicySet,
|
|
49
49
|
PermissionUpdateType,
|
|
50
|
-
|
|
50
|
+
SignatureRequestHandle,
|
|
51
51
|
SortDirection,
|
|
52
52
|
} from "@xmtp/wasm-bindings";
|
|
53
|
-
export type { Signer } from "./utils/signer";
|
|
53
|
+
export type { Signer, SafeSigner, EOASigner, SCWSigner } from "./utils/signer";
|
|
54
|
+
export { toSafeSigner } from "./utils/signer";
|
|
54
55
|
export * from "./utils/errors";
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { Identifier
|
|
1
|
+
import type { Identifier } from "@xmtp/wasm-bindings";
|
|
2
2
|
import type { ClientOptions } from "@/types/options";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
SafeIdentityStats,
|
|
6
|
-
SafeKeyPackageStatus,
|
|
7
|
-
} from "@/utils/conversions";
|
|
3
|
+
import type { SafeKeyPackageStatus } from "@/utils/conversions";
|
|
4
|
+
import type { SafeSigner } from "@/utils/signer";
|
|
8
5
|
|
|
9
6
|
export type ClientAction =
|
|
10
7
|
| {
|
|
@@ -20,81 +17,142 @@ export type ClientAction =
|
|
|
20
17
|
options?: ClientOptions;
|
|
21
18
|
};
|
|
22
19
|
}
|
|
20
|
+
| {
|
|
21
|
+
action: "client.applySignatureRequest";
|
|
22
|
+
id: string;
|
|
23
|
+
result: undefined;
|
|
24
|
+
data: {
|
|
25
|
+
signer: SafeSigner;
|
|
26
|
+
signatureRequestId: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
23
29
|
| {
|
|
24
30
|
action: "client.createInboxSignatureText";
|
|
25
31
|
id: string;
|
|
26
|
-
result:
|
|
27
|
-
|
|
32
|
+
result: {
|
|
33
|
+
signatureText?: string;
|
|
34
|
+
signatureRequestId?: string;
|
|
35
|
+
};
|
|
36
|
+
data: {
|
|
37
|
+
signatureRequestId: string;
|
|
38
|
+
};
|
|
28
39
|
}
|
|
29
40
|
| {
|
|
30
41
|
action: "client.addAccountSignatureText";
|
|
31
42
|
id: string;
|
|
32
|
-
result:
|
|
43
|
+
result: {
|
|
44
|
+
signatureText: string;
|
|
45
|
+
signatureRequestId: string;
|
|
46
|
+
};
|
|
33
47
|
data: {
|
|
34
48
|
newIdentifier: Identifier;
|
|
49
|
+
signatureRequestId: string;
|
|
35
50
|
};
|
|
36
51
|
}
|
|
37
52
|
| {
|
|
38
53
|
action: "client.removeAccountSignatureText";
|
|
39
54
|
id: string;
|
|
40
|
-
result:
|
|
55
|
+
result: {
|
|
56
|
+
signatureText: string;
|
|
57
|
+
signatureRequestId: string;
|
|
58
|
+
};
|
|
41
59
|
data: {
|
|
42
60
|
identifier: Identifier;
|
|
61
|
+
signatureRequestId: string;
|
|
43
62
|
};
|
|
44
63
|
}
|
|
45
64
|
| {
|
|
46
65
|
action: "client.revokeAllOtherInstallationsSignatureText";
|
|
47
66
|
id: string;
|
|
48
|
-
result:
|
|
49
|
-
|
|
67
|
+
result: {
|
|
68
|
+
signatureText: string;
|
|
69
|
+
signatureRequestId: string;
|
|
70
|
+
};
|
|
71
|
+
data: {
|
|
72
|
+
signatureRequestId: string;
|
|
73
|
+
};
|
|
50
74
|
}
|
|
51
75
|
| {
|
|
52
76
|
action: "client.revokeInstallationsSignatureText";
|
|
53
77
|
id: string;
|
|
54
|
-
result:
|
|
78
|
+
result: {
|
|
79
|
+
signatureText: string;
|
|
80
|
+
signatureRequestId: string;
|
|
81
|
+
};
|
|
55
82
|
data: {
|
|
56
83
|
installationIds: Uint8Array[];
|
|
84
|
+
signatureRequestId: string;
|
|
57
85
|
};
|
|
58
86
|
}
|
|
59
87
|
| {
|
|
60
88
|
action: "client.changeRecoveryIdentifierSignatureText";
|
|
61
89
|
id: string;
|
|
62
|
-
result:
|
|
90
|
+
result: {
|
|
91
|
+
signatureText: string;
|
|
92
|
+
signatureRequestId: string;
|
|
93
|
+
};
|
|
63
94
|
data: {
|
|
64
95
|
identifier: Identifier;
|
|
96
|
+
signatureRequestId: string;
|
|
65
97
|
};
|
|
66
98
|
}
|
|
67
99
|
| {
|
|
68
|
-
action: "client.
|
|
100
|
+
action: "client.registerIdentity";
|
|
69
101
|
id: string;
|
|
70
102
|
result: undefined;
|
|
71
103
|
data: {
|
|
72
|
-
|
|
73
|
-
|
|
104
|
+
signer: SafeSigner;
|
|
105
|
+
signatureRequestId: string;
|
|
74
106
|
};
|
|
75
107
|
}
|
|
76
108
|
| {
|
|
77
|
-
action: "client.
|
|
109
|
+
action: "client.addAccount";
|
|
78
110
|
id: string;
|
|
79
111
|
result: undefined;
|
|
80
112
|
data: {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
blockNumber?: bigint;
|
|
113
|
+
identifier: Identifier;
|
|
114
|
+
signer: SafeSigner;
|
|
115
|
+
signatureRequestId: string;
|
|
85
116
|
};
|
|
86
117
|
}
|
|
87
118
|
| {
|
|
88
|
-
action: "client.
|
|
119
|
+
action: "client.removeAccount";
|
|
89
120
|
id: string;
|
|
90
121
|
result: undefined;
|
|
91
|
-
data:
|
|
122
|
+
data: {
|
|
123
|
+
identifier: Identifier;
|
|
124
|
+
signer: SafeSigner;
|
|
125
|
+
signatureRequestId: string;
|
|
126
|
+
};
|
|
92
127
|
}
|
|
93
128
|
| {
|
|
94
|
-
action: "client.
|
|
129
|
+
action: "client.revokeAllOtherInstallations";
|
|
95
130
|
id: string;
|
|
96
131
|
result: undefined;
|
|
97
|
-
data:
|
|
132
|
+
data: {
|
|
133
|
+
signer: SafeSigner;
|
|
134
|
+
signatureRequestId: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
| {
|
|
138
|
+
action: "client.changeRecoveryIdentifier";
|
|
139
|
+
id: string;
|
|
140
|
+
result: undefined;
|
|
141
|
+
data: {
|
|
142
|
+
identifier: Identifier;
|
|
143
|
+
signer: SafeSigner;
|
|
144
|
+
signatureRequestId: string;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
| {
|
|
148
|
+
action: "client.revokeInstallations";
|
|
149
|
+
id: string;
|
|
150
|
+
result: undefined;
|
|
151
|
+
data: {
|
|
152
|
+
installationIds: Uint8Array[];
|
|
153
|
+
signer: SafeSigner;
|
|
154
|
+
signatureRequestId: string;
|
|
155
|
+
};
|
|
98
156
|
}
|
|
99
157
|
| {
|
|
100
158
|
action: "client.isRegistered";
|
|
@@ -152,36 +210,4 @@ export type ClientAction =
|
|
|
152
210
|
data: {
|
|
153
211
|
installationIds: string[];
|
|
154
212
|
};
|
|
155
|
-
}
|
|
156
|
-
| {
|
|
157
|
-
action: "client.apiStatistics";
|
|
158
|
-
id: string;
|
|
159
|
-
result: SafeApiStats;
|
|
160
|
-
data: undefined;
|
|
161
|
-
}
|
|
162
|
-
| {
|
|
163
|
-
action: "client.apiIdentityStatistics";
|
|
164
|
-
id: string;
|
|
165
|
-
result: SafeIdentityStats;
|
|
166
|
-
data: undefined;
|
|
167
|
-
}
|
|
168
|
-
| {
|
|
169
|
-
action: "client.apiAggregateStatistics";
|
|
170
|
-
id: string;
|
|
171
|
-
result: string;
|
|
172
|
-
data: undefined;
|
|
173
|
-
}
|
|
174
|
-
| {
|
|
175
|
-
action: "client.clearAllStatistics";
|
|
176
|
-
id: string;
|
|
177
|
-
result: undefined;
|
|
178
|
-
data: undefined;
|
|
179
|
-
}
|
|
180
|
-
| {
|
|
181
|
-
action: "client.uploadDebugArchive";
|
|
182
|
-
id: string;
|
|
183
|
-
result: string;
|
|
184
|
-
data: {
|
|
185
|
-
serverUrl?: string;
|
|
186
|
-
};
|
|
187
213
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SafeApiStats, SafeIdentityStats } from "@/utils/conversions";
|
|
2
|
+
|
|
3
|
+
export type DebugInformationAction =
|
|
4
|
+
| {
|
|
5
|
+
action: "debugInformation.apiStatistics";
|
|
6
|
+
id: string;
|
|
7
|
+
result: SafeApiStats;
|
|
8
|
+
data: undefined;
|
|
9
|
+
}
|
|
10
|
+
| {
|
|
11
|
+
action: "debugInformation.apiIdentityStatistics";
|
|
12
|
+
id: string;
|
|
13
|
+
result: SafeIdentityStats;
|
|
14
|
+
data: undefined;
|
|
15
|
+
}
|
|
16
|
+
| {
|
|
17
|
+
action: "debugInformation.apiAggregateStatistics";
|
|
18
|
+
id: string;
|
|
19
|
+
result: string;
|
|
20
|
+
data: undefined;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
action: "debugInformation.clearAllStatistics";
|
|
24
|
+
id: string;
|
|
25
|
+
result: undefined;
|
|
26
|
+
data: undefined;
|
|
27
|
+
}
|
|
28
|
+
| {
|
|
29
|
+
action: "debugInformation.uploadDebugArchive";
|
|
30
|
+
id: string;
|
|
31
|
+
result: string;
|
|
32
|
+
data: {
|
|
33
|
+
serverUrl?: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Identifier } from "@xmtp/wasm-bindings";
|
|
2
2
|
import type { XmtpEnv } from "@/types/options";
|
|
3
|
+
import type { SafeInboxState } from "@/utils/conversions";
|
|
4
|
+
import type { SafeSigner } from "@/utils/signer";
|
|
3
5
|
|
|
4
6
|
export type UtilsWorkerAction =
|
|
5
7
|
| {
|
|
@@ -26,4 +28,35 @@ export type UtilsWorkerAction =
|
|
|
26
28
|
identifier: Identifier;
|
|
27
29
|
env?: XmtpEnv;
|
|
28
30
|
};
|
|
31
|
+
}
|
|
32
|
+
| {
|
|
33
|
+
action: "utils.revokeInstallationsSignatureText";
|
|
34
|
+
id: string;
|
|
35
|
+
result: string;
|
|
36
|
+
data: {
|
|
37
|
+
env?: XmtpEnv;
|
|
38
|
+
identifier: Identifier;
|
|
39
|
+
inboxId: string;
|
|
40
|
+
installationIds: Uint8Array[];
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
action: "utils.revokeInstallations";
|
|
45
|
+
id: string;
|
|
46
|
+
result: undefined;
|
|
47
|
+
data: {
|
|
48
|
+
env?: XmtpEnv;
|
|
49
|
+
signer: SafeSigner;
|
|
50
|
+
inboxId: string;
|
|
51
|
+
installationIds: Uint8Array[];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
| {
|
|
55
|
+
action: "utils.inboxStateFromInboxIds";
|
|
56
|
+
id: string;
|
|
57
|
+
result: SafeInboxState[];
|
|
58
|
+
data: {
|
|
59
|
+
inboxIds: string[];
|
|
60
|
+
env?: XmtpEnv;
|
|
61
|
+
};
|
|
29
62
|
};
|
package/src/types/actions.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ClientAction } from "@/types/actions/client";
|
|
2
2
|
import type { ConversationAction } from "@/types/actions/conversation";
|
|
3
3
|
import type { ConversationsAction } from "@/types/actions/conversations";
|
|
4
|
+
import type { DebugInformationAction } from "@/types/actions/debugInformation";
|
|
4
5
|
import type { DmAction } from "@/types/actions/dm";
|
|
5
6
|
import type { GroupAction } from "@/types/actions/group";
|
|
6
7
|
import type { PreferencesAction } from "@/types/actions/preferences";
|
|
@@ -26,7 +27,8 @@ export type ClientWorkerAction =
|
|
|
26
27
|
| ConversationsAction
|
|
27
28
|
| DmAction
|
|
28
29
|
| GroupAction
|
|
29
|
-
| PreferencesAction
|
|
30
|
+
| PreferencesAction
|
|
31
|
+
| DebugInformationAction;
|
|
30
32
|
|
|
31
33
|
export type ActionName<T extends UnknownAction> = T["action"];
|
|
32
34
|
|