@dedot/api 0.18.8 → 1.0.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.
Files changed (102) hide show
  1. package/chaintypes/substrate/consts.d.ts +2 -2
  2. package/chaintypes/substrate/consts.js +1 -0
  3. package/chaintypes/substrate/errors.d.ts +909 -909
  4. package/chaintypes/substrate/errors.js +1 -0
  5. package/chaintypes/substrate/events.d.ts +664 -664
  6. package/chaintypes/substrate/events.js +1 -0
  7. package/chaintypes/substrate/index.d.ts +13 -16
  8. package/chaintypes/substrate/index.js +1 -0
  9. package/chaintypes/substrate/json-rpc.d.ts +2 -2
  10. package/chaintypes/substrate/json-rpc.js +1 -0
  11. package/chaintypes/substrate/query.d.ts +509 -527
  12. package/chaintypes/substrate/query.js +1 -0
  13. package/chaintypes/substrate/runtime.d.ts +123 -123
  14. package/chaintypes/substrate/runtime.js +1 -0
  15. package/chaintypes/substrate/tx.d.ts +1311 -1311
  16. package/chaintypes/substrate/tx.js +1 -0
  17. package/chaintypes/substrate/types.js +1 -0
  18. package/chaintypes/substrate/view-functions.d.ts +2 -2
  19. package/chaintypes/substrate/view-functions.js +1 -0
  20. package/cjs/chaintypes/substrate/consts.js +1 -0
  21. package/cjs/chaintypes/substrate/errors.js +1 -0
  22. package/cjs/chaintypes/substrate/events.js +1 -0
  23. package/cjs/chaintypes/substrate/index.js +1 -0
  24. package/cjs/chaintypes/substrate/json-rpc.js +1 -0
  25. package/cjs/chaintypes/substrate/query.js +1 -0
  26. package/cjs/chaintypes/substrate/runtime.js +1 -0
  27. package/cjs/chaintypes/substrate/tx.js +1 -0
  28. package/cjs/chaintypes/substrate/types.js +1 -0
  29. package/cjs/chaintypes/substrate/view-functions.js +1 -0
  30. package/cjs/client/BaseSubstrateClient.js +45 -2
  31. package/cjs/client/DedotClient.js +356 -224
  32. package/cjs/client/LegacyClient.js +99 -23
  33. package/cjs/client/V2Client.js +316 -0
  34. package/cjs/client/explorer/LegacyBlockExplorer.js +263 -0
  35. package/cjs/client/explorer/V2BlockExplorer.js +74 -0
  36. package/cjs/client/explorer/index.js +18 -0
  37. package/cjs/client/utils.js +57 -0
  38. package/cjs/executor/EventExecutor.js +1 -0
  39. package/cjs/executor/RuntimeApiExecutor.js +49 -2
  40. package/cjs/executor/StorageQueryExecutor.js +114 -2
  41. package/cjs/executor/ViewFunctionExecutor.js +21 -2
  42. package/cjs/executor/v2/StorageQueryExecutorV2.js +7 -1
  43. package/cjs/executor/validation-helpers.js +181 -0
  44. package/cjs/extrinsic/submittable/BaseSubmittableExtrinsic.js +86 -2
  45. package/cjs/extrinsic/submittable/SubmittableExtrinsic.js +38 -16
  46. package/cjs/extrinsic/submittable/SubmittableExtrinsicV2.js +12 -2
  47. package/cjs/json-rpc/group/ChainHead/ChainHead.js +226 -21
  48. package/cjs/storage/QueryableStorage.js +1 -0
  49. package/client/BaseSubstrateClient.d.ts +34 -18
  50. package/client/BaseSubstrateClient.js +47 -4
  51. package/client/DedotClient.d.ts +346 -49
  52. package/client/DedotClient.js +356 -224
  53. package/client/LegacyClient.d.ts +22 -17
  54. package/client/LegacyClient.js +101 -25
  55. package/client/V2Client.d.ts +75 -0
  56. package/client/V2Client.js +312 -0
  57. package/client/explorer/LegacyBlockExplorer.d.ts +68 -0
  58. package/client/explorer/LegacyBlockExplorer.js +259 -0
  59. package/client/explorer/V2BlockExplorer.d.ts +40 -0
  60. package/client/explorer/V2BlockExplorer.js +70 -0
  61. package/client/explorer/index.d.ts +2 -0
  62. package/client/explorer/index.js +2 -0
  63. package/client/utils.d.ts +18 -0
  64. package/client/utils.js +52 -0
  65. package/executor/ConstantExecutor.d.ts +1 -2
  66. package/executor/ErrorExecutor.d.ts +2 -2
  67. package/executor/EventExecutor.d.ts +2 -2
  68. package/executor/EventExecutor.js +1 -0
  69. package/executor/Executor.d.ts +4 -5
  70. package/executor/RuntimeApiExecutor.d.ts +2 -2
  71. package/executor/RuntimeApiExecutor.js +27 -3
  72. package/executor/StorageQueryExecutor.d.ts +3 -2
  73. package/executor/StorageQueryExecutor.js +92 -3
  74. package/executor/TxExecutor.d.ts +2 -2
  75. package/executor/ViewFunctionExecutor.d.ts +2 -2
  76. package/executor/ViewFunctionExecutor.js +22 -3
  77. package/executor/v2/RuntimeApiExecutorV2.d.ts +2 -3
  78. package/executor/v2/StorageQueryExecutorV2.d.ts +3 -3
  79. package/executor/v2/StorageQueryExecutorV2.js +8 -2
  80. package/executor/v2/TxExecutorV2.d.ts +5 -5
  81. package/executor/v2/ViewFunctionExecutorV2.d.ts +2 -3
  82. package/executor/validation-helpers.d.ts +36 -0
  83. package/executor/validation-helpers.js +174 -0
  84. package/extrinsic/extensions/SignedExtension.d.ts +1 -1
  85. package/extrinsic/submittable/BaseSubmittableExtrinsic.d.ts +7 -3
  86. package/extrinsic/submittable/BaseSubmittableExtrinsic.js +64 -3
  87. package/extrinsic/submittable/SubmittableExtrinsic.d.ts +4 -1
  88. package/extrinsic/submittable/SubmittableExtrinsic.js +39 -17
  89. package/extrinsic/submittable/SubmittableExtrinsicV2.d.ts +6 -3
  90. package/extrinsic/submittable/SubmittableExtrinsicV2.js +13 -3
  91. package/json-rpc/JsonRpcClient.d.ts +6 -6
  92. package/json-rpc/group/Archive.d.ts +1 -1
  93. package/json-rpc/group/ChainHead/ChainHead.d.ts +18 -2
  94. package/json-rpc/group/ChainHead/ChainHead.js +226 -21
  95. package/json-rpc/group/ChainSpec.d.ts +3 -3
  96. package/json-rpc/group/Transaction.d.ts +1 -1
  97. package/json-rpc/group/TransactionWatch.d.ts +1 -1
  98. package/package.json +9 -9
  99. package/proxychain.d.ts +3 -4
  100. package/storage/NewStorageQuery.d.ts +3 -3
  101. package/storage/QueryableStorage.js +1 -0
  102. package/types.d.ts +94 -6
