aboutsummaryrefslogtreecommitdiffstats
path: root/lib/contract.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-20 22:06:05 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-20 22:06:05 +0800
commit380c1522ac450fdafe9bfb8e2d2f60fdfe918745 (patch)
tree8ec905b875a77a86f279f174a32e413ebe22a25a /lib/contract.js
parent6a58db66f7f42a49667bcc751418256441752279 (diff)
downloadgo-tangerine-380c1522ac450fdafe9bfb8e2d2f60fdfe918745.tar
go-tangerine-380c1522ac450fdafe9bfb8e2d2f60fdfe918745.tar.gz
go-tangerine-380c1522ac450fdafe9bfb8e2d2f60fdfe918745.tar.bz2
go-tangerine-380c1522ac450fdafe9bfb8e2d2f60fdfe918745.tar.lz
go-tangerine-380c1522ac450fdafe9bfb8e2d2f60fdfe918745.tar.xz
go-tangerine-380c1522ac450fdafe9bfb8e2d2f60fdfe918745.tar.zst
go-tangerine-380c1522ac450fdafe9bfb8e2d2f60fdfe918745.zip
solidity methods "overloading"
Diffstat (limited to 'lib/contract.js')
-rw-r--r--lib/contract.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/contract.js b/lib/contract.js
index 744fc88a4..2e8ef8ce4 100644
--- a/lib/contract.js
+++ b/lib/contract.js
@@ -53,12 +53,16 @@ var contract = function (address, desc) {
var contract = {};
desc.forEach(function (method) {
- contract[method.name] = function () {
+
+ var displayName = abi.methodDisplayName(method.name);
+ var typeName = abi.methodTypeName(method.name);
+
+ var impl = function () {
var params = Array.prototype.slice.call(arguments);
- var parsed = inputParser[method.name].apply(null, params);
+ var parsed = inputParser[displayName][typeName].apply(null, params);
var onSuccess = function (result) {
- return outputParser[method.name](result);
+ return outputParser[displayName][typeName](result);
};
return {
@@ -80,6 +84,12 @@ var contract = function (address, desc) {
}
};
};
+
+ if (contract[displayName] === undefined) {
+ contract[displayName] = impl;
+ }
+
+ contract[displayName][typeName] = impl;
});
return contract;