|
@ -102,18 +102,6 @@ window.eth = (function ethScope() { |
|
|
return p; |
|
|
return p; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var setupProperties = function (root, spec) { |
|
|
|
|
|
var properties = [ |
|
|
|
|
|
{ name: "coinbase", getter: "coinbase", setter: "setCoinbase" }, |
|
|
|
|
|
{ name: "listening", getter: "listening", setter: "setListening" }, |
|
|
|
|
|
{ name: "mining", getter: "mining", setter: "setMining" }, |
|
|
|
|
|
{ name: "gasPrice", getter: "gasPrice"}, |
|
|
|
|
|
{ name: "key", getter: "key" }, |
|
|
|
|
|
{ name: "keys", getter: "keys" }, |
|
|
|
|
|
{ name: "peerCount", getter: "peerCount" }, |
|
|
|
|
|
{ name: "defaultBlock", getter: "defaultBlock" }, |
|
|
|
|
|
{ name: "number", getter: "number" }]; |
|
|
|
|
|
|
|
|
|
|
|
var addPrefix = function (s, prefix) { |
|
|
var addPrefix = function (s, prefix) { |
|
|
if (!s) { |
|
|
if (!s) { |
|
|
return s; |
|
|
return s; |
|
@ -129,6 +117,18 @@ window.eth = (function ethScope() { |
|
|
return addPrefix(s, "set"); |
|
|
return addPrefix(s, "set"); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var setupProperties = function (root, spec) { |
|
|
|
|
|
var properties = [ |
|
|
|
|
|
{ name: "coinbase", getter: "coinbase", setter: "setCoinbase" }, |
|
|
|
|
|
{ name: "listening", getter: "listening", setter: "setListening" }, |
|
|
|
|
|
{ name: "mining", getter: "mining", setter: "setMining" }, |
|
|
|
|
|
{ name: "gasPrice", getter: "gasPrice"}, |
|
|
|
|
|
{ name: "key", getter: "key" }, |
|
|
|
|
|
{ name: "keys", getter: "keys" }, |
|
|
|
|
|
{ name: "peerCount", getter: "peerCount" }, |
|
|
|
|
|
{ name: "defaultBlock", getter: "defaultBlock" }, |
|
|
|
|
|
{ name: "number", getter: "number" }]; |
|
|
|
|
|
|
|
|
properties.forEach(function (property) { |
|
|
properties.forEach(function (property) { |
|
|
var p = {}; |
|
|
var p = {}; |
|
|
if (property.getter) { |
|
|
if (property.getter) { |
|
@ -152,7 +152,32 @@ window.eth = (function ethScope() { |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var setupMethods = function (root, spec) { |
|
|
|
|
|
var methods = [ |
|
|
|
|
|
{ name: "balanceAt", async: "getBalanceAt" }, |
|
|
|
|
|
{ name: "stateAt", async: "getStateAt" }, |
|
|
|
|
|
{ name: "countAt", async: "getCountAt" }, |
|
|
|
|
|
{ name: "codeAt", async: "getCodeAt" }, |
|
|
|
|
|
{ name: "transact", async: "makeTransact" }, |
|
|
|
|
|
{ name: "call", async: "makeCall" }, |
|
|
|
|
|
{ name: "messages", async: "getMessages" }, |
|
|
|
|
|
{ name: "transaction", async: "getTransaction" } |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
methods.forEach(function (method) { |
|
|
|
|
|
root[method.name] = function () { |
|
|
|
|
|
return reqSync(method.name, getParams(spec, method.name, arguments)); |
|
|
|
|
|
}; |
|
|
|
|
|
if (method.async) { |
|
|
|
|
|
root[method.async] = function () { |
|
|
|
|
|
return reqAsync(method.name, getParams(spec, method.name, arguments), arguments[arguments.length - 1]); |
|
|
|
|
|
}; |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
setupProperties(ret, window.spec); |
|
|
setupProperties(ret, window.spec); |
|
|
|
|
|
setupMethods(ret, window.spec); |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
|
|
|
|
|
|