@dedot/api 0.0.1-alpha.36 → 0.0.1-alpha.37
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BlockHash, Hash, Metadata, PortableRegistry, RuntimeVersion } from '@dedot/codecs';
|
|
2
2
|
import type { JsonRpcProvider } from '@dedot/providers';
|
|
3
3
|
import { type IStorage } from '@dedot/storage';
|
|
4
|
-
import { GenericSubstrateApi, RpcVersion } from '@dedot/types';
|
|
4
|
+
import { GenericSubstrateApi, RpcVersion, VersionedGenericSubstrateApi } from '@dedot/types';
|
|
5
|
+
import type { SubstrateApi } from '../chaintypes/index.js';
|
|
5
6
|
import { JsonRpcClient } from '../json-rpc/index.js';
|
|
6
7
|
import type { ApiEvent, ApiOptions, ISubstrateClient, ISubstrateClientAt, JsonRpcClientOptions, MetadataKey, SubstrateRuntimeVersion } from '../types.js';
|
|
7
8
|
export declare function ensurePresence<T>(value: T): NonNullable<T>;
|
|
@@ -9,7 +10,7 @@ export declare function ensurePresence<T>(value: T): NonNullable<T>;
|
|
|
9
10
|
* @name BaseSubstrateClient
|
|
10
11
|
* @description Base & shared abstraction for Substrate API Clients
|
|
11
12
|
*/
|
|
12
|
-
export declare abstract class BaseSubstrateClient<ChainApi extends
|
|
13
|
+
export declare abstract class BaseSubstrateClient<Rv extends RpcVersion, ChainApi extends VersionedGenericSubstrateApi = SubstrateApi> extends JsonRpcClient<ChainApi, ApiEvent> implements ISubstrateClient<ChainApi[Rv]> {
|
|
13
14
|
rpcVersion: RpcVersion;
|
|
14
15
|
protected _options: ApiOptions;
|
|
15
16
|
protected _registry?: PortableRegistry;
|
|
@@ -53,12 +54,12 @@ export declare abstract class BaseSubstrateClient<ChainApi extends GenericSubstr
|
|
|
53
54
|
get registry(): PortableRegistry;
|
|
54
55
|
get genesisHash(): Hash;
|
|
55
56
|
get runtimeVersion(): SubstrateRuntimeVersion;
|
|
56
|
-
get consts(): ChainApi['consts'];
|
|
57
|
-
get errors(): ChainApi['errors'];
|
|
58
|
-
get events(): ChainApi['events'];
|
|
59
|
-
get query(): ChainApi['query'];
|
|
60
|
-
get call(): ChainApi['call'];
|
|
61
|
-
protected callAt(hash?: BlockHash): ChainApi['call'];
|
|
62
|
-
get tx(): ChainApi['tx'];
|
|
63
|
-
at<ChainApiAt extends GenericSubstrateApi = ChainApi>(hash: BlockHash): Promise<ISubstrateClientAt<ChainApiAt>>;
|
|
57
|
+
get consts(): ChainApi[Rv]['consts'];
|
|
58
|
+
get errors(): ChainApi[Rv]['errors'];
|
|
59
|
+
get events(): ChainApi[Rv]['events'];
|
|
60
|
+
get query(): ChainApi[Rv]['query'];
|
|
61
|
+
get call(): ChainApi[Rv]['call'];
|
|
62
|
+
protected callAt(hash?: BlockHash): ChainApi[Rv]['call'];
|
|
63
|
+
get tx(): ChainApi[Rv]['tx'];
|
|
64
|
+
at<ChainApiAt extends GenericSubstrateApi = ChainApi[Rv]>(hash: BlockHash): Promise<ISubstrateClientAt<ChainApiAt>>;
|
|
64
65
|
}
|
package/client/DedotClient.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { BaseSubstrateClient } from './BaseSubstrateClient.js';
|
|
|
12
12
|
* __Unstable, use with caution.__
|
|
13
13
|
*/
|
|
14
14
|
export declare class DedotClient<ChainApi extends VersionedGenericSubstrateApi = SubstrateApi>// prettier-end-here
|
|
15
|
-
extends BaseSubstrateClient<ChainApi
|
|
15
|
+
extends BaseSubstrateClient<RpcV2, ChainApi> {
|
|
16
16
|
#private;
|
|
17
17
|
protected _chainHead?: ChainHead;
|
|
18
18
|
protected _chainSpec?: ChainSpec;
|
package/client/LegacyClient.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ import { BaseSubstrateClient } from './BaseSubstrateClient.js';
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export declare class LegacyClient<ChainApi extends VersionedGenericSubstrateApi = SubstrateApi>// prettier-end-here
|
|
46
|
-
extends BaseSubstrateClient<ChainApi
|
|
46
|
+
extends BaseSubstrateClient<RpcLegacy, ChainApi> {
|
|
47
47
|
#private;
|
|
48
48
|
/**
|
|
49
49
|
* Use factory methods (`create`, `new`) to create `Dedot` instances.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ConnectionStatus, JsonRpcProvider, ProviderEvent } from '@dedot/providers';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RpcVersion, VersionedGenericSubstrateApi } from '@dedot/types';
|
|
3
3
|
import { EventEmitter } from '@dedot/utils';
|
|
4
4
|
import type { SubstrateApi } from '../chaintypes/index.js';
|
|
5
5
|
import type { IJsonRpcClient, JsonRpcClientOptions } from '../types.js';
|
|
6
6
|
export declare const isJsonRpcProvider: (provider: any) => provider is JsonRpcProvider;
|
|
7
|
-
export declare class JsonRpcClient<ChainApi extends
|
|
7
|
+
export declare class JsonRpcClient<ChainApi extends VersionedGenericSubstrateApi = SubstrateApi, // prettier-end-here
|
|
8
|
+
Events extends string = ProviderEvent> extends EventEmitter<Events> implements IJsonRpcClient<ChainApi[RpcVersion], Events> {
|
|
8
9
|
#private;
|
|
9
10
|
constructor(options: JsonRpcClientOptions | JsonRpcProvider);
|
|
10
11
|
/**
|
|
@@ -12,13 +13,13 @@ export declare class JsonRpcClient<ChainApi extends GenericSubstrateApi = Substr
|
|
|
12
13
|
*
|
|
13
14
|
* @param options
|
|
14
15
|
*/
|
|
15
|
-
static create<ChainApi extends
|
|
16
|
+
static create<ChainApi extends VersionedGenericSubstrateApi = SubstrateApi>(options: JsonRpcClientOptions | JsonRpcProvider): Promise<JsonRpcClient<ChainApi>>;
|
|
16
17
|
/**
|
|
17
18
|
* Alias for __JsonRpcClient.create__
|
|
18
19
|
*
|
|
19
20
|
* @param options
|
|
20
21
|
*/
|
|
21
|
-
static new<ChainApi extends
|
|
22
|
+
static new<ChainApi extends VersionedGenericSubstrateApi = SubstrateApi>(options: JsonRpcClientOptions | JsonRpcProvider): Promise<JsonRpcClient<ChainApi>>;
|
|
22
23
|
get options(): JsonRpcClientOptions;
|
|
23
24
|
/**
|
|
24
25
|
* @description Check connection status of the api instance
|
|
@@ -46,5 +47,5 @@ export declare class JsonRpcClient<ChainApi extends GenericSubstrateApi = Substr
|
|
|
46
47
|
* const result = await client.rpc.module_rpc_name();
|
|
47
48
|
* ```
|
|
48
49
|
*/
|
|
49
|
-
get rpc(): ChainApi['rpc'];
|
|
50
|
+
get rpc(): ChainApi[RpcVersion]['rpc'];
|
|
50
51
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/api",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.37",
|
|
4
4
|
"description": "A delightful JavaScript/TypeScript client for Polkadot & Substrate",
|
|
5
5
|
"author": "Thang X. Vu <thang@coongcrafts.io>",
|
|
6
|
-
"homepage": "https://github.com/dedotdev/dedot",
|
|
6
|
+
"homepage": "https://github.com/dedotdev/dedot/tree/main/packages/api",
|
|
7
7
|
"repository": {
|
|
8
8
|
"directory": "packages/api",
|
|
9
9
|
"type": "git",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dedot/codecs": "0.0.1-alpha.
|
|
17
|
-
"@dedot/providers": "0.0.1-alpha.
|
|
18
|
-
"@dedot/runtime-specs": "0.0.1-alpha.
|
|
19
|
-
"@dedot/shape": "0.0.1-alpha.
|
|
20
|
-
"@dedot/storage": "0.0.1-alpha.
|
|
21
|
-
"@dedot/types": "0.0.1-alpha.
|
|
22
|
-
"@dedot/utils": "0.0.1-alpha.
|
|
16
|
+
"@dedot/codecs": "0.0.1-alpha.37",
|
|
17
|
+
"@dedot/providers": "0.0.1-alpha.37",
|
|
18
|
+
"@dedot/runtime-specs": "0.0.1-alpha.37",
|
|
19
|
+
"@dedot/shape": "0.0.1-alpha.37",
|
|
20
|
+
"@dedot/storage": "0.0.1-alpha.37",
|
|
21
|
+
"@dedot/types": "0.0.1-alpha.37",
|
|
22
|
+
"@dedot/utils": "0.0.1-alpha.37"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.cjs.json",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@polkadot/types": "^12.0.1"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "6ed023a9455476d39ef810da46928b3f05621879",
|
|
52
52
|
"module": "./index.js",
|
|
53
53
|
"types": "./index.d.ts"
|
|
54
54
|
}
|