Skip to content
Snippets Groups Projects
Commit c51a2db8 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Algunos bugs

parent b8fd8d9f
No related branches found
No related tags found
No related merge requests found
......@@ -97,25 +97,23 @@ module.exports = class Libbfa
var w3 = new this.Web3( this.provider );
var req_url = this.req_url;
var _bfa = this;
// This could just remain the same number all the time.
var unneededcounter = 1;
w3.jsonify = function( opname, params )
{
var extra = params.join(',');
return JSON.parse(
'{'+
'"jsonrpc":"2.0",' +
'"id":1,' +
'"method":"' + opname + '",' +
'"params":[' + extra + ']' +
'}'
);
var obj = {};
obj.id = unneededcounter++;
obj.jsonrpc = "2.0";
obj.method = opname;
obj.params = params;
return obj;
};
w3.rpcreq = function( opname, params, callback )
{
var body = w3.jsonify( opname, params );
request.post({
uri: req_url,
json: true,
body: body,
body: w3.jsonify( opname, params ),
callback: function RPCresponse( err, obj )
{
var r;
......@@ -154,7 +152,7 @@ module.exports = class Libbfa
// in a TCP stream .
// Writes out data and closes our end of the connection.
// Geth will reply and then close it's end.
s.end( w3.jsonify(opname,params) );
socket.end( w3.jsonify(opname,params).valueOf() );
});
socket.on("data", (d) => {
try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment