Merge branch 'master' into tests
This commit is contained in:
commit
b3eda29f41
22
dist/ethereum.js
vendored
22
dist/ethereum.js
vendored
@ -141,7 +141,6 @@ var toAbiInput = function (json, methodName, params) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = "0x" + padLeft(index.toString(16), 2);
|
|
||||||
var method = json[index];
|
var method = json[index];
|
||||||
|
|
||||||
for (var i = 0; i < method.inputs.length; i++) {
|
for (var i = 0; i < method.inputs.length; i++) {
|
||||||
@ -260,9 +259,22 @@ var outputParser = function (json) {
|
|||||||
return parser;
|
return parser;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var methodSignature = function (json, name) {
|
||||||
|
var method = json[findMethodIndex(json, name)];
|
||||||
|
var result = name + '(';
|
||||||
|
var inputTypes = method.inputs.map(function (inp) {
|
||||||
|
return inp.type;
|
||||||
|
});
|
||||||
|
result += inputTypes.join(',');
|
||||||
|
result += ')';
|
||||||
|
|
||||||
|
return web3.sha3(result);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inputParser: inputParser,
|
inputParser: inputParser,
|
||||||
outputParser: outputParser
|
outputParser: outputParser,
|
||||||
|
methodSignature: methodSignature
|
||||||
};
|
};
|
||||||
|
|
||||||
},{}],2:[function(require,module,exports){
|
},{}],2:[function(require,module,exports){
|
||||||
@ -418,8 +430,10 @@ var contract = function (address, desc) {
|
|||||||
call: function (extra) {
|
call: function (extra) {
|
||||||
extra = extra || {};
|
extra = extra || {};
|
||||||
extra.to = address;
|
extra.to = address;
|
||||||
extra.data = parsed;
|
return abi.methodSignature(desc, method.name).then(function (signature) {
|
||||||
return web3.eth.call(extra).then(onSuccess);
|
extra.data = signature.slice(0, 10) + parsed;
|
||||||
|
return web3.eth.call(extra).then(onSuccess);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
transact: function (extra) {
|
transact: function (extra) {
|
||||||
extra = extra || {};
|
extra = extra || {};
|
||||||
|
6
dist/ethereum.js.map
vendored
6
dist/ethereum.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/ethereum.min.js
vendored
2
dist/ethereum.min.js
vendored
File diff suppressed because one or more lines are too long
20
lib/abi.js
20
lib/abi.js
@ -140,7 +140,6 @@ var toAbiInput = function (json, methodName, params) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = "0x" + padLeft(index.toString(16), 2);
|
|
||||||
var method = json[index];
|
var method = json[index];
|
||||||
|
|
||||||
for (var i = 0; i < method.inputs.length; i++) {
|
for (var i = 0; i < method.inputs.length; i++) {
|
||||||
@ -259,8 +258,21 @@ var outputParser = function (json) {
|
|||||||
return parser;
|
return parser;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
var methodSignature = function (json, name) {
|
||||||
inputParser: inputParser,
|
var method = json[findMethodIndex(json, name)];
|
||||||
outputParser: outputParser
|
var result = name + '(';
|
||||||
|
var inputTypes = method.inputs.map(function (inp) {
|
||||||
|
return inp.type;
|
||||||
|
});
|
||||||
|
result += inputTypes.join(',');
|
||||||
|
result += ')';
|
||||||
|
|
||||||
|
return web3.sha3(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
inputParser: inputParser,
|
||||||
|
outputParser: outputParser,
|
||||||
|
methodSignature: methodSignature
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,8 +46,10 @@ var contract = function (address, desc) {
|
|||||||
call: function (extra) {
|
call: function (extra) {
|
||||||
extra = extra || {};
|
extra = extra || {};
|
||||||
extra.to = address;
|
extra.to = address;
|
||||||
extra.data = parsed;
|
return abi.methodSignature(desc, method.name).then(function (signature) {
|
||||||
return web3.eth.call(extra).then(onSuccess);
|
extra.data = signature.slice(0, 10) + parsed;
|
||||||
|
return web3.eth.call(extra).then(onSuccess);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
transact: function (extra) {
|
transact: function (extra) {
|
||||||
extra = extra || {};
|
extra = extra || {};
|
||||||
|
@ -505,4 +505,5 @@ function messageHandler(data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = web3;
|
if (typeof(module) !== "undefined")
|
||||||
|
module.exports = web3;
|
||||||
|
@ -74,4 +74,5 @@ Object.defineProperty(WebSocketProvider.prototype, "onmessage", {
|
|||||||
set: function(provider) { this.onMessage(provider); }
|
set: function(provider) { this.onMessage(provider); }
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = WebSocketProvider;
|
if (typeof(module) !== "undefined")
|
||||||
|
module.exports = WebSocketProvider;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ethereum.js",
|
"name": "ethereum.js",
|
||||||
"namespace": "ethereum",
|
"namespace": "ethereum",
|
||||||
"version": "0.0.6",
|
"version": "0.0.7",
|
||||||
"description": "Ethereum Compatible JavaScript API",
|
"description": "Ethereum Compatible JavaScript API",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
Loading…
Reference in New Issue
Block a user