solidity/helpers/FakeHttpProvider2.js
Marek Kotewicz 572d268f28 Squashed 'libjsqrc/ethereumjs/' changes from c74c854..3b799d1
3b799d1 fixed typos
c5f6379 version 0.3.3
d795d36 fixed trimming call output prefix
a2f561f fixed calling contract only with array param
4912ec6 tests for decoding solidity params
2b4fd21 solidity param encoding tests

git-subtree-dir: libjsqrc/ethereumjs
git-subtree-split: 3b799d128452639463424c657956ee90a28daec6
2015-04-26 17:40:35 +02:00

28 lines
693 B
JavaScript

var FakeHttpProvider = require('./FakeHttpProvider');
var FakeHttpProvider2 = function () {
this.counter = 0;
this.resultList = [];
};
FakeHttpProvider2.prototype = new FakeHttpProvider();
FakeHttpProvider2.prototype.constructor = FakeHttpProvider2;
FakeHttpProvider2.prototype.injectResultList = function (list) {
this.resultList = list;
};
FakeHttpProvider2.prototype.getResponse = function () {
var result = this.resultList[this.counter];
this.counter++;
if (result.type === 'batch') {
this.injectBatchResults(result.result);
} else {
this.injectResult(result.result);
}
return this.response;
};
module.exports = FakeHttpProvider2;