Adjust class privates via #, where applicable (#1921)

* Adjust class priates via #, where applicable

* Remove stray log

* Cleanup rpc-provider

* Small adjustments

* No private access in tests

* Submittable privates

* Use derive for nonce derivation

* Tweak observers

* Alphabetical privates
This commit is contained in:
Jaco Greeff
2020-02-22 11:29:50 +01:00
committed by GitHub
parent ccf32a6289
commit 3bf4c3fac5
32 changed files with 406 additions and 514 deletions
+7 -7
View File
@@ -36,9 +36,9 @@ const l = logger('api-http');
* @see [[WsProvider]]
*/
export default class HttpProvider implements ProviderInterface {
private coder: Coder;
readonly #coder: Coder;
private endpoint: string;
readonly #endpoint: string;
/**
* @param {string} endpoint The endpoint url starting with http://
@@ -46,8 +46,8 @@ export default class HttpProvider implements ProviderInterface {
constructor (endpoint: string = defaults.HTTP_URL) {
assert(/^(https|http):\/\//.test(endpoint), `Endpoint should start with 'http://', received '${endpoint}'`);
this.coder = new Coder();
this.endpoint = endpoint;
this.#coder = new Coder();
this.#endpoint = endpoint;
}
/**
@@ -95,8 +95,8 @@ export default class HttpProvider implements ProviderInterface {
* @summary Send HTTP POST Request with Body to configured HTTP Endpoint.
*/
public async send (method: string, params: any[]): Promise<any> {
const body = this.coder.encodeJson(method, params);
const response = await fetch(this.endpoint, {
const body = this.#coder.encodeJson(method, params);
const response = await fetch(this.#endpoint, {
body,
headers: {
Accept: 'application/json',
@@ -110,7 +110,7 @@ export default class HttpProvider implements ProviderInterface {
const result = await response.json();
return this.coder.decodeResponse(result);
return this.#coder.decodeResponse(result);
}
/**