Add rpc_methods (#1397)

* Add rpc_methods

* Adjust interface tests

* Add account_nextIndex & contracts_call, filter

* Rework AbstractArray includes with some

* Adjust tests

* Ordering

* Correct definitions (pull in from methods)

* Be agressive on filtering, regardless of isOptional

* async/await in filterRpcMethods

* map Text[] -> string[]

* Correct naming for account_nextIndex

* Remove/don't remove rpc_methods as applicable

* Cleanup method handling errors
This commit is contained in:
Jaco Greeff
2019-09-16 11:40:54 +02:00
committed by GitHub
parent 5576dacd9a
commit bed3f9f4c5
18 changed files with 262 additions and 12 deletions
+13 -1
View File
@@ -56,10 +56,16 @@ export default class Rpc implements RpcInterface {
public readonly provider: ProviderInterface;
public readonly account: RpcInterface['account'];
public readonly author: RpcInterface['author'];
public readonly chain: RpcInterface['chain'];
public readonly contracts: RpcInterface['contracts'];
public readonly rpc: RpcInterface['rpc'];
public readonly state: RpcInterface['state'];
public readonly system: RpcInterface['system'];
@@ -75,8 +81,11 @@ export default class Rpc implements RpcInterface {
this.provider = provider;
this.account = this.createInterface('account');
this.author = this.createInterface('author');
this.contracts = this.createInterface('contracts');
this.chain = this.createInterface('chain');
this.rpc = this.createInterface('rpc');
this.state = this.createInterface('state');
this.system = this.createInterface('system');
}
@@ -161,7 +170,10 @@ export default class Rpc implements RpcInterface {
catchError((error): any => {
const message = this.createErrorMessage(method, error);
l.error(message);
// don't scare with old nodes, this is handled transparently
if (rpcName !== 'rpc_methods') {
l.error(message);
}
return throwError(new Error(message));
}),