@parity/truapi 0.1.0 → 0.3.1

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.
Files changed (38) hide show
  1. package/dist/client.js +5 -2
  2. package/dist/explorer/codegen/types.d.ts +2 -0
  3. package/dist/explorer/codegen/types.js +3610 -0
  4. package/dist/explorer/codegen/versions/0.2.0/services.d.ts +2 -0
  5. package/dist/explorer/codegen/versions/0.2.0/services.js +644 -0
  6. package/dist/explorer/codegen/versions/0.2.0/types.d.ts +2 -0
  7. package/dist/explorer/codegen/versions/0.2.0/types.js +3960 -0
  8. package/dist/explorer/codegen/versions/0.3.0/services.d.ts +2 -0
  9. package/dist/explorer/codegen/versions/0.3.0/services.js +644 -0
  10. package/dist/explorer/codegen/versions/0.3.0/types.d.ts +2 -0
  11. package/dist/explorer/codegen/versions/0.3.0/types.js +3610 -0
  12. package/dist/explorer/codegen/versions/0.3.1/services.d.ts +2 -0
  13. package/dist/explorer/codegen/versions/0.3.1/services.js +644 -0
  14. package/dist/explorer/codegen/versions/0.3.1/types.d.ts +2 -0
  15. package/dist/explorer/codegen/versions/0.3.1/types.js +3610 -0
  16. package/dist/explorer/data-types.d.ts +49 -0
  17. package/dist/explorer/data-types.js +1 -0
  18. package/dist/explorer/versions.d.ts +9 -0
  19. package/dist/explorer/versions.js +21 -0
  20. package/dist/generated/client.d.ts +86 -65
  21. package/dist/generated/client.js +166 -194
  22. package/dist/generated/types.d.ts +442 -232
  23. package/dist/generated/types.js +110 -94
  24. package/dist/generated/wire-table.d.ts +5 -11
  25. package/dist/generated/wire-table.js +5 -11
  26. package/dist/index.d.ts +2 -1
  27. package/dist/index.js +2 -1
  28. package/dist/playground/codegen/services.js +327 -84
  29. package/dist/playground/codegen/truapi-dts.d.ts +1 -0
  30. package/dist/playground/codegen/truapi-dts.js +4310 -0
  31. package/dist/playground/services-types.d.ts +11 -2
  32. package/dist/scale.d.ts +8 -1
  33. package/dist/scale.js +19 -1
  34. package/dist/transport.d.ts +33 -6
  35. package/dist/transport.js +150 -71
  36. package/dist/well-known-chains.d.ts +13 -0
  37. package/dist/well-known-chains.js +7 -0
  38. package/package.json +28 -6
