Add method name & prefix to StorageFunction (#182)

* Add methods & prefix to StorageFunction

* Match method/section to exposed names

* Export method/section on extrinsic & jsonrpc

* PR comment prefix -> section
This commit is contained in:
Jaco Greeff
2018-10-02 11:10:17 +02:00
committed by GitHub
parent 92d72d0007
commit 2f60ba0e1c
12 changed files with 38 additions and 26 deletions
+3 -3
View File
@@ -37,14 +37,14 @@ export default class ApiBase {
return this.api.isConnected();
}
rawCall = <T> ({ name, section }: Method, ...params: Array<any>): Observable<T> => {
rawCall = <T> ({ method, section }: Method, ...params: Array<any>): Observable<T> => {
const apiSection = this.api[section as keyof RxApiInterface] as RxApiInterface$Section;
assert(apiSection, `Unable to find 'api.${section}'`);
const fn: RxApiInterface$Method = apiSection[name];
const fn: RxApiInterface$Method = apiSection[method];
assert(fn, `Unable to find 'api.${section}.${name}'`);
assert(fn, `Unable to find 'api.${section}.${method}'`);
return fn.apply(null, params);
}