Dangling st -> query renames (#273)

This commit is contained in:
Jaco Greeff
2018-10-12 17:57:54 +02:00
committed by GitHub
parent 15ed626e2e
commit 64e3ca653d
4 changed files with 28 additions and 28 deletions
+25 -25
View File
@@ -33,7 +33,7 @@ export default abstract class ApiBase<R, S, E> implements ApiBaseInterface<R, S,
private _eventemitter: EventEmitter;
protected _extrinsics?: E;
protected _genesisHash?: Hash;
protected _storage?: S;
protected _query?: S;
protected _rpc: R;
protected _rpcBase: Rpc;
protected _runtimeMetadata?: RuntimeMetadata;
@@ -93,7 +93,29 @@ export default abstract class ApiBase<R, S, E> implements ApiBaseInterface<R, S,
}
/**
* @description Contains all the raw rpc sections and their subsequent methods in the API as defined by the jsonrpc interface definitions. Unlike the dynamic `api.st` and `api.tx` sections, these methods are fixed (although extensible with node upgrades) and not determined by the runtime.
* @description Contains all the chain state modules and their subsequent methods in the API. These are attached dynamically from the runtime metadata.
*
* All calls inside the namespace, is denoted by `section`.`method` and may take an optional query parameter. As an example, `api.query.timestamp.now()` (current block timestamp) does not take parameters, while `api.query.system.accountNonce(<accountId>)` (retrieving the associated nonce for an account), takes the `AccountId` as a parameter.
*
* @example
* <BR>
*
* ```javascript
* api.query.balances
* .freeBalance(<accountId>)
* .subscribe((balance) => {
* console.log('new balance', balance);
* });
* ```
*/
get query (): S {
assert(!isUndefined(this._query), INIT_ERROR);
return this._query as S;
}
/**
* @description Contains all the raw rpc sections and their subsequent methods in the API as defined by the jsonrpc interface definitions. Unlike the dynamic `api.query` and `api.tx` sections, these methods are fixed (although extensible with node upgrades) and not determined by the runtime.
*
* RPC endpoints available here allow for the query of chain, node and system information, in addition to providing interfaces for the raw queries of state (usine known keys) and the submission of transactions.
*
@@ -112,28 +134,6 @@ export default abstract class ApiBase<R, S, E> implements ApiBaseInterface<R, S,
return this._rpc;
}
/**
* @description Contains all the chain state modules and their subsequent methods in the API. These are attached dynamically from the runtime metadata.
*
* All calls inside the namespace, is denoted by `section`.`method` and may take an optional query parameter. As an example, `api.query.timestamp.now()` (current block timestamp) does not take parameters, while `api.query.system.accountNonce(<accountId>)` (retrieving the associated nonce for an account), takes the `AccountId` as a parameter.
*
* @example
* <BR>
*
* ```javascript
* api.query.balances
* .freeBalance(<accountId>)
* .subscribe((balance) => {
* console.log('new balance', balance);
* });
* ```
*/
get st (): S {
assert(!isUndefined(this._storage), INIT_ERROR);
return this._storage as S;
}
/**
* @description Contains all the extrinsic modules and their subsequent methods in the API. It allows for the construction of transactions and the submission thereof. These are attached dynamically from the runtime metadata.
*
@@ -222,7 +222,7 @@ export default abstract class ApiBase<R, S, E> implements ApiBaseInterface<R, S,
const storage = storageFromMeta(this.runtimeMetadata);
this._extrinsics = this.decorateExtrinsics(extrinsics);
this._storage = this.decorateStorage(storage);
this._query = this.decorateStorage(storage);
Method.injectExtrinsics(extrinsics);
+1 -1
View File
@@ -16,8 +16,8 @@ export interface ApiBaseInterface <R, S, E> {
readonly genesisHash: Hash;
readonly runtimeMetadata: RuntimeMetadata;
readonly runtimeVersion: RuntimeVersion;
readonly query: S;
readonly rpc: R;
readonly st: S;
readonly tx: E
on: (type: ApiInterface$Events, handler: (...args: Array<any>) => any) => void;
@@ -22,7 +22,7 @@ describe.skip('e2e queries', () => {
expect(api.runtimeMetadata).toBeDefined();
expect(api.runtimeVersion).toBeDefined();
expect(api.rpc).toBeDefined();
expect(api.st).toBeDefined();
expect(api.query).toBeDefined();
expect(api.tx).toBeDefined();
});
+1 -1
View File
@@ -22,7 +22,7 @@ describe.skip('e2e queries', () => {
expect(api.runtimeMetadata).toBeDefined();
expect(api.runtimeVersion).toBeDefined();
expect(api.rpc).toBeDefined();
expect(api.st).toBeDefined();
expect(api.query).toBeDefined();
expect(api.tx).toBeDefined();
});