@@ -5,48 +5,79 @@ export const services = [
5
5
  {
6
6
  name: "connection_status_subscribe",
7
7
  type: "subscription",
8
+ signature: "connectionStatusSubscribe(): ObservableLike<HostAccountConnectionStatusSubscribeItem>",
9
+ docUrl: "api/account/trait.Account.html#method.connection_status_subscribe",
8
10
  description: "Subscribe to account connection status changes.",
9
- noParams: true,
11
+ exampleSource: 'import { from, take } from "rxjs";\n\nfrom(truapi.account.connectionStatusSubscribe())\n .pipe(take(1))\n .subscribe({\n next: (status) => console.log(status),\n error: (error) => console.error(error),\n complete: () => console.log("completed"),\n });',
12
+ responseType: "host-account-connection-status-subscribe-item",
10
13
  },
11
14
  {
12
15
  name: "get_account",
13
16
  type: "unary",
17
+ signature: "getAccount(request: HostAccountGetRequest): Promise<Result<HostAccountGetResponse, HostAccountGetError>>",
18
+ docUrl: "api/account/trait.Account.html#method.get_account",
14
19
  description: "Retrieve a product-scoped account.",
15
20
  requestDescription: "HostAccountGetRequest",
16
- defaultRequest: '{\n "productAccountId": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n }\n}',
21
+ exampleSource: 'const result = await truapi.account.getAccount({\n productAccountId: {\n dotNsIdentifier: "truapi-playground.dot",\n derivationIndex: 0,\n },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
22
+ requestType: "host-account-get-request",
23
+ responseType: "host-account-get-response",
24
+ errorType: "host-account-get-error",
17
25
  },
18
26
  {
19
27
  name: "get_account_alias",
20
28
  type: "unary",
29
+ signature: "getAccountAlias(request: HostAccountGetAliasRequest): Promise<Result<HostAccountGetAliasResponse, HostAccountGetError>>",
30
+ docUrl: "api/account/trait.Account.html#method.get_account_alias",
21
31
  description: "Retrieve a contextual alias for a product account.",
22
32
  requestDescription: "HostAccountGetAliasRequest",
23
- defaultRequest: '{\n "productAccountId": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n }\n}',
33
+ exampleSource: 'const result = await truapi.account.getAccountAlias({\n productAccountId: {\n dotNsIdentifier: "truapi-playground.dot",\n derivationIndex: 0,\n },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
34
+ requestType: "host-account-get-alias-request",
35
+ responseType: "host-account-get-alias-response",
36
+ errorType: "host-account-get-error",
24
37
  },
25
38
  {
26
39
  name: "create_account_proof",
27
40
  type: "unary",
41
+ signature: "createAccountProof(request: HostAccountCreateProofRequest): Promise<Result<HostAccountCreateProofResponse, HostAccountCreateProofError>>",
42
+ docUrl: "api/account/trait.Account.html#method.create_account_proof",
28
43
  description: "Generate a ring VRF proof for a product account.",
29
44
  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}',
45
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.account.createAccountProof({\n productAccountId: {\n dotNsIdentifier: "truapi-playground.dot",\n derivationIndex: 0,\n },\n ringLocation: {\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n ringRootHash: "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n hints: { palletInstance: 42 },\n },\n context: "0x",\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
46
+ requestType: "host-account-create-proof-request",
47
+ responseType: "host-account-create-proof-response",
48
+ errorType: "host-account-create-proof-error",
31
49
  },
32
50
  {
33
51
  name: "get_legacy_accounts",
34
52
  type: "unary",
53
+ signature: "getLegacyAccounts(): Promise<Result<HostGetLegacyAccountsResponse, HostAccountGetError>>",
54
+ docUrl: "api/account/trait.Account.html#method.get_legacy_accounts",
35
55
  description: "List non-product accounts the user owns.",
36
- noParams: true,
56
+ exampleSource: "const result = await truapi.account.getLegacyAccounts();\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);",
57
+ responseType: "host-get-legacy-accounts-response",
58
+ errorType: "host-account-get-error",
37
59
  },
38
60
  {
39
61
  name: "get_user_id",
40
62
  type: "unary",
63
+ signature: "getUserId(): Promise<Result<HostGetUserIdResponse, HostGetUserIdError>>",
64
+ docUrl: "api/account/trait.Account.html#method.get_user_id",
41
65
  description: "Fetch the user's primary identity.",
42
- noParams: true,
66
+ exampleSource: "const result = await truapi.account.getUserId();\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);",
67
+ responseType: "host-get-user-id-response",
68
+ errorType: "host-get-user-id-error",
43
69
  },
44
70
  {
45
71
  name: "request_login",
46
72
  type: "unary",
73
+ signature: "requestLogin(request: HostRequestLoginRequest): Promise<Result<HostRequestLoginResponse, HostRequestLoginError>>",
74
+ docUrl: "api/account/trait.Account.html#method.request_login",
47
75
  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
76
  requestDescription: "HostRequestLoginRequest",
49
- defaultRequest: '{\n "reason": "Sign in to vote on Referendum #42"\n}',
77
+ exampleSource: 'const result = await truapi.account.requestLogin({\n reason: "Sign in to vote on Referendum #42",\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
78
+ requestType: "host-request-login-request",
79
+ responseType: "host-request-login-response",
80
+ errorType: "host-request-login-error",
50
81
  },
51
82
  ],
52
83
  },
@@ -56,93 +87,153 @@ export const services = [
56
87
  {
57
88
  name: "follow_head_subscribe",
58
89
  type: "subscription",
90
+ signature: "followHeadSubscribe(request: RemoteChainHeadFollowRequest): ObservableLike<RemoteChainHeadFollowItem>",
91
+ docUrl: "api/chain/trait.Chain.html#method.follow_head_subscribe",
59
92
  description: "Follow the chain head and receive block events.",
60
93
  requestDescription: "RemoteChainHeadFollowRequest",
61
- defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "withRuntime": false\n}',
94
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nimport { from, take } from "rxjs";\n\nfrom(\n truapi.chain.followHeadSubscribe({\n request: {\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n withRuntime: false,\n },\n }),\n)\n .pipe(take(3))\n .subscribe({\n next: (item) => console.log(item),\n error: (error) => console.error(error),\n complete: () => console.log("completed"),\n });',
95
+ requestType: "remote-chain-head-follow-request",
96
+ responseType: "remote-chain-head-follow-item",
62
97
  },
63
98
  {
64
99
  name: "get_head_header",
65
100
  type: "unary",
101
+ signature: "getHeadHeader(request: RemoteChainHeadHeaderRequest): Promise<Result<RemoteChainHeadHeaderResponse, GenericError>>",
102
+ docUrl: "api/chain/trait.Chain.html#method.get_head_header",
66
103
  description: "Fetch a block header.",
67
104
  requestDescription: "RemoteChainHeadHeaderRequest",
68
- defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hash": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
105
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nimport { firstValueFrom, mergeMap } from "rxjs";\n\nconst result = await firstValueFrom(\n withChainHeadFollow({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n }).pipe(\n mergeMap(({ genesisHash, followSubscriptionId, hash }) =>\n truapi.chain.getHeadHeader({ genesisHash, followSubscriptionId, hash }),\n ),\n ),\n);\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
106
+ requestType: "remote-chain-head-header-request",
107
+ responseType: "remote-chain-head-header-response",
108
+ errorType: "generic-error",
69
109
  },
70
110
  {
71
111
  name: "get_head_body",
72
112
  type: "unary",
113
+ signature: "getHeadBody(request: RemoteChainHeadBodyRequest): Promise<Result<RemoteChainHeadBodyResponse, GenericError>>",
114
+ docUrl: "api/chain/trait.Chain.html#method.get_head_body",
73
115
  description: "Fetch a block body.",
74
116
  requestDescription: "RemoteChainHeadBodyRequest",
75
- defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hash": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
117
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nimport { firstValueFrom, mergeMap } from "rxjs";\n\nconst result = await firstValueFrom(\n withChainHeadFollow({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n }).pipe(\n mergeMap(({ genesisHash, followSubscriptionId, hash }) =>\n truapi.chain.getHeadBody({ genesisHash, followSubscriptionId, hash }),\n ),\n ),\n);\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
118
+ requestType: "remote-chain-head-body-request",
119
+ responseType: "remote-chain-head-body-response",
120
+ errorType: "generic-error",
76
121
  },
77
122
  {
78
123
  name: "get_head_storage",
79
124
  type: "unary",
125
+ signature: "getHeadStorage(request: RemoteChainHeadStorageRequest): Promise<Result<RemoteChainHeadStorageResponse, GenericError>>",
126
+ docUrl: "api/chain/trait.Chain.html#method.get_head_storage",
80
127
  description: "Query runtime storage at a specific block.",
81
128
  requestDescription: "RemoteChainHeadStorageRequest",
82
- defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hash": "0x0000000000000000000000000000000000000000000000000000000000000000",\n "items": [\n {\n "key": "0x26aa394eea5630e07c48ae0c9558cef7",\n "queryType": "Value"\n }\n ]\n}',
129
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nimport { firstValueFrom, mergeMap } from "rxjs";\n\nconst result = await firstValueFrom(\n withChainHeadFollow({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n }).pipe(\n mergeMap(({ genesisHash, followSubscriptionId, hash }) =>\n truapi.chain.getHeadStorage({\n genesisHash,\n followSubscriptionId,\n hash,\n items: [{ key: "0x26aa394eea5630e07c48ae0c9558cef7", queryType: "Value" }],\n }),\n ),\n ),\n);\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
130
+ requestType: "remote-chain-head-storage-request",
131
+ responseType: "remote-chain-head-storage-response",
132
+ errorType: "generic-error",
83
133
  },
84
134
  {
85
135
  name: "call_head",
86
136
  type: "unary",
137
+ signature: "callHead(request: RemoteChainHeadCallRequest): Promise<Result<RemoteChainHeadCallResponse, GenericError>>",
138
+ docUrl: "api/chain/trait.Chain.html#method.call_head",
87
139
  description: "Invoke a runtime call at a specific block.",
88
140
  requestDescription: "RemoteChainHeadCallRequest",
89
- defaultRequest: '{\n "callParameters": "0x",\n "followSubscriptionId": "",\n "function": "Core_version",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hash": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
141
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nimport { firstValueFrom, mergeMap } from "rxjs";\n\nconst result = await firstValueFrom(\n withChainHeadFollow({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n withRuntime: true,\n }).pipe(\n mergeMap(({ genesisHash, followSubscriptionId, hash }) =>\n truapi.chain.callHead({\n genesisHash,\n followSubscriptionId,\n hash,\n function: "Core_version",\n callParameters: "0x",\n }),\n ),\n ),\n);\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
142
+ requestType: "remote-chain-head-call-request",
143
+ responseType: "remote-chain-head-call-response",
144
+ errorType: "generic-error",
90
145
  },
91
146
  {
92
147
  name: "unpin_head",
93
148
  type: "unary",
149
+ signature: "unpinHead(request: RemoteChainHeadUnpinRequest): Promise<Result<undefined, GenericError>>",
150
+ docUrl: "api/chain/trait.Chain.html#method.unpin_head",
94
151
  description: "Release pinned blocks.",
95
152
  requestDescription: "RemoteChainHeadUnpinRequest",
96
- defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "hashes": [\n "0x0000000000000000000000000000000000000000000000000000000000000000"\n ]\n}',
153
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nimport { firstValueFrom, mergeMap } from "rxjs";\n\nconst result = await firstValueFrom(\n withChainHeadFollow({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n }).pipe(\n mergeMap(({ genesisHash, followSubscriptionId, hash }) =>\n truapi.chain.unpinHead({\n genesisHash,\n followSubscriptionId,\n hashes: [hash],\n }),\n ),\n ),\n);\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
154
+ requestType: "remote-chain-head-unpin-request",
155
+ errorType: "generic-error",
97
156
  },
