polkadot-api 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -4,6 +4,8 @@ import { HexString, Binary, SS58String, Enum, BlockHeader } from '@polkadot-api/
4
4
  export { AccountId, Binary, Codec, Enum, EnumVariant, FixedSizeBinary, GetEnum, HexString, ResultPayload, SS58String, _Enum } from '@polkadot-api/substrate-bindings';
5
5
  import { ChainSpecData } from '@polkadot-api/substrate-client';
6
6
  import { Observable } from 'rxjs';
7
+ import { DescriptorValues } from '@polkadot-api/codegen';
8
+ export { DescriptorValues } from '@polkadot-api/codegen';
7
9
  import { PolkadotSigner } from '@polkadot-api/polkadot-signer';
8
10
  export { PolkadotSigner } from '@polkadot-api/polkadot-signer';
9
11
 
@@ -23,13 +25,6 @@ type TxDescriptor<Args extends {} | undefined> = {
23
25
  };
24
26
  type RuntimeDescriptor<Args extends Array<any>, T> = [Args, T];
25
27
  type DescriptorEntry<T> = Record<string, Record<string, T>>;
26
- type PalletDescriptors = Record<string, [
27
- Record<string, number>,
28
- Record<string, number>,
29
- Record<string, number>,
30
- Record<string, number>,
31
- Record<string, number>
32
- ]>;
33
28
  type PalletsTypedef<St extends DescriptorEntry<StorageDescriptor<any, any, any>>, Tx extends DescriptorEntry<TxDescriptor<any>>, Ev extends DescriptorEntry<PlainDescriptor<any>>, Err extends DescriptorEntry<PlainDescriptor<any>>, Ct extends DescriptorEntry<PlainDescriptor<any>>> = {
34
29
  __storage: St;
35
30
  __tx: Tx;
@@ -37,14 +32,10 @@ type PalletsTypedef<St extends DescriptorEntry<StorageDescriptor<any, any, any>>
37
32
  __error: Err;
38
33
  __const: Ct;
39
34
  };
40
- type ApisDescriptors = DescriptorEntry<number>;
41
35
  type ApisTypedef<T extends DescriptorEntry<RuntimeDescriptor<any, any>>> = T;
