From 64e3ca653d05f88515d76b41cedc1402c2aadb43 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 12 Oct 2018 17:57:54 +0200 Subject: [PATCH] Dangling st -> query renames (#273) --- packages/api/src/Base.ts | 50 +++++++++---------- packages/api/src/types.d.ts | 2 +- packages/api/test/e2e/promise-queries.spec.js | 2 +- packages/api/test/e2e/rx-queries.spec.js | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/packages/api/src/Base.ts b/packages/api/src/Base.ts index d9a172ae19..c192be981f 100644 --- a/packages/api/src/Base.ts +++ b/packages/api/src/Base.ts @@ -33,7 +33,7 @@ export default abstract class ApiBase implements ApiBaseInterface implements ApiBaseInterface)` (retrieving the associated nonce for an account), takes the `AccountId` as a parameter. + * + * @example + *
+ * + * ```javascript + * api.query.balances + * .freeBalance() + * .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 implements ApiBaseInterface)` (retrieving the associated nonce for an account), takes the `AccountId` as a parameter. - * - * @example - *
- * - * ```javascript - * api.query.balances - * .freeBalance() - * .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 implements ApiBaseInterface { 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) => void; diff --git a/packages/api/test/e2e/promise-queries.spec.js b/packages/api/test/e2e/promise-queries.spec.js index 9e50ecdac8..68f8b7448a 100644 --- a/packages/api/test/e2e/promise-queries.spec.js +++ b/packages/api/test/e2e/promise-queries.spec.js @@ -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(); }); diff --git a/packages/api/test/e2e/rx-queries.spec.js b/packages/api/test/e2e/rx-queries.spec.js index b3164c7a6f..dc94df4fb5 100644 --- a/packages/api/test/e2e/rx-queries.spec.js +++ b/packages/api/test/e2e/rx-queries.spec.js @@ -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(); });