Browse Source

Additional work on the JS stuff to make it more similar to Solidity.

cl-refactor
Gav Wood 10 years ago
parent
commit
c3e1a3616a
  1. 18
      libjsqrc/ethereumjs/dist/ethereum.js
  2. 6
      libjsqrc/ethereumjs/dist/ethereum.js.map
  3. 2
      libjsqrc/ethereumjs/dist/ethereum.min.js
  4. 9
      libjsqrc/ethereumjs/lib/contract.js
  5. 9
      libjsqrc/ethereumjs/lib/web3.js
  6. 4
      standard.js

18
libjsqrc/ethereumjs/dist/ethereum.js

@ -486,6 +486,15 @@ var contract = function (address, desc) {
return result;
};
result._options = {};
['gas', 'gasPrice', 'value', 'from'].forEach(function(p) {
result[p] = function (v) {
result._options[p] = v;
return result;
};
});
desc.forEach(function (method) {
var displayName = abi.methodDisplayName(method.name);
@ -1096,6 +1105,15 @@ var web3 = {
/// eth object prototype
eth: {
contractFromAbi: function (abi) {
return function(addr) {
// Default to address of Config. TODO: rremove prior to genesis.
addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b';
var ret = web3.eth.contract(addr, abi);
ret.address = addr;
return ret;
};
},
watch: function (params) {
return new web3.filter(params, ethWatch);
}

6
libjsqrc/ethereumjs/dist/ethereum.js.map

File diff suppressed because one or more lines are too long

2
libjsqrc/ethereumjs/dist/ethereum.min.js

File diff suppressed because one or more lines are too long

9
libjsqrc/ethereumjs/lib/contract.js

@ -75,6 +75,15 @@ var contract = function (address, desc) {
return result;
};
result._options = {};
['gas', 'gasPrice', 'value', 'from'].forEach(function(p) {
result[p] = function (v) {
result._options[p] = v;
return result;
};
});
desc.forEach(function (method) {
var displayName = abi.methodDisplayName(method.name);

9
libjsqrc/ethereumjs/lib/web3.js

@ -268,6 +268,15 @@ var web3 = {
/// eth object prototype
eth: {
contractFromAbi: function (abi) {
return function(addr) {
// Default to address of Config. TODO: rremove prior to genesis.
addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b';
var ret = web3.eth.contract(addr, abi);
ret.address = addr;
return ret;
};
},
watch: function (params) {
return new web3.filter(params, ethWatch);
}

4
standard.js

@ -8,8 +8,8 @@ var initService = function(name) { return create(compile(name)); };
var initServiceVal = function(name, val) { createVal(compile(name), val); };
var addrConfig = create(compile("config"));
var addrNameReg = initService("namereg", addrConfig);
var addrGavsino = initServiceVal("gavmble", addrNameReg, "1000000000000000000");
var addrNameReg = initService("namereg");
var addrGavsino = initServiceVal("gavmble", "1000000000000000000");
var abiNameReg = [{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"getName","outputs":[{"name":"o_name","type":"string32"}]},{"constant":false,"inputs":[{"name":"name","type":"string32"}],"name":"register","outputs":[]},{"constant":true,"inputs":[{"name":"name","type":"string32"}],"name":"addressOf","outputs":[{"name":"addr","type":"address"}]},{"constant":true,"inputs":[{"name":"_name","type":"string32"}],"name":"getAddress","outputs":[{"name":"o_owner","type":"address"}]},{"constant":false,"inputs":[],"name":"unregister","outputs":[]},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"nameOf","outputs":[{"name":"name","type":"string32"}]}];
var regName = function(account, name) { return web3.eth.contract(addrNameReg, abiNameReg).transact({'from': account, 'gas': 10000}).register(name); };

Loading…
Cancel
Save