98
157
  {
99
158
  name: "continue_head",
100
159
  type: "unary",
160
+ signature: "continueHead(request: RemoteChainHeadContinueRequest): Promise<Result<undefined, GenericError>>",
161
+ docUrl: "api/chain/trait.Chain.html#method.continue_head",
101
162
  description: "Continue a paused chain-head operation.",
102
163
  requestDescription: "RemoteChainHeadContinueRequest",
103
- defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "operationId": "op-id"\n}',
164
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nimport { firstValueFrom, mergeMap } from "rxjs";\n\nconst result = await firstValueFrom(\n withChainHeadFollow({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n }).pipe(\n mergeMap(({ genesisHash, followSubscriptionId }) =>\n truapi.chain.continueHead({\n genesisHash,\n followSubscriptionId,\n operationId: "op-id",\n }),\n ),\n ),\n);\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
165
+ requestType: "remote-chain-head-continue-request",
166
+ errorType: "generic-error",
104
167
  },
105
168
  {
106
169
  name: "stop_head_operation",
107
170
  type: "unary",
171
+ signature: "stopHeadOperation(request: RemoteChainHeadStopOperationRequest): Promise<Result<undefined, GenericError>>",
172
+ docUrl: "api/chain/trait.Chain.html#method.stop_head_operation",
108
173
  description: "Stop a chain-head operation.",
109
174
  requestDescription: "RemoteChainHeadStopOperationRequest",
110
- defaultRequest: '{\n "followSubscriptionId": "",\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "operationId": "op-id"\n}',
175
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nimport { firstValueFrom, mergeMap } from "rxjs";\n\nconst result = await firstValueFrom(\n withChainHeadFollow({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n }).pipe(\n mergeMap(({ genesisHash, followSubscriptionId }) =>\n truapi.chain.stopHeadOperation({\n genesisHash,\n followSubscriptionId,\n operationId: "op-id",\n }),\n ),\n ),\n);\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
176
+ requestType: "remote-chain-head-stop-operation-request",
177
+ errorType: "generic-error",
111
178
  },
