@novasamatech/host-api 0.5.2 → 0.5.4-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/README.md +3 -3
- package/dist/helpers.d.ts +0 -29
- package/dist/helpers.js +0 -30
- package/dist/hostApi.d.ts +3 -2
- package/dist/hostApi.js +65 -42
- package/dist/index.d.ts +8 -7
- package/dist/index.js +5 -5
- package/dist/protocol/commonCodecs.d.ts +3 -38
- package/dist/protocol/commonCodecs.js +2 -59
- package/dist/protocol/impl.d.ts +22 -14
- package/dist/protocol/impl.js +23 -15
- package/dist/protocol/messageCodec.d.ts +554 -668
- package/dist/protocol/messageCodec.js +3 -3
- package/dist/protocol/v1/accounts.d.ts +37 -209
- package/dist/protocol/v1/accounts.js +2 -1
- package/dist/protocol/v1/chat.d.ts +224 -149
- package/dist/protocol/v1/chat.js +51 -12
- package/dist/protocol/v1/createTransaction.d.ts +21 -116
- package/dist/protocol/v1/createTransaction.js +7 -5
- package/dist/protocol/v1/feature.d.ts +3 -7
- package/dist/protocol/v1/feature.js +2 -1
- package/dist/protocol/v1/handshake.d.ts +15 -75
- package/dist/protocol/v1/handshake.js +2 -1
- package/dist/protocol/v1/jsonRpc.d.ts +3 -7
- package/dist/protocol/v1/permission.d.ts +14 -54
- package/dist/protocol/v1/permission.js +2 -1
- package/dist/protocol/v1/sign.d.ts +19 -90
- package/dist/protocol/v1/sign.js +6 -4
- package/dist/protocol/v1/statementStore.d.ts +153 -74
- package/dist/protocol/v1/statementStore.js +18 -1
- package/dist/protocol/v1/storage.d.ts +24 -80
- package/dist/protocol/v1/storage.js +5 -4
- package/dist/transport.js +5 -4
- package/dist/types.d.ts +6 -4
- package/package.json +2 -1
|
@@ -1,51 +1,81 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare const ChatRoomRegistrationErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
2
|
+
reason: string;
|
|
3
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
4
|
+
reason: string;
|
|
5
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>] & {
|
|
6
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
5
7
|
reason: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
name: "ChatContactRegistrationErr::Unknown";
|
|
9
|
-
className: string;
|
|
10
|
-
payload: {
|
|
8
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>;
|
|
9
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
11
10
|
reason: string;
|
|
12
|
-
}
|
|
13
|
-
}>] & {
|
|
14
|
-
enc: import("scale-ts").Encoder<Error & {
|
|
15
|
-
name: "ChatContactRegistrationErr::Unknown";
|
|
16
|
-
className: string;
|
|
17
|
-
payload: {
|
|
18
|
-
reason: string;
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
21
|
-
dec: import("scale-ts").Decoder<Error & {
|
|
22
|
-
name: "ChatContactRegistrationErr::Unknown";
|
|
23
|
-
className: string;
|
|
24
|
-
payload: {
|
|
25
|
-
reason: string;
|
|
26
|
-
};
|
|
27
|
-
}>;
|
|
11
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>;
|
|
28
12
|
} & {
|
|
29
|
-
readonly
|
|
13
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "ChatRoomRegistrationErr::PermissionDenied">;
|
|
14
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
30
15
|
reason: string;
|
|
31
|
-
}, "
|
|
16
|
+
}, "ChatRoomRegistrationErr::Unknown">;
|
|
32
17
|
};
|
|
33
|
-
export declare const
|
|
34
|
-
|
|
18
|
+
export declare const ChatRoomRequest: import("scale-ts").Codec<{
|
|
19
|
+
roomId: string;
|
|
35
20
|
name: string;
|
|
36
21
|
icon: string;
|
|
37
22
|
}>;
|
|
38
|
-
export declare const
|
|
23
|
+
export declare const ChatRoomRegistrationStatus: import("scale-ts").Codec<"New" | "Exists">;
|
|
24
|
+
export declare const ChatRoomRegistrationResult: import("scale-ts").Codec<{
|
|
25
|
+
status: "New" | "Exists";
|
|
26
|
+
}>;
|
|
27
|
+
export declare const ChatCreateRoomV1_request: import("scale-ts").Codec<{
|
|
28
|
+
roomId: string;
|
|
39
29
|
name: string;
|
|
40
30
|
icon: string;
|
|
41
31
|
}>;
|
|
42
|
-
export declare const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
export declare const ChatCreateRoomV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
33
|
+
status: "New" | "Exists";
|
|
34
|
+
}, import("@novasamatech/scale").CodecError<{
|
|
35
|
+
reason: string;
|
|
36
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>>;
|
|
37
|
+
export declare const ChatBotRegistrationErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
38
|
+
reason: string;
|
|
39
|
+
}, "ChatBotRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatBotRegistrationErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
40
|
+
reason: string;
|
|
41
|
+
}, "ChatBotRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatBotRegistrationErr::PermissionDenied">>] & {
|
|
42
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
46
43
|
reason: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
44
|
+
}, "ChatBotRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatBotRegistrationErr::PermissionDenied">>;
|
|
45
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
46
|
+
reason: string;
|
|
47
|
+
}, "ChatBotRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatBotRegistrationErr::PermissionDenied">>;
|
|
48
|
+
} & {
|
|
49
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "ChatBotRegistrationErr::PermissionDenied">;
|
|
50
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
51
|
+
reason: string;
|
|
52
|
+
}, "ChatBotRegistrationErr::Unknown">;
|
|
53
|
+
};
|
|
54
|
+
export declare const ChatBotRequest: import("scale-ts").Codec<{
|
|
55
|
+
botId: string;
|
|
56
|
+
name: string;
|
|
57
|
+
icon: string;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const ChatCreateBotV1_request: import("scale-ts").Codec<{
|
|
60
|
+
botId: string;
|
|
61
|
+
name: string;
|
|
62
|
+
icon: string;
|
|
63
|
+
}>;
|
|
64
|
+
export declare const ChatCreateBotV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
65
|
+
status: "New" | "Exists";
|
|
66
|
+
}, import("@novasamatech/scale").CodecError<{
|
|
67
|
+
reason: string;
|
|
68
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>>;
|
|
69
|
+
export declare const ChatRoomParticipation: import("scale-ts").Codec<"RoomHost" | "Bot">;
|
|
70
|
+
export declare const ChatRoom: import("scale-ts").Codec<{
|
|
71
|
+
roomId: string;
|
|
72
|
+
participatingAs: "RoomHost" | "Bot";
|
|
73
|
+
}>;
|
|
74
|
+
export declare const ChatListSubscribeV1_start: import("scale-ts").Codec<undefined>;
|
|
75
|
+
export declare const ChatListSubscribeV1_receive: import("scale-ts").Codec<{
|
|
76
|
+
roomId: string;
|
|
77
|
+
participatingAs: "RoomHost" | "Bot";
|
|
78
|
+
}[]>;
|
|
49
79
|
export declare const ChatAction: import("scale-ts").Codec<{
|
|
50
80
|
actionId: string;
|
|
51
81
|
title: string;
|
|
@@ -79,7 +109,7 @@ export declare const ChatReaction: import("scale-ts").Codec<{
|
|
|
79
109
|
messageId: string;
|
|
80
110
|
emoji: string;
|
|
81
111
|
}>;
|
|
82
|
-
export declare const
|
|
112
|
+
export declare const ChatMessageContent: import("scale-ts").Codec<{
|
|
83
113
|
tag: "Text";
|
|
84
114
|
value: string;
|
|
85
115
|
} | {
|
|
@@ -122,52 +152,20 @@ export declare const ChatMessage: import("scale-ts").Codec<{
|
|
|
122
152
|
emoji: string;
|
|
123
153
|
};
|
|
124
154
|
}>;
|
|
125
|
-
export declare const ChatMessagePostingErr: [import("scale-ts").Encoder<(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
155
|
+
export declare const ChatMessagePostingErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
156
|
+
reason: string;
|
|
157
|
+
}, "ChatMessagePostingErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatMessagePostingErr::MessageTooLarge">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
158
|
+
reason: string;
|
|
159
|
+
}, "ChatMessagePostingErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatMessagePostingErr::MessageTooLarge">>] & {
|
|
160
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
129
161
|
reason: string;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
name: "ChatMessagePostingErr::MessageTooLarge";
|
|
133
|
-
className: string;
|
|
134
|
-
payload: undefined;
|
|
135
|
-
})>, import("scale-ts").Decoder<(Error & {
|
|
136
|
-
name: "ChatMessagePostingErr::Unknown";
|
|
137
|
-
className: string;
|
|
138
|
-
payload: {
|
|
162
|
+
}, "ChatMessagePostingErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatMessagePostingErr::MessageTooLarge">>;
|
|
163
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
139
164
|
reason: string;
|
|
140
|
-
}
|
|
141
|
-
}) | (Error & {
|
|
142
|
-
name: "ChatMessagePostingErr::MessageTooLarge";
|
|
143
|
-
className: string;
|
|
144
|
-
payload: undefined;
|
|
145
|
-
})>] & {
|
|
146
|
-
enc: import("scale-ts").Encoder<(Error & {
|
|
147
|
-
name: "ChatMessagePostingErr::Unknown";
|
|
148
|
-
className: string;
|
|
149
|
-
payload: {
|
|
150
|
-
reason: string;
|
|
151
|
-
};
|
|
152
|
-
}) | (Error & {
|
|
153
|
-
name: "ChatMessagePostingErr::MessageTooLarge";
|
|
154
|
-
className: string;
|
|
155
|
-
payload: undefined;
|
|
156
|
-
})>;
|
|
157
|
-
dec: import("scale-ts").Decoder<(Error & {
|
|
158
|
-
name: "ChatMessagePostingErr::Unknown";
|
|
159
|
-
className: string;
|
|
160
|
-
payload: {
|
|
161
|
-
reason: string;
|
|
162
|
-
};
|
|
163
|
-
}) | (Error & {
|
|
164
|
-
name: "ChatMessagePostingErr::MessageTooLarge";
|
|
165
|
-
className: string;
|
|
166
|
-
payload: undefined;
|
|
167
|
-
})>;
|
|
165
|
+
}, "ChatMessagePostingErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatMessagePostingErr::MessageTooLarge">>;
|
|
168
166
|
} & {
|
|
169
|
-
readonly MessageTooLarge: import("
|
|
170
|
-
readonly Unknown: import("
|
|
167
|
+
readonly MessageTooLarge: import("@novasamatech/scale").ErrCodec<undefined, "ChatMessagePostingErr::MessageTooLarge">;
|
|
168
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
171
169
|
reason: string;
|
|
172
170
|
}, "ChatMessagePostingErr::Unknown">;
|
|
173
171
|
};
|
|
@@ -175,68 +173,8 @@ export declare const ChatPostMessageResult: import("scale-ts").Codec<{
|
|
|
175
173
|
messageId: string;
|
|
176
174
|
}>;
|
|
177
175
|
export declare const ChatPostMessageV1_request: import("scale-ts").Codec<{
|
|
178
|
-
|
|
179
|
-
value: string;
|
|
180
|
-
} | {
|
|
181
|
-
tag: "RichText";
|
|
182
|
-
value: {
|
|
183
|
-
text: string | undefined;
|
|
184
|
-
media: {
|
|
185
|
-
url: string;
|
|
186
|
-
}[];
|
|
187
|
-
};
|
|
188
|
-
} | {
|
|
189
|
-
tag: "Actions";
|
|
190
|
-
value: {
|
|
191
|
-
text: string | undefined;
|
|
192
|
-
actions: {
|
|
193
|
-
actionId: string;
|
|
194
|
-
title: string;
|
|
195
|
-
}[];
|
|
196
|
-
layout: "Column" | "Grid";
|
|
197
|
-
};
|
|
198
|
-
} | {
|
|
199
|
-
tag: "File";
|
|
200
|
-
value: {
|
|
201
|
-
url: string;
|
|
202
|
-
fileName: string;
|
|
203
|
-
mimeType: string;
|
|
204
|
-
sizeBytes: bigint;
|
|
205
|
-
text: string | undefined;
|
|
206
|
-
};
|
|
207
|
-
} | {
|
|
208
|
-
tag: "Reaction";
|
|
209
|
-
value: {
|
|
210
|
-
messageId: string;
|
|
211
|
-
emoji: string;
|
|
212
|
-
};
|
|
213
|
-
} | {
|
|
214
|
-
tag: "ReactionRemoved";
|
|
215
|
-
value: {
|
|
216
|
-
messageId: string;
|
|
217
|
-
emoji: string;
|
|
218
|
-
};
|
|
219
|
-
}>;
|
|
220
|
-
export declare const ChatPostMessageV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
221
|
-
messageId: string;
|
|
222
|
-
}, (Error & {
|
|
223
|
-
name: "ChatMessagePostingErr::Unknown";
|
|
224
|
-
className: string;
|
|
176
|
+
roomId: string;
|
|
225
177
|
payload: {
|
|
226
|
-
reason: string;
|
|
227
|
-
};
|
|
228
|
-
}) | (Error & {
|
|
229
|
-
name: "ChatMessagePostingErr::MessageTooLarge";
|
|
230
|
-
className: string;
|
|
231
|
-
payload: undefined;
|
|
232
|
-
})>>;
|
|
233
|
-
export declare const ActionTrigger: import("scale-ts").Codec<{
|
|
234
|
-
messageId: string;
|
|
235
|
-
actionId: string;
|
|
236
|
-
}>;
|
|
237
|
-
export declare const ReceivedChatAction: import("scale-ts").Codec<{
|
|
238
|
-
tag: "MessagePosted";
|
|
239
|
-
value: {
|
|
240
178
|
tag: "Text";
|
|
241
179
|
value: string;
|
|
242
180
|
} | {
|
|
@@ -279,15 +217,21 @@ export declare const ReceivedChatAction: import("scale-ts").Codec<{
|
|
|
279
217
|
emoji: string;
|
|
280
218
|
};
|
|
281
219
|
};
|
|
282
|
-
} | {
|
|
283
|
-
tag: "ActionTriggered";
|
|
284
|
-
value: {
|
|
285
|
-
messageId: string;
|
|
286
|
-
actionId: string;
|
|
287
|
-
};
|
|
288
220
|
}>;
|
|
289
|
-
export declare const
|
|
290
|
-
|
|
221
|
+
export declare const ChatPostMessageV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
222
|
+
messageId: string;
|
|
223
|
+
}, import("@novasamatech/scale").CodecError<{
|
|
224
|
+
reason: string;
|
|
225
|
+
}, "ChatMessagePostingErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatMessagePostingErr::MessageTooLarge">>>;
|
|
226
|
+
export declare const ActionTrigger: import("scale-ts").Codec<{
|
|
227
|
+
messageId: string;
|
|
228
|
+
actionId: string;
|
|
229
|
+
}>;
|
|
230
|
+
export declare const ChatCommand: import("scale-ts").Codec<{
|
|
231
|
+
command: string;
|
|
232
|
+
payload: string;
|
|
233
|
+
}>;
|
|
234
|
+
export declare const ChatActionPayload: import("scale-ts").Codec<{
|
|
291
235
|
tag: "MessagePosted";
|
|
292
236
|
value: {
|
|
293
237
|
tag: "Text";
|
|
@@ -338,4 +282,135 @@ export declare const ChatActionSubscribeV1_receive: import("scale-ts").Codec<{
|
|
|
338
282
|
messageId: string;
|
|
339
283
|
actionId: string;
|
|
340
284
|
};
|
|
285
|
+
} | {
|
|
286
|
+
tag: "Command";
|
|
287
|
+
value: {
|
|
288
|
+
command: string;
|
|
289
|
+
payload: string;
|
|
290
|
+
};
|
|
291
|
+
}>;
|
|
292
|
+
export declare const ReceivedChatAction: import("scale-ts").Codec<{
|
|
293
|
+
roomId: string;
|
|
294
|
+
peer: string;
|
|
295
|
+
payload: {
|
|
296
|
+
tag: "MessagePosted";
|
|
297
|
+
value: {
|
|
298
|
+
tag: "Text";
|
|
299
|
+
value: string;
|
|
300
|
+
} | {
|
|
301
|
+
tag: "RichText";
|
|
302
|
+
value: {
|
|
303
|
+
text: string | undefined;
|
|
304
|
+
media: {
|
|
305
|
+
url: string;
|
|
306
|
+
}[];
|
|
307
|
+
};
|
|
308
|
+
} | {
|
|
309
|
+
tag: "Actions";
|
|
310
|
+
value: {
|
|
311
|
+
text: string | undefined;
|
|
312
|
+
actions: {
|
|
313
|
+
actionId: string;
|
|
314
|
+
title: string;
|
|
315
|
+
}[];
|
|
316
|
+
layout: "Column" | "Grid";
|
|
317
|
+
};
|
|
318
|
+
} | {
|
|
319
|
+
tag: "File";
|
|
320
|
+
value: {
|
|
321
|
+
url: string;
|
|
322
|
+
fileName: string;
|
|
323
|
+
mimeType: string;
|
|
324
|
+
sizeBytes: bigint;
|
|
325
|
+
text: string | undefined;
|
|
326
|
+
};
|
|
327
|
+
} | {
|
|
328
|
+
tag: "Reaction";
|
|
329
|
+
value: {
|
|
330
|
+
messageId: string;
|
|
331
|
+
emoji: string;
|
|
332
|
+
};
|
|
333
|
+
} | {
|
|
334
|
+
tag: "ReactionRemoved";
|
|
335
|
+
value: {
|
|
336
|
+
messageId: string;
|
|
337
|
+
emoji: string;
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
} | {
|
|
341
|
+
tag: "ActionTriggered";
|
|
342
|
+
value: {
|
|
343
|
+
messageId: string;
|
|
344
|
+
actionId: string;
|
|
345
|
+
};
|
|
346
|
+
} | {
|
|
347
|
+
tag: "Command";
|
|
348
|
+
value: {
|
|
349
|
+
command: string;
|
|
350
|
+
payload: string;
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
}>;
|
|
354
|
+
export declare const ChatActionSubscribeV1_start: import("scale-ts").Codec<undefined>;
|
|
355
|
+
export declare const ChatActionSubscribeV1_receive: import("scale-ts").Codec<{
|
|
356
|
+
roomId: string;
|
|
357
|
+
peer: string;
|
|
358
|
+
payload: {
|
|
359
|
+
tag: "MessagePosted";
|
|
360
|
+
value: {
|
|
361
|
+
tag: "Text";
|
|
362
|
+
value: string;
|
|
363
|
+
} | {
|
|
364
|
+
tag: "RichText";
|
|
365
|
+
value: {
|
|
366
|
+
text: string | undefined;
|
|
367
|
+
media: {
|
|
368
|
+
url: string;
|
|
369
|
+
}[];
|
|
370
|
+
};
|
|
371
|
+
} | {
|
|
372
|
+
tag: "Actions";
|
|
373
|
+
value: {
|
|
374
|
+
text: string | undefined;
|
|
375
|
+
actions: {
|
|
376
|
+
actionId: string;
|
|
377
|
+
title: string;
|
|
378
|
+
}[];
|
|
379
|
+
layout: "Column" | "Grid";
|
|
380
|
+
};
|
|
381
|
+
} | {
|
|
382
|
+
tag: "File";
|
|
383
|
+
value: {
|
|
384
|
+
url: string;
|
|
385
|
+
fileName: string;
|
|
386
|
+
mimeType: string;
|
|
387
|
+
sizeBytes: bigint;
|
|
388
|
+
text: string | undefined;
|
|
389
|
+
};
|
|
390
|
+
} | {
|
|
391
|
+
tag: "Reaction";
|
|
392
|
+
value: {
|
|
393
|
+
messageId: string;
|
|
394
|
+
emoji: string;
|
|
395
|
+
};
|
|
396
|
+
} | {
|
|
397
|
+
tag: "ReactionRemoved";
|
|
398
|
+
value: {
|
|
399
|
+
messageId: string;
|
|
400
|
+
emoji: string;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
} | {
|
|
404
|
+
tag: "ActionTriggered";
|
|
405
|
+
value: {
|
|
406
|
+
messageId: string;
|
|
407
|
+
actionId: string;
|
|
408
|
+
};
|
|
409
|
+
} | {
|
|
410
|
+
tag: "Command";
|
|
411
|
+
value: {
|
|
412
|
+
command: string;
|
|
413
|
+
payload: string;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
341
416
|
}>;
|
package/dist/protocol/v1/chat.js
CHANGED
|
@@ -1,16 +1,42 @@
|
|
|
1
|
+
import { Enum, ErrEnum, Status } from '@novasamatech/scale';
|
|
1
2
|
import { Option, Result, Struct, Vector, _void, str, u64 } from 'scale-ts';
|
|
2
|
-
import {
|
|
3
|
-
//
|
|
4
|
-
export const
|
|
3
|
+
import { GenericErr } from '../commonCodecs.js';
|
|
4
|
+
// room registration
|
|
5
|
+
export const ChatRoomRegistrationErr = ErrEnum('ChatRoomRegistrationErr', {
|
|
6
|
+
PermissionDenied: [_void, 'Permission denied'],
|
|
5
7
|
Unknown: [GenericErr, 'Unknown error while chat registration'],
|
|
6
8
|
});
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
+
export const ChatRoomRequest = Struct({
|
|
10
|
+
roomId: str,
|
|
9
11
|
name: str,
|
|
10
|
-
icon: str, //
|
|
12
|
+
icon: str, // URL or base64-encoded image for contact
|
|
11
13
|
});
|
|
12
|
-
export const
|
|
13
|
-
export const
|
|
14
|
+
export const ChatRoomRegistrationStatus = Status('New', 'Exists');
|
|
15
|
+
export const ChatRoomRegistrationResult = Struct({
|
|
16
|
+
status: ChatRoomRegistrationStatus,
|
|
17
|
+
});
|
|
18
|
+
export const ChatCreateRoomV1_request = ChatRoomRequest;
|
|
19
|
+
export const ChatCreateRoomV1_response = Result(ChatRoomRegistrationResult, ChatRoomRegistrationErr);
|
|
20
|
+
// register as a bot
|
|
21
|
+
export const ChatBotRegistrationErr = ErrEnum('ChatBotRegistrationErr', {
|
|
22
|
+
PermissionDenied: [_void, 'Permission denied'],
|
|
23
|
+
Unknown: [GenericErr, 'Unknown error while chat registration'],
|
|
24
|
+
});
|
|
25
|
+
export const ChatBotRequest = Struct({
|
|
26
|
+
botId: str,
|
|
27
|
+
name: str,
|
|
28
|
+
icon: str, // URL or base64-encoded image for contact
|
|
29
|
+
});
|
|
30
|
+
export const ChatCreateBotV1_request = ChatBotRequest;
|
|
31
|
+
export const ChatCreateBotV1_response = Result(ChatRoomRegistrationResult, ChatRoomRegistrationErr);
|
|
32
|
+
// receiving rooms
|
|
33
|
+
export const ChatRoomParticipation = Status('RoomHost', 'Bot');
|
|
34
|
+
export const ChatRoom = Struct({
|
|
35
|
+
roomId: str,
|
|
36
|
+
participatingAs: ChatRoomParticipation,
|
|
37
|
+
});
|
|
38
|
+
export const ChatListSubscribeV1_start = _void;
|
|
39
|
+
export const ChatListSubscribeV1_receive = Vector(ChatRoom);
|
|
14
40
|
// message format
|
|
15
41
|
export const ChatAction = Struct({
|
|
16
42
|
actionId: str,
|
|
@@ -40,7 +66,7 @@ export const ChatReaction = Struct({
|
|
|
40
66
|
messageId: str,
|
|
41
67
|
emoji: str,
|
|
42
68
|
});
|
|
43
|
-
export const
|
|
69
|
+
export const ChatMessageContent = Enum({
|
|
44
70
|
Text: str,
|
|
45
71
|
RichText: ChatRichText,
|
|
46
72
|
Actions: ChatActions,
|
|
@@ -56,16 +82,29 @@ export const ChatMessagePostingErr = ErrEnum('ChatMessagePostingErr', {
|
|
|
56
82
|
export const ChatPostMessageResult = Struct({
|
|
57
83
|
messageId: str,
|
|
58
84
|
});
|
|
59
|
-
export const ChatPostMessageV1_request =
|
|
85
|
+
export const ChatPostMessageV1_request = Struct({
|
|
86
|
+
roomId: str,
|
|
87
|
+
payload: ChatMessageContent,
|
|
88
|
+
});
|
|
60
89
|
export const ChatPostMessageV1_response = Result(ChatPostMessageResult, ChatMessagePostingErr);
|
|
61
90
|
// receiving a message
|
|
62
91
|
export const ActionTrigger = Struct({
|
|
63
92
|
messageId: str,
|
|
64
93
|
actionId: str,
|
|
65
94
|
});
|
|
66
|
-
export const
|
|
67
|
-
|
|
95
|
+
export const ChatCommand = Struct({
|
|
96
|
+
command: str,
|
|
97
|
+
payload: str,
|
|
98
|
+
});
|
|
99
|
+
export const ChatActionPayload = Enum({
|
|
100
|
+
MessagePosted: ChatMessageContent,
|
|
68
101
|
ActionTriggered: ActionTrigger,
|
|
102
|
+
Command: ChatCommand,
|
|
103
|
+
});
|
|
104
|
+
export const ReceivedChatAction = Struct({
|
|
105
|
+
roomId: str,
|
|
106
|
+
peer: str,
|
|
107
|
+
payload: ChatActionPayload,
|
|
69
108
|
});
|
|
70
109
|
export const ChatActionSubscribeV1_start = _void;
|
|
71
110
|
export const ChatActionSubscribeV1_receive = ReceivedChatAction;
|
|
@@ -1,88 +1,25 @@
|
|
|
1
|
-
import type { HexString } from '
|
|
1
|
+
import type { HexString } from '@novasamatech/scale';
|
|
2
2
|
/**
|
|
3
3
|
* createTransaction implementation
|
|
4
4
|
* @see https://github.com/polkadot-js/api/issues/6213
|
|
5
5
|
*/
|
|
6
|
-
export declare const CreateTransactionErr: [import("scale-ts").Encoder<(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}) | (
|
|
11
|
-
|
|
12
|
-
className: string;
|
|
13
|
-
payload: {
|
|
6
|
+
export declare const CreateTransactionErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
7
|
+
reason: string;
|
|
8
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
9
|
+
reason: string;
|
|
10
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>] & {
|
|
11
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
14
12
|
reason: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
name: "CreateTransactionErr::FailedToDecode";
|
|
18
|
-
className: string;
|
|
19
|
-
payload: undefined;
|
|
20
|
-
}) | (Error & {
|
|
21
|
-
name: "CreateTransactionErr::NotSupported";
|
|
22
|
-
className: string;
|
|
23
|
-
payload: string;
|
|
24
|
-
})>, import("scale-ts").Decoder<(Error & {
|
|
25
|
-
name: "CreateTransactionErr::Rejected";
|
|
26
|
-
className: string;
|
|
27
|
-
payload: undefined;
|
|
28
|
-
}) | (Error & {
|
|
29
|
-
name: "CreateTransactionErr::Unknown";
|
|
30
|
-
className: string;
|
|
31
|
-
payload: {
|
|
13
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>;
|
|
14
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
32
15
|
reason: string;
|
|
33
|
-
}
|
|
34
|
-
}) | (Error & {
|
|
35
|
-
name: "CreateTransactionErr::FailedToDecode";
|
|
36
|
-
className: string;
|
|
37
|
-
payload: undefined;
|
|
38
|
-
}) | (Error & {
|
|
39
|
-
name: "CreateTransactionErr::NotSupported";
|
|
40
|
-
className: string;
|
|
41
|
-
payload: string;
|
|
42
|
-
})>] & {
|
|
43
|
-
enc: import("scale-ts").Encoder<(Error & {
|
|
44
|
-
name: "CreateTransactionErr::Rejected";
|
|
45
|
-
className: string;
|
|
46
|
-
payload: undefined;
|
|
47
|
-
}) | (Error & {
|
|
48
|
-
name: "CreateTransactionErr::Unknown";
|
|
49
|
-
className: string;
|
|
50
|
-
payload: {
|
|
51
|
-
reason: string;
|
|
52
|
-
};
|
|
53
|
-
}) | (Error & {
|
|
54
|
-
name: "CreateTransactionErr::FailedToDecode";
|
|
55
|
-
className: string;
|
|
56
|
-
payload: undefined;
|
|
57
|
-
}) | (Error & {
|
|
58
|
-
name: "CreateTransactionErr::NotSupported";
|
|
59
|
-
className: string;
|
|
60
|
-
payload: string;
|
|
61
|
-
})>;
|
|
62
|
-
dec: import("scale-ts").Decoder<(Error & {
|
|
63
|
-
name: "CreateTransactionErr::Rejected";
|
|
64
|
-
className: string;
|
|
65
|
-
payload: undefined;
|
|
66
|
-
}) | (Error & {
|
|
67
|
-
name: "CreateTransactionErr::Unknown";
|
|
68
|
-
className: string;
|
|
69
|
-
payload: {
|
|
70
|
-
reason: string;
|
|
71
|
-
};
|
|
72
|
-
}) | (Error & {
|
|
73
|
-
name: "CreateTransactionErr::FailedToDecode";
|
|
74
|
-
className: string;
|
|
75
|
-
payload: undefined;
|
|
76
|
-
}) | (Error & {
|
|
77
|
-
name: "CreateTransactionErr::NotSupported";
|
|
78
|
-
className: string;
|
|
79
|
-
payload: string;
|
|
80
|
-
})>;
|
|
16
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>;
|
|
81
17
|
} & {
|
|
82
|
-
readonly FailedToDecode: import("
|
|
83
|
-
readonly Rejected: import("
|
|
84
|
-
readonly NotSupported: import("
|
|
85
|
-
readonly
|
|
18
|
+
readonly FailedToDecode: import("@novasamatech/scale").ErrCodec<undefined, "CreateTransactionErr::FailedToDecode">;
|
|
19
|
+
readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "CreateTransactionErr::Rejected">;
|
|
20
|
+
readonly NotSupported: import("@novasamatech/scale").ErrCodec<string, "CreateTransactionErr::NotSupported">;
|
|
21
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "CreateTransactionErr::PermissionDenied">;
|
|
22
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
86
23
|
reason: string;
|
|
87
24
|
}, "CreateTransactionErr::Unknown">;
|
|
88
25
|
};
|
|
@@ -134,45 +71,13 @@ export declare const VersionedTxPayload: import("scale-ts").Codec<{
|
|
|
134
71
|
}>;
|
|
135
72
|
export declare const VersionedPublicTxPayload: import("scale-ts").Codec<TxPayloadV1Public>;
|
|
136
73
|
export declare const CreateTransactionV1_request: import("scale-ts").Codec<[[string, number], TxPayloadV1Public]>;
|
|
137
|
-
export declare const CreateTransactionV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
payload: undefined;
|
|
141
|
-
}) | (Error & {
|
|
142
|
-
name: "CreateTransactionErr::Unknown";
|
|
143
|
-
className: string;
|
|
144
|
-
payload: {
|
|
145
|
-
reason: string;
|
|
146
|
-
};
|
|
147
|
-
}) | (Error & {
|
|
148
|
-
name: "CreateTransactionErr::FailedToDecode";
|
|
149
|
-
className: string;
|
|
150
|
-
payload: undefined;
|
|
151
|
-
}) | (Error & {
|
|
152
|
-
name: "CreateTransactionErr::NotSupported";
|
|
153
|
-
className: string;
|
|
154
|
-
payload: string;
|
|
155
|
-
})>>;
|
|
74
|
+
export declare const CreateTransactionV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
75
|
+
reason: string;
|
|
76
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>>;
|
|
156
77
|
export declare const CreateTransactionWithNonProductAccountV1_request: import("scale-ts").Codec<TxPayloadV1Public>;
|
|
157
|
-
export declare const CreateTransactionWithNonProductAccountV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
payload: undefined;
|
|
161
|
-
}) | (Error & {
|
|
162
|
-
name: "CreateTransactionErr::Unknown";
|
|
163
|
-
className: string;
|
|
164
|
-
payload: {
|
|
165
|
-
reason: string;
|
|
166
|
-
};
|
|
167
|
-
}) | (Error & {
|
|
168
|
-
name: "CreateTransactionErr::FailedToDecode";
|
|
169
|
-
className: string;
|
|
170
|
-
payload: undefined;
|
|
171
|
-
}) | (Error & {
|
|
172
|
-
name: "CreateTransactionErr::NotSupported";
|
|
173
|
-
className: string;
|
|
174
|
-
payload: string;
|
|
175
|
-
})>>;
|
|
78
|
+
export declare const CreateTransactionWithNonProductAccountV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike>, import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
79
|
+
reason: string;
|
|
80
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>>;
|
|
176
81
|
export interface TxPayloadV1Public {
|
|
177
82
|
/** Payload version. MUST be 1. */
|
|
178
83
|
version: 1;
|