@parity/truapi 0.1.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.
@@ -0,0 +1,456 @@
1
+ export const services = [
2
+ {
3
+ name: "Account",
4
+ methods: [
5
+ {
6
+ name: "connection_status_subscribe",
7
+ type: "subscription",
8
+ description: "Subscribe to account connection status changes.",
9
+ noParams: true,
10
+ },
11
+ {
12
+ name: "get_account",
13
+ type: "unary",
14
+ description: "Retrieve a product-scoped account.",
15
+ requestDescription: "HostAccountGetRequest",
16
+ defaultRequest: '{\n "productAccountId": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n }\n}',
17
+ },
18
+ {
19
+ name: "get_account_alias",
20
+ type: "unary",
21
+ description: "Retrieve a contextual alias for a product account.",
22
+ requestDescription: "HostAccountGetAliasRequest",
23
+ defaultRequest: '{\n "productAccountId": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n }\n}',
24
+ },
25
+ {
26
+ name: "create_account_proof",
27
+ type: "unary",
28
+ description: "Generate a ring VRF proof for a product account.",
29
+ requestDescription: "HostAccountCreateProofRequest",
30
+ defaultRequest: '{\n "context": "0x",\n "productAccountId": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n },\n "ringLocation": {\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hints": {\n "palletInstance": 42\n },\n "ringRootHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n }\n}',
31
+ },
32
+ {
33
+ name: "get_legacy_accounts",
34
+ type: "unary",
35
+ description: "List non-product accounts the user owns.",
36
+ noParams: true,
37
+ },
38
+ {
39
+ name: "get_user_id",
40
+ type: "unary",
41
+ description: "Fetch the user's primary identity.",
42
+ noParams: true,
43
+ },
44
+ {
45
+ name: "request_login",
46
+ type: "unary",
47
+ description: 'Request the host to present the login flow to the user.\n\nProducts should call this in response to a user action (e.g. tapping a\n"Sign in" button), not automatically on load.',
48
+ requestDescription: "HostRequestLoginRequest",
49
+ defaultRequest: '{\n "reason": "Sign in to vote on Referendum #42"\n}',
50
+ },
51
+ ],
52
+ },
53
+ {
54
+ name: "Chain",
55
+ methods: [
56
+ {
57
+ name: "follow_head_subscribe",
58
+ type: "subscription",
59
+ description: "Follow the chain head and receive block events.",
60
+ requestDescription: "RemoteChainHeadFollowRequest",
61
+ defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "withRuntime": false\n}',
62
+ },
63
+ {
64
+ name: "get_head_header",
65
+ type: "unary",
66
+ description: "Fetch a block header.",
67
+ requestDescription: "RemoteChainHeadHeaderRequest",
68
+ defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hash": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
69
+ },
70
+ {
71
+ name: "get_head_body",
72
+ type: "unary",
73
+ description: "Fetch a block body.",
74
+ requestDescription: "RemoteChainHeadBodyRequest",
75
+ defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hash": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
76
+ },
77
+ {
78
+ name: "get_head_storage",
79
+ type: "unary",
80
+ description: "Query runtime storage at a specific block.",
81
+ requestDescription: "RemoteChainHeadStorageRequest",
82
+ defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hash": "0x0000000000000000000000000000000000000000000000000000000000000000",\n "items": [\n {\n "key": "0x26aa394eea5630e07c48ae0c9558cef7",\n "queryType": "Value"\n }\n ]\n}',
83
+ },
84
+ {
85
+ name: "call_head",
86
+ type: "unary",
87
+ description: "Invoke a runtime call at a specific block.",
88
+ requestDescription: "RemoteChainHeadCallRequest",
89
+ defaultRequest: '{\n "callParameters": "0x",\n "followSubscriptionId": "",\n "function": "Core_version",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hash": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
90
+ },
91
+ {
92
+ name: "unpin_head",
93
+ type: "unary",
94
+ description: "Release pinned blocks.",
95
+ requestDescription: "RemoteChainHeadUnpinRequest",
96
+ defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hashes": [\n "0x0000000000000000000000000000000000000000000000000000000000000000"\n ]\n}',
97
+ },
98
+ {
99
+ name: "continue_head",
100
+ type: "unary",
101
+ description: "Continue a paused chain-head operation.",
102
+ requestDescription: "RemoteChainHeadContinueRequest",
103
+ defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "operationId": "op-id"\n}',
104
+ },
105
+ {
106
+ name: "stop_head_operation",
107
+ type: "unary",
108
+ description: "Stop a chain-head operation.",
109
+ requestDescription: "RemoteChainHeadStopOperationRequest",
110
+ defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "operationId": "op-id"\n}',
111
+ },
112
+ {
113
+ name: "get_spec_genesis_hash",
114
+ type: "unary",
115
+ description: "Fetch the canonical genesis hash for a chain.",
116
+ requestDescription: "RemoteChainSpecGenesisHashRequest",
117
+ defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n}',
118
+ },
119
+ {
120
+ name: "get_spec_chain_name",
121
+ type: "unary",
122
+ description: "Fetch the display name of a chain.",
123
+ requestDescription: "RemoteChainSpecChainNameRequest",
124
+ defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n}',
125
+ },
126
+ {
127
+ name: "get_spec_properties",
128
+ type: "unary",
129
+ description: "Fetch the JSON-encoded properties of a chain.",
130
+ requestDescription: "RemoteChainSpecPropertiesRequest",
131
+ defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n}',
132
+ },
133
+ {
134
+ name: "broadcast_transaction",
135
+ type: "unary",
136
+ description: "Broadcast a signed transaction.",
137
+ requestDescription: "RemoteChainTransactionBroadcastRequest",
138
+ defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "transaction": "0x"\n}',
139
+ },
140
+ {
141
+ name: "stop_transaction",
142
+ type: "unary",
143
+ description: "Stop a transaction broadcast.",
144
+ requestDescription: "RemoteChainTransactionStopRequest",
145
+ defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "operationId": "op-id"\n}',
146
+ },
147
+ ],
148
+ },
149
+ {
150
+ name: "Chat",
151
+ methods: [
152
+ {
153
+ name: "create_room",
154
+ type: "unary",
155
+ description: "Create a chat room.",
156
+ requestDescription: "HostChatCreateRoomRequest",
157
+ defaultRequest: '{\n "icon": "",\n "name": "Test Room",\n "roomId": "test-room"\n}',
158
+ },
159
+ {
160
+ name: "register_bot",
161
+ type: "unary",
162
+ description: "Register a chat bot.",
163
+ requestDescription: "HostChatRegisterBotRequest",
164
+ defaultRequest: '{\n "botId": "test-bot",\n "icon": "",\n "name": "Test Bot"\n}',
165
+ },
166
+ {
167
+ name: "list_subscribe",
168
+ type: "subscription",
169
+ description: "Subscribe to the list of chat rooms.",
170
+ noParams: true,
171
+ },
172
+ {
173
+ name: "post_message",
174
+ type: "unary",
175
+ description: "Post a message to a chat room.",
176
+ requestDescription: "HostChatPostMessageRequest",
177
+ defaultRequest: '{\n "payload": {\n "tag": "Text",\n "value": {\n "text": "Hello from playground!"\n }\n },\n "roomId": "test-room"\n}',
178
+ },
179
+ {
180
+ name: "action_subscribe",
181
+ type: "subscription",
182
+ description: "Subscribe to received chat actions.",
183
+ noParams: true,
184
+ },
185
+ {
186
+ name: "custom_message_render_subscribe",
187
+ type: "subscription",
188
+ description: "Subscribe to custom message render requests from the host. Each\nemitted item is a [`CustomRendererNode`](crate::v01::CustomRendererNode)\ntree describing the rendered UI.",
189
+ requestDescription: "ProductChatCustomMessageRenderSubscribeRequest",
190
+ defaultRequest: '{\n "messageId": "msg-1",\n "messageType": "custom-render-demo",\n "payload": "0x"\n}',
191
+ },
192
+ ],
193
+ },
194
+ {
195
+ name: "Entropy",
196
+ methods: [
197
+ {
198
+ name: "derive",
199
+ type: "unary",
200
+ description: "Derive deterministic entropy.",
201
+ requestDescription: "HostDeriveEntropyRequest",
202
+ defaultRequest: '{\n "context": "0x70726f647563742d6b6579"\n}',
203
+ },
204
+ ],
205
+ },
206
+ {
207
+ name: "JSON-RPC",
208
+ methods: [
209
+ {
210
+ name: "send_message",
211
+ type: "unary",
212
+ description: "Send a JSON-RPC message.",
213
+ requestDescription: "HostJsonrpcMessageSendRequest",
214
+ defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "message": "{\\"jsonrpc\\":\\"2.0\\",\\"id\\":1,\\"method\\":\\"system_name\\",\\"params\\":[]}"\n}',
215
+ },
216
+ {
217
+ name: "subscribe_messages",
218
+ type: "subscription",
219
+ description: "Subscribe to inbound JSON-RPC messages.",
220
+ requestDescription: "HostJsonrpcMessageSubscribeRequest",
221
+ defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n}',
222
+ },
223
+ ],
224
+ },
225
+ {
226
+ name: "Local Storage",
227
+ methods: [
228
+ {
229
+ name: "read",
230
+ type: "unary",
231
+ description: "Read a value by key.",
232
+ requestDescription: "HostLocalStorageReadRequest",
233
+ defaultRequest: '{\n "key": "test-key"\n}',
234
+ },
235
+ {
236
+ name: "write",
237
+ type: "unary",
238
+ description: "Write a value to a key.",
239
+ requestDescription: "HostLocalStorageWriteRequest",
240
+ defaultRequest: '{\n "key": "test-key",\n "value": "0x48656c6c6f"\n}',
241
+ },
242
+ {
243
+ name: "clear",
244
+ type: "unary",
245
+ description: "Clear a value by key.",
246
+ requestDescription: "HostLocalStorageClearRequest",
247
+ defaultRequest: '{\n "key": "test-key"\n}',
248
+ },
249
+ ],
250
+ },
251
+ {
252
+ name: "Payment",
253
+ methods: [
254
+ {
255
+ name: "balance_subscribe",
256
+ type: "subscription",
257
+ description: "Subscribe to payment balance updates.",
258
+ noParams: true,
259
+ },
260
+ {
261
+ name: "top_up",
262
+ type: "unary",
263
+ description: "Top up the user's payment balance.",
264
+ requestDescription: "HostPaymentTopUpRequest",
265
+ defaultRequest: '{\n "amount": "1000000000000n",\n "source": {\n "tag": "ProductAccount",\n "value": {\n "derivationIndex": 0\n }\n }\n}',
266
+ },
267
+ {
268
+ name: "request",
269
+ type: "unary",
270
+ description: "Request a payment from the user.",
271
+ requestDescription: "HostPaymentRequestRequest",
272
+ defaultRequest: '{\n "amount": "1000000000000n",\n "destination": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
273
+ },
274
+ {
275
+ name: "status_subscribe",
276
+ type: "subscription",
277
+ description: "Subscribe to payment lifecycle updates for a specific payment.",
278
+ requestDescription: "HostPaymentStatusSubscribeRequest",
279
+ defaultRequest: '{\n "paymentId": "payment-id"\n}',
280
+ },
281
+ ],
282
+ },
283
+ {
284
+ name: "Permissions",
285
+ methods: [
286
+ {
287
+ name: "request_device_permission",
288
+ type: "unary",
289
+ description: "Request a device-capability permission from the user.",
290
+ requestDescription: "Enum values: Notifications / Camera / Microphone / Bluetooth / NFC / Location / Clipboard / OpenUrl / Biometrics",
291
+ defaultRequest: '"Camera"',
292
+ },
293
+ {
294
+ name: "request_remote_permission",
295
+ type: "unary",
296
+ description: "Request one or more remote-operation permissions.",
297
+ requestDescription: "RemotePermissionRequest",
298
+ defaultRequest: '{\n "permissions": [\n {\n "tag": "Remote",\n "value": {\n "domains": [\n "api.example.com"\n ]\n }\n }\n ]\n}',
299
+ },
300
+ ],
301
+ },
302
+ {
303
+ name: "Preimage",
304
+ methods: [
305
+ {
306
+ name: "lookup_subscribe",
307
+ type: "subscription",
308
+ description: "Subscribe to preimage lookups for a given key.",
309
+ requestDescription: "RemotePreimageLookupSubscribeRequest",
310
+ defaultRequest: '{\n "key": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
311
+ },
312
+ {
313
+ name: "submit",
314
+ type: "unary",
315
+ description: "Submit a preimage. Returns the preimage key (hash) on success.",
316
+ requestDescription: "HexString",
317
+ defaultRequest: '"0xdeadbeef"',
318
+ },
319
+ ],
320
+ },
321
+ {
322
+ name: "Resource Allocation",
323
+ methods: [
324
+ {
325
+ name: "request",
326
+ type: "unary",
327
+ description: "Request the host to pre-allocate one or more resources.",
328
+ requestDescription: "HostRequestResourceAllocationRequest",
329
+ defaultRequest: '{\n "resources": [\n {\n "tag": "StatementStoreAllowance"\n },\n {\n "tag": "AutoSigning"\n }\n ]\n}',
330
+ },
331
+ ],
332
+ },
333
+ {
334
+ name: "Signing",
335
+ methods: [
336
+ {
337
+ name: "create_transaction",
338
+ type: "unary",
339
+ description: "Construct a signed transaction for a product account.",
340
+ requestDescription: "HostCreateTransactionRequest",
341
+ defaultRequest: '{\n "payload": {\n "tag": "V1",\n "value": {\n "callData": "0x0000",\n "context": {\n "bestBlockHeight": 0,\n "metadata": "0x",\n "tokenDecimals": 10,\n "tokenSymbol": "DOT"\n },\n "extensions": [],\n "txExtVersion": 0\n }\n },\n "productAccountId": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n }\n}',
342
+ },
343
+ {
344
+ name: "create_transaction_with_legacy_account",
345
+ type: "unary",
346
+ description: "Construct a signed transaction for a non-product account.",
347
+ requestDescription: "HostCreateTransactionWithLegacyAccountRequest",
348
+ defaultRequest: '{\n "payload": {\n "tag": "V1",\n "value": {\n "callData": "0x0000",\n "context": {\n "bestBlockHeight": 0,\n "metadata": "0x",\n "tokenDecimals": 10,\n "tokenSymbol": "DOT"\n },\n "extensions": [],\n "txExtVersion": 0\n }\n }\n}',
349
+ },
350
+ {
351
+ name: "sign_raw_with_legacy_account",
352
+ type: "unary",
353
+ description: "Sign raw bytes with a non-product account.",
354
+ requestDescription: "HostSignRawWithLegacyAccountRequest",
355
+ defaultRequest: '{\n "payload": {\n "tag": "Bytes",\n "value": {\n "bytes": "0x48656c6c6f"\n }\n },\n "signer": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"\n}',
356
+ },
357
+ {
358
+ name: "sign_payload_with_legacy_account",
359
+ type: "unary",
360
+ description: "Sign an extrinsic payload with a non-product account.",
361
+ requestDescription: "HostSignPayloadWithLegacyAccountRequest",
362
+ defaultRequest: '{\n "payload": {\n "account": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n },\n "blockHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "blockNumber": "0x00000000",\n "era": "0x00",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "method": "0x0000",\n "nonce": "0x00000000",\n "signedExtensions": [],\n "specVersion": "0x00000000",\n "tip": "0x00000000000000000000000000000000",\n "transactionVersion": "0x00000000",\n "version": 4\n },\n "signer": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"\n}',
363
+ },
364
+ {
365
+ name: "sign_raw",
366
+ type: "unary",
367
+ description: "Sign raw bytes or a message.",
368
+ requestDescription: "HostSignRawRequest",
369
+ defaultRequest: '{\n "account": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n },\n "payload": {\n "tag": "Bytes",\n "value": {\n "bytes": "0x48656c6c6f2c20776f726c6421"\n }\n }\n}',
370
+ },
371
+ {
372
+ name: "sign_payload",
373
+ type: "unary",
374
+ description: "Sign an extrinsic payload.",
375
+ requestDescription: "HostSignPayloadRequest",
376
+ defaultRequest: '{\n "account": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n },\n "blockHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "blockNumber": "0x00000000",\n "era": "0x00",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "method": "0x00003448656c6c6f2c20776f726c6421",\n "nonce": "0x00000000",\n "signedExtensions": [],\n "specVersion": "0x00000000",\n "tip": "0x00000000000000000000000000000000",\n "transactionVersion": "0x00000000",\n "version": 4\n}',
377
+ },
378
+ ],
379
+ },
380
+ {
381
+ name: "Statement Store",
382
+ methods: [
383
+ {
384
+ name: "subscribe",
385
+ type: "subscription",
386
+ description: "Subscribe to statements matching a topic filter.",
387
+ requestDescription: "RemoteStatementStoreSubscribeRequest",
388
+ defaultRequest: '{\n "tag": "MatchAll",\n "value": []\n}',
389
+ },
390
+ {
391
+ name: "create_proof",
392
+ type: "unary",
393
+ description: "Create a proof for a statement.",
394
+ requestDescription: "RemoteStatementStoreCreateProofRequest",
395
+ defaultRequest: '{\n "productAccountId": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n },\n "statement": {\n "expiry": "9999999999999n",\n "topics": []\n }\n}',
396
+ },
397
+ {
398
+ name: "submit",
399
+ type: "unary",
400
+ description: "Submit a signed statement to the network. The request body is the\n[`SignedStatement`](crate::v01::SignedStatement) directly (no wrapping\nstruct), matching upstream `triangle-js-sdks`.",
401
+ requestDescription: "SignedStatement",
402
+ defaultRequest: '{\n "proof": {\n "tag": "Sr25519",\n "value": {\n "signature": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",\n "signer": "0x0000000000000000000000000000000000000000000000000000000000000000"\n }\n },\n "topics": []\n}',
403
+ },
404
+ {
405
+ name: "create_proof_authorized",
406
+ type: "unary",
407
+ description: "Create a proof for a statement using a pre-allocated allowance account,\nbypassing the per-call signing prompt.",
408
+ requestDescription: "Statement",
409
+ defaultRequest: '{\n "expiry": "9999999999999n",\n "topics": []\n}',
410
+ },
411
+ ],
412
+ },
413
+ {
414
+ name: "System",
415
+ methods: [
416
+ {
417
+ name: "handshake",
418
+ type: "unary",
419
+ description: "Negotiate the wire codec version with the product.",
420
+ requestDescription: "HostHandshakeRequest",
421
+ },
422
+ {
423
+ name: "feature_supported",
424
+ type: "unary",
425
+ description: "Query whether the host supports a specific feature.",
426
+ requestDescription: "HostFeatureSupportedRequest",
427
+ defaultRequest: '{\n "tag": "Chain",\n "value": {\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n }\n}',
428
+ },
429
+ {
430
+ name: "push_notification",
431
+ type: "unary",
432
+ description: "Send a push notification to the user.",
433
+ requestDescription: "HostPushNotificationRequest",
434
+ defaultRequest: '{\n "text": "Hello!"\n}',
435
+ },
436
+ {
437
+ name: "navigate_to",
438
+ type: "unary",
439
+ description: "Request the host to open a URL.",
440
+ requestDescription: "HostNavigateToRequest",
441
+ defaultRequest: '{\n "url": "https://example.com"\n}',
442
+ },
443
+ ],
444
+ },
445
+ {
446
+ name: "Theme",
447
+ methods: [
448
+ {
449
+ name: "subscribe",
450
+ type: "subscription",
451
+ description: "Subscribe to host theme changes.",
452
+ noParams: true,
453
+ },
454
+ ],
455
+ },
456
+ ];
@@ -0,0 +1,12 @@
1
+ export interface MethodInfo {
2
+ name: string;
3
+ type: "unary" | "subscription";
4
+ description?: string;
5
+ requestDescription?: string;
6
+ defaultRequest?: string;
7
+ noParams?: boolean;
8
+ }
9
+ export interface ServiceInfo {
10
+ name: string;
11
+ methods: MethodInfo[];
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,77 @@
1
+ /** SCALE codec primitives used by the generated client.
2
+ *
3
+ * Thin wrapper over `scale-ts`: re-exports its primitives and combinators,
4
+ * plus the Polkadot-flavour helpers it does not ship (hex-encoded bytes,
5
+ * lazy recursive codecs, and `V<N>`-indexed tagged unions).
6
+ */
7
+ import { type Codec } from "scale-ts";
8
+ export type { Codec };
9
+ export type { ResultPayload } from "scale-ts";
10
+ export { Enum, Option, Result, Struct, Tuple, Vector, _void, bool, i8, i16, i32, i64, i128, str, u8, u16, u32, u64, u128, } from "scale-ts";
11
+ /** Hex-encoded byte string, e.g. `"0xdeadbeef"`. */
12
+ export type HexString = `0x${string}`;
13
+ /** Assert that a string is a valid hex string (`0x...`). */
14
+ export declare function toHexString(value: string): HexString;
15
+ /** Encode a byte array as a lower-case hex string with a `0x` prefix. */
16
+ export declare function bytesToHex(bytes: Uint8Array): HexString;
17
+ /** Decode a hex string into a byte array. Tolerates a missing `0x` prefix. */
18
+ export declare function hexToBytes(hex: string): Uint8Array;
19
+ /**
20
+ * SCALE codec for hex-encoded byte strings.
21
+ *
22
+ * Encode accepts a `0x`-prefixed hex string and emits SCALE bytes; decode
23
+ * returns the bytes as a hex string. Pass `length` for fixed-size byte arrays
24
+ * (`[u8; N]`); omit it for variable-length byte vectors (`Vec<u8>`).
25
+ */
26
+ export declare function Hex(length?: number): Codec<HexString>;
27
+ /**
28
+ * Same wire format as `scale-ts`'s `Enum`, but exposes `value` as optional in
29
+ * the public TS type when the variant codec is `Codec<undefined>`. Lets unit
30
+ * variants of mixed enums round-trip as `{ tag: "X" }` (no `value` key).
31
+ */
32
+ export declare function TaggedUnion<O extends TaggedUnionCodecs>(inner: O): Codec<TaggedUnionValue<O>>;
33
+ type TaggedUnionCodecs = {
34
+ [Sym: symbol]: never;
35
+ [Num: number]: never;
36
+ [Str: string]: Codec<any>;
37
+ };
38
+ type TaggedUnionValue<O extends TaggedUnionCodecs> = {
39
+ [K in keyof O & string]: O[K] extends Codec<infer T> ? [T] extends [undefined] ? {
40
+ tag: K;
41
+ value?: undefined;
42
+ } : {
43
+ tag: K;
44
+ value: T;
45
+ } : never;
46
+ }[keyof O & string];
47
+ /**
48
+ * Enum without payloads — maps string labels to SCALE discriminant bytes.
49
+ *
50
+ * `scale-ts` models `Enum({ Foo: _void, Bar: _void })` as tagged objects. For
51
+ * user-facing TrUAPI enums with only unit variants, we keep the public TS shape
52
+ * as a plain string union instead.
53
+ */
54
+ export declare function Status<const T extends string>(...variants: readonly T[]): Codec<T>;
55
+ /**
56
+ * Defers codec construction until first use so recursive generated codecs can
57
+ * reference each other safely.
58
+ */
59
+ export declare function lazy<T>(factory: () => Codec<T>): Codec<T>;
60
+ type IndexedVariantCodec<T> = readonly [index: number, codec: Codec<T>];
61
+ type IndexedVariantValue<Variants extends Record<string, IndexedVariantCodec<any>>, K extends keyof Variants & string> = Variants[K] extends IndexedVariantCodec<infer T> ? [T] extends [undefined] ? {
62
+ tag: K;
63
+ value?: undefined;
64
+ } : {
65
+ tag: K;
66
+ value: T;
67
+ } : never;
68
+ /**
69
+ * Builds a tagged union codec with explicit SCALE discriminants.
70
+ *
71
+ * `scale-ts` assigns enum indexes by object key order. TrUAPI versioned enums pin
72
+ * `V<N>` to index `N - 1`, including V2-only enums, so generated codecs use this
73
+ * helper for versioned wire wrappers.
74
+ */
75
+ export declare function indexedTaggedUnion<Variants extends Record<string, IndexedVariantCodec<any>>>(variants: Variants): Codec<{
76
+ [K in keyof Variants & string]: IndexedVariantValue<Variants, K>;
77
+ }[keyof Variants & string]>;