1 |
|
2 | import type { RpcInterface } from '@polkadot/rpc-core/types';
|
3 | import type { Text } from '@polkadot/types';
|
4 | import type { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
|
5 | import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
|
6 | import type { AnyFunction, Codec, DefinitionRpc, DefinitionRpcSub, DetectCodec, Registry, RegistryTypes } from '@polkadot/types/types';
|
7 | import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecorateMethod, QueryableConsts, QueryableStorage, QueryableStorageMulti, SubmittableExtrinsics } from '../types';
|
8 | import type { VersionedRegistry } from './types';
|
9 | import { BehaviorSubject } from 'rxjs';
|
10 | import { RpcCore } from '@polkadot/rpc-core';
|
11 | import { Metadata } from '@polkadot/types';
|
12 | import { BN } from '@polkadot/util';
|
13 | import { AllDerives } from '../util/decorate';
|
14 | import { Events } from './Events';
|
15 | interface FullDecoration<ApiType extends ApiTypes> {
|
16 | decoratedApi: ApiDecoration<ApiType>;
|
17 | decoratedMeta: DecoratedMeta;
|
18 | }
|
19 | export declare abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
20 | #private;
|
21 | protected __phantom: BN;
|
22 | protected _consts: QueryableConsts<ApiType>;
|
23 | protected _derive?: ReturnType<Decorate<ApiType>['_decorateDerive']>;
|
24 | protected _errors: DecoratedErrors<ApiType>;
|
25 | protected _events: DecoratedEvents<ApiType>;
|
26 | protected _extrinsics?: SubmittableExtrinsics<ApiType>;
|
27 | protected _extrinsicType: number;
|
28 | protected _genesisHash?: Hash;
|
29 | protected _isConnected: BehaviorSubject<boolean>;
|
30 | protected _isReady: boolean;
|
31 | protected readonly _options: ApiOptions;
|
32 | protected _query: QueryableStorage<ApiType>;
|
33 | protected _queryMulti?: QueryableStorageMulti<ApiType>;
|
34 | protected _rpc?: DecoratedRpc<ApiType, RpcInterface>;
|
35 | protected _rpcCore: RpcCore & RpcInterface;
|
36 | protected _runtimeChain?: Text;
|
37 | protected _runtimeMetadata?: Metadata;
|
38 | protected _runtimeVersion?: RuntimeVersion;
|
39 | protected _rx: ApiInterfaceRx;
|
40 | protected _type: ApiTypes;
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | protected _decorateMethod: DecorateMethod<ApiType>;
|
58 | |
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | constructor(options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>);
|
77 | abstract at(blockHash: Uint8Array | string, knownVersion?: RuntimeVersion): Promise<ApiDecoration<ApiType>>;
|
78 | /**
|
79 | * @description Return the current used registry
|
80 | */
|
81 | get registry(): Registry;
|
82 | /**
|
83 | * @description Creates an instance of a type as registered
|
84 | */
|
85 | createType<T extends Codec = Codec, K extends string = string>(type: K, ...params: unknown[]): DetectCodec<T, K>;
|
86 | /**
|
87 | * @description Register additional user-defined of chain-specific types in the type registry
|
88 | */
|
89 | registerTypes(types?: RegistryTypes): void;
|
90 | /**
|
91 | * @returns `true` if the API operates with subscriptions
|
92 | */
|
93 | get hasSubscriptions(): boolean;
|
94 | /**
|
95 | * @returns `true` if the API decorate multi-key queries
|
96 | */
|
97 | get supportMulti(): boolean;
|
98 | protected _emptyDecorated(registry: Registry, blockHash?: Uint8Array): ApiDecoration<ApiType>;
|
99 | protected _createDecorated(registry: VersionedRegistry<ApiType>, fromEmpty: boolean, decoratedApi: ApiDecoration<ApiType> | null, blockHash?: Uint8Array): FullDecoration<ApiType>;
|
100 | protected _injectMetadata(registry: VersionedRegistry<ApiType>, fromEmpty?: boolean): void;
|
101 | /**
|
102 | * @deprecated
|
103 | * backwards compatible endpoint for metadata injection, may be removed in the future (However, it is still useful for testing injection)
|
104 | */
|
105 | injectMetadata(metadata: Metadata, fromEmpty?: boolean, registry?: Registry): void;
|
106 | private _decorateFunctionMeta;
|
107 | protected _filterRpc(methods: string[], additional: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void;
|
108 | protected _filterRpcMethods(exposed: string[]): void;
|
109 | protected _decorateRpc<ApiType extends ApiTypes>(rpc: RpcCore & RpcInterface, decorateMethod: DecorateMethod<ApiType>, input?: Partial<DecoratedRpc<ApiType, RpcInterface>>): DecoratedRpc<ApiType, RpcInterface>;
|
110 | protected _decorateMulti<ApiType extends ApiTypes>(decorateMethod: DecorateMethod<ApiType>): QueryableStorageMulti<ApiType>;
|
111 | protected _decorateMultiAt<ApiType extends ApiTypes>(atApi: ApiDecoration<ApiType>, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array | string): QueryableStorageMulti<ApiType>;
|
112 | protected _decorateExtrinsics<ApiType extends ApiTypes>({ tx }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): SubmittableExtrinsics<ApiType>;
|
113 | private _decorateExtrinsicEntry;
|
114 | protected _decorateStorage<ApiType extends ApiTypes>({ query, registry }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>, blockHash?: Uint8Array): QueryableStorage<ApiType>;
|
115 | private _decorateStorageEntry;
|
116 | private _decorateStorageEntryAt;
|
117 | private _decorateStorageCall;
|
118 | private _decorateStorageRange;
|
119 | private _retrieveMulti;
|
120 | private _retrieveMapKeys;
|
121 | private _retrieveMapKeysPaged;
|
122 | private _retrieveMapEntries;
|
123 | private _retrieveMapEntriesPaged;
|
124 | protected _decorateDeriveRx(decorateMethod: DecorateMethod<ApiType>): AllDerives<'rxjs'>;
|
125 | protected _decorateDerive(decorateMethod: DecorateMethod<ApiType>): AllDerives<ApiType>;
|
126 | /**
|
127 | * Put the `this.onCall` function of ApiRx here, because it is needed by
|
128 | * `api._rx`.
|
129 | */
|
130 | protected _rxDecorateMethod: <Method extends AnyFunction>(method: Method) => Method;
|
131 | }
|
132 | export {};
|