42
- type DescriptorsValue = {
43
- pallets: PalletDescriptors;
44
- apis: ApisDescriptors;
45
- };
36
+
46
37
  type ChainDefinition = {
47
- descriptors: Promise<DescriptorsValue> & {
38
+ descriptors: Promise<DescriptorValues> & {
48
39
  pallets: PalletsTypedef<any, any, any, any, any>;
49
40
  apis: ApisTypedef<any>;
50
41
  };
@@ -77,11 +68,11 @@ type ErrorsFromPalletsDef<T extends PalletsTypedef<any, any, any, any, any>> = E
77
68
  type ConstFromPalletsDef<T extends PalletsTypedef<any, any, any, any, any>> = ExtractPlain<T["__const"]>;
78
69
 
79
70
  declare const enum OpType {
80
- Storage = 0,
81
- Tx = 1,
82
- Event = 2,
83
- Error = 3,
84
- Const = 4
71
+ Storage = "storage",
72
+ Tx = "tx",
73
+ Event = "events",
74
+ Error = "errors",
75
+ Const = "constants"
85
76
  }
86
77
  declare class Runtime {
87
78
  private _ctx;
@@ -91,7 +82,7 @@ declare class Runtime {
91
82
  /**
92
83
  * @access package - Internal implementation detail. Do not use.
93
84
  */
94
- static _create(ctx: RuntimeContext, checksums: string[], descriptors: DescriptorsValue): Runtime;
85
+ static _create(ctx: RuntimeContext, checksums: string[], descriptors: DescriptorValues): Runtime;
95
86
  /**
96
87
  * @access package - Internal implementation detail. Do not use.
97
88
  */
@@ -106,10 +97,28 @@ declare class Runtime {
106
97
  _getApiChecksum(name: string, method: string): string;
107
98
  }
108
99
  type RuntimeApi = Observable<Runtime> & {
100
+ /**
101
+ * @returns Promise that resolves in the `Runtime` as soon as it's
102
+ * loaded.
103
+ */
109
104
  latest: () => Promise<Runtime>;
110
105
  };
111
106
  interface IsCompatible {
107
+ /**
108
+ * `isCompatible` enables you to check whether or not the call you're trying
109
+ * to make is compatible with the descriptors you generated on dev time.
110
+ * In this case the function waits for `Runtime` to load, and returns
111
+ * asynchronously.
112
+ *
113
+ * @returns Promise that resolves with the result of the compatibility
114
+ * check.
115
+ */
112
116
  (): Promise<boolean>;
117
+ /**
118
+ * Passing the runtime makes the function to return synchronously.
119
+ *
120
+ * @returns Result of the compatibility check.
121
+ */
113
122
  (runtime: Runtime): boolean;
114
123
  }
115
124
  declare const compatibilityHelper: (runtimeApi: RuntimeApi, getDescriptorChecksum: (runtime: Runtime) => string) => (getChecksum: (ctx: RuntimeContext) => string | null) => {
@@ -121,8 +130,21 @@ declare const compatibilityHelper: (runtimeApi: RuntimeApi, getDescriptorChecksu
121
130
  type CompatibilityHelper = ReturnType<typeof compatibilityHelper>;
122
131
 
123
132
  interface ConstantEntry<T> {
133
+ /**
134
+ * Constants are simple key-value structures found in the runtime metadata.
135
+ *
136
+ * @returns Promise that will resolve in the value of the constant.
137
+ */
124
138
  (): Promise<T>;
139
+ /**
140
+ * @param runtime Runtime from got with `typedApi.runtime`
141
+ * @returns Synchronously returns value of the constant.
142
+ */
125
143
  (runtime: Runtime): T;
144
+ /**
145
+ * `isCompatible` enables you to check whether or not the call you're trying
146
+ * to make is compatible with the descriptors you generated on dev time.
147
+ */
126
148
  isCompatible: IsCompatible;
127
149
  }
128
150
 
@@ -150,9 +172,30 @@ type EvPull<T> = () => Promise<Array<{
150
172
  }>>;
151
173
  type EvFilter<T> = (collection: SystemEvent["event"][]) => Array<T>;
152
174
  type EvClient<T> = {
175
+ /**
176
+ * Multicast and stateful Observable watching for new events (matching the
177
+ * event kind chosen) in the latest known `finalized` block.
178
+ *
179
+ * @param filter Optional filter function to only emit events complying
180
+ * with the function.
181
+ */
153
182
  watch: EvWatch<T>;
183
+ /**
184
+ * Fetch (Promise-based) all events (matching the event kind chosen) available
185
+ * in the latest known `finalized` block.
186
+ */
154
187
  pull: EvPull<T>;
188
+ /**
189
+ * Filter a bunch of `SystemEvent` and return the decoded `payload` of every
190
+ * of them.
191
+ *
192
+ * @param collection Array of `SystemEvent` to filter.
193
+ */
155
194
  filter: EvFilter<T>;
195
+ /**
196
+ * `isCompatible` enables you to check whether or not the call you're trying
197
+ * to make is compatible with the descriptors you generated on dev time.
198
+ */
156
199
  isCompatible: IsCompatible;
157
200
  };
158
201
  type SystemEvent = {
@@ -173,12 +216,31 @@ type CallOptions$1 = Partial<{
173
216
  }>;
174
217
  type WithCallOptions$1<Args extends Array<any>> = Args["length"] extends 0 ? [options?: CallOptions$1] : [...args: Args, options?: CallOptions$1];
175
218
  interface RuntimeCall<Args extends Array<any>, Payload> {
219
+ /**
220
+ * Get `Payload` (Promise-based) for the runtime call.
221
+ *
222
+ * @param args All keys needed for that runtime call.
223
+ * At the end, optionally set which block to target (latest
224
+ * known finalized is the default) and an AbortSignal.
225
+ */
176
226
  (...args: WithCallOptions$1<Args>): Promise<Payload>;
227
+ /**
228
+ * `isCompatible` enables you to check whether or not the call you're trying
229
+ * to make is compatible with the descriptors you generated on dev time.
230
+ */
177
231
  isCompatible: IsCompatible;
178
232
  }
179
233
 
180
234
  type CallOptions = Partial<{
235
+ /**
236
+ * `at` could be a blockHash, `best`, or `finalized` (default)
237
+ */
181
238
  at: string;
239
+ /**
240
+ * `signal` allows you to abort an ongoing Promise. See [MDN
241
+ * docs](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) for
242
+ * more information
243
+ */
182
244
  signal: AbortSignal;
183
245
  }>;
184
246
  type WithCallOptions<Args extends Array<any>> = [
@@ -187,15 +249,73 @@ type WithCallOptions<Args extends Array<any>> = [
187
249
  ];
188
250
  type PossibleParents<A extends Array<any>> = A extends [...infer Left, any] ? Left | PossibleParents<Left> : [];
189
251
  type StorageEntryWithoutKeys<Payload> = {
252
+ /**
253
+ * `isCompatible` enables you to check whether or not the call you're trying
254
+ * to make is compatible with the descriptors you generated on dev time.
255
+ */
190
256
  isCompatible: IsCompatible;
257
+ /**
258
+ * Get `Payload` (Promise-based) for the storage entry.
259
+ *
260
+ * @param options Optionally set which block to target (latest known
261
+ * finalized is the default) and an AbortSignal.
262
+ */
191
263
  getValue: (options?: CallOptions) => Promise<Payload>;
264
+ /**
265
+ * Watch changes in `Payload` (observable-based) for the storage entry.
266
+ *
267
+ * @param bestOrFinalized Optionally choose which block to query and watch
268
+ * changes, `best` or `finalized` (default)
269
+ */
192
270
  watchValue: (bestOrFinalized?: "best" | "finalized") => Observable<Payload>;
193
271
  };
194
272
  type StorageEntryWithKeys<Args extends Array<any>, Payload> = {
273
+ /**
274
+ * `isCompatible` enables you to check whether or not the call you're trying
275
+ * to make is compatible with the descriptors you generated on dev time.
276
+ */
195
277
  isCompatible: IsCompatible;
278
+ /**
279
+ * Get `Payload` (Promise-based) for the storage entry with a specific set of
280
+ * `Args`.
281
+ *
282
+ * @param args All keys needed for that storage entry.
283
+ * At the end, optionally set which block to target (latest
284
+ * known finalized is the default) and an AbortSignal.
285
+ */
196
286
  getValue: (...args: [...WithCallOptions<Args>]) => Promise<Payload>;
287
+ /**
288
+ * Watch changes in `Payload` (observable-based) for the storage entry.
289
+ *
290
+ * @param args All keys needed for that storage entry.
291
+ * At the end, optionally choose which block to query and
292
+ * watch changes, `best` or `finalized` (default)
293
+ */
197
294
  watchValue: (...args: [...Args, bestOrFinalized?: "best" | "finalized"]) => Observable<Payload>;
295
+ /**
296
+ * Get an Array of `Payload` (Promise-based) for the storage entry with
297
+ * several sets of `Args`.
298
+ *
299
+ * @param keys Array of sets of keys needed for the storage entry.
300
+ * @param options Optionally set which block to target (latest known
301
+ * finalized is the default) and an AbortSignal.
302
+ */
198
303
  getValues: (keys: Array<[...Args]>, options?: CallOptions) => Promise<Array<Payload>>;
304
+ /**
305
+ * Get an Array of `Payload` (Promise-based) for the storage entry with a
306
+ * subset of `Args`.
307
+ *
308
+ * @param args Subset of keys needed for the storage entry.
309
+ * At the end, optionally set which block to target (latest
310
+ * known finalized is the default) and an AbortSignal.
311
+ * @example
312
+ *
313
+ * // this is a query with 3 keys
314
+ * typedApi.query.Pallet.Query.getEntries({ at: "best" }) // no keys
315
+ * typedApi.query.Pallet.Query.getEntries(arg1, { at: "finalized" }) // 1/3 keys
316
+ * typedApi.query.Pallet.Query.getEntries(arg1, arg2, { at: "0x12345678" }) // 2/3 keys
317
+ *
318
+ */
199
319
  getEntries: (...args: WithCallOptions<PossibleParents<Args>>) => Promise<Array<{
200
320
  keyArgs: Args;
201
321
  value: NonNullable<Payload>;
@@ -331,8 +451,8 @@ type TypedApi<D extends ChainDefinition> = {
331
451
  };
332
452
  interface PolkadotClient {
333
453
  /**
334
- * Retrieve the ChainSpecData as it comes from the
335
- * [JSON-RPC spec](https://paritytech.github.io/json-rpc-interface-spec/api/chainSpec.html)
454
+ * Retrieve the ChainSpecData as it comes from the [JSON-RPC
455
+ * spec](https://paritytech.github.io/json-rpc-interface-spec/api/chainSpec.html)
336
456
  */
337
457
  getChainSpecData: () => Promise<ChainSpecData>;
338
458
  /**
@@ -461,4 +581,4 @@ type FixedSizeArray<L extends number, T> = Array<T> & {
461
581
  */
462
582
  declare function createClient(provider: JsonRpcProvider): PolkadotClient;
463
583
 
464
- export { type ApisDescriptors, type ApisTypedef, type AssetDescriptor, type ChainDefinition, type ConstFromPalletsDef, type DescriptorEntry, type DescriptorsValue, type ErrorsFromPalletsDef, type EventPhase, type EventsFromPalletsDef, type FixedSizeArray, type PalletDescriptors, type PalletsTypedef, type PlainDescriptor, type PolkadotClient, type QueryFromPalletsDef, type RuntimeDescriptor, type StorageDescriptor, type Transaction, type TxBestBlocksState, type TxBroadcastEvent, type TxBroadcasted, type TxCall, type TxDescriptor, type TxEntry, type TxEvent, type TxEventsPayload, type TxFinalized, type TxFinalizedPayload, type TxFromPalletsDef, type TxInBestBlocksFound, type TxInBestBlocksNotFound, type TxObservable, type TxOptions, type TxPromise, type TxSignFn, type TxSigned, type TypedApi, createClient, createTxEntry, submit, submit$ };
584
+ export { type ApisTypedef, type AssetDescriptor, type ChainDefinition, type ConstFromPalletsDef, type DescriptorEntry, type ErrorsFromPalletsDef, type EventPhase, type EventsFromPalletsDef, type FixedSizeArray, type PalletsTypedef, type PlainDescriptor, type PolkadotClient, type QueryFromPalletsDef, type RuntimeDescriptor, type StorageDescriptor, type Transaction, type TxBestBlocksState, type TxBroadcastEvent, type TxBroadcasted, type TxCall, type TxDescriptor, type TxEntry, type TxEvent, type TxEventsPayload, type TxFinalized, type TxFinalizedPayload, type TxFromPalletsDef, type TxInBestBlocksFound, type TxInBestBlocksNotFound, type TxObservable, type TxOptions, type TxPromise, type TxSignFn, type TxSigned, type TypedApi, createClient, createTxEntry, submit, submit$ };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,8 @@ import { HexString, Binary, SS58String, Enum, BlockHeader } from '@polkadot-api/
4
4
  export { AccountId, Binary, Codec, Enum, EnumVariant, FixedSizeBinary, GetEnum, HexString, ResultPayload, SS58String, _Enum } from '@polkadot-api/substrate-bindings';
5
5
  import { ChainSpecData } from '@polkadot-api/substrate-client';
6
6
  import { Observable } from 'rxjs';
7
+ import { DescriptorValues } from '@polkadot-api/codegen';
8
+ export { DescriptorValues } from '@polkadot-api/codegen';
7
9
  import { PolkadotSigner } from '@polkadot-api/polkadot-signer';
8
10
  export { PolkadotSigner } from '@polkadot-api/polkadot-signer';
9
11
 
@@ -23,13 +25,6 @@ type TxDescriptor<Args extends {} | undefined> = {
23
25
  };
24
26
  type RuntimeDescriptor<Args extends Array<any>, T> = [Args, T];
25
27
  type DescriptorEntry<T> = Record<string, Record<string, T>>;
26
- type PalletDescriptors = Record<string, [
27
- Record<string, number>,
28
- Record<string, number>,
29
- Record<string, number>,
30
- Record<string, number>,
31
- Record<string, number>
32
- ]>;
33
28
  type PalletsTypedef<St extends DescriptorEntry<StorageDescriptor<any, any, any>>, Tx extends DescriptorEntry<TxDescriptor<any>>, Ev extends DescriptorEntry<PlainDescriptor<any>>, Err extends DescriptorEntry<PlainDescriptor<any>>, Ct extends DescriptorEntry<PlainDescriptor<any>>> = {
34
29
  __storage: St;
35
30
  __tx: Tx;
@@ -37,14 +32,10 @@ type PalletsTypedef<St extends DescriptorEntry<StorageDescriptor<any, any, any>>
37
32
  __error: Err;
38
33
  __const: Ct;
39
34
  };
40
- type ApisDescriptors = DescriptorEntry<number>;
41
35
  type ApisTypedef<T extends DescriptorEntry<RuntimeDescriptor<any, any>>> = T;
42
- type DescriptorsValue = {
43
- pallets: PalletDescriptors;
44
- apis: ApisDescriptors;
45
- };
36
+
46
37
  type ChainDefinition = {
47
- descriptors: Promise<DescriptorsValue> & {
38
+ descriptors: Promise<DescriptorValues> & {
48
39
  pallets: PalletsTypedef<any, any, any, any, any>;
49
40
  apis: ApisTypedef<any>;
50
41
  };
@@ -77,11 +68,11 @@ type ErrorsFromPalletsDef<T extends PalletsTypedef<any, any, any, any, any>> = E
77
68
  type ConstFromPalletsDef<T extends PalletsTypedef<any, any, any, any, any>> = ExtractPlain<T["__const"]>;
78
69
 
79
70
  declare const enum OpType {
80
- Storage = 0,
81
- Tx = 1,
82
- Event = 2,
83
- Error = 3,
84
- Const = 4
71
+ Storage = "storage",
72
+ Tx = "tx",
73
+ Event = "events",
74
+ Error = "errors",
75
+ Const = "constants"
85
76
  }
86
77
  declare class Runtime {
87
78
  private _ctx;
@@ -91,7 +82,7 @@ declare class Runtime {
91
82
  /**
92
83
  * @access package - Internal implementation detail. Do not use.
93
84
  */
94
- static _create(ctx: RuntimeContext, checksums: string[], descriptors: DescriptorsValue): Runtime;
85
+ static _create(ctx: RuntimeContext, checksums: string[], descriptors: DescriptorValues): Runtime;
95
86
  /**
96
87
  * @access package - Internal implementation detail. Do not use.
97
88
  */
@@ -106,10 +97,28 @@ declare class Runtime {
106
97
  _getApiChecksum(name: string, method: string): string;
107
98
  }
108
99
  type RuntimeApi = Observable<Runtime> & {
100
+ /**
101
+ * @returns Promise that resolves in the `Runtime` as soon as it's
102
+ * loaded.
103
+ */
109
104
  latest: () => Promise<Runtime>;
110
105
  };
111
106
  interface IsCompatible {
107
+ /**
108
+ * `isCompatible` enables you to check whether or not the call you're trying
109
+ * to make is compatible with the descriptors you generated on dev time.
110
+ * In this case the function waits for `Runtime` to load, and returns
111
+ * asynchronously.
112
+ *
113
+ * @returns Promise that resolves with the result of the compatibility
114
+ * check.
115
+ */
112
116
  (): Promise<boolean>;
117
+ /**
118
+ * Passing the runtime makes the function to return synchronously.
119
+ *
120
+ * @returns Result of the compatibility check.
121
+ */
113
122
  (runtime: Runtime): boolean;
114
123
  }
115
124
  declare const compatibilityHelper: (runtimeApi: RuntimeApi, getDescriptorChecksum: (runtime: Runtime) => string) => (getChecksum: (ctx: RuntimeContext) => string | null) => {
@@ -121,8 +130,21 @@ declare const compatibilityHelper: (runtimeApi: RuntimeApi, getDescriptorChecksu
121
130
  type CompatibilityHelper = ReturnType<typeof compatibilityHelper>;
122
131
 
123
132
  interface ConstantEntry<T> {
133
+ /**
134
+ * Constants are simple key-value structures found in the runtime metadata.
135
+ *
136
+ * @returns Promise that will resolve in the value of the constant.
137
+ */
124
138
  (): Promise<T>;
139
+ /**
140
+ * @param runtime Runtime from got with `typedApi.runtime`
141
+ * @returns Synchronously returns value of the constant.
142
+ */
125
143
  (runtime: Runtime): T;
144
+ /**
145
+ * `isCompatible` enables you to check whether or not the call you're trying
146
+ * to make is compatible with the descriptors you generated on dev time.
147
+ */
126
148
  isCompatible: IsCompatible;
127
149
  }
128
150
 
@@ -150,9 +172,30 @@ type EvPull<T> = () => Promise<Array<{
150
172
  }>>;
151
173
  type EvFilter<T> = (collection: SystemEvent["event"][]) => Array<T>;
152
174
  type EvClient<T> = {
175
+ /**
176
+ * Multicast and stateful Observable watching for new events (matching the
177
+ * event kind chosen) in the latest known `finalized` block.
178
+ *
179
+ * @param filter Optional filter function to only emit events complying
180
+ * with the function.
181
+ */
153
182
  watch: EvWatch<T>;
183
+ /**
184
+ * Fetch (Promise-based) all events (matching the event kind chosen) available
185
+ * in the latest known `finalized` block.
186
+ */
154
187
  pull: EvPull<T>;
188
+ /**
189
+ * Filter a bunch of `SystemEvent` and return the decoded `payload` of every
190
+ * of them.
191
+ *
192
+ * @param collection Array of `SystemEvent` to filter.
193
+ */
155
194
  filter: EvFilter<T>;
195
+ /**
196
+ * `isCompatible` enables you to check whether or not the call you're trying
197
+ * to make is compatible with the descriptors you generated on dev time.
198
+ */
156
199
  isCompatible: IsCompatible;
157
200
  };
158
201
  type SystemEvent = {
@@ -173,12 +216,31 @@ type CallOptions$1 = Partial<{
173
216
  }>;
174
217
  type WithCallOptions$1<Args extends Array<any>> = Args["length"] extends 0 ? [options?: CallOptions$1] : [...args: Args, options?: CallOptions$1];
175
218
  interface RuntimeCall<Args extends Array<any>, Payload> {
219
+ /**
220
+ * Get `Payload` (Promise-based) for the runtime call.
221
+ *
222
+ * @param args All keys needed for that runtime call.
223
+ * At the end, optionally set which block to target (latest
224
+ * known finalized is the default) and an AbortSignal.
225
+ */
176
226
  (...args: WithCallOptions$1<Args>): Promise<Payload>;
227
+ /**
228
+ * `isCompatible` enables you to check whether or not the call you're trying
229
+ * to make is compatible with the descriptors you generated on dev time.
230
+ */
177
231
  isCompatible: IsCompatible;
178
232
  }
179
233
 
180
234
  type CallOptions = Partial<{
235
+ /**
236
+ * `at` could be a blockHash, `best`, or `finalized` (default)
237
+ */
181
238
  at: string;
239
+ /**
240
+ * `signal` allows you to abort an ongoing Promise. See [MDN
241
+ * docs](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) for
242
+ * more information
243
+ */
182
244
  signal: AbortSignal;
183
245
  }>;
184
246
  type WithCallOptions<Args extends Array<any>> = [
@@ -187,15 +249,73 @@ type WithCallOptions<Args extends Array<any>> = [
187
249
  ];
188
250
  type PossibleParents<A extends Array<any>> = A extends [...infer Left, any] ? Left | PossibleParents<Left> : [];
189
251
  type StorageEntryWithoutKeys<Payload> = {
252
+ /**
253
+ * `isCompatible` enables you to check whether or not the call you're trying
254
+ * to make is compatible with the descriptors you generated on dev time.
255
+ */
190
256
  isCompatible: IsCompatible;
257
+ /**
258
+ * Get `Payload` (Promise-based) for the storage entry.
259
+ *
260
+ * @param options Optionally set which block to target (latest known
261
+ * finalized is the default) and an AbortSignal.
262
+ */
191
263
  getValue: (options?: CallOptions) => Promise<Payload>;
264
+ /**
265
+ * Watch changes in `Payload` (observable-based) for the storage entry.
266
+ *
267
+ * @param bestOrFinalized Optionally choose which block to query and watch
268
+ * changes, `best` or `finalized` (default)
269
+ */
192
270
  watchValue: (bestOrFinalized?: "best" | "finalized") => Observable<Payload>;
193
271
  };
194
272
  type StorageEntryWithKeys<Args extends Array<any>, Payload> = {
273
+ /**
274
+ * `isCompatible` enables you to check whether or not the call you're trying
275
+ * to make is compatible with the descriptors you generated on dev time.
276
+ */
195
277
  isCompatible: IsCompatible;
278
+ /**
279
+ * Get `Payload` (Promise-based) for the storage entry with a specific set of
280
+ * `Args`.
281
+ *
282
+ * @param args All keys needed for that storage entry.
283
+ * At the end, optionally set which block to target (latest
284
+ * known finalized is the default) and an AbortSignal.
285
+ */
196
286
  getValue: (...args: [...WithCallOptions<Args>]) => Promise<Payload>;
287
+ /**
288
+ * Watch changes in `Payload` (observable-based) for the storage entry.
289
+ *
290
+ * @param args All keys needed for that storage entry.
291
+ * At the end, optionally choose which block to query and
292
+ * watch changes, `best` or `finalized` (default)
293
+ */
197
294
  watchValue: (...args: [...Args, bestOrFinalized?: "best" | "finalized"]) => Observable<Payload>;
295
+ /**
296
+ * Get an Array of `Payload` (Promise-based) for the storage entry with
297
+ * several sets of `Args`.
298
+ *
299
+ * @param keys Array of sets of keys needed for the storage entry.
300
+ * @param options Optionally set which block to target (latest known
301
+ * finalized is the default) and an AbortSignal.
302
+ */
198
303
  getValues: (keys: Array<[...Args]>, options?: CallOptions) => Promise<Array<Payload>>;
304
+ /**
305
+ * Get an Array of `Payload` (Promise-based) for the storage entry with a
306
+ * subset of `Args`.
307
+ *
308
+ * @param args Subset of keys needed for the storage entry.
309
+ * At the end, optionally set which block to target (latest
310
+ * known finalized is the default) and an AbortSignal.
311
+ * @example
312
+ *
313
+ * // this is a query with 3 keys
314
+ * typedApi.query.Pallet.Query.getEntries({ at: "best" }) // no keys
315
+ * typedApi.query.Pallet.Query.getEntries(arg1, { at: "finalized" }) // 1/3 keys
316
+ * typedApi.query.Pallet.Query.getEntries(arg1, arg2, { at: "0x12345678" }) // 2/3 keys
317
+ *
318
+ */
199
319
  getEntries: (...args: WithCallOptions<PossibleParents<Args>>) => Promise<Array<{
200
320
  keyArgs: Args;
201
321
  value: NonNullable<Payload>;
@@ -331,8 +451,8 @@ type TypedApi<D extends ChainDefinition> = {
331
451
  };
332
452
  interface PolkadotClient {
333
453
  /**
334
- * Retrieve the ChainSpecData as it comes from the
335
- * [JSON-RPC spec](https://paritytech.github.io/json-rpc-interface-spec/api/chainSpec.html)
454
+ * Retrieve the ChainSpecData as it comes from the [JSON-RPC
455
+ * spec](https://paritytech.github.io/json-rpc-interface-spec/api/chainSpec.html)
336
456
  */
337
457
  getChainSpecData: () => Promise<ChainSpecData>;
338
458
  /**
@@ -461,4 +581,4 @@ type FixedSizeArray<L extends number, T> = Array<T> & {
461
581
  */
462
582
  declare function createClient(provider: JsonRpcProvider): PolkadotClient;
463
583
 
464
- export { type ApisDescriptors, type ApisTypedef, type AssetDescriptor, type ChainDefinition, type ConstFromPalletsDef, type DescriptorEntry, type DescriptorsValue, type ErrorsFromPalletsDef, type EventPhase, type EventsFromPalletsDef, type FixedSizeArray, type PalletDescriptors, type PalletsTypedef, type PlainDescriptor, type PolkadotClient, type QueryFromPalletsDef, type RuntimeDescriptor, type StorageDescriptor, type Transaction, type TxBestBlocksState, type TxBroadcastEvent, type TxBroadcasted, type TxCall, type TxDescriptor, type TxEntry, type TxEvent, type TxEventsPayload, type TxFinalized, type TxFinalizedPayload, type TxFromPalletsDef, type TxInBestBlocksFound, type TxInBestBlocksNotFound, type TxObservable, type TxOptions, type TxPromise, type TxSignFn, type TxSigned, type TypedApi, createClient, createTxEntry, submit, submit$ };
584
+ export { type ApisTypedef, type AssetDescriptor, type ChainDefinition, type ConstFromPalletsDef, type DescriptorEntry, type ErrorsFromPalletsDef, type EventPhase, type EventsFromPalletsDef, type FixedSizeArray, type PalletsTypedef, type PlainDescriptor, type PolkadotClient, type QueryFromPalletsDef, type RuntimeDescriptor, type StorageDescriptor, type Transaction, type TxBestBlocksState, type TxBroadcastEvent, type TxBroadcasted, type TxCall, type TxDescriptor, type TxEntry, type TxEvent, type TxEventsPayload, type TxFinalized, type TxFinalizedPayload, type TxFromPalletsDef, type TxInBestBlocksFound, type TxInBestBlocksNotFound, type TxObservable, type TxOptions, type TxPromise, type TxSignFn, type TxSigned, type TypedApi, createClient, createTxEntry, submit, submit$ };