112
179
  {
113
180
  name: "get_spec_genesis_hash",
114
181
  type: "unary",
182
+ signature: "getSpecGenesisHash(request: RemoteChainSpecGenesisHashRequest): Promise<Result<RemoteChainSpecGenesisHashResponse, GenericError>>",
183
+ docUrl: "api/chain/trait.Chain.html#method.get_spec_genesis_hash",
115
184
  description: "Fetch the canonical genesis hash for a chain.",
116
185
  requestDescription: "RemoteChainSpecGenesisHashRequest",
117
- defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n}',
186
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.chain.getSpecGenesisHash({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
187
+ requestType: "remote-chain-spec-genesis-hash-request",
188
+ responseType: "remote-chain-spec-genesis-hash-response",
189
+ errorType: "generic-error",
118
190
  },
119
191
  {
120
192
  name: "get_spec_chain_name",
121
193
  type: "unary",
194
+ signature: "getSpecChainName(request: RemoteChainSpecChainNameRequest): Promise<Result<RemoteChainSpecChainNameResponse, GenericError>>",
195
+ docUrl: "api/chain/trait.Chain.html#method.get_spec_chain_name",
122
196
  description: "Fetch the display name of a chain.",
123
197
  requestDescription: "RemoteChainSpecChainNameRequest",
124
- defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n}',
198
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.chain.getSpecChainName({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
199
+ requestType: "remote-chain-spec-chain-name-request",
200
+ responseType: "remote-chain-spec-chain-name-response",
201
+ errorType: "generic-error",
125
202
  },
126
203
  {
127
204
  name: "get_spec_properties",
128
205
  type: "unary",
206
+ signature: "getSpecProperties(request: RemoteChainSpecPropertiesRequest): Promise<Result<RemoteChainSpecPropertiesResponse, GenericError>>",
207
+ docUrl: "api/chain/trait.Chain.html#method.get_spec_properties",
129
208
  description: "Fetch the JSON-encoded properties of a chain.",
130
209
  requestDescription: "RemoteChainSpecPropertiesRequest",
131
- defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2"\n}',
210
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.chain.getSpecProperties({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
211
+ requestType: "remote-chain-spec-properties-request",
212
+ responseType: "remote-chain-spec-properties-response",
213
+ errorType: "generic-error",
132
214
  },
133
215
  {
134
216
  name: "broadcast_transaction",
135
217
  type: "unary",
218
+ signature: "broadcastTransaction(request: RemoteChainTransactionBroadcastRequest): Promise<Result<RemoteChainTransactionBroadcastResponse, GenericError>>",
219
+ docUrl: "api/chain/trait.Chain.html#method.broadcast_transaction",
136
220
  description: "Broadcast a signed transaction.",
137
221
  requestDescription: "RemoteChainTransactionBroadcastRequest",
138
- defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "transaction": "0x"\n}',
222
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.chain.broadcastTransaction({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n transaction: "0x",\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
223
+ requestType: "remote-chain-transaction-broadcast-request",
224
+ responseType: "remote-chain-transaction-broadcast-response",
225
+ errorType: "generic-error",
139
226
  },
140
227
  {
141
228
  name: "stop_transaction",
142
229
  type: "unary",
230
+ signature: "stopTransaction(request: RemoteChainTransactionStopRequest): Promise<Result<undefined, GenericError>>",
231
+ docUrl: "api/chain/trait.Chain.html#method.stop_transaction",
143
232
  description: "Stop a transaction broadcast.",
144
233
  requestDescription: "RemoteChainTransactionStopRequest",
145
- defaultRequest: '{\n "genesisHash": "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n "operationId": "op-id"\n}',
234
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.chain.stopTransaction({\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n operationId: "op-id",\n});\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
235
+ requestType: "remote-chain-transaction-stop-request",
236
+ errorType: "generic-error",
146
237
  },
147
238
  ],
148
239
  },
@@ -152,42 +243,67 @@ export const services = [
152
243
  {
153
244
  name: "create_room",
154
245
  type: "unary",
246
+ signature: "createRoom(request: HostChatCreateRoomRequest): Promise<Result<HostChatCreateRoomResponse, HostChatCreateRoomError>>",
247
+ docUrl: "api/chat/trait.Chat.html#method.create_room",
155
248
  description: "Create a chat room.",
156
249
  requestDescription: "HostChatCreateRoomRequest",
157
- defaultRequest: '{\n "icon": "",\n "name": "Test Room",\n "roomId": "test-room"\n}',
250
+ exampleSource: 'const result = await truapi.chat.createRoom({\n roomId: "test-room",\n name: "Test Room",\n icon: "",\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
251
+ requestType: "host-chat-create-room-request",
252
+ responseType: "host-chat-create-room-response",
253
+ errorType: "host-chat-create-room-error",
158
254
  },
159
255
  {
160
256
  name: "register_bot",
161
257
  type: "unary",
258
+ signature: "registerBot(request: HostChatRegisterBotRequest): Promise<Result<HostChatRegisterBotResponse, HostChatRegisterBotError>>",
259
+ docUrl: "api/chat/trait.Chat.html#method.register_bot",
162
260
  description: "Register a chat bot.",
163
261
  requestDescription: "HostChatRegisterBotRequest",
164
- defaultRequest: '{\n "botId": "test-bot",\n "icon": "",\n "name": "Test Bot"\n}',
262
+ exampleSource: 'const result = await truapi.chat.registerBot({\n botId: "test-bot",\n name: "Test Bot",\n icon: "",\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
263
+ requestType: "host-chat-register-bot-request",
264
+ responseType: "host-chat-register-bot-response",
265
+ errorType: "host-chat-register-bot-error",
165
266
  },
166
267
  {
167
268
  name: "list_subscribe",
168
269
  type: "subscription",
270
+ signature: "listSubscribe(): ObservableLike<HostChatListSubscribeItem>",
271
+ docUrl: "api/chat/trait.Chat.html#method.list_subscribe",
169
272
  description: "Subscribe to the list of chat rooms.",
170
- noParams: true,
273
+ exampleSource: 'import { from, take } from "rxjs";\n\nfrom(truapi.chat.listSubscribe())\n .pipe(take(1))\n .subscribe({\n next: (rooms) => console.log(rooms),\n error: (error) => console.error(error),\n complete: () => console.log("completed"),\n });',
274
+ responseType: "host-chat-list-subscribe-item",
171
275
  },
172
276
  {
173
277
  name: "post_message",
174
278
  type: "unary",
279
+ signature: "postMessage(request: HostChatPostMessageRequest): Promise<Result<HostChatPostMessageResponse, HostChatPostMessageError>>",
280
+ docUrl: "api/chat/trait.Chat.html#method.post_message",
175
281
  description: "Post a message to a chat room.",
176
282
  requestDescription: "HostChatPostMessageRequest",
177
- defaultRequest: '{\n "payload": {\n "tag": "Text",\n "value": {\n "text": "Hello from playground!"\n }\n },\n "roomId": "test-room"\n}',
283
+ exampleSource: 'const result = await truapi.chat.postMessage({\n roomId: "test-room",\n payload: { tag: "Text", value: { text: "Hello from playground!" } },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
284
+ requestType: "host-chat-post-message-request",
285
+ responseType: "host-chat-post-message-response",
286
+ errorType: "host-chat-post-message-error",
178
287
  },
179
288
  {
180
289
  name: "action_subscribe",
181
290
  type: "subscription",
291
+ signature: "actionSubscribe(): ObservableLike<HostChatActionSubscribeItem>",
292
+ docUrl: "api/chat/trait.Chat.html#method.action_subscribe",
182
293
  description: "Subscribe to received chat actions.",
183
- noParams: true,
294
+ exampleSource: 'import { from, take } from "rxjs";\n\nfrom(truapi.chat.actionSubscribe())\n .pipe(take(1))\n .subscribe({\n next: (action) => console.log(action),\n error: (error) => console.error(error),\n complete: () => console.log("completed"),\n });',
295
+ responseType: "host-chat-action-subscribe-item",
184
296
  },
185
297
  {
186
298
  name: "custom_message_render_subscribe",
187
299
  type: "subscription",
300
+ signature: "customMessageRenderSubscribe(request: ProductChatCustomMessageRenderSubscribeRequest): ObservableLike<CustomRendererNode>",
301
+ docUrl: "api/chat/trait.Chat.html#method.custom_message_render_subscribe",
188
302
  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
303
  requestDescription: "ProductChatCustomMessageRenderSubscribeRequest",
190
- defaultRequest: '{\n "messageId": "msg-1",\n "messageType": "custom-render-demo",\n "payload": "0x"\n}',
304
+ exampleSource: 'import { from, take } from "rxjs";\n\nfrom(\n truapi.chat.customMessageRenderSubscribe({\n request: {\n messageId: "msg-1",\n messageType: "custom-render-demo",\n payload: "0x",\n },\n }),\n)\n .pipe(take(1))\n .subscribe({\n next: (node) => console.log(node),\n error: (error) => console.error(error),\n complete: () => console.log("completed"),\n });',
305
+ requestType: "product-chat-custom-message-render-subscribe-request",
306
+ responseType: "custom-renderer-node",
191
307
  },
192
308
  ],
193
309
  },
@@ -197,28 +313,14 @@ export const services = [
197
313
  {
198
314
  name: "derive",
199
315
  type: "unary",
316
+ signature: "derive(request: HostDeriveEntropyRequest): Promise<Result<HostDeriveEntropyResponse, HostDeriveEntropyError>>",
317
+ docUrl: "api/entropy/trait.Entropy.html#method.derive",
200
318
  description: "Derive deterministic entropy.",
201
319
  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}',
320
+ exampleSource: 'const result = await truapi.entropy.derive({\n context: "0x70726f647563742d6b6579",\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
321
+ requestType: "host-derive-entropy-request",
322
+ responseType: "host-derive-entropy-response",
323
+ errorType: "host-derive-entropy-error",
222
324
  },
223
325
  ],
224
326
  },
