Align all RPC methods with Rust (#264)

* Align all RPC methods with Rust

* Adjust tests for extrinsicUpdate (e2e & working)

* Update transfer.spec.js

Auto-complete imports removed
This commit is contained in:
Jaco Greeff
2018-10-12 14:47:22 +02:00
committed by GitHub
parent eb5fbad5aa
commit f8d9f1c76e
15 changed files with 152 additions and 58 deletions
+8 -3
View File
@@ -157,10 +157,15 @@ export default class Rpc implements RpcInterface {
}
private formatInputs (method: RpcMethod, inputs: Array<any>): Array<Base> {
assert(method.params.length === inputs.length, `Expected ${method.params.length} parameters, ${inputs.length} found instead`);
const reqArgCount = method.params.filter(({ isOptional }) => !isOptional).length;
const optText = reqArgCount === method.params.length
? ''
: ` (${method.params.length - reqArgCount} optional)`;
return method.params.map(({ type }, index) =>
createType(type as string, inputs[index])
assert(inputs.length >= reqArgCount && inputs.length <= method.params.length, `Expected ${method.params.length} parameters${optText}, ${inputs.length} found instead`);
return inputs.map((input, index) =>
createType(method.params[index].type, input)
);
}