aboutsummaryrefslogtreecommitdiffstats
path: root/lib/web3.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/web3.js')
-rw-r--r--lib/web3.js23
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/web3.js b/lib/web3.js
index 166bf68de..515c8c37b 100644
--- a/lib/web3.js
+++ b/lib/web3.js
@@ -129,14 +129,10 @@ var setupMethods = function (obj, methods) {
obj[method.name] = function () {
var args = Array.prototype.slice.call(arguments);
var call = typeof method.call === 'function' ? method.call(args) : method.call;
- var result = web3.provider.send({
+ return web3.provider.send({
call: call,
args: args
});
-
- result = JSON.parse(result);
- return result.result;
-
};
});
};
@@ -147,24 +143,17 @@ var setupProperties = function (obj, properties) {
properties.forEach(function (property) {
var proto = {};
proto.get = function () {
- var result = web3.provider.send({
+ return web3.provider.send({
call: property.getter
});
-
- result = JSON.parse(result);
- return result.result;
-
};
+
if (property.setter) {
proto.set = function (val) {
- var result = web3.provider.send({
+ return web3.provider.send({
call: property.setter,
args: [val]
});
-
- result = JSON.parse(result);
- return result.result;
-
};
}
Object.defineProperty(obj, property.name, proto);
@@ -172,6 +161,7 @@ var setupProperties = function (obj, properties) {
};
// TODO: import from a dependency, don't duplicate.
+// TODO: use bignumber for that!
var hexToDec = function (hex) {
return parseInt(hex, 16).toString();
};
@@ -330,9 +320,8 @@ var shhWatch = {
setupMethods(shhWatch, shhWatchMethods());
web3.setProvider = function(provider) {
- provider.onmessage = messageHandler;
+ //provider.onmessage = messageHandler; // there will be no async calls, to remove
web3.provider.set(provider);
- web3.provider.sendQueued();
};
/// callled when there is new incoming message