@@ -228,23 +330,64 @@ export const services = [
228
330
  {
229
331
  name: "read",
230
332
  type: "unary",
333
+ signature: "read(request: HostLocalStorageReadRequest): Promise<Result<HostLocalStorageReadResponse, HostLocalStorageReadError>>",
334
+ docUrl: "api/local_storage/trait.LocalStorage.html#method.read",
231
335
  description: "Read a value by key.",
232
336
  requestDescription: "HostLocalStorageReadRequest",
233
- defaultRequest: '{\n "key": "test-key"\n}',
337
+ exampleSource: 'const result = await truapi.localStorage.read({ key: "test-key" });\nresult.match(\n (response) => console.log(response.value),\n (error) => console.error(error),\n);',
338
+ requestType: "host-local-storage-read-request",
339
+ responseType: "host-local-storage-read-response",
340
+ errorType: "host-local-storage-read-error",
234
341
  },
235
342
  {
236
343
  name: "write",
237
344
  type: "unary",
345
+ signature: "write(request: HostLocalStorageWriteRequest): Promise<Result<undefined, HostLocalStorageReadError>>",
346
+ docUrl: "api/local_storage/trait.LocalStorage.html#method.write",
238
347
  description: "Write a value to a key.",
239
348
  requestDescription: "HostLocalStorageWriteRequest",
240
- defaultRequest: '{\n "key": "test-key",\n "value": "0x48656c6c6f"\n}',
349
+ exampleSource: 'const result = await truapi.localStorage.write({\n key: "test-key",\n value: "0x48656c6c6f",\n});\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
350
+ requestType: "host-local-storage-write-request",
351
+ errorType: "host-local-storage-read-error",
241
352
  },
242
353
  {
243
354
  name: "clear",
244
355
  type: "unary",
356
+ signature: "clear(request: HostLocalStorageClearRequest): Promise<Result<undefined, HostLocalStorageReadError>>",
357
+ docUrl: "api/local_storage/trait.LocalStorage.html#method.clear",
245
358
  description: "Clear a value by key.",
246
359
  requestDescription: "HostLocalStorageClearRequest",
247
- defaultRequest: '{\n "key": "test-key"\n}',
360
+ exampleSource: 'const result = await truapi.localStorage.clear({ key: "test-key" });\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
361
+ requestType: "host-local-storage-clear-request",
362
+ errorType: "host-local-storage-read-error",
363
+ },
364
+ ],
365
+ },
366
+ {
367
+ name: "Notifications",
368
+ methods: [
369
+ {
370
+ name: "send_push_notification",
371
+ type: "unary",
372
+ signature: "sendPushNotification(request: HostPushNotificationRequest): Promise<Result<HostPushNotificationResponse, HostPushNotificationError>>",
373
+ docUrl: "api/notifications/trait.Notifications.html#method.send_push_notification",
374
+ description: "Send a push notification to the user.\n\nReturns a [`NotificationId`](crate::v01::NotificationId) that can be\npassed to [`cancel_push_notification`](Self::cancel_push_notification)\nto retract a scheduled notification. When `scheduled_at` is set the host\npersists the notification across restarts and fires it through the\nplatform-native scheduler. See [RFC 0019].\n\n[RFC 0019]: https://github.com/paritytech/truapi/blob/main/docs/rfcs/0019-scheduled-notifications.md",
375
+ requestDescription: "HostPushNotificationRequest",
376
+ exampleSource: 'const result = await truapi.notifications.sendPushNotification({\n text: "Hello!",\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
377
+ requestType: "host-push-notification-request",
378
+ responseType: "host-push-notification-response",
379
+ errorType: "host-push-notification-error",
380
+ },
381
+ {
382
+ name: "cancel_push_notification",
383
+ type: "unary",
384
+ signature: "cancelPushNotification(request: HostPushNotificationCancelRequest): Promise<Result<undefined, GenericError>>",
385
+ docUrl: "api/notifications/trait.Notifications.html#method.cancel_push_notification",
386
+ description: "Cancels a previously issued push notification.\n\nCancellation is idempotent: returns `Ok(())` whether the notification is\nstill pending, already fired, or was never issued. See [RFC 0019].\n\n[RFC 0019]: https://github.com/paritytech/truapi/blob/main/docs/rfcs/0019-scheduled-notifications.md",
387
+ requestDescription: "HostPushNotificationCancelRequest",
388
+ exampleSource: 'const result = await truapi.notifications.cancelPushNotification({\n id: 1,\n});\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
389
+ requestType: "host-push-notification-cancel-request",
390
+ errorType: "generic-error",
248
391
  },
249
392
  ],
250
393
  },
@@ -254,29 +397,49 @@ export const services = [
254
397
  {
255
398
  name: "balance_subscribe",
256
399
  type: "subscription",
400
+ signature: "balanceSubscribe(request: HostPaymentBalanceSubscribeRequest): ObservableLike<HostPaymentBalanceSubscribeItem, HostPaymentBalanceSubscribeError>",
401
+ docUrl: "api/payment/trait.Payment.html#method.balance_subscribe",
257
402
  description: "Subscribe to payment balance updates.",
258
- noParams: true,
403
+ requestDescription: "HostPaymentBalanceSubscribeRequest",
404
+ exampleSource: 'import { from, take } from "rxjs";\n\nfrom(truapi.payment.balanceSubscribe({ request: {} }))\n .pipe(take(1))\n .subscribe({\n next: (balance) => console.log(balance),\n error: (error) => console.error(error),\n complete: () => console.log("completed"),\n });',
405
+ requestType: "host-payment-balance-subscribe-request",
406
+ responseType: "host-payment-balance-subscribe-item",
407
+ errorType: "host-payment-balance-subscribe-error",
259
408
  },
260
409
  {
261
410
  name: "top_up",
262
411
  type: "unary",
412
+ signature: "topUp(request: HostPaymentTopUpRequest): Promise<Result<undefined, HostPaymentTopUpError>>",
413
+ docUrl: "api/payment/trait.Payment.html#method.top_up",
263
414
  description: "Top up the user's payment balance.",
264
415
  requestDescription: "HostPaymentTopUpRequest",
265
- defaultRequest: '{\n "amount": "1000000000000n",\n "source": {\n "tag": "ProductAccount",\n "value": {\n "derivationIndex": 0\n }\n }\n}',
416
+ exampleSource: 'const result = await truapi.payment.topUp({\n amount: 1000n,\n source: { tag: "ProductAccount", value: { derivationIndex: 0 } },\n});\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
417
+ requestType: "host-payment-top-up-request",
418
+ errorType: "host-payment-top-up-error",
266
419
  },
267
420
  {
268
421
  name: "request",
269
422
  type: "unary",
423
+ signature: "request(request: HostPaymentRequest): Promise<Result<HostPaymentResponse, HostPaymentError>>",
424
+ docUrl: "api/payment/trait.Payment.html#method.request",
270
425
  description: "Request a payment from the user.",
271
- requestDescription: "HostPaymentRequestRequest",
272
- defaultRequest: '{\n "amount": "1000000000000n",\n "destination": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
426
+ requestDescription: "HostPaymentRequest",
427
+ exampleSource: '// Fund the balance first so the request is not rejected for lack of funds.\nconst topUp = await truapi.payment.topUp({\n amount: 1000n,\n source: { tag: "ProductAccount", value: { derivationIndex: 0 } },\n});\n\nif (topUp.isErr()) {\n console.error("topUp failed:", topUp.error);\n} else {\n const result = await truapi.payment.request({\n amount: 1000n,\n destination:\n "0x0000000000000000000000000000000000000000000000000000000000000000",\n });\n result.match(\n (value) => console.log(value),\n (error) => console.error("request failed:", error),\n );\n}',
428
+ requestType: "host-payment-request",
429
+ responseType: "host-payment-response",
430
+ errorType: "host-payment-error",
273
431
  },
274
432
  {
275
433
  name: "status_subscribe",
276
434
  type: "subscription",
435
+ signature: "statusSubscribe(request: HostPaymentStatusSubscribeRequest): ObservableLike<HostPaymentStatusSubscribeItem, HostPaymentStatusSubscribeError>",
436
+ docUrl: "api/payment/trait.Payment.html#method.status_subscribe",
277
437
  description: "Subscribe to payment lifecycle updates for a specific payment.",
278
438
  requestDescription: "HostPaymentStatusSubscribeRequest",
279
- defaultRequest: '{\n "paymentId": "payment-id"\n}',
439
+ exampleSource: 'import { from, take } from "rxjs";\n\n// Fund the balance and start a payment first so there is a status to watch.\nconst topUp = await truapi.payment.topUp({\n amount: 1000n,\n source: { tag: "ProductAccount", value: { derivationIndex: 0 } },\n});\n\nif (topUp.isErr()) {\n console.error("topUp failed:", topUp.error);\n} else {\n const requested = await truapi.payment.request({\n amount: 1000n,\n destination:\n "0x0000000000000000000000000000000000000000000000000000000000000000",\n });\n if (requested.isErr()) {\n console.error("request failed:", requested.error);\n } else {\n from(\n truapi.payment.statusSubscribe({\n request: { paymentId: requested.value.id },\n }),\n )\n .pipe(take(1))\n .subscribe({\n next: (status) => console.log(status),\n error: (error) => console.error("statusSubscribe failed:", error),\n complete: () => console.log("completed"),\n });\n }\n}',
440
+ requestType: "host-payment-status-subscribe-request",
441
+ responseType: "host-payment-status-subscribe-item",
442
+ errorType: "host-payment-status-subscribe-error",
280
443
  },
281
444
  ],
