@polkadot/api-base 9.8.2 → 9.9.2
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/cjs/packageInfo.js +1 -1
- package/package.json +4 -4
- package/packageInfo.js +1 -1
- package/types/base.d.ts +12 -12
- package/types/calls.d.ts +2 -2
- package/types/derive.d.ts +2 -2
- package/types/errors.d.ts +1 -1
- package/types/events.d.ts +1 -1
- package/types/rpc.d.ts +4 -4
- package/types/storage.d.ts +8 -8
- package/types/submittable.d.ts +6 -6
package/cjs/packageInfo.js
CHANGED
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./cjs/detectPackage.js"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "9.
|
|
23
|
+
"version": "9.9.2",
|
|
24
24
|
"main": "./cjs/index.js",
|
|
25
25
|
"module": "./index.js",
|
|
26
26
|
"types": "./index.d.ts",
|
|
@@ -116,9 +116,9 @@
|
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@babel/runtime": "^7.20.1",
|
|
119
|
-
"@polkadot/rpc-core": "9.
|
|
120
|
-
"@polkadot/types": "9.
|
|
121
|
-
"@polkadot/util": "^10.1.
|
|
119
|
+
"@polkadot/rpc-core": "9.9.2",
|
|
120
|
+
"@polkadot/types": "9.9.2",
|
|
121
|
+
"@polkadot/util": "^10.1.14",
|
|
122
122
|
"rxjs": "^7.5.7"
|
|
123
123
|
}
|
|
124
124
|
}
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@polkadot/api-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '9.
|
|
10
|
+
version: '9.9.2'
|
|
11
11
|
};
|
package/types/base.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
2
|
import type { AnyFunction, Callback, Codec } from '@polkadot/types/types';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
3
|
+
export type Push<T extends readonly unknown[], V> = [...T, V];
|
|
4
|
+
export type DropLast<T extends readonly unknown[]> = T extends readonly [...infer U, any?] ? U : [...T];
|
|
5
|
+
export type ApiTypes = 'promise' | 'rxjs';
|
|
6
|
+
export type ObsInnerType<O extends Observable<any>> = O extends Observable<infer U> ? U : never;
|
|
7
|
+
export type VoidFn = () => void;
|
|
8
|
+
export type UnsubscribePromise = Promise<VoidFn>;
|
|
9
|
+
export type PromiseOrObs<ApiType extends ApiTypes, T> = ApiType extends 'rxjs' ? Observable<T> : Promise<T>;
|
|
10
|
+
export type MethodResult<ApiType extends ApiTypes, F extends AnyFunction> = ApiType extends 'rxjs' ? RxResult<F> : PromiseResult<F>;
|
|
11
11
|
export interface RxResult<F extends AnyFunction> {
|
|
12
12
|
(...args: Parameters<F>): Observable<ObsInnerType<ReturnType<F>>>;
|
|
13
13
|
<T>(...args: Parameters<F>): Observable<T>;
|
|
@@ -22,13 +22,13 @@ export interface DecorateMethodOptions {
|
|
|
22
22
|
methodName?: string;
|
|
23
23
|
overrideNoSub?: (...args: unknown[]) => Observable<Codec>;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
25
|
+
export type DecorateFn<T extends Codec> = (...args: any[]) => Observable<T>;
|
|
26
26
|
export interface PaginationOptions<A = unknown> {
|
|
27
27
|
args: A[];
|
|
28
28
|
pageSize: number;
|
|
29
29
|
startKey?: string;
|
|
30
30
|
}
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
export
|
|
31
|
+
export type DecorateMethod<ApiType extends ApiTypes, T = any> = <M extends (...args: any[]) => Observable<any>>(method: M, options?: DecorateMethodOptions) => T;
|
|
32
|
+
type AsCodec<R extends Codec | any> = R extends Codec ? R : Codec;
|
|
33
|
+
export type ReturnCodec<F extends AnyFunction> = AsCodec<ObsInnerType<ReturnType<F>>>;
|
|
34
34
|
export {};
|
package/types/calls.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
2
|
import type { AnyFunction, Codec, DefinitionCallNamed } from '@polkadot/types/types';
|
|
3
3
|
import type { ApiTypes, ReturnCodec } from './base';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type DecoratedCallBase<ApiType extends ApiTypes, F extends AnyFunction = (...args: any[]) => Observable<Codec>> = ApiType extends 'rxjs' ? <T extends Codec | any = ReturnCodec<F>>(...args: Parameters<F>) => Observable<T> : <T extends Codec | any = ReturnCodec<F>>(...args: Parameters<F>) => Promise<T>;
|
|
5
|
+
export type AugmentedCall<ApiType extends ApiTypes, F extends AnyFunction = (...args: any[]) => Observable<Codec>> = DecoratedCallBase<ApiType, F> & {
|
|
6
6
|
/** The metadata/description/definition for this method */
|
|
7
7
|
meta: DefinitionCallNamed;
|
|
8
8
|
};
|
package/types/derive.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
type DeriveCreator = (instanceId: string, api: unknown) => (...args: unknown[]) => Observable<any>;
|
|
3
|
+
export type DeriveCustom = Record<string, Record<string, DeriveCreator>>;
|
|
4
4
|
export {};
|
package/types/errors.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IsError } from '@polkadot/types/metadata/decorate/types';
|
|
2
2
|
import type { ApiTypes } from './base';
|
|
3
|
-
export
|
|
3
|
+
export type AugmentedError<ApiType extends ApiTypes> = IsError;
|
|
4
4
|
export interface AugmentedErrors<ApiType extends ApiTypes> {
|
|
5
5
|
}
|
|
6
6
|
export interface DecoratedErrors<ApiType extends ApiTypes> extends AugmentedErrors<ApiType> {
|
package/types/events.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IsEvent } from '@polkadot/types/metadata/decorate/types';
|
|
2
2
|
import type { AnyTuple } from '@polkadot/types/types';
|
|
3
3
|
import type { ApiTypes } from './base';
|
|
4
|
-
export
|
|
4
|
+
export type AugmentedEvent<ApiType extends ApiTypes, T extends AnyTuple = AnyTuple, N = unknown> = IsEvent<T, N>;
|
|
5
5
|
export interface AugmentedEvents<ApiType extends ApiTypes> {
|
|
6
6
|
}
|
|
7
7
|
export interface DecoratedEvents<ApiType extends ApiTypes> extends AugmentedEvents<ApiType> {
|
package/types/rpc.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ export interface PromiseRpcResult<F extends AnyFunction> extends PromiseResult<F
|
|
|
11
11
|
raw<T>(...args: Push<Parameters<F>, Callback<T>>): UnsubscribePromise;
|
|
12
12
|
meta: DefinitionRpc;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
15
|
-
export
|
|
14
|
+
export type RpcMethodResult<ApiType extends ApiTypes, F extends AnyFunction> = ApiType extends 'rxjs' ? RxRpcResult<F> : PromiseRpcResult<F>;
|
|
15
|
+
export type DecoratedRpcSection<ApiType extends ApiTypes, Section> = {
|
|
16
16
|
[M in keyof Section]: Section[M] extends AnyFunction ? RpcMethodResult<ApiType, Section[M]> : never;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
19
|
-
export
|
|
18
|
+
export type RawRpcType<ApiType extends ApiTypes> = (method: string, ...params: unknown[]) => ApiType extends 'rxjs' ? Observable<AnyJson> : Promise<AnyJson>;
|
|
19
|
+
export type DecoratedRpc<ApiType extends ApiTypes, AllSections> = {
|
|
20
20
|
[S in keyof AllSections]: DecoratedRpcSection<ApiType, AllSections[S]>;
|
|
21
21
|
} & RawRpcType<ApiType>;
|
package/types/storage.d.ts
CHANGED
|
@@ -23,9 +23,9 @@ export interface StorageEntryPromiseOverloadsAt {
|
|
|
23
23
|
(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<Codec>;
|
|
24
24
|
<T extends Codec>(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<T>;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
26
|
+
export type GenericStorageEntryFunction = (...args: unknown[]) => Observable<Codec>;
|
|
27
|
+
export type QueryableStorageEntry<ApiType extends ApiTypes, A extends AnyTuple = AnyTuple> = ApiType extends 'rxjs' ? AugmentedQuery<'rxjs', GenericStorageEntryFunction, A> : AugmentedQuery<'promise', GenericStorageEntryFunction, A> & StorageEntryPromiseOverloads;
|
|
28
|
+
export type QueryableStorageEntryAt<ApiType extends ApiTypes, A extends AnyTuple = AnyTuple> = ApiType extends 'rxjs' ? AugmentedQueryAt<'rxjs', GenericStorageEntryFunction, A> : AugmentedQueryAt<'promise', GenericStorageEntryFunction, A> & StorageEntryPromiseOverloadsAt;
|
|
29
29
|
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> extends StorageEntryBaseAt<ApiType, F, A> {
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated Use api.at(<blockHash>)
|
|
@@ -63,7 +63,7 @@ export interface QueryableModuleStorage<ApiType extends ApiTypes> {
|
|
|
63
63
|
export interface QueryableModuleStorageAt<ApiType extends ApiTypes> {
|
|
64
64
|
[key: string]: QueryableStorageEntryAt<ApiType, AnyTuple>;
|
|
65
65
|
}
|
|
66
|
-
export
|
|
66
|
+
export type QueryableStorageMultiArg<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType> | [
|
|
67
67
|
QueryableStorageEntry<ApiType>,
|
|
68
68
|
...unknown[]
|
|
69
69
|
];
|
|
@@ -74,10 +74,10 @@ export interface QueryableStorageMultiPromise<ApiType extends ApiTypes> {
|
|
|
74
74
|
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[], callback: Callback<T>): UnsubscribePromise;
|
|
75
75
|
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[]): Promise<T>;
|
|
76
76
|
}
|
|
77
|
-
export
|
|
78
|
-
export
|
|
79
|
-
export
|
|
80
|
-
export
|
|
77
|
+
export type QueryableStorageMulti<ApiType extends ApiTypes> = ApiType extends 'rxjs' ? QueryableStorageMultiBase<ApiType> : QueryableStorageMultiPromise<ApiType>;
|
|
78
|
+
export type AugmentedQuery<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> = MethodResult<ApiType, F> & StorageEntryBase<ApiType, F, A>;
|
|
79
|
+
export type AugmentedQueryAt<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> = MethodResult<ApiType, F> & StorageEntryBaseAt<ApiType, F, A>;
|
|
80
|
+
export type AugmentedQueryDoubleMap<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> = AugmentedQuery<ApiType, F, A>;
|
|
81
81
|
export interface AugmentedQueries<ApiType extends ApiTypes> {
|
|
82
82
|
}
|
|
83
83
|
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
|
package/types/submittable.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Observable } from 'rxjs';
|
|
|
2
2
|
import type { AccountId, Address, ApplyExtrinsicResult, Call, DispatchError, DispatchInfo, EventRecord, Extrinsic, ExtrinsicStatus, Hash, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
|
|
3
3
|
import type { AnyFunction, AnyNumber, AnyTuple, Callback, CallBase, Codec, IExtrinsicEra, IKeyringPair, ISubmittableResult, Signer } from '@polkadot/types/types';
|
|
4
4
|
import type { ApiTypes, PromiseOrObs } from './base';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type AugmentedSubmittable<T extends AnyFunction, A extends AnyTuple = AnyTuple> = T & CallBase<A>;
|
|
6
|
+
export type AddressOrPair = IKeyringPair | string | AccountId | Address;
|
|
7
7
|
export interface SignerOptions {
|
|
8
8
|
blockHash: Uint8Array | string;
|
|
9
9
|
era?: IExtrinsicEra | number;
|
|
@@ -12,10 +12,10 @@ export interface SignerOptions {
|
|
|
12
12
|
tip?: AnyNumber;
|
|
13
13
|
assetId?: AnyNumber;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
15
|
+
export type SubmittableDryRunResult<ApiType extends ApiTypes> = ApiType extends 'rxjs' ? Observable<ApplyExtrinsicResult> : Promise<ApplyExtrinsicResult>;
|
|
16
|
+
export type SubmittableResultResult<ApiType extends ApiTypes, R extends ISubmittableResult = ISubmittableResult> = ApiType extends 'rxjs' ? Observable<R> : Promise<Hash>;
|
|
17
|
+
export type SubmittableResultSubscription<ApiType extends ApiTypes, R extends ISubmittableResult = ISubmittableResult> = ApiType extends 'rxjs' ? Observable<R> : Promise<() => void>;
|
|
18
|
+
export type SubmittablePaymentResult<ApiType extends ApiTypes> = ApiType extends 'rxjs' ? Observable<RuntimeDispatchInfo> : Promise<RuntimeDispatchInfo>;
|
|
19
19
|
export interface SubmittableResultValue {
|
|
20
20
|
dispatchError?: DispatchError;
|
|
21
21
|
dispatchInfo?: DispatchInfo;
|