|
|
@ -153,12 +153,12 @@ |
|
|
|
return {call: call, args: args}; |
|
|
|
return {call: call, args: args}; |
|
|
|
}).then(function (request) { |
|
|
|
}).then(function (request) { |
|
|
|
return new Promise(function (resolve, reject) { |
|
|
|
return new Promise(function (resolve, reject) { |
|
|
|
web3.provider.send(request, function (result) { |
|
|
|
web3.provider.send(request, function (err, result) { |
|
|
|
if (result || typeof result === "boolean") { |
|
|
|
if (!err) { |
|
|
|
resolve(result); |
|
|
|
resolve(result); |
|
|
|
return; |
|
|
|
return; |
|
|
|
}
|
|
|
|
}
|
|
|
|
reject(result); |
|
|
|
reject(err); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}).catch(function(err) { |
|
|
|
}).catch(function(err) { |
|
|
@ -173,8 +173,12 @@ |
|
|
|
var proto = {}; |
|
|
|
var proto = {}; |
|
|
|
proto.get = function () { |
|
|
|
proto.get = function () { |
|
|
|
return new Promise(function(resolve, reject) { |
|
|
|
return new Promise(function(resolve, reject) { |
|
|
|
web3.provider.send({call: property.getter}, function(result) { |
|
|
|
web3.provider.send({call: property.getter}, function(err, result) { |
|
|
|
|
|
|
|
if (!err) { |
|
|
|
resolve(result); |
|
|
|
resolve(result); |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
reject(err); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -182,12 +186,12 @@ |
|
|
|
proto.set = function (val) { |
|
|
|
proto.set = function (val) { |
|
|
|
return flattenPromise([val]).then(function (args) { |
|
|
|
return flattenPromise([val]).then(function (args) { |
|
|
|
return new Promise(function (resolve) { |
|
|
|
return new Promise(function (resolve) { |
|
|
|
web3.provider.send({call: property.setter, args: args}, function (result) { |
|
|
|
web3.provider.send({call: property.setter, args: args}, function (err, result) { |
|
|
|
if (result) { |
|
|
|
if (!err) { |
|
|
|
resolve(result); |
|
|
|
resolve(result); |
|
|
|
} else { |
|
|
|
return |
|
|
|
reject(result); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
reject(err); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}).catch(function (err) { |
|
|
|
}).catch(function (err) { |
|
|
@ -438,7 +442,7 @@ |
|
|
|
if(data._id) { |
|
|
|
if(data._id) { |
|
|
|
var cb = web3._callbacks[data._id]; |
|
|
|
var cb = web3._callbacks[data._id]; |
|
|
|
if (cb) { |
|
|
|
if (cb) { |
|
|
|
cb.call(this, data.data) |
|
|
|
cb.call(this, data.error, data.data) |
|
|
|
delete web3._callbacks[data._id]; |
|
|
|
delete web3._callbacks[data._id]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|