282
445
  },
@@ -286,16 +449,26 @@ export const services = [
286
449
  {
287
450
  name: "request_device_permission",
288
451
  type: "unary",
452
+ signature: "requestDevicePermission(request: HostDevicePermissionRequest): Promise<Result<HostDevicePermissionResponse, GenericError>>",
453
+ docUrl: "api/permissions/trait.Permissions.html#method.request_device_permission",
289
454
  description: "Request a device-capability permission from the user.",
290
455
  requestDescription: "Enum values: Notifications / Camera / Microphone / Bluetooth / NFC / Location / Clipboard / OpenUrl / Biometrics",
291
- defaultRequest: '"Camera"',
456
+ exampleSource: 'const result = await truapi.permissions.requestDevicePermission("Camera");\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
457
+ requestType: "host-device-permission-request",
458
+ responseType: "host-device-permission-response",
459
+ errorType: "generic-error",
292
460
  },
293
461
  {
294
462
  name: "request_remote_permission",
295
463
  type: "unary",
296
- description: "Request one or more remote-operation permissions.",
464
+ signature: "requestRemotePermission(request: RemotePermissionRequest): Promise<Result<RemotePermissionResponse, GenericError>>",
465
+ docUrl: "api/permissions/trait.Permissions.html#method.request_remote_permission",
466
+ description: "Request a remote-operation permission.",
297
467
  requestDescription: "RemotePermissionRequest",
298
- defaultRequest: '{\n "permissions": [\n {\n "tag": "Remote",\n "value": {\n "domains": [\n "api.example.com"\n ]\n }\n }\n ]\n}',
468
+ exampleSource: 'const result = await truapi.permissions.requestRemotePermission({\n permission: { tag: "Remote", value: { domains: ["api.example.com"] } },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
469
+ requestType: "remote-permission-request",
470
+ responseType: "remote-permission-response",
471
+ errorType: "generic-error",
299
472
  },
300
473
  ],
301
474
  },
@@ -305,16 +478,23 @@ export const services = [
305
478
  {
306
479
  name: "lookup_subscribe",
307
480
  type: "subscription",
481
+ signature: "lookupSubscribe(request: RemotePreimageLookupSubscribeRequest): ObservableLike<RemotePreimageLookupSubscribeItem>",
482
+ docUrl: "api/preimage/trait.Preimage.html#method.lookup_subscribe",
308
483
  description: "Subscribe to preimage lookups for a given key.",
309
484
  requestDescription: "RemotePreimageLookupSubscribeRequest",
310
- defaultRequest: '{\n "key": "0x0000000000000000000000000000000000000000000000000000000000000000"\n}',
485
+ exampleSource: 'import { from, take } from "rxjs";\n\n// Submit a preimage first so the lookup resolves to a value.\nconst submitted = await truapi.preimage.submit("0xdeadbeef");\nif (submitted.isErr()) {\n console.error("submit failed:", submitted.error);\n} else {\n from(truapi.preimage.lookupSubscribe({ request: { key: submitted.value } }))\n .pipe(take(1))\n .subscribe({\n next: (item) => console.log(item),\n error: (error) => console.error("lookupSubscribe failed:", error),\n complete: () => console.log("completed"),\n });\n}',
486
+ requestType: "remote-preimage-lookup-subscribe-request",
487
+ responseType: "remote-preimage-lookup-subscribe-item",
311
488
  },
312
489
  {
313
490
  name: "submit",
314
491
  type: "unary",
492
+ signature: "submit(request: HexString): Promise<Result<HexString, PreimageSubmitError>>",
493
+ docUrl: "api/preimage/trait.Preimage.html#method.submit",
315
494
  description: "Submit a preimage. Returns the preimage key (hash) on success.",
316
495
  requestDescription: "HexString",
317
- defaultRequest: '"0xdeadbeef"',
496
+ exampleSource: 'const result = await truapi.preimage.submit("0xdeadbeef");\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
497
+ errorType: "preimage-submit-error",
318
498
  },
319
499
  ],
320
500
  },
@@ -324,9 +504,14 @@ export const services = [
324
504
  {
325
505
  name: "request",
326
506
  type: "unary",
507
+ signature: "request(request: HostRequestResourceAllocationRequest): Promise<Result<HostRequestResourceAllocationResponse, ResourceAllocationError>>",
508
+ docUrl: "api/resource_allocation/trait.ResourceAllocation.html#method.request",
327
509
  description: "Request the host to pre-allocate one or more resources.",
328
510
  requestDescription: "HostRequestResourceAllocationRequest",
329
- defaultRequest: '{\n "resources": [\n {\n "tag": "StatementStoreAllowance"\n },\n {\n "tag": "AutoSigning"\n }\n ]\n}',
511
+ exampleSource: 'const result = await truapi.resourceAllocation.request({\n resources: [\n { tag: "StatementStoreAllowance" },\n { tag: "AutoSigning" },\n ],\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
512
+ requestType: "host-request-resource-allocation-request",
513
+ responseType: "host-request-resource-allocation-response",
514
+ errorType: "resource-allocation-error",
330
515
  },
331
516
  ],
332
517
  },
