From 620308f820b569db0eec3a013e29c6cd69817cb3 Mon Sep 17 00:00:00 2001
From: Robert Martin-Legene <robert@nic.ar>
Date: Wed, 9 Oct 2019 03:21:19 -0300
Subject: [PATCH] Algunos bugs mas

---
 bin/libbfa.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/libbfa.js b/bin/libbfa.js
index c8a2903..f1ac798 100644
--- a/bin/libbfa.js
+++ b/bin/libbfa.js
@@ -152,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.
-                socket.end( w3.jsonify(opname,params).valueOf() );
+                socket.end( JSON.stringify( w3.jsonify(opname,params).valueOf()));
             });
             socket.on("data", (d) => {
                 try {
@@ -170,6 +170,10 @@ module.exports = class Libbfa
                 err = e;
             });
             socket.on("close", () => {
+                if ( result.error && result.error.code && result.error.message )
+                    err = 'Error ' + result.error.code + ": "+ result.error.message;
+                else
+                    result = result.result;
                 callback( err, result );
             });
         }
-- 
GitLab