web3.js/test/web3.eth.getBalance.js

71 lines
2.6 KiB
JavaScript
Raw Normal View History

2015-03-24 05:50:42 +00:00
var BigNumber = require('bignumber.js');
2015-03-23 13:08:59 +00:00
var web3 = require('../index');
2015-03-24 05:50:42 +00:00
var testMethod = require('./helpers/test.method.js');
2015-03-23 13:08:59 +00:00
var method = 'getBalance';
var tests = [{
2015-08-08 19:22:01 +00:00
args: ['0x000000000000000000000000000000000000012d', 2],
2015-04-02 11:08:40 +00:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x2'],
2015-03-23 16:02:34 +00:00
result: '0x31981',
2015-03-24 05:50:42 +00:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 16:27:14 +00:00
call: 'eth_'+ method
2015-03-23 16:02:34 +00:00
},{
2015-08-08 19:22:01 +00:00
args: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-04-02 11:08:40 +00:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-03-23 13:08:59 +00:00
result: '0x31981',
2015-03-24 05:50:42 +00:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 16:27:14 +00:00
call: 'eth_'+ method
2015-03-23 13:23:45 +00:00
}, {
2015-08-08 19:22:01 +00:00
args: ['0x000000000000000000000000000000000000012d', 0x1],
2015-04-02 11:08:40 +00:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-03-23 13:23:45 +00:00
result: '0x31981',
2015-03-24 05:50:42 +00:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 16:27:14 +00:00
call: 'eth_'+ method
2015-03-23 13:23:45 +00:00
}, {
2015-08-08 19:22:01 +00:00
args: ['0x000000000000000000000000000000000000012d'],
2015-04-02 11:08:40 +00:00
formattedArgs: ['0x000000000000000000000000000000000000012d', web3.eth.defaultBlock],
2015-03-23 13:23:45 +00:00
result: '0x31981',
2015-03-24 05:50:42 +00:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 16:27:14 +00:00
call: 'eth_'+ method
2015-03-29 19:54:53 +00:00
}, {
args: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-04-02 12:04:06 +00:00
}, {
args: ['dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-03-29 19:54:53 +00:00
}, {
2015-08-08 19:22:01 +00:00
args: ['0x000000000000000000000000000000000000012d', 0x1],
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
}, {
args: ['0x000000000000000000000000000000000000012d'],
formattedArgs: ['0x000000000000000000000000000000000000012d', 'latest'],
2015-03-29 19:54:53 +00:00
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
}, {
2015-08-08 19:22:01 +00:00
args: ['000000000000000000000000000000000000012d'],
formattedArgs: ['0x000000000000000000000000000000000000012d', 'latest'],
2015-03-29 19:54:53 +00:00
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-04-02 11:08:40 +00:00
}, {
2015-08-08 19:22:01 +00:00
args: ['XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS'],
formattedArgs: ['0x00c5496aee77c1ba1f0854206a26dda82a81d6d8', 'latest'],
2015-04-02 11:08:40 +00:00
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-03-23 13:08:59 +00:00
}];
2015-03-24 10:44:33 +00:00
testMethod.runTests('eth', method, tests);
2015-03-23 13:08:59 +00:00