@novasamatech/host-api 0.6.1 → 0.6.3

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.
@@ -0,0 +1,357 @@
1
+ export declare const RuntimeType: import("scale-ts").Codec<{
2
+ tag: "Valid";
3
+ value: {
4
+ specName: string;
5
+ implName: string;
6
+ specVersion: number;
7
+ implVersion: number;
8
+ transactionVersion: number | undefined;
9
+ apis: [string, number][];
10
+ };
11
+ } | {
12
+ tag: "Invalid";
13
+ value: {
14
+ error: string;
15
+ };
16
+ }>;
17
+ export declare const StorageQueryType: import("scale-ts").Codec<"Value" | "Hash" | "ClosestDescendantMerkleValue" | "DescendantsValues" | "DescendantsHashes">;
18
+ export declare const StorageQueryItem: import("scale-ts").Codec<{
19
+ key: `0x${string}`;
20
+ type: "Value" | "Hash" | "ClosestDescendantMerkleValue" | "DescendantsValues" | "DescendantsHashes";
21
+ }>;
22
+ export declare const StorageResultItem: import("scale-ts").Codec<{
23
+ key: `0x${string}`;
24
+ value: `0x${string}` | null;
25
+ hash: `0x${string}` | null;
26
+ closestDescendantMerkleValue: `0x${string}` | null;
27
+ }>;
28
+ export declare const OperationStartedResult: import("scale-ts").Codec<{
29
+ tag: "Started";
30
+ value: {
31
+ operationId: string;
32
+ };
33
+ } | {
34
+ tag: "LimitReached";
35
+ value: undefined;
36
+ }>;
37
+ export declare const ChainHeadFollowV1_start: import("scale-ts").Codec<{
38
+ genesisHash: `0x${string}`;
39
+ withRuntime: boolean;
40
+ }>;
41
+ export declare const ChainHeadEvent: import("scale-ts").Codec<{
42
+ tag: "Initialized";
43
+ value: {
44
+ finalizedBlockHashes: `0x${string}`[];
45
+ finalizedBlockRuntime: {
46
+ tag: "Valid";
47
+ value: {
48
+ specName: string;
49
+ implName: string;
50
+ specVersion: number;
51
+ implVersion: number;
52
+ transactionVersion: number | undefined;
53
+ apis: [string, number][];
54
+ };
55
+ } | {
56
+ tag: "Invalid";
57
+ value: {
58
+ error: string;
59
+ };
60
+ } | undefined;
61
+ };
62
+ } | {
63
+ tag: "NewBlock";
64
+ value: {
65
+ blockHash: `0x${string}`;
66
+ parentBlockHash: `0x${string}`;
67
+ newRuntime: {
68
+ tag: "Valid";
69
+ value: {
70
+ specName: string;
71
+ implName: string;
72
+ specVersion: number;
73
+ implVersion: number;
74
+ transactionVersion: number | undefined;
75
+ apis: [string, number][];
76
+ };
77
+ } | {
78
+ tag: "Invalid";
79
+ value: {
80
+ error: string;
81
+ };
82
+ } | undefined;
83
+ };
84
+ } | {
85
+ tag: "BestBlockChanged";
86
+ value: {
87
+ bestBlockHash: `0x${string}`;
88
+ };
89
+ } | {
90
+ tag: "Finalized";
91
+ value: {
92
+ finalizedBlockHashes: `0x${string}`[];
93
+ prunedBlockHashes: `0x${string}`[];
94
+ };
95
+ } | {
96
+ tag: "OperationBodyDone";
97
+ value: {
98
+ operationId: string;
99
+ value: `0x${string}`[];
100
+ };
101
+ } | {
102
+ tag: "OperationCallDone";
103
+ value: {
104
+ operationId: string;
105
+ output: `0x${string}`;
106
+ };
107
+ } | {
108
+ tag: "OperationStorageItems";
109
+ value: {
110
+ operationId: string;
111
+ items: {
112
+ key: `0x${string}`;
113
+ value: `0x${string}` | null;
114
+ hash: `0x${string}` | null;
115
+ closestDescendantMerkleValue: `0x${string}` | null;
116
+ }[];
117
+ };
118
+ } | {
119
+ tag: "OperationStorageDone";
120
+ value: {
121
+ operationId: string;
122
+ };
123
+ } | {
124
+ tag: "OperationWaitingForContinue";
125
+ value: {
126
+ operationId: string;
127
+ };
128
+ } | {
129
+ tag: "OperationInaccessible";
130
+ value: {
131
+ operationId: string;
132
+ };
133
+ } | {
134
+ tag: "OperationError";
135
+ value: {
136
+ operationId: string;
137
+ error: string;
138
+ };
139
+ } | {
140
+ tag: "Stop";
141
+ value: undefined;
142
+ }>;
143
+ export declare const ChainHeadFollowV1_receive: import("scale-ts").Codec<{
144
+ tag: "Initialized";
145
+ value: {
146
+ finalizedBlockHashes: `0x${string}`[];
147
+ finalizedBlockRuntime: {
148
+ tag: "Valid";
149
+ value: {
150
+ specName: string;
151
+ implName: string;
152
+ specVersion: number;
153
+ implVersion: number;
154
+ transactionVersion: number | undefined;
155
+ apis: [string, number][];
156
+ };
157
+ } | {
158
+ tag: "Invalid";
159
+ value: {
160
+ error: string;
161
+ };
162
+ } | undefined;
163
+ };
164
+ } | {
165
+ tag: "NewBlock";
166
+ value: {
167
+ blockHash: `0x${string}`;
168
+ parentBlockHash: `0x${string}`;
169
+ newRuntime: {
170
+ tag: "Valid";
171
+ value: {
172
+ specName: string;
173
+ implName: string;
174
+ specVersion: number;
175
+ implVersion: number;
176
+ transactionVersion: number | undefined;
177
+ apis: [string, number][];
178
+ };
179
+ } | {
180
+ tag: "Invalid";
181
+ value: {
182
+ error: string;
183
+ };
184
+ } | undefined;
185
+ };
186
+ } | {
187
+ tag: "BestBlockChanged";
188
+ value: {
189
+ bestBlockHash: `0x${string}`;
190
+ };
191
+ } | {
192
+ tag: "Finalized";
193
+ value: {
194
+ finalizedBlockHashes: `0x${string}`[];
195
+ prunedBlockHashes: `0x${string}`[];
196
+ };
197
+ } | {
198
+ tag: "OperationBodyDone";
199
+ value: {
200
+ operationId: string;
201
+ value: `0x${string}`[];
202
+ };
203
+ } | {
204
+ tag: "OperationCallDone";
205
+ value: {
206
+ operationId: string;
207
+ output: `0x${string}`;
208
+ };
209
+ } | {
210
+ tag: "OperationStorageItems";
211
+ value: {
212
+ operationId: string;
213
+ items: {
214
+ key: `0x${string}`;
215
+ value: `0x${string}` | null;
216
+ hash: `0x${string}` | null;
217
+ closestDescendantMerkleValue: `0x${string}` | null;
218
+ }[];
219
+ };
220
+ } | {
221
+ tag: "OperationStorageDone";
222
+ value: {
223
+ operationId: string;
224
+ };
225
+ } | {
226
+ tag: "OperationWaitingForContinue";
227
+ value: {
228
+ operationId: string;
229
+ };
230
+ } | {
231
+ tag: "OperationInaccessible";
232
+ value: {
233
+ operationId: string;
234
+ };
235
+ } | {
236
+ tag: "OperationError";
237
+ value: {
238
+ operationId: string;
239
+ error: string;
240
+ };
241
+ } | {
242
+ tag: "Stop";
243
+ value: undefined;
244
+ }>;
245
+ export declare const ChainHeadHeaderV1_request: import("scale-ts").Codec<{
246
+ genesisHash: `0x${string}`;
247
+ followSubscriptionId: string;
248
+ hash: `0x${string}`;
249
+ }>;
250
+ export declare const ChainHeadHeaderV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<`0x${string}` | null, import("@novasamatech/scale").CodecError<{
251
+ reason: string;
252
+ }, "GenericError">>>;
253
+ export declare const ChainHeadBodyV1_request: import("scale-ts").Codec<{
254
+ genesisHash: `0x${string}`;
255
+ followSubscriptionId: string;
256
+ hash: `0x${string}`;
257
+ }>;
258
+ export declare const ChainHeadBodyV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
259
+ tag: "Started";
260
+ value: {
261
+ operationId: string;
262
+ };
263
+ } | {
264
+ tag: "LimitReached";
265
+ value: undefined;
266
+ }, import("@novasamatech/scale").CodecError<{
267
+ reason: string;
268
+ }, "GenericError">>>;
269
+ export declare const ChainHeadStorageV1_request: import("scale-ts").Codec<{
270
+ genesisHash: `0x${string}`;
271
+ followSubscriptionId: string;
272
+ hash: `0x${string}`;
273
+ items: {
274
+ key: `0x${string}`;
275
+ type: "Value" | "Hash" | "ClosestDescendantMerkleValue" | "DescendantsValues" | "DescendantsHashes";
276
+ }[];
277
+ childTrie: `0x${string}` | null;
278
+ }>;
279
+ export declare const ChainHeadStorageV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
280
+ tag: "Started";
281
+ value: {
282
+ operationId: string;
283
+ };
284
+ } | {
285
+ tag: "LimitReached";
286
+ value: undefined;
287
+ }, import("@novasamatech/scale").CodecError<{
288
+ reason: string;
289
+ }, "GenericError">>>;
290
+ export declare const ChainHeadCallV1_request: import("scale-ts").Codec<{
291
+ genesisHash: `0x${string}`;
292
+ followSubscriptionId: string;
293
+ hash: `0x${string}`;
294
+ function: string;
295
+ callParameters: `0x${string}`;
296
+ }>;
297
+ export declare const ChainHeadCallV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
298
+ tag: "Started";
299
+ value: {
300
+ operationId: string;
301
+ };
302
+ } | {
303
+ tag: "LimitReached";
304
+ value: undefined;
305
+ }, import("@novasamatech/scale").CodecError<{
306
+ reason: string;
307
+ }, "GenericError">>>;
308
+ export declare const ChainHeadUnpinV1_request: import("scale-ts").Codec<{
309
+ genesisHash: `0x${string}`;
310
+ followSubscriptionId: string;
311
+ hashes: `0x${string}`[];
312
+ }>;
313
+ export declare const ChainHeadUnpinV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
314
+ reason: string;
315
+ }, "GenericError">>>;
316
+ export declare const ChainHeadContinueV1_request: import("scale-ts").Codec<{
317
+ genesisHash: `0x${string}`;
318
+ followSubscriptionId: string;
319
+ operationId: string;
320
+ }>;
321
+ export declare const ChainHeadContinueV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
322
+ reason: string;
323
+ }, "GenericError">>>;
324
+ export declare const ChainHeadStopOperationV1_request: import("scale-ts").Codec<{
325
+ genesisHash: `0x${string}`;
326
+ followSubscriptionId: string;
327
+ operationId: string;
328
+ }>;
329
+ export declare const ChainHeadStopOperationV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
330
+ reason: string;
331
+ }, "GenericError">>>;
332
+ export declare const ChainSpecGenesisHashV1_request: import("scale-ts").Codec<`0x${string}`>;
333
+ export declare const ChainSpecGenesisHashV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<`0x${string}`, import("@novasamatech/scale").CodecError<{
334
+ reason: string;
335
+ }, "GenericError">>>;
336
+ export declare const ChainSpecChainNameV1_request: import("scale-ts").Codec<`0x${string}`>;
337
+ export declare const ChainSpecChainNameV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<string, import("@novasamatech/scale").CodecError<{
338
+ reason: string;
339
+ }, "GenericError">>>;
340
+ export declare const ChainSpecPropertiesV1_request: import("scale-ts").Codec<`0x${string}`>;
341
+ export declare const ChainSpecPropertiesV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<string, import("@novasamatech/scale").CodecError<{
342
+ reason: string;
343
+ }, "GenericError">>>;
344
+ export declare const TransactionBroadcastV1_request: import("scale-ts").Codec<{
345
+ genesisHash: `0x${string}`;
346
+ transaction: `0x${string}`;
347
+ }>;
348
+ export declare const TransactionBroadcastV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<string | null, import("@novasamatech/scale").CodecError<{
349
+ reason: string;
350
+ }, "GenericError">>>;
351
+ export declare const TransactionStopV1_request: import("scale-ts").Codec<{
352
+ genesisHash: `0x${string}`;
353
+ operationId: string;
354
+ }>;
355
+ export declare const TransactionStopV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
356
+ reason: string;
357
+ }, "GenericError">>>;
@@ -0,0 +1,159 @@
1
+ import { Enum, Hex, Nullable, Status } from '@novasamatech/scale';
2
+ import { Option, Result, Struct, Tuple, Vector, _void, bool, str, u32 } from 'scale-ts';
3
+ import { GenericError, GenesisHash } from '../commonCodecs.js';
4
+ // === Shared types ===
5
+ const BlockHash = Hex();
6
+ const OperationId = str;
7
+ // === Runtime spec (for follow events with withRuntime=true) ===
8
+ const RuntimeApi = Tuple(str, u32);
9
+ const RuntimeSpec = Struct({
10
+ specName: str,
11
+ implName: str,
12
+ specVersion: u32,
13
+ implVersion: u32,
14
+ transactionVersion: Option(u32),
15
+ apis: Vector(RuntimeApi),
16
+ });
17
+ export const RuntimeType = Enum({
18
+ Valid: RuntimeSpec,
19
+ Invalid: Struct({ error: str }),
20
+ });
21
+ // === Storage types ===
22
+ export const StorageQueryType = Status('Value', 'Hash', 'ClosestDescendantMerkleValue', 'DescendantsValues', 'DescendantsHashes');
23
+ export const StorageQueryItem = Struct({
24
+ key: Hex(),
25
+ type: StorageQueryType,
26
+ });
27
+ export const StorageResultItem = Struct({
28
+ key: Hex(),
29
+ value: Nullable(Hex()),
30
+ hash: Nullable(Hex()),
31
+ closestDescendantMerkleValue: Nullable(Hex()),
32
+ });
33
+ // === Operation result (shared by body/storage/call responses) ===
34
+ export const OperationStartedResult = Enum({
35
+ Started: Struct({ operationId: OperationId }),
36
+ LimitReached: _void,
37
+ });
38
+ // === ChainHead Follow ===
39
+ export const ChainHeadFollowV1_start = Struct({
40
+ genesisHash: GenesisHash,
41
+ withRuntime: bool,
42
+ });
43
+ export const ChainHeadEvent = Enum({
44
+ Initialized: Struct({
45
+ finalizedBlockHashes: Vector(BlockHash),
46
+ finalizedBlockRuntime: Option(RuntimeType),
47
+ }),
48
+ NewBlock: Struct({
49
+ blockHash: BlockHash,
50
+ parentBlockHash: BlockHash,
51
+ newRuntime: Option(RuntimeType),
52
+ }),
53
+ BestBlockChanged: Struct({
54
+ bestBlockHash: BlockHash,
55
+ }),
56
+ Finalized: Struct({
57
+ finalizedBlockHashes: Vector(BlockHash),
58
+ prunedBlockHashes: Vector(BlockHash),
59
+ }),
60
+ OperationBodyDone: Struct({
61
+ operationId: OperationId,
62
+ value: Vector(Hex()),
63
+ }),
64
+ OperationCallDone: Struct({
65
+ operationId: OperationId,
66
+ output: Hex(),
67
+ }),
68
+ OperationStorageItems: Struct({
69
+ operationId: OperationId,
70
+ items: Vector(StorageResultItem),
71
+ }),
72
+ OperationStorageDone: Struct({
73
+ operationId: OperationId,
74
+ }),
75
+ OperationWaitingForContinue: Struct({
76
+ operationId: OperationId,
77
+ }),
78
+ OperationInaccessible: Struct({
79
+ operationId: OperationId,
80
+ }),
81
+ OperationError: Struct({
82
+ operationId: OperationId,
83
+ error: str,
84
+ }),
85
+ Stop: _void,
86
+ });
87
+ export const ChainHeadFollowV1_receive = ChainHeadEvent;
88
+ // === ChainHead Header ===
89
+ export const ChainHeadHeaderV1_request = Struct({
90
+ genesisHash: GenesisHash,
91
+ followSubscriptionId: str,
92
+ hash: BlockHash,
93
+ });
94
+ export const ChainHeadHeaderV1_response = Result(Nullable(Hex()), GenericError);
95
+ // === ChainHead Body ===
96
+ export const ChainHeadBodyV1_request = Struct({
97
+ genesisHash: GenesisHash,
98
+ followSubscriptionId: str,
99
+ hash: BlockHash,
100
+ });
101
+ export const ChainHeadBodyV1_response = Result(OperationStartedResult, GenericError);
102
+ // === ChainHead Storage ===
103
+ export const ChainHeadStorageV1_request = Struct({
104
+ genesisHash: GenesisHash,
105
+ followSubscriptionId: str,
106
+ hash: BlockHash,
107
+ items: Vector(StorageQueryItem),
108
+ childTrie: Nullable(Hex()),
109
+ });
110
+ export const ChainHeadStorageV1_response = Result(OperationStartedResult, GenericError);
111
+ // === ChainHead Call ===
112
+ export const ChainHeadCallV1_request = Struct({
113
+ genesisHash: GenesisHash,
114
+ followSubscriptionId: str,
115
+ hash: BlockHash,
116
+ function: str,
117
+ callParameters: Hex(),
118
+ });
119
+ export const ChainHeadCallV1_response = Result(OperationStartedResult, GenericError);
120
+ // === ChainHead Unpin ===
121
+ export const ChainHeadUnpinV1_request = Struct({
122
+ genesisHash: GenesisHash,
123
+ followSubscriptionId: str,
124
+ hashes: Vector(BlockHash),
125
+ });
126
+ export const ChainHeadUnpinV1_response = Result(_void, GenericError);
127
+ // === ChainHead Continue ===
128
+ export const ChainHeadContinueV1_request = Struct({
129
+ genesisHash: GenesisHash,
130
+ followSubscriptionId: str,
131
+ operationId: OperationId,
132
+ });
133
+ export const ChainHeadContinueV1_response = Result(_void, GenericError);
134
+ // === ChainHead StopOperation ===
135
+ export const ChainHeadStopOperationV1_request = Struct({
136
+ genesisHash: GenesisHash,
137
+ followSubscriptionId: str,
138
+ operationId: OperationId,
139
+ });
140
+ export const ChainHeadStopOperationV1_response = Result(_void, GenericError);
141
+ // === ChainSpec ===
142
+ export const ChainSpecGenesisHashV1_request = GenesisHash;
143
+ export const ChainSpecGenesisHashV1_response = Result(Hex(), GenericError);
144
+ export const ChainSpecChainNameV1_request = GenesisHash;
145
+ export const ChainSpecChainNameV1_response = Result(str, GenericError);
146
+ export const ChainSpecPropertiesV1_request = GenesisHash;
147
+ export const ChainSpecPropertiesV1_response = Result(str, GenericError);
148
+ // === Transaction Broadcast ===
149
+ export const TransactionBroadcastV1_request = Struct({
150
+ genesisHash: GenesisHash,
151
+ transaction: Hex(),
152
+ });
153
+ export const TransactionBroadcastV1_response = Result(Nullable(str), GenericError);
154
+ // === Transaction Stop ===
155
+ export const TransactionStopV1_request = Struct({
156
+ genesisHash: GenesisHash,
157
+ operationId: str,
158
+ });
159
+ export const TransactionStopV1_response = Result(_void, GenericError);
@@ -459,6 +459,7 @@ export declare const ChatActionSubscribeV1_receive: Codec<{
459
459
  };
460
460
  }>;
461
461
  export declare const ChatCustomMessageRenderingV1_start: Codec<{
462
+ messageId: string;
462
463
  messageType: string;
463
464
  payload: Uint8Array<ArrayBufferLike>;
464
465
  }>;
@@ -120,5 +120,5 @@ export const ReceivedChatAction = Struct({
120
120
  export const ChatActionSubscribeV1_start = _void;
121
121
  export const ChatActionSubscribeV1_receive = ReceivedChatAction;
122
122
  // custom message rendering
123
- export const ChatCustomMessageRenderingV1_start = Struct({ messageType: str, payload: Bytes() });
123
+ export const ChatCustomMessageRenderingV1_start = Struct({ messageId: str, messageType: str, payload: Bytes() });
124
124
  export const ChatCustomMessageRenderingV1_receive = CustomRendererNode;