@@ -336,44 +521,74 @@ export const services = [
336
521
  {
337
522
  name: "create_transaction",
338
523
  type: "unary",
524
+ signature: "createTransaction(request: ProductAccountTxPayload): Promise<Result<HostCreateTransactionResponse, HostCreateTransactionError>>",
525
+ docUrl: "api/signing/trait.Signing.html#method.create_transaction",
339
526
  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}',
527
+ requestDescription: "ProductAccountTxPayload",
528
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.signing.createTransaction({\n signer: {\n dotNsIdentifier: "truapi-playground.dot",\n derivationIndex: 0,\n },\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n callData: "0x0000",\n extensions: [],\n txExtVersion: 0,\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
529
+ requestType: "product-account-tx-payload",
530
+ responseType: "host-create-transaction-response",
531
+ errorType: "host-create-transaction-error",
342
532
  },
343
533
  {
344
534
  name: "create_transaction_with_legacy_account",
345
535
  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}',
536
+ signature: "createTransactionWithLegacyAccount(request: LegacyAccountTxPayload): Promise<Result<HostCreateTransactionWithLegacyAccountResponse, HostCreateTransactionError>>",
537
+ docUrl: "api/signing/trait.Signing.html#method.create_transaction_with_legacy_account",
538
+ description: "Construct a signed transaction for a non-product (legacy) account.",
539
+ requestDescription: "LegacyAccountTxPayload",
540
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.signing.createTransactionWithLegacyAccount({\n signer: "0x0000000000000000000000000000000000000000000000000000000000000000",\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n callData: "0x0000",\n extensions: [],\n txExtVersion: 0,\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
541
+ requestType: "legacy-account-tx-payload",
542
+ responseType: "host-create-transaction-with-legacy-account-response",
543
+ errorType: "host-create-transaction-error",
349
544
  },
350
545
  {
351
546
  name: "sign_raw_with_legacy_account",
352
547
  type: "unary",
548
+ signature: "signRawWithLegacyAccount(request: HostSignRawWithLegacyAccountRequest): Promise<Result<HostSignPayloadResponse, HostSignPayloadError>>",
549
+ docUrl: "api/signing/trait.Signing.html#method.sign_raw_with_legacy_account",
353
550
  description: "Sign raw bytes with a non-product account.",
354
551
  requestDescription: "HostSignRawWithLegacyAccountRequest",
355
- defaultRequest: '{\n "payload": {\n "tag": "Bytes",\n "value": {\n "bytes": "0x48656c6c6f"\n }\n },\n "signer": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"\n}',
552
+ exampleSource: 'const result = await truapi.signing.signRawWithLegacyAccount({\n signer: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",\n payload: {\n tag: "Bytes",\n value: { bytes: "0x48656c6c6f" },\n },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
553
+ requestType: "host-sign-raw-with-legacy-account-request",
554
+ responseType: "host-sign-payload-response",
555
+ errorType: "host-sign-payload-error",
356
556
  },
357
557
  {
358
558
  name: "sign_payload_with_legacy_account",
359
559
  type: "unary",
560
+ signature: "signPayloadWithLegacyAccount(request: HostSignPayloadWithLegacyAccountRequest): Promise<Result<HostSignPayloadResponse, HostSignPayloadError>>",
561
+ docUrl: "api/signing/trait.Signing.html#method.sign_payload_with_legacy_account",
360
562
  description: "Sign an extrinsic payload with a non-product account.",
361
563
  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}',
564
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.signing.signPayloadWithLegacyAccount({\n signer: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",\n payload: {\n blockHash: "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n blockNumber: "0x00000000",\n era: "0x00",\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n method: "0x0000",\n nonce: "0x00000000",\n signedExtensions: [],\n specVersion: "0x00000000",\n tip: "0x00000000000000000000000000000000",\n transactionVersion: "0x00000000",\n version: 4,\n },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
565
+ requestType: "host-sign-payload-with-legacy-account-request",
566
+ responseType: "host-sign-payload-response",
567
+ errorType: "host-sign-payload-error",
363
568
  },
364
569
  {
365
570
  name: "sign_raw",
366
571
  type: "unary",
572
+ signature: "signRaw(request: HostSignRawRequest): Promise<Result<HostSignPayloadResponse, HostSignPayloadError>>",
573
+ docUrl: "api/signing/trait.Signing.html#method.sign_raw",
367
574
  description: "Sign raw bytes or a message.",
368
575
  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}',
576
+ exampleSource: 'const result = await truapi.signing.signRaw({\n account: { dotNsIdentifier: "truapi-playground.dot", derivationIndex: 0 },\n payload: {\n tag: "Bytes",\n value: {\n bytes: "0x48656c6c6f2c20776f726c6421",\n },\n },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
577
+ requestType: "host-sign-raw-request",
578
+ responseType: "host-sign-payload-response",
579
+ errorType: "host-sign-payload-error",
370
580
  },
371
581
  {
372
582
  name: "sign_payload",
373
583
  type: "unary",
584
+ signature: "signPayload(request: HostSignPayloadRequest): Promise<Result<HostSignPayloadResponse, HostSignPayloadError>>",
585
+ docUrl: "api/signing/trait.Signing.html#method.sign_payload",
374
586
  description: "Sign an extrinsic payload.",
375
587
  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}',
588
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.signing.signPayload({\n account: { dotNsIdentifier: "truapi-playground.dot", derivationIndex: 0 },\n payload: {\n blockHash: "0xd6eec26135305a8ad257a20d003357284c8aa03d0bdb2b357ab0a22371e11ef2",\n blockNumber: "0x00000000",\n era: "0x00",\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n method: "0x00003448656c6c6f2c20776f726c6421",\n nonce: "0x00000000",\n signedExtensions: [],\n specVersion: "0x00000000",\n tip: "0x00000000000000000000000000000000",\n transactionVersion: "0x00000000",\n version: 4,\n },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
589
+ requestType: "host-sign-payload-request",
590
+ responseType: "host-sign-payload-response",
591
+ errorType: "host-sign-payload-error",
377
592
  },
378
593
  ],
379
594
  },
@@ -383,30 +598,48 @@ export const services = [
383
598
  {
384
599
  name: "subscribe",
385
600
  type: "subscription",
601
+ signature: "subscribe(request: RemoteStatementStoreSubscribeRequest): ObservableLike<RemoteStatementStoreSubscribeItem>",
602
+ docUrl: "api/statement_store/trait.StatementStore.html#method.subscribe",
386
603
  description: "Subscribe to statements matching a topic filter.",
387
604
  requestDescription: "RemoteStatementStoreSubscribeRequest",
388
- defaultRequest: '{\n "tag": "MatchAll",\n "value": []\n}',
605
+ exampleSource: 'import { from, take } from "rxjs";\n\n// Create and submit a statement first so the subscription has a match.\nconst proofResult = await truapi.statementStore.createProof({\n productAccountId: {\n dotNsIdentifier: "truapi-playground.dot",\n derivationIndex: 0,\n },\n statement: { topics: [] },\n});\n\nif (proofResult.isErr()) {\n console.error("createProof failed:", proofResult.error);\n} else {\n await truapi.statementStore.submit({\n proof: proofResult.value.proof,\n topics: [],\n });\n from(\n truapi.statementStore.subscribe({\n request: { tag: "MatchAll", value: [] },\n }),\n )\n .pipe(take(1))\n .subscribe({\n next: (statements) => console.log(statements),\n error: (error) => console.error("subscribe failed:", error),\n complete: () => console.log("completed"),\n });\n}',
606
+ requestType: "remote-statement-store-subscribe-request",
607
+ responseType: "remote-statement-store-subscribe-item",
389
608
  },
390
609
  {
391
610
  name: "create_proof",
392
611
  type: "unary",
393
- description: "Create a proof for a statement.",
612
+ signature: "createProof(request: RemoteStatementStoreCreateProofRequest): Promise<Result<RemoteStatementStoreCreateProofResponse, RemoteStatementStoreCreateProofError>>",
613
+ docUrl: "api/statement_store/trait.StatementStore.html#method.create_proof",
614
+ description: "Create a proof for a statement.\n\n**Deprecated:** use [`create_proof_authorized`](Self::create_proof_authorized)\ninstead, which uses a pre-allocated allowance account and does not\nrequire a per-call signing prompt.",
394
615
  requestDescription: "RemoteStatementStoreCreateProofRequest",
395
- defaultRequest: '{\n "productAccountId": {\n "derivationIndex": 0,\n "dotNsIdentifier": "truapi-playground.dot"\n },\n "statement": {\n "expiry": "9999999999999n",\n "topics": []\n }\n}',
616
+ exampleSource: '// Expiry packs a Unix-seconds timestamp in the high 32 bits; a day out\n// keeps the statement unexpired when it is submitted.\nconst expiry = BigInt(Math.floor(Date.now() / 1000) + 86400) << 32n;\nconst result = await truapi.statementStore.createProof({\n productAccountId: {\n dotNsIdentifier: "truapi-playground.dot",\n derivationIndex: 0,\n },\n statement: {\n expiry,\n topics: [],\n },\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);',
617
+ requestType: "remote-statement-store-create-proof-request",
618
+ responseType: "remote-statement-store-create-proof-response",
619
+ errorType: "remote-statement-store-create-proof-error",
396
620
  },
397
621
  {
398
622
  name: "submit",
399
623
  type: "unary",
624
+ signature: "submit(request: SignedStatement): Promise<Result<undefined, GenericError>>",
625
+ docUrl: "api/statement_store/trait.StatementStore.html#method.submit",
400
626
  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
627
  requestDescription: "SignedStatement",
402
- defaultRequest: '{\n "proof": {\n "tag": "Sr25519",\n "value": {\n "signature": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",\n "signer": "0x0000000000000000000000000000000000000000000000000000000000000000"\n }\n },\n "topics": []\n}',
628
+ exampleSource: '// Expiry packs a Unix-seconds timestamp in the high 32 bits; a day out\n// keeps the statement unexpired when it is submitted.\nconst expiry = BigInt(Math.floor(Date.now() / 1000) + 86400) << 32n;\nconst proofResult = await truapi.statementStore.createProof({\n productAccountId: {\n dotNsIdentifier: "truapi-playground.dot",\n derivationIndex: 0,\n },\n statement: {\n expiry,\n topics: [],\n },\n});\nif (proofResult.isErr()) {\n console.error("createProof failed:", proofResult.error);\n} else {\n const result = await truapi.statementStore.submit({\n proof: proofResult.value.proof,\n topics: [],\n });\n result.match(\n () => console.log("ok"),\n (error) => console.error("submit failed:", error),\n );\n}',
629
+ requestType: "signed-statement",
630
+ errorType: "generic-error",
403
631
  },
404
632
  {
405
633
  name: "create_proof_authorized",
406
634
  type: "unary",
635
+ signature: "createProofAuthorized(request: Statement): Promise<Result<RemoteStatementStoreCreateProofResponse, RemoteStatementStoreCreateProofError>>",
636
+ docUrl: "api/statement_store/trait.StatementStore.html#method.create_proof_authorized",
407
637
  description: "Create a proof for a statement using a pre-allocated allowance account,\nbypassing the per-call signing prompt.",
408
638
  requestDescription: "Statement",
409
- defaultRequest: '{\n "expiry": "9999999999999n",\n "topics": []\n}',
639
+ exampleSource: "// Expiry packs a Unix-seconds timestamp in the high 32 bits; a day out\n// keeps the statement unexpired when it is submitted.\nconst expiry = BigInt(Math.floor(Date.now() / 1000) + 86400) << 32n;\nconst result = await truapi.statementStore.createProofAuthorized({\n expiry,\n topics: [],\n});\nresult.match(\n (value) => console.log(value),\n (error) => console.error(error),\n);",
640
+ requestType: "statement",
641
+ responseType: "remote-statement-store-create-proof-response",
642
+ errorType: "remote-statement-store-create-proof-error",
410
643
  },
411
644
  ],
412
645
  },