@@ -1,71 +1,368 @@
1
- import { BlockHash } from '@dedot/codecs';
2
- import type { JsonRpcProvider } from '@dedot/providers';
3
- import { GenericSubstrateApi, RpcV2, VersionedGenericSubstrateApi } from '@dedot/types';
4
- import type { SubstrateApi } from '../chaintypes/index.js';
5
- import { Archive, ChainHead, ChainSpec, PinnedBlock } from '../json-rpc/index.js';
6
- import { BaseStorageQuery } from '../storage/index.js';
7
- import type { ApiOptions, DedotClientEvent, ISubstrateClientAt, TxBroadcaster } from '../types.js';
8
- import { BaseSubstrateClient } from './BaseSubstrateClient.js';
1
+ import { type Extrinsic, Metadata, PortableRegistry } from '@dedot/codecs';
2
+ import { ConnectionStatus, JsonRpcProvider } from '@dedot/providers';
3
+ import { Callback, GenericStorageQuery, GenericSubstrateApi, InjectedSigner, Query, QueryFnResult, RpcVersion, TxUnsub, Unsub } from '@dedot/types';
4
+ import { HexString } from '@dedot/utils';
5
+ import { SubstrateApi } from '../chaintypes/index.js';
6
+ import { ApiEvent, ApiOptions, BlockExplorer, ISubstrateClient, ISubstrateClientAt, SubstrateRuntimeVersion, IChainSpec, type EventHandlerFn } from '../types.js';
7
+ /**
8
+ * Configuration options for DedotClient
9
+ */
10
+ export type ClientOptions = ApiOptions & {
11
+ /**
12
+ * The JSON-RPC version to use
13
+ * - 'v2' (default): Uses the new JSON-RPC v2 specification
14
+ * - 'legacy': Uses the legacy JSON-RPC specification for older nodes
15
+ */
16
+ rpcVersion?: RpcVersion;
17
+ };
9
18
  /**
10
19
  * @name DedotClient
11
- * @description New promised-based API Client for Polkadot & Substrate based on JSON-RPC V2
20
+ * @description The main entry point for interacting with PolkadotSDK-based blockchains.
21
+ *
22
+ * DedotClient is a facade that provides a unified API for both JSON-RPC v2 (default) and legacy
23
+ * JSON-RPC versions.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * import { DedotClient, WsProvider } from 'dedot';
28
+ * import type { PolkadotApi } from '@dedot/chaintypes/polkadot';
29
+ *
30
+ * // Create and connect to a Polkadot node
31
+ * const provider = new WsProvider('wss://rpc.polkadot.io');
32
+ * const client = await DedotClient.new<PolkadotApi>(provider);
33
+ *
34
+ * // Get the current best block
35
+ * const bestBlock = await client.block.best();
36
+ * console.log('Best block:', bestBlock.number, bestBlock.hash);
37
+ *
38
+ * // Subscribe to finalized blocks
39
+ * const unsub = client.block.finalized((block) => {
40
+ * console.log('Finalized:', block.number);
41
+ * });
42
+ *
43
+ * // Query on-chain storage
44
+ * const balance = await client.query.system.account('14...');
45
+ * console.log('Balance:', balance);
46
+ *
47
+ * // Subscribe to runtime upgrades
48
+ * const unsub = client.on('runtimeUpgraded', (version, block) => {
49
+ * console.log('Runtime upgraded to:', version.specVersion, 'at block:', block.number);
50
+ * });
12
51
  *
13
- * __Unstable, use with caution.__
52
+ * // Sending transactions
53
+ * await client.tx.balances.transferKeepAlive('15...', 1000000000000n)
54
+ * .signAndSend(signer)
55
+ * .untilFinalized();
56
+ *
57
+ * // Disconnect when done
58
+ * await client.disconnect();
59
+ * ```
60
+ *
61
+ * @template ChainApi - Chain-specific API type for type-safe interactions (defaults to SubstrateApi)
14
62
  */
