@novasamatech/host-api 0.5.3-0 → 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/dist/hostApi.d.ts +3 -2
- package/dist/hostApi.js +65 -42
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -4
- package/dist/protocol/impl.d.ts +19 -11
- package/dist/protocol/impl.js +20 -12
- package/dist/protocol/messageCodec.d.ts +469 -199
- package/dist/protocol/v1/chat.d.ts +209 -74
- package/dist/protocol/v1/chat.js +49 -11
- package/dist/protocol/v1/createTransaction.d.ts +7 -6
- package/dist/protocol/v1/createTransaction.js +5 -4
- package/dist/protocol/v1/sign.d.ts +7 -6
- package/dist/protocol/v1/sign.js +4 -3
- package/dist/protocol/v1/statementStore.d.ts +139 -0
- package/dist/protocol/v1/statementStore.js +17 -1
- package/dist/protocol/v1/storage.d.ts +4 -4
- package/dist/protocol/v1/storage.js +3 -3
- package/dist/types.d.ts +6 -4
- package/package.json +2 -1
|
@@ -1,31 +1,81 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const ChatRoomRegistrationErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
2
2
|
reason: string;
|
|
3
|
-
}, "
|
|
3
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
4
4
|
reason: string;
|
|
5
|
-
}, "
|
|
5
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>] & {
|
|
6
6
|
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
7
7
|
reason: string;
|
|
8
|
-
}, "
|
|
8
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>;
|
|
9
9
|
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
10
10
|
reason: string;
|
|
11
|
-
}, "
|
|
11
|
+
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>;
|
|
12
12
|
} & {
|
|
13
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "ChatRoomRegistrationErr::PermissionDenied">;
|
|
13
14
|
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
14
15
|
reason: string;
|
|
15
|
-
}, "
|
|
16
|
+
}, "ChatRoomRegistrationErr::Unknown">;
|
|
16
17
|
};
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
18
|
+
export declare const ChatRoomRequest: import("scale-ts").Codec<{
|
|
19
|
+
roomId: string;
|
|
19
20
|
name: string;
|
|
20
21
|
icon: string;
|
|
21
22
|
}>;
|
|
22
|
-
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;
|
|
29
|
+
name: string;
|
|
30
|
+
icon: string;
|
|
31
|
+
}>;
|
|
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<{
|
|
43
|
+
reason: string;
|
|
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;
|
|
23
56
|
name: string;
|
|
24
57
|
icon: string;
|
|
25
58
|
}>;
|
|
26
|
-
export declare const
|
|
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<{
|
|
27
67
|
reason: string;
|
|
28
|
-
}, "
|
|
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
|
+
}[]>;
|
|
29
79
|
export declare const ChatAction: import("scale-ts").Codec<{
|
|
30
80
|
actionId: string;
|
|
31
81
|
title: string;
|
|
@@ -59,7 +109,7 @@ export declare const ChatReaction: import("scale-ts").Codec<{
|
|
|
59
109
|
messageId: string;
|
|
60
110
|
emoji: string;
|
|
61
111
|
}>;
|
|
62
|
-
export declare const
|
|
112
|
+
export declare const ChatMessageContent: import("scale-ts").Codec<{
|
|
63
113
|
tag: "Text";
|
|
64
114
|
value: string;
|
|
65
115
|
} | {
|
|
@@ -123,60 +173,8 @@ export declare const ChatPostMessageResult: import("scale-ts").Codec<{
|
|
|
123
173
|
messageId: string;
|
|
124
174
|
}>;
|
|
125
175
|
export declare const ChatPostMessageV1_request: import("scale-ts").Codec<{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
} | {
|
|
129
|
-
tag: "RichText";
|
|
130
|
-
value: {
|
|
131
|
-
text: string | undefined;
|
|
132
|
-
media: {
|
|
133
|
-
url: string;
|
|
134
|
-
}[];
|
|
135
|
-
};
|
|
136
|
-
} | {
|
|
137
|
-
tag: "Actions";
|
|
138
|
-
value: {
|
|
139
|
-
text: string | undefined;
|
|
140
|
-
actions: {
|
|
141
|
-
actionId: string;
|
|
142
|
-
title: string;
|
|
143
|
-
}[];
|
|
144
|
-
layout: "Column" | "Grid";
|
|
145
|
-
};
|
|
146
|
-
} | {
|
|
147
|
-
tag: "File";
|
|
148
|
-
value: {
|
|
149
|
-
url: string;
|
|
150
|
-
fileName: string;
|
|
151
|
-
mimeType: string;
|
|
152
|
-
sizeBytes: bigint;
|
|
153
|
-
text: string | undefined;
|
|
154
|
-
};
|
|
155
|
-
} | {
|
|
156
|
-
tag: "Reaction";
|
|
157
|
-
value: {
|
|
158
|
-
messageId: string;
|
|
159
|
-
emoji: string;
|
|
160
|
-
};
|
|
161
|
-
} | {
|
|
162
|
-
tag: "ReactionRemoved";
|
|
163
|
-
value: {
|
|
164
|
-
messageId: string;
|
|
165
|
-
emoji: string;
|
|
166
|
-
};
|
|
167
|
-
}>;
|
|
168
|
-
export declare const ChatPostMessageV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
169
|
-
messageId: string;
|
|
170
|
-
}, import("@novasamatech/scale").CodecError<{
|
|
171
|
-
reason: string;
|
|
172
|
-
}, "ChatMessagePostingErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatMessagePostingErr::MessageTooLarge">>>;
|
|
173
|
-
export declare const ActionTrigger: import("scale-ts").Codec<{
|
|
174
|
-
messageId: string;
|
|
175
|
-
actionId: string;
|
|
176
|
-
}>;
|
|
177
|
-
export declare const ReceivedChatAction: import("scale-ts").Codec<{
|
|
178
|
-
tag: "MessagePosted";
|
|
179
|
-
value: {
|
|
176
|
+
roomId: string;
|
|
177
|
+
payload: {
|
|
180
178
|
tag: "Text";
|
|
181
179
|
value: string;
|
|
182
180
|
} | {
|
|
@@ -219,15 +217,21 @@ export declare const ReceivedChatAction: import("scale-ts").Codec<{
|
|
|
219
217
|
emoji: string;
|
|
220
218
|
};
|
|
221
219
|
};
|
|
222
|
-
} | {
|
|
223
|
-
tag: "ActionTriggered";
|
|
224
|
-
value: {
|
|
225
|
-
messageId: string;
|
|
226
|
-
actionId: string;
|
|
227
|
-
};
|
|
228
220
|
}>;
|
|
229
|
-
export declare const
|
|
230
|
-
|
|
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<{
|
|
231
235
|
tag: "MessagePosted";
|
|
232
236
|
value: {
|
|
233
237
|
tag: "Text";
|
|
@@ -278,4 +282,135 @@ export declare const ChatActionSubscribeV1_receive: import("scale-ts").Codec<{
|
|
|
278
282
|
messageId: string;
|
|
279
283
|
actionId: string;
|
|
280
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
|
+
};
|
|
281
416
|
}>;
|
package/dist/protocol/v1/chat.js
CHANGED
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
import { Enum, ErrEnum, Status } from '@novasamatech/scale';
|
|
2
2
|
import { Option, Result, Struct, Vector, _void, str, u64 } from 'scale-ts';
|
|
3
3
|
import { GenericErr } from '../commonCodecs.js';
|
|
4
|
-
//
|
|
5
|
-
export const
|
|
4
|
+
// room registration
|
|
5
|
+
export const ChatRoomRegistrationErr = ErrEnum('ChatRoomRegistrationErr', {
|
|
6
|
+
PermissionDenied: [_void, 'Permission denied'],
|
|
6
7
|
Unknown: [GenericErr, 'Unknown error while chat registration'],
|
|
7
8
|
});
|
|
8
|
-
export const
|
|
9
|
-
|
|
9
|
+
export const ChatRoomRequest = Struct({
|
|
10
|
+
roomId: str,
|
|
10
11
|
name: str,
|
|
11
|
-
icon: str, //
|
|
12
|
+
icon: str, // URL or base64-encoded image for contact
|
|
12
13
|
});
|
|
13
|
-
export const
|
|
14
|
-
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);
|
|
15
40
|
// message format
|
|
16
41
|
export const ChatAction = Struct({
|
|
17
42
|
actionId: str,
|
|
@@ -41,7 +66,7 @@ export const ChatReaction = Struct({
|
|
|
41
66
|
messageId: str,
|
|
42
67
|
emoji: str,
|
|
43
68
|
});
|
|
44
|
-
export const
|
|
69
|
+
export const ChatMessageContent = Enum({
|
|
45
70
|
Text: str,
|
|
46
71
|
RichText: ChatRichText,
|
|
47
72
|
Actions: ChatActions,
|
|
@@ -57,16 +82,29 @@ export const ChatMessagePostingErr = ErrEnum('ChatMessagePostingErr', {
|
|
|
57
82
|
export const ChatPostMessageResult = Struct({
|
|
58
83
|
messageId: str,
|
|
59
84
|
});
|
|
60
|
-
export const ChatPostMessageV1_request =
|
|
85
|
+
export const ChatPostMessageV1_request = Struct({
|
|
86
|
+
roomId: str,
|
|
87
|
+
payload: ChatMessageContent,
|
|
88
|
+
});
|
|
61
89
|
export const ChatPostMessageV1_response = Result(ChatPostMessageResult, ChatMessagePostingErr);
|
|
62
90
|
// receiving a message
|
|
63
91
|
export const ActionTrigger = Struct({
|
|
64
92
|
messageId: str,
|
|
65
93
|
actionId: str,
|
|
66
94
|
});
|
|
67
|
-
export const
|
|
68
|
-
|
|
95
|
+
export const ChatCommand = Struct({
|
|
96
|
+
command: str,
|
|
97
|
+
payload: str,
|
|
98
|
+
});
|
|
99
|
+
export const ChatActionPayload = Enum({
|
|
100
|
+
MessagePosted: ChatMessageContent,
|
|
69
101
|
ActionTriggered: ActionTrigger,
|
|
102
|
+
Command: ChatCommand,
|
|
103
|
+
});
|
|
104
|
+
export const ReceivedChatAction = Struct({
|
|
105
|
+
roomId: str,
|
|
106
|
+
peer: str,
|
|
107
|
+
payload: ChatActionPayload,
|
|
70
108
|
});
|
|
71
109
|
export const ChatActionSubscribeV1_start = _void;
|
|
72
110
|
export const ChatActionSubscribeV1_receive = ReceivedChatAction;
|
|
@@ -5,19 +5,20 @@ import type { HexString } from '@novasamatech/scale';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const CreateTransactionErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
7
7
|
reason: string;
|
|
8
|
-
}, "CreateTransactionErr::Unknown"> | 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<{
|
|
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
9
|
reason: string;
|
|
10
|
-
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>] & {
|
|
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
11
|
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
12
12
|
reason: string;
|
|
13
|
-
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>;
|
|
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
14
|
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
15
15
|
reason: string;
|
|
16
|
-
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>;
|
|
16
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>;
|
|
17
17
|
} & {
|
|
18
18
|
readonly FailedToDecode: import("@novasamatech/scale").ErrCodec<undefined, "CreateTransactionErr::FailedToDecode">;
|
|
19
19
|
readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "CreateTransactionErr::Rejected">;
|
|
20
20
|
readonly NotSupported: import("@novasamatech/scale").ErrCodec<string, "CreateTransactionErr::NotSupported">;
|
|
21
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "CreateTransactionErr::PermissionDenied">;
|
|
21
22
|
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
22
23
|
reason: string;
|
|
23
24
|
}, "CreateTransactionErr::Unknown">;
|
|
@@ -72,11 +73,11 @@ export declare const VersionedPublicTxPayload: import("scale-ts").Codec<TxPayloa
|
|
|
72
73
|
export declare const CreateTransactionV1_request: import("scale-ts").Codec<[[string, number], TxPayloadV1Public]>;
|
|
73
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<{
|
|
74
75
|
reason: string;
|
|
75
|
-
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>>;
|
|
76
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>>;
|
|
76
77
|
export declare const CreateTransactionWithNonProductAccountV1_request: import("scale-ts").Codec<TxPayloadV1Public>;
|
|
77
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<{
|
|
78
79
|
reason: string;
|
|
79
|
-
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>>;
|
|
80
|
+
}, "CreateTransactionErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "CreateTransactionErr::FailedToDecode"> | import("@novasamatech/scale").CodecError<string, "CreateTransactionErr::NotSupported">>>;
|
|
80
81
|
export interface TxPayloadV1Public {
|
|
81
82
|
/** Payload version. MUST be 1. */
|
|
82
83
|
version: 1;
|
|
@@ -7,12 +7,13 @@ import { ProductAccountId } from './accounts.js';
|
|
|
7
7
|
* @see https://github.com/polkadot-js/api/issues/6213
|
|
8
8
|
*/
|
|
9
9
|
export const CreateTransactionErr = ErrEnum('CreateTransactionErr', {
|
|
10
|
-
FailedToDecode: [_void, '
|
|
11
|
-
Rejected: [_void, '
|
|
10
|
+
FailedToDecode: [_void, 'Failed to decode'],
|
|
11
|
+
Rejected: [_void, 'Rejected'],
|
|
12
12
|
// Unsupported payload version
|
|
13
13
|
// Failed to infer missing extensions, some extension is unsupported, etc.
|
|
14
|
-
NotSupported: [str, '
|
|
15
|
-
|
|
14
|
+
NotSupported: [str, 'Not Supported'],
|
|
15
|
+
PermissionDenied: [_void, 'Permission denied'],
|
|
16
|
+
Unknown: [GenericErr, 'Unknown error'],
|
|
16
17
|
});
|
|
17
18
|
export const TxPayloadExtensionV1 = Struct({
|
|
18
19
|
id: str,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
export declare const SigningErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "SigningErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
2
2
|
reason: string;
|
|
3
|
-
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "SigningErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
3
|
+
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "SigningErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
4
4
|
reason: string;
|
|
5
|
-
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>] & {
|
|
5
|
+
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>] & {
|
|
6
6
|
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<undefined, "SigningErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
7
7
|
reason: string;
|
|
8
|
-
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>;
|
|
8
|
+
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>;
|
|
9
9
|
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<undefined, "SigningErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
10
10
|
reason: string;
|
|
11
|
-
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>;
|
|
11
|
+
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>;
|
|
12
12
|
} & {
|
|
13
13
|
readonly FailedToDecode: import("@novasamatech/scale").ErrCodec<undefined, "SigningErr::FailedToDecode">;
|
|
14
14
|
readonly Rejected: import("@novasamatech/scale").ErrCodec<undefined, "SigningErr::Rejected">;
|
|
15
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "SigningErr::PermissionDenied">;
|
|
15
16
|
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
16
17
|
reason: string;
|
|
17
18
|
}, "SigningErr::Unknown">;
|
|
@@ -35,7 +36,7 @@ export declare const SignRawV1_response: import("scale-ts").Codec<import("scale-
|
|
|
35
36
|
signedTransaction: `0x${string}` | undefined;
|
|
36
37
|
}, import("@novasamatech/scale").CodecError<undefined, "SigningErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
37
38
|
reason: string;
|
|
38
|
-
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>>;
|
|
39
|
+
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>>;
|
|
39
40
|
export declare const SigningPayload: import("scale-ts").Codec<{
|
|
40
41
|
address: string;
|
|
41
42
|
blockHash: `0x${string}`;
|
|
@@ -77,4 +78,4 @@ export declare const SignPayloadV1_response: import("scale-ts").Codec<import("sc
|
|
|
77
78
|
signedTransaction: `0x${string}` | undefined;
|
|
78
79
|
}, import("@novasamatech/scale").CodecError<undefined, "SigningErr::Rejected"> | import("@novasamatech/scale").CodecError<{
|
|
79
80
|
reason: string;
|
|
80
|
-
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>>;
|
|
81
|
+
}, "SigningErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::PermissionDenied"> | import("@novasamatech/scale").CodecError<undefined, "SigningErr::FailedToDecode">>>;
|
package/dist/protocol/v1/sign.js
CHANGED
|
@@ -3,9 +3,10 @@ import { Bytes, Option, Result, Struct, Vector, _void, bool, str, u32 } from 'sc
|
|
|
3
3
|
import { GenericErr, GenesisHash } from '../commonCodecs.js';
|
|
4
4
|
// common structures
|
|
5
5
|
export const SigningErr = ErrEnum('SigningErr', {
|
|
6
|
-
FailedToDecode: [_void, '
|
|
7
|
-
Rejected: [_void, '
|
|
8
|
-
|
|
6
|
+
FailedToDecode: [_void, 'Failed to decode'],
|
|
7
|
+
Rejected: [_void, 'Rejected'],
|
|
8
|
+
PermissionDenied: [_void, 'Permission denied'],
|
|
9
|
+
Unknown: [GenericErr, 'Unknown error'],
|
|
9
10
|
});
|
|
10
11
|
export const SigningResult = Struct({
|
|
11
12
|
signature: Hex(),
|