@@ -416,29 +649,36 @@ export const services = [
416
649
  {
417
650
  name: "handshake",
418
651
  type: "unary",
652
+ signature: "handshake(request: HostHandshakeRequest): Promise<Result<undefined, HostHandshakeError>>",
653
+ docUrl: "api/system/trait.System.html#method.handshake",
419
654
  description: "Negotiate the wire codec version with the product.",
420
655
  requestDescription: "HostHandshakeRequest",
656
+ exampleSource: 'const result = await truapi.system.handshake();\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
657
+ requestType: "host-handshake-request",
658
+ errorType: "host-handshake-error",
421
659
  },
422
660
  {
423
661
  name: "feature_supported",
424
662
  type: "unary",
663
+ signature: "featureSupported(request: HostFeatureSupportedRequest): Promise<Result<HostFeatureSupportedResponse, GenericError>>",
664
+ docUrl: "api/system/trait.System.html#method.feature_supported",
425
665
  description: "Query whether the host supports a specific feature.",
426
666
  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}',
667
+ exampleSource: 'import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi";\n\nconst result = await truapi.system.featureSupported({\n tag: "Chain",\n value: {\n genesisHash: PASEO_NEXT_V2_ASSET_HUB.genesis,\n },\n});\nresult.match(\n (value) => console.log(value.supported),\n (error) => console.error(error),\n);',
668
+ requestType: "host-feature-supported-request",
669
+ responseType: "host-feature-supported-response",
670
+ errorType: "generic-error",
435
671
  },
436
672
  {
437
673
  name: "navigate_to",
438
674
  type: "unary",
675
+ signature: "navigateTo(request: HostNavigateToRequest): Promise<Result<undefined, HostNavigateToError>>",
676
+ docUrl: "api/system/trait.System.html#method.navigate_to",
439
677
  description: "Request the host to open a URL.",
440
678
  requestDescription: "HostNavigateToRequest",
441
- defaultRequest: '{\n "url": "https://example.com"\n}',
679
+ exampleSource: 'const result = await truapi.system.navigateTo({\n url: "https://example.com",\n});\nresult.match(\n () => console.log("ok"),\n (error) => console.error(error),\n);',
680
+ requestType: "host-navigate-to-request",
681
+ errorType: "host-navigate-to-error",
442
682
  },
443
683
  ],
444
684
  },
@@ -448,8 +688,11 @@ export const services = [
448
688
  {
449
689
  name: "subscribe",
450
690
  type: "subscription",
691
+ signature: "subscribe(): ObservableLike<HostThemeSubscribeItem>",
692
+ docUrl: "api/theme/trait.Theme.html#method.subscribe",
451
693
  description: "Subscribe to host theme changes.",
452
- noParams: true,
694
+ exampleSource: 'import { from, take } from "rxjs";\n\nfrom(truapi.theme.subscribe())\n .pipe(take(3))\n .subscribe({\n next: (theme) => console.log(theme),\n error: (error) => console.error(error),\n complete: () => console.log("completed"),\n });',
695
+ responseType: "host-theme-subscribe-item",
453
696
  },
454
697
  ],
455
698
  },