15
- export declare class DedotClient<ChainApi extends VersionedGenericSubstrateApi = SubstrateApi>// prettier-end-here
16
- extends BaseSubstrateClient<RpcV2, ChainApi, DedotClientEvent> {
63
+ export declare class DedotClient<ChainApi extends GenericSubstrateApi = SubstrateApi> implements ISubstrateClient<ChainApi, ApiEvent> {
17
64
  #private;
18
- protected _chainHead?: ChainHead;
19
- protected _chainSpec?: ChainSpec;
20
- protected _archive?: Archive;
21
- protected _txBroadcaster?: TxBroadcaster;
65
+ /** The JSON-RPC version being used ('v2' or 'legacy') */
66
+ rpcVersion: RpcVersion;
22
67
  /**
23
- * Use factory methods (`create`, `new`) to create `DedotClient` instances.
68
+ * Creates a new DedotClient instance.
69
+ *
70
+ * Use factory methods (`create`, `new`, `legacy`) for automatic connection.
24
71
  *
25
- * @param options
72
+ * @param options - Client configuration options or a JsonRpcProvider instance
26
73
  */
27
- constructor(options: ApiOptions | JsonRpcProvider);
74
+ constructor(options: ClientOptions | JsonRpcProvider);
28
75
  /**
29
- * Factory method to create a new DedotClient instance
76
+ * Factory method to create and connect a new DedotClient instance.
30
77
  *
31
- * @param options
78
+ * @param options - Client configuration options or a JsonRpcProvider instance
79
+ * @returns A connected DedotClient instance
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * const client = await DedotClient.create<PolkadotApi>({
84
+ * provider: new WsProvider('wss://rpc.polkadot.io'),
85
+ * });
86
+ * ```
32
87
  */
33
- static create<ChainApi extends VersionedGenericSubstrateApi = SubstrateApi>(options: ApiOptions | JsonRpcProvider): Promise<DedotClient<ChainApi>>;
88
+ static create<ChainApi extends GenericSubstrateApi = SubstrateApi>(options: ClientOptions | JsonRpcProvider): Promise<DedotClient<ChainApi>>;
34
89
  /**
35
- * Alias for __DedotClient.create__
90
+ * Alias for `DedotClient.create`
36
91
  *
37
- * @param options
92
+ * @param options - Client configuration options or a JsonRpcProvider instance
93
+ * @returns A connected DedotClient instance
38
94
  */
39
- static new<ChainApi extends VersionedGenericSubstrateApi = SubstrateApi>(options: ApiOptions | JsonRpcProvider): Promise<DedotClient<ChainApi>>;
40
- get chainSpec(): ChainSpec;
41
- get chainHead(): ChainHead;
42
- archive(): Promise<Archive>;
43
- get txBroadcaster(): TxBroadcaster;
95
+ static new<ChainApi extends GenericSubstrateApi = SubstrateApi>(options: ClientOptions | JsonRpcProvider): Promise<DedotClient<ChainApi>>;
44
96
  /**
45
- * Initialize APIs before usage
97
+ * Factory method to create a DedotClient using legacy JSON-RPC.
98
+ *
99
+ * This is a convenience method that automatically sets `rpcVersion: 'legacy'`.
100
+ *
101
+ * @param options - Client configuration options or a JsonRpcProvider instance
102
+ * @returns A connected DedotClient instance using legacy JSON-RPC
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * const client = await DedotClient.legacy<PolkadotApi>({
107
+ * provider: new WsProvider('wss://rpc.polkadot.io'),
108
+ * });
109
+ * ```
46
110
  */
47
- protected doInitialize(): Promise<void>;
48
- protected subscribeRuntimeUpgrades(): void;
49
- protected onRuntimeUpgrade: (block: PinnedBlock) => Promise<void>;
50
- protected beforeDisconnect(): Promise<void>;
51
- protected onDisconnected: () => Promise<void>;
52
- protected cleanUp(): void;
111
+ static legacy<ChainApi extends GenericSubstrateApi = SubstrateApi>(options: ClientOptions | JsonRpcProvider): Promise<DedotClient<ChainApi>>;
112
+ /** The API configuration options */
113
+ get options(): ApiOptions;
114
+ /** Current connection status */
115
+ get status(): ConnectionStatus;
116
+ /** The underlying JSON-RPC provider */
117
+ get provider(): JsonRpcProvider;
118
+ /** Transaction builder for submitting extrinsics */
119
+ get tx(): ChainApi['tx'];
120
+ /** Raw JSON-RPC method access */
121
+ get rpc(): ChainApi['rpc'];
122
+ /** The genesis hash of the connected chain */
123
+ get genesisHash(): HexString;
124
+ /** Current runtime version information */
125
+ get runtimeVersion(): SubstrateRuntimeVersion;
126
+ /** The chain metadata */
127
+ get metadata(): Metadata;
128
+ /** Type registry for encoding/decoding chain types */
129
+ get registry(): PortableRegistry<ChainApi['types']>;
53
130
  /**
54
- * @description Clear local cache, API at-block cache, and ChainHead cache
55
- * @param keepMetadataCache Keep the metadata cache, only clear other caches.
131
+ * Access to pallet constants.
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const existentialDeposit = client.consts.balances.existentialDeposit;
136
+ * const ss58Prefix = client.consts.system.ss58Prefix;
137
+ * ```
56
138
  */
57
- clearCache(keepMetadataCache?: boolean): Promise<void>;
58
- get query(): ChainApi[RpcV2]['query'];
59
- get view(): ChainApi[RpcV2]['view'];
60
- get call(): ChainApi[RpcV2]['call'];
61
- protected callAt(blockHash?: BlockHash): ChainApi[RpcV2]['call'];
62
- get tx(): ChainApi[RpcV2]['tx'];
139
+ get consts(): ChainApi['consts'];
140
+ /**
141
+ * Storage query interface for reading on-chain state.
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * // One-time query
146
+ * const account = await client.query.system.account(address);
147
+ *
148
+ * // Subscribe to storage changes
149
+ * const unsub = await client.query.system.number((blockNumber) => {
150
+ * console.log('Current block:', blockNumber);
151
+ * });
152
+ * ```
153
+ */
154
+ get query(): ChainApi['query'];
155
+ /**
156
+ * Runtime API call interface.
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const rawMetadata = await client.call.metadata.metadataAtVersion(16);
161
+ * const version = await client.call.core.version();
162
+ * ```
163
+ */
164
+ get call(): ChainApi['call'];
165
+ /**
166
+ * Event type definitions and utilities.
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * // Check if an event matches a specific type
171
+ * if (client.events.balances.Transfer.is(event)) {
172
+ * console.log('Transfer event:', event.data);
173
+ * }
174
+ * ```
175
+ */
176
+ get events(): ChainApi['events'];
177
+ /**
178
+ * Error type definitions and utilities.
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * // Check if an error matches a specific type
183
+ * if (client.errors.balances.InsufficientBalance.is(dispatchError)) {
184
+ * console.log('Insufficient balance error');
185
+ * }
186
+ * ```
187
+ */
188
+ get errors(): ChainApi['errors'];
189
+ /**
190
+ * View functions interface (requires Metadata V16+).
191
+ *
192
+ * @example
193
+ * ```typescript
194
+ * // Call a view function
195
+ * const result = await client.view.voterList.scores(ALICE_ADDRESS);
196
+ * ```
197
+ */
198
+ get view(): ChainApi['view'];
199
+ /**
200
+ * Block explorer interface for accessing block data.
201
+ *
202
+ * Provides methods to get/subscribe to best and finalized blocks,
203
+ * as well as retrieve block headers and bodies.
204
+ *
205
+ * @example
206
+ * ```typescript
207
+ * // Get the current best block
208
+ * const bestBlock = await client.block.best();
209
+ * console.log('Best block:', bestBlock.number, bestBlock.hash);
210
+ *
211
+ * // Subscribe to finalized blocks
212
+ * const unsub = client.block.finalized((block) => {
213
+ * console.log('Finalized block:', block.number);
214
+ * });
215
+ *
216
+ * // Get block header and body
217
+ * const header = await client.block.header(blockHash);
218
+ * const body = await client.block.body(blockHash);
219
+ * ```
220
+ */
221
+ get block(): BlockExplorer;
63
222
  /**
64
- * Get a new API instance at a specific block hash
65
- * Supports both pinned blocks (via ChainHead) and historical blocks (via Archive fallback)
223
+ * Chain specification interface for accessing chain information.
66
224
  *
67
- * @param hash
225
+ * Provides methods to get chain name, genesis hash, and chain properties.
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * const chainName = await client.chainSpec.chainName();
230
+ * const genesisHash = await client.chainSpec.genesisHash();
231
+ * const properties = await client.chainSpec.properties();
232
+ *
233
+ * console.log(`Connected to ${chainName}`);
234
+ * console.log('Token symbol:', properties.tokenSymbol);
235
+ * console.log('Token decimals:', properties.tokenDecimals);
236
+ * ```
237
+ */
238
+ get chainSpec(): IChainSpec;
239
+ /**
240
+ * Establishes connection to the blockchain network.
241
+ *
242
+ * @returns This client instance for method chaining
243
+ */
244
+ connect(): Promise<this>;
245
+ /**
246
+ * Closes the connection to the blockchain network.
247
+ */
248
+ disconnect(): Promise<void>;
249
+ /**
250
+ * Subscribe to client events.
251
+ *
252
+ * @param event - The event to listen for ('ready', 'connected', 'disconnected', 'reconnecting', 'runtimeUpgraded', 'error')
253
+ * @param handler - Callback function to handle the event
254
+ * @returns Unsubscribe function
255
+ */
256
+ on<Event extends ApiEvent = ApiEvent>(event: Event, handler: EventHandlerFn<Event>): () => void;
257
+ /**
258
+ * Subscribe to a client event once.
259
+ *
260
+ * @param event - The event to listen for
261
+ * @param handler - Callback function to handle the event
262
+ * @returns Unsubscribe function
263
+ */
264
+ once<Event extends ApiEvent = ApiEvent>(event: Event, handler: EventHandlerFn<Event>): () => void;
265
+ /**
266
+ * Unsubscribe from client events.
267
+ *
268
+ * @param event - The event to unsubscribe from
269
+ * @param handler - The handler function to remove (optional, removes all handlers if not provided)
270
+ * @returns This client instance for method chaining
271
+ */
272
+ off<Event extends ApiEvent = ApiEvent>(event: Event, handler?: EventHandlerFn<Event>): this;
273
+ /**
274
+ * Get a client instance at a specific block hash.
275
+ *
276
+ * This allows querying historical state at a specific block.
277
+ *
278
+ * @template ChainApiAt - Chain API type for the historical state (defaults to ChainApi)
279
+ * @param hash - The block hash to query at
280
+ * @returns A client instance for querying state at the specified block
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * const clientAtBlock = await client.at('0x1234...');
285
+ * const historicalBalance = await clientAtBlock.query.system.account('14...');
286
+ * ```
68
287
  */
69
- at<ChainApiAt extends GenericSubstrateApi = ChainApi[RpcV2]>(hash: BlockHash): Promise<ISubstrateClientAt<ChainApiAt>>;
70
- protected getStorageQuery(): BaseStorageQuery;
288
+ at<ChainApiAt extends GenericSubstrateApi = ChainApi>(hash: `0x${string}`): Promise<ISubstrateClientAt<ChainApiAt>>;
289
+ /**
290
+ * Get the current runtime version with metadata sync.
291
+ *
292
+ * Unlike the `runtimeVersion` getter, this method ensures the corresponding
293
+ * metadata for the runtime version is downloaded and set up. Useful for
294
+ * preparing for runtime upgrades.
295
+ *
296
+ * @returns The current runtime version
297
+ */
298
+ getRuntimeVersion(): Promise<SubstrateRuntimeVersion>;
299
+ /**
300
+ * Set or update the signer instance for signing transactions.
301
+ *
302
+ * @param signer - The signer instance (or undefined to clear)
303
+ */
304
+ setSigner(signer?: InjectedSigner | undefined): void;
305
+ /**
306
+ * Query multiple storage items in a single call or subscribe to multiple storage items.
307
+ *
308
+ * @example
309
+ * ```typescript
310
+ * // One-time query
311
+ * const [balance, blockNumber] = await client.queryMulti([
312
+ * { fn: client.query.system.account, args: [ALICE] },
313
+ * { fn: client.query.system.number, args: [] }
314
+ * ]);
315
+ *
316
+ * // Subscription
317
+ * const unsub = await client.queryMulti([
318
+ * { fn: client.query.system.account, args: [ALICE] },
319
+ * { fn: client.query.system.number, args: [] }
320
+ * ], ([balance, blockNumber]) => {
321
+ * console.log('Balance:', balance, 'Block:', blockNumber);
322
+ * });
323
+ * ```
324
+ *
325
+ * @template Fns - Array of storage query functions
326
+ * @param queries - Array of query specifications with function and arguments
327
+ * @param callback - Optional callback for subscription mode
328
+ * @returns Query results array, or unsubscribe function if callback provided
329
+ */
330
+ queryMulti<Fns extends GenericStorageQuery[]>(queries: {
331
+ [K in keyof Fns]: Query<Fns[K]>;
332
+ }): Promise<{
333
+ [K in keyof Fns]: QueryFnResult<Fns[K]>;
334
+ }>;
335
+ queryMulti<Fns extends GenericStorageQuery[]>(queries: {
336
+ [K in keyof Fns]: Query<Fns[K]>;
337
+ }, callback: Callback<{
338
+ [K in keyof Fns]: QueryFnResult<Fns[K]>;
339
+ }>): Promise<Unsub>;
340
+ /**
341
+ * Broadcast a transaction to the network and track its status.
342
+ *
343
+ * @param tx - The transaction (hex string or Extrinsic instance)
344
+ * @param callback - Optional callback for transaction status updates
345
+ * @returns TxUnsub object with utility methods (`.untilFinalized()`, `.untilBestChainBlockIncluded()`)
346
+ *
347
+ * @example
348
+ * ```typescript
349
+ * // Wait for finalization
350
+ * const result = await client.sendTx(txHex).untilFinalized();
351
+ *
352
+ * // With status callback to track progress
353
+ * const unsub = await client.sendTx(txHex, (result) => {
354
+ * console.log('Status:', result.status);
355
+ * if (result.dispatchError) {
356
+ * console.error('Transaction failed:', result.dispatchError);
357
+ * }
358
+ * });
359
+ * ```
360
+ */
361
+ sendTx(tx: HexString | Extrinsic, callback?: Callback): TxUnsub;
362
+ /**
363
+ * Clear internal caches.
364
+ *
365
+ * @param keepMetadataCache - If true, preserves the metadata cache (default: false)
366
+ */
367
+ clearCache(keepMetadataCache?: boolean): Promise<void>;
71
368
  }