Skip to content

Commit

Permalink
improved fake provider, with stacking validation and results
Browse files Browse the repository at this point in the history
  • Loading branch information
frozeman committed Oct 4, 2016
1 parent 8654941 commit f3107c2
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 180 deletions.
4 changes: 3 additions & 1 deletion lib/web3/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ Contract.prototype.deploy = function(options, callback){
return defer.promise;
};

// TODO add constructor as method with .encodeABI

/**
* Encodes any contract function, including the constructor into a data ABI HEX string.
Expand Down Expand Up @@ -752,8 +753,9 @@ Contract.prototype._executeMethod = function _executeMethod(type){
// create the callback method
var methodReturnCallback = function(err, returnValue) {

if(type === 'call')
if(type === 'call') {
returnValue = _this._parent._decodeMethodReturn(_this._method.outputTypes, returnValue);
}


if (err) {
Expand Down
2 changes: 1 addition & 1 deletion lib/web3/requestmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ RequestManager.prototype.sendAsync = function (data, callback) {
}
var payload = Jsonrpc.getInstance().toPayload(data.method, data.params);
this.provider.sendAsync(payload, function (err, result) {
// if(payload.id !== result.id) return callback(new Error('Wrong response id for '+ JSON.stringify(payload)));;
if(payload.id !== result.id) return callback(new Error('Wrong response id "'+ result.id +'" (expected: "'+ payload.id +'") in '+ JSON.stringify(payload)));;

if (err) {
return callback(err);
Expand Down
Loading

0 comments on commit f3107c2

Please sign in to comment.