Skip to content

Commit

Permalink
Merge 4dae102 into 10e368d
Browse files Browse the repository at this point in the history
  • Loading branch information
yemel committed Feb 26, 2015
2 parents 10e368d + 4dae102 commit 3965e47
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,14 @@ function generateRPCMethods(constructor, apiCalls, rpc) {
this.batchedCalls.push({
jsonrpc: '2.0',
method: methodName,
params: slice(arguments)
params: slice(arguments),
id: getRandomId()
});
} else {
rpc.call(this, {
method: methodName,
params: slice(arguments, 0, arguments.length - 1)
params: slice(arguments, 0, arguments.length - 1),
id: getRandomId()
}, arguments[arguments.length - 1]);
}

Expand Down Expand Up @@ -268,6 +270,10 @@ function generateRPCMethods(constructor, apiCalls, rpc) {

}

function getRandomId() {
return parseInt(Math.random() * 100000);
}

generateRPCMethods(RpcClient, callspec, rpc);

module.exports = RpcClient;

0 comments on commit 3965e47

Please sign in to comment.