mirror of https://github.com/status-im/web3.js.git
43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
var formatters = require('../formatters');
|
|
var utils = require('../../utils/utils');
|
|
var Method = require('../method');
|
|
var Property = require('../property');
|
|
var c = require('../../utils/config');
|
|
|
|
function Eth(web3) {
|
|
this.web3 = web3;
|
|
}
|
|
|
|
Object.defineProperty(Eth.prototype, 'defaultBlock', {
|
|
get: function () {
|
|
return c.defaultBlock;
|
|
},
|
|
set: function (val) {
|
|
c.defaultBlock = val;
|
|
return val;
|
|
}
|
|
});
|
|
|
|
Object.defineProperty(Eth.prototype, 'defaultAccount', {
|
|
get: function () {
|
|
return c.defaultAccount;
|
|
},
|
|
set: function (val) {
|
|
c.defaultAccount = val;
|
|
return val;
|
|
}
|
|
});
|
|
|
|
var methods = [
|
|
new Method({
|
|
name: 'getBalance',
|
|
call: 'eth_getBalance',
|
|
params: 2,
|
|
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
|
|
outputFormatter: formatters.outputBigNumberFormatter
|
|
})
|
|
];
|
|
methods.forEach(function(method) { method.attachToObject1(Eth.prototype) });
|
|
|
|
module.exports = Eth;
|